Search in sources :

Example 21 with XmlPath

use of io.restassured.path.xml.XmlPath in project ddf by codice.

the class TestCatalog method testIngestXmlNoExtension.

// Is this test bad??
@Ignore
@Test
public void testIngestXmlNoExtension() throws Exception {
    final String TMP_PREFIX = "tcdm_";
    Path tmpDir = Files.createTempDirectory(TMP_PREFIX);
    tmpDir.toFile().deleteOnExit();
    Path tmpFile = Files.createTempFile(tmpDir, TMP_PREFIX, "_tmp");
    tmpFile.toFile().deleteOnExit();
    Files.copy(getFileContentAsStream("metacard5.xml"), tmpFile, StandardCopyOption.REPLACE_EXISTING);
    Map<String, Object> cdmProperties = new HashMap<>(getServiceManager().getMetatypeDefaults("content-core-directorymonitor", "org.codice.ddf.catalog.content.monitor.ContentDirectoryMonitor"));
    cdmProperties.put("monitoredDirectoryPath", tmpDir.toString() + "/");
    cdmProperties.put("processingMechanism", ContentDirectoryMonitor.IN_PLACE);
    Configuration managedService = getServiceManager().createManagedService("org.codice.ddf.catalog.content.monitor.ContentDirectoryMonitor", cdmProperties);
    ValidatableResponse response = assertIngestedDirectoryMonitor("SysAdmin", 1);
    boolean result = response.extract().xmlPath().getString("metacards.metacard.type").equals("ddf.metacard");
    assertThat(result, is(true));
    getServiceManager().stopManagedService(managedService.getPid());
}
Also used : Path(java.nio.file.Path) XmlPath(io.restassured.path.xml.XmlPath) HasXPath.hasXPath(org.hamcrest.xml.HasXPath.hasXPath) ValidatableResponse(io.restassured.response.ValidatableResponse) Configuration(org.osgi.service.cm.Configuration) HashMap(java.util.HashMap) JSONObject(org.json.simple.JSONObject) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ConditionalIgnore(org.codice.ddf.itests.common.annotations.ConditionalIgnoreRule.ConditionalIgnore) Ignore(org.junit.Ignore) SkipUnstableTest(org.codice.ddf.itests.common.annotations.SkipUnstableTest) Test(org.junit.Test) AbstractIntegrationTest(org.codice.ddf.itests.common.AbstractIntegrationTest)

Aggregations

XmlPath (io.restassured.path.xml.XmlPath)21 Test (org.junit.Test)18 Node (io.restassured.path.xml.element.Node)2 HashMap (java.util.HashMap)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 Call (com.xebialabs.restito.semantics.Call)1 XmlPathConfig (io.restassured.path.xml.config.XmlPathConfig)1 NodeChildren (io.restassured.path.xml.element.NodeChildren)1 ValidatableResponse (io.restassured.response.ValidatableResponse)1 Path (java.nio.file.Path)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 FilterType (net.opengis.filter.v_1_1_0.FilterType)1 AbstractIntegrationTest (org.codice.ddf.itests.common.AbstractIntegrationTest)1 ConditionalIgnore (org.codice.ddf.itests.common.annotations.ConditionalIgnoreRule.ConditionalIgnore)1 SkipUnstableTest (org.codice.ddf.itests.common.annotations.SkipUnstableTest)1 Matchers.isEmptyOrNullString (org.hamcrest.Matchers.isEmptyOrNullString)1 HasXPath.hasXPath (org.hamcrest.xml.HasXPath.hasXPath)1 JSONObject (org.json.simple.JSONObject)1 Ignore (org.junit.Ignore)1