Search in sources :

Example 1 with PolicyResponse

use of ddf.catalog.plugin.PolicyResponse in project ddf by codice.

the class MetacardValidityFilterPluginTest method testInvalidMetacards.

@Test
public void testInvalidMetacards() throws Exception {
    Result result = mock(Result.class);
    PolicyResponse response = filterPluginResponseHelper(result, getErrorsMetacard(), true, false);
    assertThat(response.itemPolicy().get("sample").contains("test1"), is(true));
}
Also used : PolicyResponse(ddf.catalog.plugin.PolicyResponse) Result(ddf.catalog.data.Result) Test(org.junit.Test)

Example 2 with PolicyResponse

use of ddf.catalog.plugin.PolicyResponse in project ddf by codice.

the class MetacardValidityFilterPluginTest method testFilterErrorsOnly.

@Test
public void testFilterErrorsOnly() throws Exception {
    Result result = mock(Result.class);
    PolicyResponse response = filterPluginResponseHelper(result, getErrorsMetacard(), true, false);
    assertThat(response.itemPolicy().get("sample").contains("test1"), is(true));
}
Also used : PolicyResponse(ddf.catalog.plugin.PolicyResponse) Result(ddf.catalog.data.Result) Test(org.junit.Test)

Example 3 with PolicyResponse

use of ddf.catalog.plugin.PolicyResponse in project ddf by codice.

the class MetacardValidityFilterPluginTest method testFilterNone.

@Test
public void testFilterNone() throws Exception {
    Result result = mock(Result.class);
    PolicyResponse response = filterPluginResponseHelper(result, getErrorsMetacard(), false, false);
    assertThat(response.itemPolicy().size(), is(0));
    response = filterPluginResponseHelper(result, getWarningsMetacard(), false, false);
    assertThat(response.itemPolicy().size(), is(0));
}
Also used : PolicyResponse(ddf.catalog.plugin.PolicyResponse) Result(ddf.catalog.data.Result) Test(org.junit.Test)

Example 4 with PolicyResponse

use of ddf.catalog.plugin.PolicyResponse in project ddf by codice.

the class MetacardValidityFilterPluginTest method testNullMetacard.

@Test
public void testNullMetacard() throws Exception {
    Result result = mock(Result.class);
    PolicyResponse response = filterPluginResponseHelper(result, null, true, false);
    assertThat(response.itemPolicy().isEmpty(), is(true));
}
Also used : PolicyResponse(ddf.catalog.plugin.PolicyResponse) Result(ddf.catalog.data.Result) Test(org.junit.Test)

Example 5 with PolicyResponse

use of ddf.catalog.plugin.PolicyResponse in project ddf by codice.

the class MetacardValidityFilterPluginTest method testNullResults.

@Test
public void testNullResults() throws Exception {
    PolicyResponse response = filterPluginResponseHelper(null, getValidMetacard(), true, false);
    assertThat(response.itemPolicy().isEmpty(), is(true));
}
Also used : PolicyResponse(ddf.catalog.plugin.PolicyResponse) Test(org.junit.Test)

Aggregations

PolicyResponse (ddf.catalog.plugin.PolicyResponse)75 Test (org.junit.Test)64 MetacardImpl (ddf.catalog.data.impl.MetacardImpl)20 Metacard (ddf.catalog.data.Metacard)19 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)14 Serializable (java.io.Serializable)14 Set (java.util.Set)14 Result (ddf.catalog.data.Result)13 HashMap (java.util.HashMap)12 PolicyPlugin (ddf.catalog.plugin.PolicyPlugin)10 HashSet (java.util.HashSet)7 ResultImpl (ddf.catalog.data.impl.ResultImpl)6 ResourceResponse (ddf.catalog.operation.ResourceResponse)6 Query (ddf.catalog.operation.Query)5 StopProcessingException (ddf.catalog.plugin.StopProcessingException)4 ImmutableSet (com.google.common.collect.ImmutableSet)3 ResourceRequest (ddf.catalog.operation.ResourceRequest)3 ArrayList (java.util.ArrayList)3 Map (java.util.Map)3 OPERATION_TRANSACTION_KEY (ddf.catalog.Constants.OPERATION_TRANSACTION_KEY)2