All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opengis.cite.ogcapitiles10.openapi3.TestPoint Maven / Gradle / Ivy

There is a newer version: 1.1
Show newest version
package org.opengis.cite.ogcapitiles10.openapi3;

import java.util.Collections;
import java.util.Map;
import java.util.Objects;

import com.reprezen.kaizen.oasparser.model3.MediaType;

/**
 * Encapsulates a Test Point with the UriTemplate and predefined replacements.
 *
 * @author Lyn Goltz 
 */
public class TestPoint {

	private final String serverUrl;

	private final String path;

	private Map predefinedTemplateReplacement;

	private Map contentMediaTypes;

	/**
	 * Instantiates a TestPoint with UriTemplate but without predefined replacements.
	 * @param serverUrl the serverUrl, never null
	 * @param path the path never, null
	 * @param contentMediaTypes the content media types for the GET operation with
	 * response "200", may be null
	 */
	public TestPoint(String serverUrl, String path, Map contentMediaTypes) {
		this(serverUrl, path, Collections.emptyMap(), contentMediaTypes);
	}

	/**
	 * Instantiates a TestPoint with UriTemplate and predefined replacements.
	 * @param serverUrl the serverUrl, never null
	 * @param path the path, never null
	 * @param predefinedTemplateReplacement a list of predefined replacements never
	 * null
	 * @param contentMediaTypes the content media types for the GET operation with
	 * response "200", may be null
	 */
	public TestPoint(String serverUrl, String path, Map predefinedTemplateReplacement,
			Map contentMediaTypes) {
		this.serverUrl = serverUrl;
		this.path = path;
		this.predefinedTemplateReplacement = Collections.unmodifiableMap(predefinedTemplateReplacement);
		this.contentMediaTypes = contentMediaTypes;
	}

	/**
	 * @return the serverUrl never null
	 */
	public String getServerUrl() {
		return serverUrl;
	}

	/**
	 * @return the path never, null
	 */
	public String getPath() {
		return path;
	}

	/**
	 * @return an unmodifiable mao with predefined replacements, may be empty but never
	 * null
	 */
	public Map getPredefinedTemplateReplacement() {
		return predefinedTemplateReplacement;
	}

	/**
	 * @return the content media types for the GET operation with response "200", may be
	 * null
	 */
	public Map getContentMediaTypes() {
		return contentMediaTypes;
	}

	@Override
	public String toString() {
		return "Server URL: " + serverUrl + " , Path: " + path + ", Replacements: " + predefinedTemplateReplacement;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;
		TestPoint testPoint = (TestPoint) o;
		return Objects.equals(serverUrl, testPoint.serverUrl)
				&& Objects.equals(path, testPoint.predefinedTemplateReplacement)
				&& Objects.equals(predefinedTemplateReplacement, testPoint.path)
				&& Objects.equals(contentMediaTypes, testPoint.contentMediaTypes);
	}

	@Override
	public int hashCode() {
		return Objects.hash(serverUrl, path, predefinedTemplateReplacement, contentMediaTypes);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy