@Override public RestStoreConfigurationBuilder path(String path) { return builder.path(path); }
@Override public void validate() { this.connectionPool.validate(); if (attributes.attribute(HOST).get() == null) { throw log.hostNotSpecified(); } String path = attributes.attribute(PATH).get(); if (!path.endsWith("/")) { path(path + "/"); } } }
builder.path(value); break;
builder.path(value); break;
builder.path(RestStoreConfigurationResource.PATH.resolveModelAttribute(context, store).asString()); builder.maxContentLength(RestStoreConfigurationResource.MAX_CONTENT_LENGTH.resolveModelAttribute(context, store).asInt()); builder.rawValues(true);
protected void configurePersistence(ConfigurationBuilder cb) { localCacheManager = TestCacheManagerFactory.createServerModeCacheManager(); RestServerConfigurationBuilder restServerConfigurationBuilder = new RestServerConfigurationBuilder(); restServer = new RestServer(); restServer.start(restServerConfigurationBuilder.build(), localCacheManager); cb.persistence().addStore(RestStoreConfigurationBuilder.class) .host("localhost") .port(restServer.getPort()) .path("/rest/"+ BasicCacheContainer.DEFAULT_CACHE_NAME) .preload(false); }
@Override protected PersistenceConfigurationBuilder createCacheStoreConfig(PersistenceConfigurationBuilder loaders, boolean preload) { localCacheManager = TestCacheManagerFactory.createServerModeCacheManager(); RestServerConfigurationBuilder restServerConfigurationBuilder = new RestServerConfigurationBuilder(); restServerConfigurationBuilder.port(0); restServer = new RestServer(); restServer.start(restServerConfigurationBuilder.build(), cacheManager); loaders.addStore(RestStoreConfigurationBuilder.class) .host("localhost") .port(restServer.getPort()) .path("/rest/"+BasicCacheContainer.DEFAULT_CACHE_NAME) .preload(preload); return loaders; }
@BeforeClass public void setup() { RestServerConfigurationBuilder restServerConfigurationBuilder = new RestServerConfigurationBuilder(); restServerConfigurationBuilder.port(0); ConfigurationBuilder serverBuilder = getSourceServerBuilder(); sourceContainer = TestCacheManagerFactory.createServerModeCacheManager(serverBuilder); sourceServerCache = sourceContainer.getCache(); sourceServer = new RestServer(); sourceServer.start(restServerConfigurationBuilder.build(), sourceContainer); ConfigurationBuilder targetConfigurationBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(false); targetConfigurationBuilder.persistence().addStore(RestStoreConfigurationBuilder.class).host("localhost").port(sourceServer.getPort()) .path("/rest/" + BasicCacheContainer.DEFAULT_CACHE_NAME).rawValues(true).locking().isolationLevel(IsolationLevel.NONE); targetConfigurationBuilder.encoding().key().mediaType(LEGACY_KEY_ENCODING); targetContainer = TestCacheManagerFactory.createServerModeCacheManager(targetConfigurationBuilder); targetServerCache = targetContainer.getCache(); targetServer = new RestServer(); targetServer.start(restServerConfigurationBuilder.build(), targetContainer); client = new HttpClient(); }
@Override protected AdvancedLoadWriteStore createStore() throws Exception { ConfigurationBuilder localBuilder = TestCacheManagerFactory.getDefaultCacheConfiguration(false); localBuilder.memory().evictionType(EvictionType.COUNT).size(WRITE_DELETE_BATCH_MAX_ENTRIES).expiration().wakeUpInterval(10L); localCacheManager = TestCacheManagerFactory.createServerModeCacheManager(localBuilder); localCacheManager.defineConfiguration(REMOTE_CACHE, localCacheManager.getDefaultCacheConfiguration()); localCacheManager.getCache(REMOTE_CACHE); TestingUtil.replaceComponent(localCacheManager, TimeService.class, timeService, true); localCacheManager.getCache(REMOTE_CACHE).getAdvancedCache().getComponentRegistry().rewire(); RestServerConfigurationBuilder restServerConfigurationBuilder = new RestServerConfigurationBuilder(); restServerConfigurationBuilder.port(0); restServer = new RestServer(); restServer.start(restServerConfigurationBuilder.build(), localCacheManager); ConfigurationBuilder builder = TestCacheManagerFactory.getDefaultCacheConfiguration(false); RestStoreConfigurationBuilder storeConfigurationBuilder = builder.persistence() .addStore(RestStoreConfigurationBuilder.class); storeConfigurationBuilder.host(restServer.getHost()).port(restServer.getPort()).path("/rest/" + REMOTE_CACHE); storeConfigurationBuilder.connectionPool().maxTotalConnections(10).maxConnectionsPerHost(10); storeConfigurationBuilder.validate(); RestStore restStore = new RestStore(); restStore.init(createContext(builder.build())); return restStore; }