use of ddf.catalog.operation.ResourceRequest in project ddf by codice.
the class TestResourceUsagePlugin method testPreResourcePersistenceException.
@Test
public void testPreResourcePersistenceException() throws StopProcessingException, PluginExecutionException, PersistenceException {
doThrow(PersistenceException.class).when(attributeStore).getCurrentDataUsageByUser(anyString());
ResourceRequest originalRequest = getMockLocalResourceRequest(RESOURCE_SIZE, TEST_USER);
ResourceRequest request = plugin.process(originalRequest);
assertThat(request, notNullValue());
assertThat(request, is(originalRequest));
}
use of ddf.catalog.operation.ResourceRequest in project ddf by codice.
the class TestResourceUsagePlugin method testPreResourceValidSize.
@Test
public void testPreResourceValidSize() throws StopProcessingException, PluginExecutionException, PersistenceException {
ArgumentCaptor<String> usernameArg = ArgumentCaptor.forClass(String.class);
ResourceRequest originalRequest = getMockLocalResourceRequest(RESOURCE_SIZE, TEST_USER);
ResourceRequest request = plugin.process(originalRequest);
assertThat(request, notNullValue());
assertThat(request, is(originalRequest));
verify(attributeStore).getDataLimitByUser(usernameArg.capture());
assertThat(usernameArg.getValue(), is(TEST_USER));
}
use of ddf.catalog.operation.ResourceRequest in project ddf by codice.
the class TestResourceUsagePlugin method testPreResourceRemoteSourceValidSize.
@Test
public void testPreResourceRemoteSourceValidSize() throws Exception {
plugin.setMonitorLocalSources(false);
ArgumentCaptor<String> usernameArg = ArgumentCaptor.forClass(String.class);
ResourceRequest originalRequest = getMockRemoteResourceRequest(RESOURCE_SIZE, TEST_USER);
ResourceRequest request = plugin.process(originalRequest);
assertThat(request, notNullValue());
assertThat(request, is(originalRequest));
verify(attributeStore).getDataLimitByUser(usernameArg.capture());
assertThat(usernameArg.getValue(), is(TEST_USER));
}
use of ddf.catalog.operation.ResourceRequest in project ddf by codice.
the class TestResourceUsagePlugin method testPreResourceSizeExceedsDataLimit.
@Test(expected = DataUsageLimitExceededException.class)
public void testPreResourceSizeExceedsDataLimit() throws StopProcessingException, PluginExecutionException, PersistenceException {
doReturn(DATA_LIMIT).when(attributeStore).getCurrentDataUsageByUser(anyString());
ResourceRequest originalRequest = getMockLocalResourceRequest(RESOURCE_SIZE_LARGE, TEST_USER);
plugin.process(originalRequest);
}
Aggregations