use of ddf.catalog.operation.ResourceRequest in project ddf by codice.
the class ReliableResourceDownloadManagerTest method getMockResourceResponse.
private ResourceResponse getMockResourceResponse() throws Exception {
resourceRequest = mock(ResourceRequest.class);
Map<String, Serializable> requestProperties = new HashMap<String, Serializable>();
when(resourceRequest.getPropertyNames()).thenReturn(requestProperties.keySet());
resource = mock(Resource.class);
when(resource.getInputStream()).thenReturn(mis);
when(resource.getName()).thenReturn("test-resource");
when(resource.getMimeType()).thenReturn(new MimeType("text/plain"));
resourceResponse = mock(ResourceResponse.class);
when(resourceResponse.getRequest()).thenReturn(resourceRequest);
when(resourceResponse.getResource()).thenReturn(resource);
Map<String, Serializable> responseProperties = new HashMap<String, Serializable>();
when(resourceResponse.getProperties()).thenReturn(responseProperties);
return resourceResponse;
}
use of ddf.catalog.operation.ResourceRequest in project ddf by codice.
the class ReliableResourceDownloadManagerTest method testDownloadWithNullMetacard.
@Test(expected = DownloadException.class)
public void testDownloadWithNullMetacard() throws Exception {
resourceRequest = mock(ResourceRequest.class);
ResourceRetriever retriever = mock(ResourceRetriever.class);
downloadMgr.download(resourceRequest, null, retriever);
}
use of ddf.catalog.operation.ResourceRequest in project ddf by codice.
the class ReliableResourceDownloadManagerTest method testDownloadWithNullResourceRetriever.
@Test(expected = DownloadException.class)
public void testDownloadWithNullResourceRetriever() throws Exception {
Metacard metacard = getMockMetacard(EXPECTED_METACARD_ID, EXPECTED_METACARD_SOURCE_ID);
resourceRequest = mock(ResourceRequest.class);
downloadMgr.download(resourceRequest, metacard, null);
}
use of ddf.catalog.operation.ResourceRequest in project ddf by codice.
the class SecurityPluginTest method testNominalCaseResource.
@Test
public void testNominalCaseResource() throws Exception {
Subject mockSubject = mock(Subject.class);
ThreadContext.bind(mockSubject);
ResourceRequest request = new MockResourceRequest();
SecurityPlugin plugin = new SecurityPlugin();
request = plugin.processPreResource(request);
assertThat(request.getPropertyValue(SecurityConstants.SECURITY_SUBJECT), equalTo(mockSubject));
}
use of ddf.catalog.operation.ResourceRequest in project ddf by codice.
the class PointOfContactUpdatePluginTest method testPassthroughMethods.
@Test
public void testPassthroughMethods() throws Exception {
CreateRequest createRequest = mock(CreateRequest.class);
DeleteRequest deleteRequest = mock(DeleteRequest.class);
QueryRequest queryRequest = mock(QueryRequest.class);
ResourceRequest resourceRequest = mock(ResourceRequest.class);
DeleteResponse deleteResponse = mock(DeleteResponse.class);
QueryResponse queryResponse = mock(QueryResponse.class);
ResourceResponse resourceResponse = mock(ResourceResponse.class);
assertThat(pointOfContactUpdatePlugin.processPreCreate(createRequest), is(createRequest));
assertThat(pointOfContactUpdatePlugin.processPreDelete(deleteRequest), is(deleteRequest));
assertThat(pointOfContactUpdatePlugin.processPostDelete(deleteResponse), is(deleteResponse));
assertThat(pointOfContactUpdatePlugin.processPreQuery(queryRequest), is(queryRequest));
assertThat(pointOfContactUpdatePlugin.processPostQuery(queryResponse), is(queryResponse));
assertThat(pointOfContactUpdatePlugin.processPreResource(resourceRequest), is(resourceRequest));
assertThat(pointOfContactUpdatePlugin.processPostResource(resourceResponse, mock(Metacard.class)), is(resourceResponse));
verifyZeroInteractions(createRequest, deleteRequest, queryRequest, resourceRequest, deleteResponse, queryResponse, resourceResponse);
}
Aggregations