Search in sources :

Example 1 with ResourceRequest

use of ddf.catalog.operation.ResourceRequest in project ddf by codice.

the class DummyPreResourcePlugin method process.

@Override
public ResourceRequest process(ResourceRequest input) throws PluginExecutionException, StopProcessingException {
    ResourceRequest newResourceRequest = input;
    if (newResourceRequest != null) {
        Map<String, Serializable> requestProperties = newResourceRequest.getProperties();
        requestProperties.put(ResourceRequest.IS_ENTERPRISE, true);
    }
    return newResourceRequest;
}
Also used : Serializable(java.io.Serializable) ResourceRequest(ddf.catalog.operation.ResourceRequest)

Example 2 with ResourceRequest

use of ddf.catalog.operation.ResourceRequest in project ddf by codice.

the class TestResourceUsagePlugin method testPreResourceLocalSourceNoLocalMonitoring.

@Test
public void testPreResourceLocalSourceNoLocalMonitoring() throws StopProcessingException, PluginExecutionException, PersistenceException {
    plugin.setMonitorLocalSources(false);
    ResourceRequest originalRequest = getMockLocalResourceRequest(RESOURCE_SIZE, TEST_USER);
    ResourceRequest request = plugin.process(originalRequest);
    assertThat(request, is(notNullValue()));
    assertThat(request, is(originalRequest));
    verify(attributeStore, never()).getDataLimitByUser(anyString());
    verify(attributeStore, never()).getCurrentDataUsageByUser(anyString());
}
Also used : ResourceRequest(ddf.catalog.operation.ResourceRequest) Test(org.junit.Test)

Example 3 with ResourceRequest

use of ddf.catalog.operation.ResourceRequest in project ddf by codice.

the class TestResourceUsagePlugin method getMockRemoteResourceRequest.

private ResourceRequest getMockRemoteResourceRequest(String resourceSize, String expectedUsername) {
    setSubject(expectedUsername);
    ResourceRequest resourceRequest = getMockResourceRequest(resourceSize, expectedUsername);
    when(resourceRequest.getPropertyValue(Constants.REMOTE_DESTINATION_KEY)).thenReturn(true);
    when(resourceRequest.hasProperties()).thenReturn(true);
    return resourceRequest;
}
Also used : ResourceRequest(ddf.catalog.operation.ResourceRequest)

Example 4 with ResourceRequest

use of ddf.catalog.operation.ResourceRequest in project ddf by codice.

the class TestResourceUsagePlugin method testPreResourceLocalSourceSizeNotFound.

@Test
public void testPreResourceLocalSourceSizeNotFound() throws PersistenceException, PluginExecutionException, StopProcessingException {
    ResourceRequest originalRequest = getMockLocalResourceRequest(null, TEST_USER);
    ResourceRequest request = plugin.process(originalRequest);
    assertThat(request, is(notNullValue()));
    assertThat(request, is(originalRequest));
    verify(attributeStore, never()).getDataLimitByUser(anyString());
    verify(attributeStore, never()).getCurrentDataUsageByUser(anyString());
}
Also used : ResourceRequest(ddf.catalog.operation.ResourceRequest) Test(org.junit.Test)

Example 5 with ResourceRequest

use of ddf.catalog.operation.ResourceRequest in project ddf by codice.

the class TestResourceUsagePlugin method testPreResourceNoSubject.

@Test
public void testPreResourceNoSubject() throws StopProcessingException, PluginExecutionException, PersistenceException {
    ResourceRequest originalRequest = getMockResourceRequestNoSubject(RESOURCE_SIZE);
    ResourceRequest request = plugin.process(originalRequest);
    assertThat(request, is(notNullValue()));
    assertThat(request, is(originalRequest));
    verify(attributeStore, never()).getDataLimitByUser(anyString());
    verify(attributeStore, never()).getCurrentDataUsageByUser(anyString());
}
Also used : ResourceRequest(ddf.catalog.operation.ResourceRequest) Test(org.junit.Test)

Aggregations

ResourceRequest (ddf.catalog.operation.ResourceRequest)42 Test (org.junit.Test)25 ResourceResponse (ddf.catalog.operation.ResourceResponse)16 Metacard (ddf.catalog.data.Metacard)12 Resource (ddf.catalog.resource.Resource)9 IOException (java.io.IOException)9 ResourceRequestById (ddf.catalog.operation.impl.ResourceRequestById)8 ResourceNotFoundException (ddf.catalog.resource.ResourceNotFoundException)8 ResourceNotSupportedException (ddf.catalog.resource.ResourceNotSupportedException)8 Serializable (java.io.Serializable)7 HashMap (java.util.HashMap)7 QueryRequest (ddf.catalog.operation.QueryRequest)6 Result (ddf.catalog.data.Result)5 QueryResponse (ddf.catalog.operation.QueryResponse)5 ResourceRetriever (ddf.catalog.resourceretriever.ResourceRetriever)5 DeleteRequest (ddf.catalog.operation.DeleteRequest)4 Matchers.anyString (org.mockito.Matchers.anyString)4 QueryRequestImpl (ddf.catalog.operation.impl.QueryRequestImpl)3 FederatedSource (ddf.catalog.source.FederatedSource)3 Subject (ddf.security.Subject)3