Package org.opengis.cite.kml22.level1
Class LinkTests
java.lang.Object
org.opengis.cite.kml22.BaseFixture
org.opengis.cite.kml22.level1.LinkTests
Contains test methods that apply to link elements and attributes that refer to various
kinds of external resources. Link elements include kml:Link,
kml:AbstractOverlayType, and kml:Icon.
- See Also:
-
- "OGC 07-134r2: OGC KML 2.2 - Abstract Test Suite"
-
Field Summary
Fields inherited from class org.opengis.cite.kml22.BaseFixture
NS_MAP, testSubject -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidaddHrefError(Node linkNode, String details, org.opengis.cite.validation.ValidationErrorHandler errHandler) (package private) voidcheckModelReferent(Element linkNode, URI uriRef, org.opengis.cite.validation.ValidationErrorHandler errHandler) Checks that Link elements which are children of a kml:Model refer to a (3D) graphics resource.(package private) voidcheckNetworkLinkReferent(Node linkNode, URI uriRef, org.opengis.cite.validation.ValidationErrorHandler errHandler) Checks that the network link referent exists.(package private) voidcheckOverlayIconReferent(Node linkNode, String href, org.opengis.cite.validation.ValidationErrorHandler errHandler) Checks that a link element occurring within a kml:Overlay element refers to an image resource.(package private) StringgetLinkHref(Element linkElem, org.opengis.cite.validation.ValidationErrorHandler errHandler) Gets the value of the child kml:href element in a Link element.voidInitializes the HTTP client component.(package private) BufferedImagereadImageDataFromURI(URI uriRef) Attempts to create a BufferedImage using the data retrieved from some URI.void[Test] Verifies that the kml:Icon/kml:href element refers to an image resource.void[Test] Verifies that if a kml:Link or a kml:Icon element is not a descendant of kml:Update, then it contains a kml:href child element.void[Test] Verifies that a link element refers to the correct resource type, according to one of the following cases: if the parent element is kml:NetworkLink - a KML or KMZ resource; if the parent element is kml:Model - a textured 3D object resource; if the parent element is kml:GroundOverlay, kml:ScreenOverlay, or kml:PhotoOverlay - an image resource (see ATC 18).void[Test] Verifies that a link element (of type kml:LinkType) satisfies the following constraint: if present, the child kml:refreshInterval element has a positive value (> 0).void[Test] Verifies that a link element (of type kml:LinkType) satisfies the following constraint: if present, the child kml:viewBoundScale element has a positive value (> 0).void[Test] Verifies that a link element (of type kml:LinkType) satisfies the following constraint: if present, the child kml:viewRefreshTime element has a positive value (> 0).void[Test] Verifies that the kml:NetworkLinkControl/kml:minRefreshPeriod element has a non-negative value (>=0).void[Test] Verifies that the value of the kml:Update/kml:targetHref element satisfies all of the following constraints: it is an absolute URL that refers to a KML or KMZ resource; the target resource contains the data to be updated.Methods inherited from class org.opengis.cite.kml22.BaseFixture
obtainTestSubject, setTestSubject, verifyElementNotEmpty
-
Constructor Details
-
LinkTests
public LinkTests()
-
-
Method Details
-
initHttpClient
@BeforeClass public void initHttpClient()Initializes the HTTP client component. It is configured to follow redirects (status code 3nn) and log the request/response messages to the test suite logger (at INFO level). -
verifyLinkRefreshInterval
public void verifyLinkRefreshInterval()[Test] Verifies that a link element (of type kml:LinkType) satisfies the following constraint: if present, the child kml:refreshInterval element has a positive value (> 0).- See Also:
-
- "OGC 07-134r2, ATC 9: Link elements"
-
verifyLinkViewRefreshTime
public void verifyLinkViewRefreshTime()[Test] Verifies that a link element (of type kml:LinkType) satisfies the following constraint: if present, the child kml:viewRefreshTime element has a positive value (> 0).- See Also:
-
- "OGC 07-134r2, ATC 9: Link elements"
-
verifyLinkViewBoundScale
public void verifyLinkViewBoundScale()[Test] Verifies that a link element (of type kml:LinkType) satisfies the following constraint: if present, the child kml:viewBoundScale element has a positive value (> 0).- See Also:
-
- "OGC 07-134r2, ATC 9: Link elements"
-
verifyLinkReferent
public void verifyLinkReferent()[Test] Verifies that a link element refers to the correct resource type, according to one of the following cases:- if the parent element is kml:NetworkLink - a KML or KMZ resource;
- if the parent element is kml:Model - a textured 3D object resource;
- if the parent element is kml:GroundOverlay, kml:ScreenOverlay, or kml:PhotoOverlay - an image resource (see ATC 18).
- See Also:
-
- "OGC 07-134r2, ATC 10: Link referent"
-
verifyIconReferent
public void verifyIconReferent()[Test] Verifies that the kml:Icon/kml:href element refers to an image resource. The image format is expected to correspond to a registered image media type (PNG, JPEG, and GIF images are commonly used for this purpose). This test applies to kml:Icon elements in both kml:IconStyle and kml:AbstractOverlayType contexts.- See Also:
-
- "OGC 07-134r2, ATC 18: Icon - href"
-
verifyNetworkLinkControlRefresh
public void verifyNetworkLinkControlRefresh()[Test] Verifies that the kml:NetworkLinkControl/kml:minRefreshPeriod element has a non-negative value (>=0).- See Also:
-
- "OGC 07-134r2, ATC 20: NetworkLinkControl - minRefreshPeriod"
-
verifyUpdateTargetExists
public void verifyUpdateTargetExists()[Test] Verifies that the value of the kml:Update/kml:targetHref element satisfies all of the following constraints:- it is an absolute URL that refers to a KML or KMZ resource;
- the target resource contains the data to be updated.
The kml:Update element specifies an update to a KML resource that has previously been retrieved via some kml:NetworkLink. The Updates page in the KML Developer's Guide provides a detailed example of how updates are applied in practice.
Sources
- OGC 07-134r2, ATC 22: Update - targetHref
- OGC 07-147r2, cl. 13.3: kml:Update
- KML Reference - Update
-
verifyLinkHasHref
public void verifyLinkHasHref()[Test] Verifies that if a kml:Link or a kml:Icon element is not a descendant of kml:Update, then it contains a kml:href child element.- See Also:
-
- "OGC 07-134r2, ATC 40: Link"
-
checkOverlayIconReferent
void checkOverlayIconReferent(Node linkNode, String href, org.opengis.cite.validation.ValidationErrorHandler errHandler) Checks that a link element occurring within a kml:Overlay element refers to an image resource. Common image formats will be auto-detected. If a suitableImageReadercannot be found, an error is reported.- Parameters:
linkNode- A link node (containing a child kml:href element).href- An absolute URI (extracted from the link node) that refers to an image resource.errHandler- The error handler that receives any errors that were detected.- See Also:
-
readImageDataFromURI
Attempts to create a BufferedImage using the data retrieved from some URI.- Parameters:
uriRef- An absolute URI reference ('http' or 'file' schemes).- Returns:
- A BufferedImage object containing the image data, or
null. - Throws:
IOException- If an error occurs while reading the image data.
-
checkModelReferent
void checkModelReferent(Element linkNode, URI uriRef, org.opengis.cite.validation.ValidationErrorHandler errHandler) Checks that Link elements which are children of a kml:Model refer to a (3D) graphics resource. No attempt is made to validate the format or content of the resource, although the media types "model/*" or "application/octet-stream" are expected.- Parameters:
linkNode- A link element containing a child kml:href element.uriRef- A URI reference.errHandler- The error handler that receives any errors that were detected.
-
checkNetworkLinkReferent
void checkNetworkLinkReferent(Node linkNode, URI uriRef, org.opengis.cite.validation.ValidationErrorHandler errHandler) Checks that the network link referent exists. If not, an error is added to the handler.- Parameters:
linkNode- A link element containing a child kml:href element.uriRef- A URI reference.errHandler- The error handler that receives any errors that were detected.
-
getLinkHref
Gets the value of the child kml:href element in a Link element. If the value is a relative URI it is resolved against the base URI of the associated Document node.Note: A kml:Icon/kml:href value will include tile parameters if a kml:PhotoOverlay element has a child kml:ImagePyramid element (
level,x,y). Substituting 0 (zero) for all parameter references should produce a URL that refers to the lowest resolution image.- Parameters:
linkElem- An Element node representing a link element.errHandler- The error handler that receives any errors that were detected.- Returns:
- A String representing an absolute URI reference, or
nullif it was missing or not a valid URI.
-
addHrefError
void addHrefError(Node linkNode, String details, org.opengis.cite.validation.ValidationErrorHandler errHandler) - Parameters:
linkNode- linkNodedetails- detailserrHandler- errHandler
-