use of de.micromata.opengis.kml.v_2_2_0.Kml in project ddf by codice.
the class TestKmlEndpoint method testGetAvailableSourcesVisibleByDefault.
@Test
public void testGetAvailableSourcesVisibleByDefault() throws UnknownHostException, MalformedURLException, IllegalArgumentException, UriBuilderException, SourceUnavailableException {
when(mockUriInfo.getQueryParameters(false)).thenReturn(mockMap);
KmlEndpoint kmlEndpoint = new KmlEndpoint(mockBranding, mockFramework);
Kml response = kmlEndpoint.getAvailableSources(mockUriInfo);
assertThat(response, notNullValue());
assertThat(response.getFeature(), instanceOf(Folder.class));
Folder folder = (Folder) response.getFeature();
assertThat(folder.getFeature(), notNullValue());
assertThat(folder.getFeature().size(), is(2));
assertThat(folder.getFeature().get(0), instanceOf(NetworkLink.class));
assertThat(folder.getFeature().get(1), instanceOf(NetworkLink.class));
NetworkLink nl1 = (NetworkLink) folder.getFeature().get(0);
assertThat(nl1.getName(), anyOf(is(REMOTE_SITE_NAME), is(LOCAL_SITE_NAME)));
assertThat(nl1.isVisibility(), is(false));
NetworkLink nl2 = (NetworkLink) folder.getFeature().get(1);
assertThat(nl2.getName(), anyOf(is(REMOTE_SITE_NAME), is(LOCAL_SITE_NAME)));
assertThat(nl2.isVisibility(), is(false));
}
use of de.micromata.opengis.kml.v_2_2_0.Kml in project ddf by codice.
the class KMLTransformerImpl method encloseDoc.
/**
* Encapsulate the kml content (placemarks, etc.) with a style in a KML Document element If
* either content or style are null, they will be in the resulting Document
*
* @param kml
* @param style
* @param documentId
* which should be the metacard id
* @return KML DocumentType element with style and content
*/
public static Document encloseDoc(Placemark placemark, Style style, String documentId, String docName) throws IllegalArgumentException {
Document document = KmlFactory.createDocument();
document.setId(documentId);
document.setOpen(true);
document.setName(docName);
if (style != null) {
document.getStyleSelector().add(style);
}
if (placemark != null) {
document.getFeature().add(placemark);
}
return document;
}
use of de.micromata.opengis.kml.v_2_2_0.Kml in project ddf by codice.
the class TestKmlEndpoint method testGetAvailableSources.
@Test
public void testGetAvailableSources() throws UnknownHostException, MalformedURLException, IllegalArgumentException, UriBuilderException, SourceUnavailableException {
when(mockUriInfo.getQueryParameters(false)).thenReturn(mockMap);
KmlEndpoint kmlEndpoint = new KmlEndpoint(mockBranding, mockFramework);
Kml response = kmlEndpoint.getAvailableSources(mockUriInfo);
assertThat(response, notNullValue());
assertThat(response.getFeature(), instanceOf(Folder.class));
Folder folder = (Folder) response.getFeature();
assertThat(folder.getFeature(), notNullValue());
assertThat(folder.getFeature().size(), is(2));
assertThat(folder.getFeature().get(0), instanceOf(NetworkLink.class));
assertThat(folder.getFeature().get(1), instanceOf(NetworkLink.class));
NetworkLink nl1 = (NetworkLink) folder.getFeature().get(0);
assertThat(nl1.getName(), anyOf(is(REMOTE_SITE_NAME), is(LOCAL_SITE_NAME)));
NetworkLink nl2 = (NetworkLink) folder.getFeature().get(1);
assertThat(nl2.getName(), anyOf(is(REMOTE_SITE_NAME), is(LOCAL_SITE_NAME)));
}
Aggregations