use of org.apereo.cas.services.replication.NoOpRegisteredServiceReplicationStrategy in project cas by apereo.
the class SamlRegisteredServiceTests method verifySavingSamlService.
@Test
public void verifySavingSamlService() throws Exception {
val appCtx = new StaticApplicationContext();
appCtx.refresh();
val registeredService = new SamlRegisteredService();
registeredService.setName(SAML_SERVICE);
registeredService.setServiceId("http://mmoayyed.unicon.net");
registeredService.setMetadataLocation(METADATA_LOCATION);
val dao = new JsonServiceRegistry(RESOURCE, WatcherService.noOp(), appCtx, new NoOpRegisteredServiceReplicationStrategy(), new DefaultRegisteredServiceResourceNamingStrategy(), new ArrayList<>());
dao.save(registeredService);
dao.load();
}
use of org.apereo.cas.services.replication.NoOpRegisteredServiceReplicationStrategy in project cas by apereo.
the class AbstractResourceBasedServiceRegistry method initializeRegistry.
private void initializeRegistry(final Path configDirectory, final Collection<StringSerializer<RegisteredService>> serializers, final RegisteredServiceReplicationStrategy registeredServiceReplicationStrategy, final RegisteredServiceResourceNamingStrategy resourceNamingStrategy, final WatcherService serviceRegistryConfigWatcher) {
this.registeredServiceReplicationStrategy = ObjectUtils.defaultIfNull(registeredServiceReplicationStrategy, new NoOpRegisteredServiceReplicationStrategy());
this.resourceNamingStrategy = ObjectUtils.defaultIfNull(resourceNamingStrategy, new DefaultRegisteredServiceResourceNamingStrategy());
this.registeredServiceSerializers = serializers;
this.serviceFileNamePattern = resourceNamingStrategy.buildNamingPattern(getExtensions());
LOGGER.trace("Constructed service name file pattern [{}]", serviceFileNamePattern.pattern());
this.serviceRegistryDirectory = configDirectory;
val file = this.serviceRegistryDirectory.toFile();
Assert.isTrue(file.exists(), this.serviceRegistryDirectory + " does not exist");
Assert.isTrue(file.isDirectory(), this.serviceRegistryDirectory + " is not a directory");
LOGGER.trace("Service registry directory is specified at [{}]", file);
this.serviceRegistryWatcherService = serviceRegistryConfigWatcher;
this.serviceRegistryWatcherService.start(getClass().getSimpleName());
}
use of org.apereo.cas.services.replication.NoOpRegisteredServiceReplicationStrategy in project cas by apereo.
the class JsonServiceRegistryTests method verifyRegistry.
@Test
public void verifyRegistry() throws Exception {
val appCtx = new StaticApplicationContext();
appCtx.refresh();
val registry = new JsonServiceRegistry(RESOURCE, WatcherService.noOp(), appCtx, new NoOpRegisteredServiceReplicationStrategy(), new DefaultRegisteredServiceResourceNamingStrategy(), new ArrayList<>());
assertNotNull(registry.getName());
assertNotNull(registry.getExtensions());
}
use of org.apereo.cas.services.replication.NoOpRegisteredServiceReplicationStrategy in project cas by apereo.
the class JsonServiceRegistryTests method getNewServiceRegistry.
@SneakyThrows
@Override
public ResourceBasedServiceRegistry getNewServiceRegistry() {
val appCtx = new StaticApplicationContext();
appCtx.refresh();
newServiceRegistry = new JsonServiceRegistry(RESOURCE, WatcherService.noOp(), appCtx, new NoOpRegisteredServiceReplicationStrategy(), new DefaultRegisteredServiceResourceNamingStrategy(), new ArrayList<>());
return newServiceRegistry;
}
use of org.apereo.cas.services.replication.NoOpRegisteredServiceReplicationStrategy in project cas by apereo.
the class GrouperRegisteredServiceAccessStrategyTests method checkAccessStrategyJson.
@Test
public void checkAccessStrategyJson() throws Exception {
val attributes = new HashMap<String, Set<String>>();
val v1 = new HashSet<String>();
v1.add("admin");
attributes.put("memberOf", v1);
val service = RegisteredServiceTestUtils.getRegisteredService("test");
val grouper = new GrouperRegisteredServiceAccessStrategy();
grouper.setConfigProperties(CollectionUtils.wrap("hello", "world"));
grouper.setRequiredAttributes(attributes);
service.setAccessStrategy(grouper);
val appCtx = new StaticApplicationContext();
appCtx.refresh();
val dao = new JsonServiceRegistry(RESOURCE, WatcherService.noOp(), appCtx, new NoOpRegisteredServiceReplicationStrategy(), new DefaultRegisteredServiceResourceNamingStrategy(), new ArrayList<>());
val saved = dao.save(service);
assertEquals(service, saved);
assertFalse(dao.load().isEmpty());
}
Aggregations