Search in sources :

Example 11 with Namespace

use of eu.esdihumboldt.hale.io.geoserver.Namespace in project hale by halestudio.

the class NamespaceResourceTest method testSerializeIsolated.

/**
 * Tests the correct serialization of a namespace resource whose
 * {@code isolated} attribute is set to {@code true}.
 *
 * @throws Exception if an error occurs parsing the resource as XML
 */
@Test
public void testSerializeIsolated() throws Exception {
    Namespace testNamespace = ResourceBuilder.namespace(TEST_PREFIX).setAttribute(Namespace.URI, TEST_URI).setAttribute(Namespace.ISOLATED, true).build();
    Document doc = parseResource(testNamespace);
    assertEquals(1, doc.getElementsByTagName(ELEMENT_NAMESPACE).getLength());
    Node namespaceEl = doc.getElementsByTagName(ELEMENT_NAMESPACE).item(0);
    Map<String, String> expectedValues = new HashMap<>();
    expectedValues.put(ELEMENT_PREFIX, TEST_PREFIX);
    expectedValues.put(ELEMENT_URI, TEST_URI);
    expectedValues.put(ELEMENT_ISOLATED, "true");
    checkResource(namespaceEl, expectedValues);
}
Also used : HashMap(java.util.HashMap) Node(org.w3c.dom.Node) Document(org.w3c.dom.Document) Namespace(eu.esdihumboldt.hale.io.geoserver.Namespace) Test(org.junit.Test)

Aggregations

Namespace (eu.esdihumboldt.hale.io.geoserver.Namespace)11 Test (org.junit.Test)7 IOReporter (eu.esdihumboldt.hale.common.core.io.report.IOReporter)4 DefaultIOReporter (eu.esdihumboldt.hale.common.core.io.report.impl.DefaultIOReporter)4 FeatureTypeMapping (eu.esdihumboldt.hale.io.appschema.impl.internal.generated.app_schema.TypeMappingsPropertyType.FeatureTypeMapping)4 HashMap (java.util.HashMap)3 Document (org.w3c.dom.Document)3 Node (org.w3c.dom.Node)3 HashSet (java.util.HashSet)2 DataStore (eu.esdihumboldt.hale.io.geoserver.DataStore)1 FeatureType (eu.esdihumboldt.hale.io.geoserver.FeatureType)1 Layer (eu.esdihumboldt.hale.io.geoserver.Layer)1 Workspace (eu.esdihumboldt.hale.io.geoserver.Workspace)1 NamespaceManager (eu.esdihumboldt.hale.io.geoserver.rest.NamespaceManager)1 BufferedOutputStream (java.io.BufferedOutputStream)1 MalformedURLException (java.net.MalformedURLException)1 ZipEntry (java.util.zip.ZipEntry)1 ZipOutputStream (java.util.zip.ZipOutputStream)1