use of org.infinispan.server.core.DummyServerStateManager in project infinispan by infinispan.
the class AbstractRestResourceTest method createCacheManagers.
@Override
protected void createCacheManagers() throws Exception {
Security.doAs(ADMIN, () -> {
for (int i = 0; i < NUM_SERVERS; i++) {
GlobalConfigurationBuilder configForNode = getGlobalConfigForNode(i);
addClusterEnabledCacheManager(new GlobalConfigurationBuilder().read(configForNode.build()), getDefaultCacheBuilder(), TransportFlags.minimalXsiteFlags());
}
cacheManagers.forEach(this::defineCaches);
cacheManagers.forEach(cm -> cm.defineConfiguration("invalid", getDefaultCacheBuilder().encoding().mediaType(APPLICATION_OBJECT_TYPE).indexing().enabled(true).addIndexedEntities("invalid").build()));
serverStateManager = new DummyServerStateManager();
for (EmbeddedCacheManager cm : cacheManagers) {
BasicComponentRegistry bcr = SecurityActions.getGlobalComponentRegistry(cm).getComponent(BasicComponentRegistry.class.getName());
bcr.registerComponent(ServerStateManager.class, serverStateManager, false);
cm.getClassAllowList().addClasses(TestClass.class);
waitForClusterToForm(cm.getCacheNames().stream().filter(name -> {
try {
cm.getCache(name);
return true;
} catch (CacheConfigurationException ignored) {
return false;
}
}).toArray(String[]::new));
RestServerHelper restServerHelper = new RestServerHelper(cm);
if (isSecurityEnabled()) {
BasicAuthenticator basicAuthenticator = new BasicAuthenticator(new SimpleSecurityDomain(ADMIN, USER), REALM);
restServerHelper.withAuthenticator(basicAuthenticator);
}
if (ssl) {
restServerHelper.withKeyStore(SERVER_KEY_STORE, STORE_PASSWORD, STORE_TYPE).withTrustStore(SERVER_KEY_STORE, STORE_PASSWORD, STORE_TYPE);
}
restServerHelper.start(TestResourceTracker.getCurrentTestShortName());
restServers.add(restServerHelper);
}
});
adminClient = RestClient.forConfiguration(getClientConfig("admin", "admin").build());
client = RestClient.forConfiguration(getClientConfig("user", "user").build());
}
use of org.infinispan.server.core.DummyServerStateManager in project infinispan by infinispan.
the class MemcachedSingleNodeTest method createCacheManager.
@Override
protected EmbeddedCacheManager createCacheManager() throws Exception {
cacheManager = createTestCacheManager();
cacheManager.getGlobalComponentRegistry().registerComponent(new DummyServerStateManager(), ServerStateManager.class);
TestingUtil.replaceComponent(cacheManager, TimeService.class, timeService, true);
server = startMemcachedTextServer(cacheManager);
client = createMemcachedClient(60000, server.getPort());
cache = cacheManager.getCache(server.getConfiguration().defaultCacheName());
return cacheManager;
}
Aggregations