Search in sources :

Example 6 with ReadStorageRequest

use of ddf.catalog.content.operation.ReadStorageRequest in project ddf by codice.

the class HistorianTest method testNullContentItemStorageReadRequest.

@Test
public void testNullContentItemStorageReadRequest() throws StorageException, UnsupportedQueryException, SourceUnavailableException, IngestException, URISyntaxException {
    List<Metacard> metacards = getMetacardUpdatePair();
    // Parameters for historian
    UpdateStorageRequest storageRequest = mock(UpdateStorageRequest.class);
    UpdateStorageResponse storageResponse = mock(UpdateStorageResponse.class);
    UpdateResponse updateResponse = mock(UpdateResponse.class);
    // Make content item null
    storageProvider.storageMap.put(METACARD_ID, null);
    mockQuery(metacards.get(1));
    historian.version(storageRequest, storageResponse, updateResponse);
    // Verify that the content item DIDN't updated
    ReadStorageRequest request = mock(ReadStorageRequest.class);
    when(request.getResourceUri()).thenReturn(new URI(RESOURCE_URI));
    ContentItem item = storageProvider.read(request).getContentItem();
    assertThat(item, nullValue());
}
Also used : UpdateResponse(ddf.catalog.operation.UpdateResponse) DeletedMetacard(ddf.catalog.core.versioning.DeletedMetacard) Metacard(ddf.catalog.data.Metacard) ReadStorageRequest(ddf.catalog.content.operation.ReadStorageRequest) UpdateStorageResponse(ddf.catalog.content.operation.UpdateStorageResponse) UpdateStorageRequest(ddf.catalog.content.operation.UpdateStorageRequest) URI(java.net.URI) ContentItem(ddf.catalog.content.data.ContentItem) Test(org.junit.Test)

Aggregations

ReadStorageRequest (ddf.catalog.content.operation.ReadStorageRequest)6 ContentItem (ddf.catalog.content.data.ContentItem)5 URI (java.net.URI)5 ReadStorageResponse (ddf.catalog.content.operation.ReadStorageResponse)4 ReadStorageRequestImpl (ddf.catalog.content.operation.impl.ReadStorageRequestImpl)4 Metacard (ddf.catalog.data.Metacard)3 ByteSource (com.google.common.io.ByteSource)2 StorageException (ddf.catalog.content.StorageException)2 ContentItemImpl (ddf.catalog.content.data.impl.ContentItemImpl)2 CreateStorageResponse (ddf.catalog.content.operation.CreateStorageResponse)2 UpdateStorageRequest (ddf.catalog.content.operation.UpdateStorageRequest)2 UpdateStorageResponse (ddf.catalog.content.operation.UpdateStorageResponse)2 CreateStorageRequestImpl (ddf.catalog.content.operation.impl.CreateStorageRequestImpl)2 UpdateResponse (ddf.catalog.operation.UpdateResponse)2 InputStream (java.io.InputStream)2 Test (org.junit.Test)2 Lists (com.google.common.collect.Lists)1 StorageProvider (ddf.catalog.content.StorageProvider)1 CreateStorageRequest (ddf.catalog.content.operation.CreateStorageRequest)1 StorageRequest (ddf.catalog.content.operation.StorageRequest)1