/** */ @Test public void testQueryEntityGetSetNotNullFields() throws Exception { QueryEntity qe = new QueryEntity(); assertNull(qe.getNotNullFields()); Set<String> val = Collections.singleton("test"); qe.setNotNullFields(val); assertEquals(val, Collections.singleton("test")); qe.setNotNullFields(null); assertNull(qe.getNotNullFields()); }
/** */ @Test public void testQueryEntityEquals() throws Exception { QueryEntity a = new QueryEntity(); QueryEntity b = new QueryEntity(); assertEquals(a, b); a.setNotNullFields(Collections.singleton("test")); assertFalse(a.equals(b)); b.setNotNullFields(Collections.singleton("test")); assertTrue(a.equals(b)); }
res.setNotNullFields(notNullFields);
entity.setNotNullFields(desc.notNullFields());
.setNotNullFields(Collections.singleton("id")) .setDefaultFieldValues(Collections.singletonMap("id", 0)) .setIndexes(Collections.singletonList(new QueryIndex("id", true, "IDX_EMPLOYEE_ID")))
.collect(Collectors.toCollection(LinkedHashSet::new)) .setNotNullFields(qryFields.stream() .filter(QueryField::isNotNull) .map(QueryField::getName)
normalEntity.setKeyFieldName(entity.getKeyFieldName()); normalEntity.setValueFieldName(entity.getValueFieldName()); normalEntity.setNotNullFields(entity.getNotNullFields()); normalEntity.setDefaultFieldValues(entity.getDefaultFieldValues()); normalEntity.setFieldsPrecision(entity.getFieldsPrecision());
.setNotNullFields(Collections.singleton("id")) .setDefaultFieldValues(Collections.singletonMap("id", 0)) .setIndexes(Collections.singletonList(new QueryIndex("id", true, "IDX_EMPLOYEE_ID")))
/** */ private CacheConfiguration buildCacheConfigurationRestricted(String cacheName, boolean readThrough, boolean interceptor, boolean hasQueryEntity) { CacheConfiguration cfg = new CacheConfiguration<Integer, Person>() .setName(cacheName) .setCacheMode(CacheMode.PARTITIONED) .setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL); if (readThrough) { cfg.setCacheStoreFactory(singletonFactory(new TestStore())); cfg.setReadThrough(true); } if (interceptor) cfg.setInterceptor(new TestInterceptor()); if (hasQueryEntity) { cfg.setQueryEntities(F.asList(new QueryEntity(Integer.class, Person.class) .setNotNullFields(Collections.singleton("name")))); } return cfg; }
/** */ 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; }
res.setNotNullFields(notNullFields);
entity.setNotNullFields(desc.notNullFields());
.collect(Collectors.toCollection(LinkedHashSet::new)) .setNotNullFields(qryFields.stream() .filter(QueryField::isNotNull) .map(QueryField::getName)
normalEntity.setKeyFieldName(entity.getKeyFieldName()); normalEntity.setValueFieldName(entity.getValueFieldName()); normalEntity.setNotNullFields(entity.getNotNullFields()); normalEntity.setDefaultFieldValues(entity.getDefaultFieldValues()); normalEntity.setFieldsPrecision(entity.getFieldsPrecision());