Search in sources :

Example 1 with ConditionalIgnore

use of org.codice.ddf.itests.common.annotations.ConditionalIgnoreRule.ConditionalIgnore in project alliance by codice.

the class NsiliSourceTest method testNsiliHttpSourceOpenSearchGetAll.

/**
 * Simple search query to assert # records returned from mock source
 *
 * @throws Exception
 */
@Test
// CAL-427
@ConditionalIgnore(condition = SkipUnstableTest.class)
public void testNsiliHttpSourceOpenSearchGetAll() throws Exception {
    ValidatableResponse response = executeOpenSearch("xml", "q=*", "src=" + HTTP_NSILI_SOURCE_ID, "count=100");
    response.log().all().body("metacards.metacard.size()", equalTo(11));
}
Also used : ValidatableResponse(com.jayway.restassured.response.ValidatableResponse) ConditionalIgnore(org.codice.ddf.itests.common.annotations.ConditionalIgnoreRule.ConditionalIgnore) AbstractAllianceIntegrationTest(org.codice.alliance.test.itests.common.AbstractAllianceIntegrationTest) Test(org.junit.Test) SkipUnstableTest(org.codice.ddf.itests.common.annotations.SkipUnstableTest)

Example 2 with ConditionalIgnore

use of org.codice.ddf.itests.common.annotations.ConditionalIgnoreRule.ConditionalIgnore in project alliance by codice.

the class NsiliSourceTest method testNsiliFtpSourceOpenSearchGetAll.

/**
 * Simple search query to assert # records returned from mock source
 *
 * @throws Exception
 */
@Test
// CAL-427
@ConditionalIgnore(condition = SkipUnstableTest.class)
public void testNsiliFtpSourceOpenSearchGetAll() throws Exception {
    ValidatableResponse response = executeOpenSearch("xml", "q=*", "src=" + FTP_NSILI_SOURCE_ID, "count=100");
    response.log().all().body("metacards.metacard.size()", equalTo(11));
}
Also used : ValidatableResponse(com.jayway.restassured.response.ValidatableResponse) ConditionalIgnore(org.codice.ddf.itests.common.annotations.ConditionalIgnoreRule.ConditionalIgnore) AbstractAllianceIntegrationTest(org.codice.alliance.test.itests.common.AbstractAllianceIntegrationTest) Test(org.junit.Test) SkipUnstableTest(org.codice.ddf.itests.common.annotations.SkipUnstableTest)

Example 3 with ConditionalIgnore

use of org.codice.ddf.itests.common.annotations.ConditionalIgnoreRule.ConditionalIgnore in project alliance by codice.

the class NsiliSourceTest method testNsiliFtpSourceOpenSearchLocation.

/**
 * Perform query with location filtering
 *
 * @throws Exception
 */
@Test
// CAL-427
@ConditionalIgnore(condition = SkipUnstableTest.class)
public void testNsiliFtpSourceOpenSearchLocation() throws Exception {
    ValidatableResponse response = executeOpenSearch("xml", "q=*", "lat=-53.0", "lon=-111.0", "radius=50", "src=" + FTP_NSILI_SOURCE_ID, "count=100");
    response.log().all().body("metacards.metacard.size()", equalTo(11));
}
Also used : ValidatableResponse(com.jayway.restassured.response.ValidatableResponse) ConditionalIgnore(org.codice.ddf.itests.common.annotations.ConditionalIgnoreRule.ConditionalIgnore) AbstractAllianceIntegrationTest(org.codice.alliance.test.itests.common.AbstractAllianceIntegrationTest) Test(org.junit.Test) SkipUnstableTest(org.codice.ddf.itests.common.annotations.SkipUnstableTest)

Example 4 with ConditionalIgnore

use of org.codice.ddf.itests.common.annotations.ConditionalIgnoreRule.ConditionalIgnore in project alliance by codice.

the class VideoTest method testStreamingVideo.

@Test
// CAL-300
@ConditionalIgnore(condition = SkipUnstableTest.class)
public void testStreamingVideo() throws Exception {
    getServiceManager().startFeature(true, "sample-mpegts-streamgenerator");
    final String videoFilePath = FilenameUtils.concat(temporaryFolder.getRoot().getCanonicalPath(), NIGHTFLIGHT);
    final File videoFile = new File(videoFilePath);
    copyResourceToFile(NIGHTFLIGHT, videoFile);
    final String streamTitle = "UDP Stream Test";
    final String udpStreamAddress = String.format("udp://%s:%d", LOCALHOST, udpPortNum);
    final Map<String, Object> streamMonitorProperties = new HashMap<>();
    streamMonitorProperties.put(UdpStreamMonitor.METATYPE_TITLE, streamTitle);
    streamMonitorProperties.put(UdpStreamMonitor.METATYPE_MONITORED_ADDRESS, udpStreamAddress);
    streamMonitorProperties.put(UdpStreamMonitor.METATYPE_METACARD_UPDATE_INITIAL_DELAY, 0);
    streamMonitorProperties.put(UdpStreamMonitor.METATYPE_BYTE_COUNT_ROLLOVER_CONDITION, 5);
    streamMonitorProperties.put("startImmediately", true);
    startUdpStreamMonitor(streamMonitorProperties);
    waitForUdpStreamMonitorStart();
    MpegTsUdpClient.broadcastVideo(videoFilePath, LOCALHOST, udpPortNum, NIGHTFLIGHT_DURATION_MS, MpegTsUdpClient.PACKET_SIZE, MpegTsUdpClient.PACKET_SIZE, false, null);
    Thread.sleep(2000);
    expect("The parent and child metacards to be created").within(15, TimeUnit.SECONDS).checkEvery(1, TimeUnit.SECONDS).until(() -> executeOpenSearch("xml", "q=*").extract().xmlPath().getList("metacards.metacard").size() == 3);
    final ValidatableResponse parentMetacardResponse = executeOpenSearch("xml", "q=" + streamTitle).log().all().assertThat().body(hasXPath(METACARD_COUNT_XPATH, is("1"))).body(hasXPath("/metacards/metacard/string[@name='title']/value", is(streamTitle))).body(hasXPath("/metacards/metacard/string[@name='resource-uri']/value", is(udpStreamAddress))).body(hasXPath("/metacards/metacard/geometry[@name='media.frame-center']/value/*[local-name()='LineString']/*[local-name()='pos'][2]", is("-110.058257 54.791167"))).body(hasXPath("/metacards/metacard/geometry[@name='location']/value/*[local-name()='MultiPoint']/*[local-name()='pointMember'][2]/*[local-name()='Point']/*[local-name()='pos']", is("-110.058257 54.791167")));
    final String parentMetacardId = parentMetacardResponse.extract().xmlPath().getString(METACARD_ID_XMLPATH);
    expect("The child metacards to be linked to the parent").within(3, TimeUnit.SECONDS).until(() -> executeOpenSearch("xml", "q=mpegts-stream*").extract().xmlPath().getInt("metacards.metacard.string.findAll { it.@name == 'metacard.associations.derived' }.size()") == 2);
    final String chunkDividerDate = "2009-06-19T07:26:30Z";
    verifyChunkMetacard("dtend=" + chunkDividerDate, 1212.82825971, "-110.058257 54.791167", parentMetacardId);
    verifyChunkMetacard("dtstart=" + chunkDividerDate, 1206.75516899, "-110.058421 54.791636", parentMetacardId);
    getServiceManager().stopFeature(true, "sample-mpegts-streamgenerator");
}
Also used : ValidatableResponse(com.jayway.restassured.response.ValidatableResponse) HashMap(java.util.HashMap) Matchers.isEmptyOrNullString(org.hamcrest.Matchers.isEmptyOrNullString) File(java.io.File) ConditionalIgnore(org.codice.ddf.itests.common.annotations.ConditionalIgnoreRule.ConditionalIgnore) AbstractAllianceIntegrationTest(org.codice.alliance.test.itests.common.AbstractAllianceIntegrationTest) Test(org.junit.Test) SkipUnstableTest(org.codice.ddf.itests.common.annotations.SkipUnstableTest)

Example 5 with ConditionalIgnore

use of org.codice.ddf.itests.common.annotations.ConditionalIgnoreRule.ConditionalIgnore in project ddf by codice.

the class TestCatalog method testInjectAttributesOnUpdate.

@Test
// DDF-2743
@ConditionalIgnore(condition = SkipUnstableTest.class)
public void testInjectAttributesOnUpdate() {
    final String id = ingestXmlFromResource("/metacard1.xml");
    final String id2 = ingestXmlFromResource("/metacard1.xml");
    try {
        final String basicMetacardTypeName = DEFAULT_METACARD_TYPE_NAME;
        final String otherMetacardTypeName = "other.metacard.type";
        final String updateBasicMetacardXml = getFileContent("metacard-injections.xml");
        final String updateOtherMetacardXml = updateBasicMetacardXml.replaceFirst(Pattern.quote(basicMetacardTypeName), otherMetacardTypeName);
        update(id, updateBasicMetacardXml, MediaType.APPLICATION_XML);
        update(id2, updateOtherMetacardXml, MediaType.APPLICATION_XML);
        final String basicMetacardXpath = format(METACARD_X_PATH, id);
        final String otherMetacardXpath = format(METACARD_X_PATH, id2);
        getOpenSearch("xml", null, null, "q=*").log().ifValidationFails().assertThat().body(hasXPath(basicMetacardXpath + "/type", is(basicMetacardTypeName))).body(hasXPath(basicMetacardXpath + "/int[@name='page-count']/value", is("55"))).body(not(hasXPath(basicMetacardXpath + "/double[@name='temperature']"))).body(not(hasXPath(basicMetacardXpath + "/string[@name='point-of-contact']"))).body(hasXPath(otherMetacardXpath + "/type", is(otherMetacardTypeName))).body(hasXPath(otherMetacardXpath + "/int[@name='page-count']/value", is("55"))).body(hasXPath(otherMetacardXpath + "/double[@name='temperature']/value", is("-12.541"))).body(not(hasXPath(basicMetacardXpath + "/string[@name='point-of-contact']")));
    } finally {
        delete(id);
        delete(id2);
    }
}
Also used : CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ConditionalIgnore(org.codice.ddf.itests.common.annotations.ConditionalIgnoreRule.ConditionalIgnore) SkipUnstableTest(org.codice.ddf.itests.common.annotations.SkipUnstableTest) Test(org.junit.Test) AbstractIntegrationTest(org.codice.ddf.itests.common.AbstractIntegrationTest)

Aggregations

ConditionalIgnore (org.codice.ddf.itests.common.annotations.ConditionalIgnoreRule.ConditionalIgnore)12 SkipUnstableTest (org.codice.ddf.itests.common.annotations.SkipUnstableTest)12 Test (org.junit.Test)12 AbstractIntegrationTest (org.codice.ddf.itests.common.AbstractIntegrationTest)7 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)6 ValidatableResponse (com.jayway.restassured.response.ValidatableResponse)5 AbstractAllianceIntegrationTest (org.codice.alliance.test.itests.common.AbstractAllianceIntegrationTest)5 MetacardType (ddf.catalog.data.MetacardType)4 File (java.io.File)4 DefaultAttributeValueRegistry (ddf.catalog.data.DefaultAttributeValueRegistry)2 JsonPath (com.jayway.restassured.path.json.JsonPath)1 AttributeRegistry (ddf.catalog.data.AttributeRegistry)1 HashMap (java.util.HashMap)1 Matchers.containsString (org.hamcrest.Matchers.containsString)1 Matchers.isEmptyOrNullString (org.hamcrest.Matchers.isEmptyOrNullString)1