Search in sources :

Example 1 with RestReplicatorPlugin

use of ddf.catalog.federation.layered.replication.RestReplicatorPlugin in project ddf by codice.

the class TestPlugin method setup.

@Before
public void setup() {
    // given
    plugin = new RestReplicatorPlugin(ENDPOINT_ADDRESS);
    transformer = mock(MetacardTransformer.class);
    BinaryContent bc = mock(BinaryContent.class);
    byte[] bytes = { 86 };
    try {
        when(bc.getByteArray()).thenReturn(bytes);
        when(transformer.transform(isA(Metacard.class), isA(Map.class))).thenReturn(bc);
    } catch (Exception e) {
        Assert.fail(e.getLocalizedMessage());
    }
    plugin.setTransformer(transformer);
    metacard = getMockMetacard();
}
Also used : Metacard(ddf.catalog.data.Metacard) MetacardTransformer(ddf.catalog.transform.MetacardTransformer) RestReplicatorPlugin(ddf.catalog.federation.layered.replication.RestReplicatorPlugin) BinaryContent(ddf.catalog.data.BinaryContent) Map(java.util.Map) SourceUnavailableException(ddf.catalog.source.SourceUnavailableException) PluginExecutionException(ddf.catalog.plugin.PluginExecutionException) IngestException(ddf.catalog.source.IngestException) IOException(java.io.IOException) CatalogTransformerException(ddf.catalog.transform.CatalogTransformerException) Before(org.junit.Before)

Example 2 with RestReplicatorPlugin

use of ddf.catalog.federation.layered.replication.RestReplicatorPlugin in project ddf by codice.

the class TestPlugin method testCreateNullTransformer.

@Test
@Ignore
public void testCreateNullTransformer() throws PluginExecutionException, IngestException, SourceUnavailableException {
    // given
    plugin = new RestReplicatorPlugin(null);
    CreateResponse createResponse = new CreateResponseImpl(new CreateRequestImpl(metacard), null, Arrays.asList(metacard));
    // when
    plugin.process(createResponse);
    // then
    verify(endpoint, never()).addDocument(isA(HttpHeaders.class), isA(UriInfo.class), isA(InputStream.class));
}
Also used : HttpHeaders(javax.ws.rs.core.HttpHeaders) RestReplicatorPlugin(ddf.catalog.federation.layered.replication.RestReplicatorPlugin) CreateResponse(ddf.catalog.operation.CreateResponse) InputStream(java.io.InputStream) CreateRequestImpl(ddf.catalog.operation.impl.CreateRequestImpl) UriInfo(javax.ws.rs.core.UriInfo) CreateResponseImpl(ddf.catalog.operation.impl.CreateResponseImpl) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

RestReplicatorPlugin (ddf.catalog.federation.layered.replication.RestReplicatorPlugin)2 BinaryContent (ddf.catalog.data.BinaryContent)1 Metacard (ddf.catalog.data.Metacard)1 CreateResponse (ddf.catalog.operation.CreateResponse)1 CreateRequestImpl (ddf.catalog.operation.impl.CreateRequestImpl)1 CreateResponseImpl (ddf.catalog.operation.impl.CreateResponseImpl)1 PluginExecutionException (ddf.catalog.plugin.PluginExecutionException)1 IngestException (ddf.catalog.source.IngestException)1 SourceUnavailableException (ddf.catalog.source.SourceUnavailableException)1 CatalogTransformerException (ddf.catalog.transform.CatalogTransformerException)1 MetacardTransformer (ddf.catalog.transform.MetacardTransformer)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Map (java.util.Map)1 HttpHeaders (javax.ws.rs.core.HttpHeaders)1 UriInfo (javax.ws.rs.core.UriInfo)1 Before (org.junit.Before)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1