use of org.infinispan.commons.configuration.StringConfiguration in project infinispan by infinispan.
the class RemoteCacheAdminStandaloneTest method testCreateClusteredCacheStandAloneServer.
@Test(expectedExceptions = HotRodClientException.class, expectedExceptionsMessageRegExp = ".*ISPN005034.*")
public void testCreateClusteredCacheStandAloneServer() {
String xml = String.format("<infinispan><cache-container><distributed-cache name=\"%s\"></distributed-cache></cache-container></infinispan>", "cache");
RemoteCache<?, ?> cache = remoteCacheManager.administration().createCache("cache", new StringConfiguration(xml));
assertEquals(0, cache.size());
}
use of org.infinispan.commons.configuration.StringConfiguration in project infinispan by infinispan.
the class RemoteCacheAdminTest method cacheCreateWithXMLConfigurationAndGetCache.
private void cacheCreateWithXMLConfigurationAndGetCache(String cacheName, String xml) {
client(0).administration().withFlags(CacheContainerAdmin.AdminFlag.VOLATILE).createCache(cacheName, new StringConfiguration(xml));
final RemoteCache<Object, Object> cache = client(0).getCache(cacheName);
assertNotNull(cache);
}
use of org.infinispan.commons.configuration.StringConfiguration in project infinispan by infinispan.
the class RemoteCacheAdminTest method templateCreateRemoveTest.
public void templateCreateRemoveTest(Method m) {
String templateName = m.getName();
String xml = String.format("<infinispan><cache-container><distributed-cache name=\"%s\"/></cache-container></infinispan>", templateName);
BasicConfiguration template = new StringConfiguration(xml);
client(0).administration().withFlags(CacheContainerAdmin.AdminFlag.VOLATILE).createTemplate(templateName, template);
assertTrue(manager(0).getCacheConfigurationNames().contains(templateName));
assertTrue(manager(0).getCacheConfigurationNames().contains(templateName));
client(1).administration().removeTemplate(templateName);
assertFalse(manager(0).getCacheConfigurationNames().contains(templateName));
assertFalse(manager(0).getCacheConfigurationNames().contains(templateName));
}
use of org.infinispan.commons.configuration.StringConfiguration in project infinispan by infinispan.
the class RemoteCacheAdminTest method cacheCreateWithStringConfiguration.
private void cacheCreateWithStringConfiguration(String cacheName, String xml) {
client(0).administration().withFlags(CacheContainerAdmin.AdminFlag.VOLATILE).getOrCreateCache(cacheName, new StringConfiguration(xml));
Configuration configuration = manager(0).getCache(cacheName).getCacheConfiguration();
assertEquals(10000, configuration.expiration().wakeUpInterval());
assertEquals(10, configuration.expiration().lifespan());
assertEquals(10, configuration.expiration().maxIdle());
assertEquals(MediaType.TEXT_PLAIN, configuration.encoding().keyDataType().mediaType());
assertEquals(MediaType.APPLICATION_JSON, configuration.encoding().valueDataType().mediaType());
}
use of org.infinispan.commons.configuration.StringConfiguration in project infinispan by infinispan.
the class IndexedCacheNonIndexedEntityTest method shouldPreventNonIndexedEntities.
@Test(expectedExceptions = HotRodClientException.class, expectedExceptionsMessageRegExp = ".*The configured indexed-entity type 'Entity' must be indexed.*")
public void shouldPreventNonIndexedEntities() {
String config = "<infinispan>" + " <cache-container>" + " <local-cache name=\"" + CACHE_NAME + "\">\n" + " <encoding media-type=\"application/x-protostream\"/>\n" + " <indexing storage=\"local-heap\">\n" + " <indexed-entities>\n" + " <indexed-entity>Entity</indexed-entity>\n" + " <indexed-entity>EvilTwin</indexed-entity>\n" + " </indexed-entities>\n" + " </indexing>" + " </local-cache>" + " </cache-container>" + "</infinispan>";
remoteCacheManager.administration().withFlags(VOLATILE).createCache(CACHE_NAME, new StringConfiguration(config));
// The SearchMapping is started lazily for protobuf caches, so the exception only happens after first usage
RemoteCache<Object, Object> cache = remoteCacheManager.getCache(CACHE_NAME);
cache.put("1", new Entity("name"));
}
Aggregations