use of org.codice.ddf.security.impl.Security in project ddf by codice.
the class ContentDirectoryMonitorTest method createContentDirectoryMonitor.
private ContentDirectoryMonitor createContentDirectoryMonitor() {
ContentDirectoryMonitor monitor = new ContentDirectoryMonitor(camelContext, mock(AttributeRegistry.class), 1, 1, Runnable::run, new Security());
monitor.systemSubjectBinder = exchange -> {
};
monitor.setNumThreads(1);
monitor.setReadLockIntervalMilliseconds(1000);
return monitor;
}
use of org.codice.ddf.security.impl.Security in project ddf by codice.
the class ApplicationServiceImplTest method testGetInstallProfilesException.
/**
* Tests the {@link ApplicationServiceImpl#getInstallationProfiles()} method for the case where
* featuresService.listFeatures() throws an exception
*/
@Test
public void testGetInstallProfilesException() throws Exception {
Set<Repository> activeRepos = new HashSet<>(Arrays.asList(mainFeatureRepo, noMainFeatureRepo1));
FeaturesService featuresService = createMockFeaturesService(activeRepos, null, null);
when(bundleContext.getService(mockFeatureRef)).thenReturn(featuresService);
ApplicationService appService = new ApplicationServiceImpl(featuresService, new Security()) {
@Override
protected BundleContext getContext() {
return bundleContext;
}
};
doThrow(new NullPointerException()).when(featuresService).listFeatures();
assertThat("No installation profiles should of been found, expected an empty collection", appService.getInstallationProfiles(), is(empty()));
}
use of org.codice.ddf.security.impl.Security in project ddf by codice.
the class FilterPluginTest method testPluginFilterResourceNoStrategiesGood.
@Test
public void testPluginFilterResourceNoStrategiesGood() throws StopProcessingException {
plugin = new FilterPlugin(new Security());
plugin.setPermissions(new PermissionsImpl());
plugin.processPostResource(resourceResponse, getExactRolesMetacard());
}
use of org.codice.ddf.security.impl.Security in project ddf by codice.
the class FilterPluginTest method testPluginFilterNoStrategies.
@Test
public void testPluginFilterNoStrategies() {
plugin = new FilterPlugin(new Security());
plugin.setPermissions(new PermissionsImpl());
plugin.setSubjectOperations(new SubjectUtils());
plugin.setSecurityLogger(mock(SecurityLogger.class));
try {
QueryResponse response = plugin.processPostQuery(incomingResponse);
verifyFilterResponse(response);
} catch (StopProcessingException e) {
LOGGER.error("Stopped processing the redaction plugin", e);
}
}
use of org.codice.ddf.security.impl.Security in project ddf by codice.
the class FilterPluginTest method testNoRequestSubjectNoStrategies.
@Test(expected = StopProcessingException.class)
public void testNoRequestSubjectNoStrategies() throws Exception {
QueryResponseImpl response = new QueryResponseImpl(null);
plugin = new FilterPlugin(new Security());
plugin.processPostQuery(response);
fail("Plugin should have thrown exception when no subject was sent in.");
}
Aggregations