Search in sources :

Example 1 with NamespaceContext

use of org.custommonkey.xmlunit.NamespaceContext in project sling by apache.

the class ReferenceTypeHintTest method setUp.

@Override
protected void setUp() throws Exception {
    super.setUp();
    postUrl = HTTP_BASE_URL + TEST_BASE_PATH + "/" + System.currentTimeMillis();
    Map<String, String> m = new HashMap<String, String>();
    m.put("sv", "http://www.jcp.org/jcr/sv/1.0");
    NamespaceContext ctx = new SimpleNamespaceContext(m);
    XMLUnit.setXpathNamespaceContext(ctx);
    final NameValuePairList props = new NameValuePairList();
    props.add("a", "");
    props.add("jcr:mixinTypes", "mix:referenceable");
    firstCreatedNodeUrl = testClient.createNode(postUrl + SlingPostConstants.DEFAULT_CREATE_SUFFIX, props, null, false);
    firstUuid = getProperty(firstCreatedNodeUrl, "jcr:uuid");
    firstPath = getPath(firstCreatedNodeUrl);
    secondCreatedNodeUrl = testClient.createNode(postUrl + SlingPostConstants.DEFAULT_CREATE_SUFFIX, props, null, false);
    secondUuid = getProperty(secondCreatedNodeUrl, "jcr:uuid");
    secondPath = getPath(secondCreatedNodeUrl);
}
Also used : HashMap(java.util.HashMap) NamespaceContext(org.custommonkey.xmlunit.NamespaceContext) SimpleNamespaceContext(org.custommonkey.xmlunit.SimpleNamespaceContext) SimpleNamespaceContext(org.custommonkey.xmlunit.SimpleNamespaceContext) NameValuePairList(org.apache.sling.commons.testing.integration.NameValuePairList)

Example 2 with NamespaceContext

use of org.custommonkey.xmlunit.NamespaceContext in project ddf by codice.

the class TestCswFilterDelegate method setupTestClass.

@BeforeClass
public static void setupTestClass() throws JAXBException, ParseException {
    XMLUnit.setIgnoreWhitespace(true);
    marshaller = JAXB_CONTEXT.createMarshaller();
    marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
    POS_LIST_GEO_FILTER_PROP_MAP.put(USE_POS_LIST_GEO_FILTER_PROP_MAP_KEY, "true");
    SAMPLE_DISTANCE_GEO_FILTER_PROP_MAP.put(DISTANCE_GEO_FILTER_PROP_MAP_KEY, Double.toString(SAMPLE_DISTANCE));
    SAMPLE_DISTANCE_POS_LIST_GEO_FILTER_PROP_MAP.put(USE_POS_LIST_GEO_FILTER_PROP_MAP_KEY, "true");
    SAMPLE_DISTANCE_POS_LIST_GEO_FILTER_PROP_MAP.put(DISTANCE_GEO_FILTER_PROP_MAP_KEY, Double.toString(SAMPLE_DISTANCE));
    THOUSAND_METER_DISTANCE_GEO_FILTER_PROP_MAP.put(DISTANCE_GEO_FILTER_PROP_MAP_KEY, "1000.0");
    // XPath query support.
    HashMap<String, String> map = new HashMap<>();
    map.put("", "http://www.opengis.net/cat/csw/2.0.2");
    map.put("ogc", "http://www.opengis.net/ogc");
    NamespaceContext ctx = new SimpleNamespaceContext(map);
    XMLUnit.setXpathNamespaceContext(ctx);
}
Also used : HashMap(java.util.HashMap) NamespaceContext(org.custommonkey.xmlunit.NamespaceContext) SimpleNamespaceContext(org.custommonkey.xmlunit.SimpleNamespaceContext) SimpleNamespaceContext(org.custommonkey.xmlunit.SimpleNamespaceContext) BeforeClass(org.junit.BeforeClass)

Example 3 with NamespaceContext

use of org.custommonkey.xmlunit.NamespaceContext in project ddf by codice.

the class TestXmlMetacardTransformer method setupXpath.

@Before
public void setupXpath() {
    Map<String, String> m = new HashMap<String, String>();
    m.put("m", "urn:catalog:metacard");
    m.put("gml", "http://www.opengis.net/gml");
    NamespaceContext ctx = new SimpleNamespaceContext(m);
    XMLUnit.setXpathNamespaceContext(ctx);
}
Also used : HashMap(java.util.HashMap) NamespaceContext(org.custommonkey.xmlunit.NamespaceContext) SimpleNamespaceContext(org.custommonkey.xmlunit.SimpleNamespaceContext) SimpleNamespaceContext(org.custommonkey.xmlunit.SimpleNamespaceContext) Before(org.junit.Before)

Example 4 with NamespaceContext

use of org.custommonkey.xmlunit.NamespaceContext in project ddf by codice.

the class AbstractTestCompositeGeometry method setupTestClass.

@BeforeClass
public static void setupTestClass() {
    HashMap map = new HashMap();
    map.put("gml", "http://www.opengis.net/gml");
    map.put("georss", "http://www.georss.org/georss");
    NamespaceContext ctx = new SimpleNamespaceContext(map);
    XMLUnit.setXpathNamespaceContext(ctx);
    XMLUnit.setIgnoreWhitespace(true);
}
Also used : HashMap(java.util.HashMap) NamespaceContext(org.custommonkey.xmlunit.NamespaceContext) SimpleNamespaceContext(org.custommonkey.xmlunit.SimpleNamespaceContext) SimpleNamespaceContext(org.custommonkey.xmlunit.SimpleNamespaceContext) BeforeClass(org.junit.BeforeClass)

Example 5 with NamespaceContext

use of org.custommonkey.xmlunit.NamespaceContext in project ddf by codice.

the class TestXmlResponseQueueTransformer method setupTestClass.

@BeforeClass
public static void setupTestClass() {
    // makes xpaths easier to write when prefixes are declared beforehand.
    HashMap<String, String> map = new HashMap<>();
    map.put("gml", "http://www.opengis.net/gml");
    map.put("mc", "urn:catalog:metacard");
    NamespaceContext ctx = new SimpleNamespaceContext(map);
    XMLUnit.setXpathNamespaceContext(ctx);
}
Also used : HashMap(java.util.HashMap) NamespaceContext(org.custommonkey.xmlunit.NamespaceContext) SimpleNamespaceContext(org.custommonkey.xmlunit.SimpleNamespaceContext) Matchers.anyString(org.mockito.Matchers.anyString) SimpleNamespaceContext(org.custommonkey.xmlunit.SimpleNamespaceContext) BeforeClass(org.junit.BeforeClass)

Aggregations

NamespaceContext (org.custommonkey.xmlunit.NamespaceContext)10 SimpleNamespaceContext (org.custommonkey.xmlunit.SimpleNamespaceContext)8 HashMap (java.util.HashMap)7 BeforeClass (org.junit.BeforeClass)5 NameValuePairList (org.apache.sling.commons.testing.integration.NameValuePairList)1 XpathEngine (org.custommonkey.xmlunit.XpathEngine)1 Before (org.junit.Before)1 Matchers.anyString (org.mockito.Matchers.anyString)1 Document (org.w3c.dom.Document)1