@Override public Object call() throws Exception { QueryEntity e = new QueryEntity(); e.setTableName("City"); e.setKeyFields(Collections.singleton("name")); e.setFields(new LinkedHashMap<>(Collections.singletonMap("name", String.class.getName()))); e.setIndexes(Collections.singleton(new QueryIndex("name").setName("idx"))); e.setKeyType("CityKey"); e.setValueType("City"); queryProcessor(client()).dynamicTableCreate("PUBLIC", e, CacheMode.PARTITIONED.name(), null, null, null, null, CacheAtomicityMode.ATOMIC, null, 10, false, false); return null; } }, SchemaOperationException.class, "Index already exists: idx");
public void testOperations() { executeSql("CREATE TABLE person (id int, name varchar, age int, company varchar, city varchar, " + "primary key (id, name, city)) WITH \"template=" + cacheMode.name() + ",atomicity=" + atomicityMode.name() + ",backups=" + backups + ",affinity_key=city\""); "\"template=" + cacheMode.name() + ",atomicity=" + atomicityMode.name() + ",backups=" + backups + ",affinity_key=name\"");
/** */ private CacheConfiguration buildCacheConfiguration(CacheMode mode, CacheAtomicityMode atomicityMode, boolean hasNear, boolean writeThrough, boolean notNullAnnotated) { CacheConfiguration cfg = new CacheConfiguration(CACHE_PREFIX + "-" + mode.name() + "-" + atomicityMode.name() + (hasNear ? "-near" : "") + (writeThrough ? "-writethrough" : "") + (notNullAnnotated ? "-annot" : "")); cfg.setCacheMode(mode); cfg.setAtomicityMode(atomicityMode); cfg.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC); QueryEntity qe = new QueryEntity(new QueryEntity(Integer.class, Person.class)); if (!notNullAnnotated) qe.setNotNullFields(Collections.singleton("name")); cfg.setQueryEntities(F.asList(qe)); if (hasNear) cfg.setNearConfiguration(new NearCacheConfiguration().setNearStartSize(100)); if (writeThrough) { cfg.setCacheStoreFactory(singletonFactory(new TestStore())); cfg.setWriteThrough(true); } return cfg; }