Search in sources :

Example 16 with MetacardImpl

use of ddf.catalog.data.impl.MetacardImpl in project ddf by codice.

the class TestRegistryStore method testUpdateNonRegistryMetacard.

@Test(expected = IngestException.class)
public void testUpdateNonRegistryMetacard() throws Exception {
    MetacardImpl updatedMcard = getDefaultMetacard();
    updatedMcard.setAttribute(RegistryObjectMetacardType.REGISTRY_ID, null);
    UpdateRequestImpl request = new UpdateRequestImpl("testId", updatedMcard);
    registryStore.update(request);
}
Also used : UpdateRequestImpl(ddf.catalog.operation.impl.UpdateRequestImpl) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) Test(org.junit.Test)

Example 17 with MetacardImpl

use of ddf.catalog.data.impl.MetacardImpl in project ddf by codice.

the class TestRegistryUtility method setup.

@Before
public void setup() {
    metacard = new MetacardImpl();
    tags.add(RegistryConstants.REGISTRY_TAG);
    tagsAttribute = new AttributeImpl(Metacard.TAGS, tags);
    metacard.setAttribute(tagsAttribute);
}
Also used : AttributeImpl(ddf.catalog.data.impl.AttributeImpl) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) Before(org.junit.Before)

Example 18 with MetacardImpl

use of ddf.catalog.data.impl.MetacardImpl in project ddf by codice.

the class ResourceOperationsOptionsTest method setUpResourceOperationsAndMocks.

private void setUpResourceOperationsAndMocks() throws URISyntaxException {
    queryOperationsMock = mock(QueryOperations.class);
    queryResponseMock = mock(QueryResponse.class);
    resultMock = mock(Result.class);
    metacard = new MetacardImpl();
    metacard.setId("Bobbert");
    metacard.setTitle("Bobbert's Title");
    mockResultList = new ArrayList<>();
    resourceOperations = new ResourceOperations(frameworkProperties, queryOperationsMock, null);
    when(queryResponseMock.getResults()).thenReturn(mockResultList);
    when(resultMock.getMetacard()).thenReturn(metacard);
}
Also used : QueryResponse(ddf.catalog.operation.QueryResponse) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) Result(ddf.catalog.data.Result)

Example 19 with MetacardImpl

use of ddf.catalog.data.impl.MetacardImpl in project ddf by codice.

the class RemoteDeleteOperationsTest method setUpMocks.

private void setUpMocks() throws IOException, CatalogTransformerException {
    String localProviderName = "ddf";
    mockPoller = mock(SourcePoller.class);
    when(mockPoller.getCachedSource(isA(Source.class))).thenReturn(null);
    provider = mock(CatalogProvider.class);
    when(provider.getId()).thenReturn(localProviderName);
    when(provider.isAvailable(isA(SourceMonitor.class))).thenReturn(true);
    when(provider.isAvailable()).thenReturn(true);
    mockPostResourcePlugin = mock(PostResourcePlugin.class);
    mockPostResourcePlugins = new ArrayList<PostResourcePlugin>();
    mockPostResourcePlugins.add(mockPostResourcePlugin);
    mockFederationStrategy = mock(FederationStrategy.class);
    postIngestPlugins = new ArrayList<>();
    storageProvider = new MockMemoryStorageProvider();
    mimeTypeResolver = mock(MimeTypeResolver.class);
    mimeTypeToTransformerMapper = mock(MimeTypeToTransformerMapper.class);
    uuidGenerator = mock(UuidGenerator.class);
    when(uuidGenerator.generateUuid()).thenReturn(UUID.randomUUID().toString());
    inputTransformer = mock(InputTransformer.class);
    when(inputTransformer.transform(any(InputStream.class))).thenReturn(new MetacardImpl());
    when(mimeTypeToTransformerMapper.findMatches(any(Class.class), any(MimeType.class))).thenReturn(Collections.singletonList(inputTransformer));
}
Also used : MimeTypeToTransformerMapper(ddf.mime.MimeTypeToTransformerMapper) PostResourcePlugin(ddf.catalog.plugin.PostResourcePlugin) UuidGenerator(org.codice.ddf.platform.util.uuidgenerator.UuidGenerator) FederationStrategy(ddf.catalog.federation.FederationStrategy) InputStream(java.io.InputStream) MockMemoryStorageProvider(ddf.catalog.content.impl.MockMemoryStorageProvider) InputTransformer(ddf.catalog.transform.InputTransformer) SourceMonitor(ddf.catalog.source.SourceMonitor) Source(ddf.catalog.source.Source) MetacardImpl(ddf.catalog.data.impl.MetacardImpl) MimeType(javax.activation.MimeType) SourcePoller(ddf.catalog.util.impl.SourcePoller) MimeTypeResolver(ddf.mime.MimeTypeResolver) CatalogProvider(ddf.catalog.source.CatalogProvider)

Example 20 with MetacardImpl

use of ddf.catalog.data.impl.MetacardImpl in project ddf by codice.

the class RemoteDeleteOperationsTest method setUpDeleteRequest.

private void setUpDeleteRequest() {
    MetacardImpl metacard = new MetacardImpl();
    ArrayList<Metacard> metacardList = new ArrayList<>();
    metacard.setId("Bob");
    metacard.setTitle("Bob's Title");
    metacardList.add(metacard);
    metacard = new MetacardImpl();
    metacard.setId("Bobbert");
    metacard.setTitle("Bobbert's Title");
    metacardList.add(metacard);
    deleteRequest = new DeleteRequestImpl(metacard.getId());
    deleteResponse = new DeleteResponseImpl(deleteRequest, new HashMap(), metacardList);
}
Also used : Metacard(ddf.catalog.data.Metacard) DeleteResponseImpl(ddf.catalog.operation.impl.DeleteResponseImpl) HashMap(java.util.HashMap) DeleteRequestImpl(ddf.catalog.operation.impl.DeleteRequestImpl) ArrayList(java.util.ArrayList) MetacardImpl(ddf.catalog.data.impl.MetacardImpl)

Aggregations

MetacardImpl (ddf.catalog.data.impl.MetacardImpl)384 Test (org.junit.Test)247 Metacard (ddf.catalog.data.Metacard)144 ArrayList (java.util.ArrayList)102 Result (ddf.catalog.data.Result)62 HashMap (java.util.HashMap)59 Date (java.util.Date)52 ResultImpl (ddf.catalog.data.impl.ResultImpl)51 AttributeImpl (ddf.catalog.data.impl.AttributeImpl)49 URI (java.net.URI)38 Matchers.anyString (org.mockito.Matchers.anyString)38 QueryRequest (ddf.catalog.operation.QueryRequest)36 QueryResponse (ddf.catalog.operation.QueryResponse)35 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)35 Serializable (java.io.Serializable)33 HashSet (java.util.HashSet)31 QueryImpl (ddf.catalog.operation.impl.QueryImpl)29 MetacardTypeImpl (ddf.catalog.data.impl.MetacardTypeImpl)28 AttributeDescriptor (ddf.catalog.data.AttributeDescriptor)27 List (java.util.List)27