@Test public void testWmsStorePasswordEncryption() throws Exception { WMSStoreInfo wms = buildWmsStore(); ByteArrayOutputStream out = new ByteArrayOutputStream(); persister.save(wms, out); Document dom = dom(new ByteArrayInputStream(out.toByteArray())); // print(dom); // check password has been encrypted XMLAssert.assertXpathExists("/wmsStore/password", dom); XMLAssert.assertXpathNotExists("/wmsStore[password = 'password']", dom); XMLAssert.assertXpathExists("/wmsStore[starts-with(password, 'crypt1:')]", dom); WMSStoreInfo loaded = persister.load(new ByteArrayInputStream(out.toByteArray()), WMSStoreInfo.class); assertEquals("password", loaded.getPassword()); }
/** * Assert that a specific XPath does NOT exist in some given XML * @param xPathExpression * @param inDocument * @see XpathEngine which provides the underlying evaluation mechanism */ public void assertXpathNotExists(String xPathExpression, Document inDocument) throws XpathException { XMLAssert.assertXpathNotExists(xPathExpression, inDocument); }
/** * Assert that a specific XPath does NOT exist in some given XML * @param xPathExpression * @param inXMLString * @see XpathEngine which provides the underlying evaluation mechanism */ public void assertXpathNotExists(String xPathExpression, String inXMLString) throws IOException, SAXException, XpathException { XMLAssert.assertXpathNotExists(xPathExpression, inXMLString); }
/** * Assert that a specific XPath does NOT exist in some given XML * @param inXpathExpression * @param xml * @see XpathEngine which provides the underlying evaluation mechanism */ public void assertXpathNotExists(String xPathExpression, InputSource xml) throws IOException, SAXException, XpathException { XMLAssert.assertXpathNotExists(xPathExpression, xml); }
/** * Assert that a specific XPath does NOT exist in some given XML * @param xPathExpression * @param xml * @see XpathEngine which provides the underlying evaluation mechanism */ public void assertXpathNotExists(String xPathExpression, InputSource xml) throws IOException, SAXException, XpathException { XMLAssert.assertXpathNotExists(xPathExpression, xml); }
/** * Assert that a specific XPath does NOT exist in some given XML * @param inXpathExpression * @param inXMLString * @see XpathEngine which provides the underlying evaluation mechanism */ public void assertXpathNotExists(String xPathExpression, String inXMLString) throws IOException, SAXException, XpathException { XMLAssert.assertXpathNotExists(xPathExpression, inXMLString); }
/** * Assert that a specific XPath does NOT exist in some given XML * @param inXpathExpression * @param inDocument * @see XpathEngine which provides the underlying evaluation mechanism */ public void assertXpathNotExists(String xPathExpression, Document inDocument) throws XpathException { XMLAssert.assertXpathNotExists(xPathExpression, inDocument); }
/** * Assert that a specific XPath does NOT exist in some given XML * @param inXpathExpression * @param inXMLString * @see XpathEngine which provides the underlying evaluation mechanism */ public static void assertXpathNotExists(String xPathExpression, String inXMLString) throws IOException, SAXException, XpathException { Document inDocument = XMLUnit.buildControlDocument(inXMLString); assertXpathNotExists(xPathExpression, inDocument); }
/** * Assert that a specific XPath does NOT exist in some given XML * @param xPathExpression * @param control * @see XpathEngine which provides the underlying evaluation mechanism */ public static void assertXpathNotExists(String xPathExpression, InputSource control) throws IOException, SAXException, XpathException { Document inDocument = XMLUnit.buildControlDocument(control); assertXpathNotExists(xPathExpression, inDocument); }
/** * Assert that a specific XPath does NOT exist in some given XML * @param inXpathExpression * @param control * @see XpathEngine which provides the underlying evaluation mechanism */ public static void assertXpathNotExists(String xPathExpression, InputSource control) throws IOException, SAXException, XpathException { Document inDocument = XMLUnit.buildControlDocument(control); assertXpathNotExists(xPathExpression, inDocument); }
/** * Assert that a specific XPath does NOT exist in some given XML * @param xPathExpression * @param inXMLString * @see XpathEngine which provides the underlying evaluation mechanism */ public static void assertXpathNotExists(String xPathExpression, String inXMLString) throws IOException, SAXException, XpathException { Document inDocument = XMLUnit.buildControlDocument(inXMLString); assertXpathNotExists(xPathExpression, inDocument); }
@Test public void testConfidential() throws Exception { String response = invokeWorkService("http", 8080, "policy-security-wss-signencrypt", true, null); XMLAssert.assertXpathNotExists("//faultcode", response); }
@Test public void testCustomSchema() throws Exception { Document dom = getAsDOM( "ows?request=DescribeFeatureType&version=1.1.0&service=WFS&typeName=cdf:Other"); XMLAssert.assertXpathExists("//xsd:element[@name = 'pointProperty']", dom); XMLAssert.assertXpathExists("//xsd:element[@name = 'string1']", dom); XMLAssert.assertXpathExists("//xsd:element[@name = 'string2']", dom); XMLAssert.assertXpathNotExists("//xsd:element[@name = 'integers']", dom); XMLAssert.assertXpathNotExists("//xsd:element[@name = 'dataTime']", dom); }
@org.junit.Test public void testCapabilitiesNoWGS84DD() throws Exception { Document dom = dom(get("wms?request=getCapabilities&version=1.1.1"), false); // print(dom); XMLAssert.assertXpathNotExists("//SRS[text() = 'EPSG:WGS84(DD)']", dom); }
@org.junit.Test public void testCapabilitiesNoWGS84DD() throws Exception { Document dom = dom(get("wms?request=getCapabilities&version=1.3.0"), false); // print(dom); XMLAssert.assertXpathNotExists("//wms:CRS[text() = 'EPSG:WGS84(DD)']", dom); }
@Test public void testConfidentialSecure() throws Exception { String response = invokeWorkService("https", 8443, "policy-security-wss-signencrypt", true, setupSSLContext()); XMLAssert.assertXpathNotExists("//faultcode", response); }
@Test public void testDescribeDefaultStoredQuery() throws Exception { Document dom = getAsDOM( "wfs?request=DescribeStoredQueries&storedQueryId=" + StoredQuery.DEFAULT.getName()); assertEquals("wfs:DescribeStoredQueriesResponse", dom.getDocumentElement().getNodeName()); XMLAssert.assertXpathExists( "//wfs:StoredQueryDescription[@id = '" + StoredQuery.DEFAULT.getName() + "']", dom); XMLAssert.assertXpathExists("//wfs:Parameter[@name = 'ID']", dom); XMLAssert.assertXpathExists("//wfs:QueryExpressionText[@isPrivate = 'true']", dom); XMLAssert.assertXpathNotExists("//wfs:QueryExpressionText/*", dom); }
@Test public void testDefaultStoredQueryGet() throws Exception { Document dom = getAsDOM( "wfs?request=GetFeature&version=2.0.0&storedQueryId=" + StoredQuery.DEFAULT.getName() + "&ID=PrimitiveGeoFeature.f001"); // GetFeatureById is special, should not be wrapped by wfs:FeatureCollection XMLAssert.assertXpathNotExists("//wfs:FeatureCollection", dom); XMLAssert.assertXpathEvaluatesTo("1", "count(/sf:PrimitiveGeoFeature)", dom); XMLAssert.assertXpathExists( "/sf:PrimitiveGeoFeature[@gml:id = 'PrimitiveGeoFeature.f001']", dom); }
@Test public void testOpaqueGroup() throws Exception { Document dom = dom(get("wms?request=GetCapabilities&version=1.3.0"), true); // the layer group is there, but not the contained layers assertXpathEvaluatesTo("1", "count(//wms:Layer[wms:Name='opaqueGroup'])", dom); for (LayerInfo l : getCatalog().getLayerGroupByName(OPAQUE_GROUP).layers()) { assertXpathNotExists("//wms:Layer[wms:Name='" + l.prefixedName() + "']", dom); } ; }
@Test public void testOpaqueGroup() throws Exception { Document dom = dom(get("wms?request=GetCapabilities&version=1.1.0"), true); // the layer group is there, but not the contained layers assertXpathEvaluatesTo("1", "count(//Layer[Name='opaqueGroup'])", dom); for (LayerInfo l : getCatalog().getLayerGroupByName(OPAQUE_GROUP).layers()) { assertXpathNotExists("//Layer[Name='" + l.prefixedName() + "']", dom); } }