use of org.apache.cayenne.map.EntityResolver in project cayenne by apache.
the class ProcedureQueryCacheKeyIT method testCacheFetchOffsetAndLimit.
@Test
public void testCacheFetchOffsetAndLimit() {
EntityResolver resolver = runtime.getDataDomain().getEntityResolver();
ProcedureQuery q1 = new ProcedureQuery("ABC", Artist.class);
q1.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
q1.setFetchOffset(5);
q1.setFetchLimit(3);
ProcedureQuery q2 = new ProcedureQuery("ABC", Artist.class);
q2.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
q2.setFetchOffset(5);
q2.setFetchLimit(3);
assertEquals(q1.getMetaData(resolver).getCacheKey(), q2.getMetaData(resolver).getCacheKey());
}
use of org.apache.cayenne.map.EntityResolver in project cayenne by apache.
the class ProcedureQueryCacheKeyIT method testNamedQuery.
@Test
public void testNamedQuery() {
EntityResolver resolver = runtime.getDataDomain().getEntityResolver();
ProcedureQuery query = new ProcedureQuery("ABC", Artist.class);
query.setCacheStrategy(QueryCacheStrategy.SHARED_CACHE);
QueryMetadata md1 = query.getMetaData(resolver);
assertEquals(QueryCacheStrategy.SHARED_CACHE, md1.getCacheStrategy());
assertEquals("proc:", md1.getCacheKey());
}
use of org.apache.cayenne.map.EntityResolver in project cayenne by apache.
the class ProcedureQueryCacheKeyIT method testNoCache.
@Test
public void testNoCache() {
EntityResolver resolver = runtime.getDataDomain().getEntityResolver();
ProcedureQuery query = new ProcedureQuery("ABC", Artist.class);
QueryMetadata md1 = query.getMetaData(resolver);
assertEquals(QueryCacheStrategy.NO_CACHE, md1.getCacheStrategy());
assertNull(md1.getCacheKey());
QueryMetadata md2 = query.getMetaData(resolver);
assertEquals(QueryCacheStrategy.NO_CACHE, md2.getCacheStrategy());
assertNull(md2.getCacheKey());
}
use of org.apache.cayenne.map.EntityResolver in project cayenne by apache.
the class ProcedureQueryCacheKeyIT method testLocalCache.
@Test
public void testLocalCache() {
EntityResolver resolver = runtime.getDataDomain().getEntityResolver();
ProcedureQuery query = new ProcedureQuery("ABC", Artist.class);
query.setCacheStrategy(QueryCacheStrategy.LOCAL_CACHE);
QueryMetadata md1 = query.getMetaData(resolver);
assertEquals(QueryCacheStrategy.LOCAL_CACHE, md1.getCacheStrategy());
assertNotNull(md1.getCacheKey());
}
use of org.apache.cayenne.map.EntityResolver in project cayenne by apache.
the class SQLSelectTest method testGetMetadata_ParamsArray_Multiple_Cache.
@Test
public void testGetMetadata_ParamsArray_Multiple_Cache() {
EntityResolver resolver = mock(EntityResolver.class);
QueryMetadata md0 = SQLSelect.dataRowQuery("bla").localCache().getMetaData(resolver);
QueryMetadata md1 = SQLSelect.dataRowQuery("bla").localCache().paramsArray("a").getMetaData(resolver);
QueryMetadata md2 = SQLSelect.dataRowQuery("bla").localCache().paramsArray("a", "b").getMetaData(resolver);
QueryMetadata md3 = SQLSelect.dataRowQuery("bla").localCache().paramsArray(null, "b").getMetaData(resolver);
assertNotNull(md0.getCacheKey());
assertNotNull(md1.getCacheKey());
assertNotNull(md2.getCacheKey());
assertNotNull(md3.getCacheKey());
assertNotEquals(md0.getCacheKey(), md1.getCacheKey());
assertNotEquals(md0.getCacheKey(), md2.getCacheKey());
assertNotEquals(md1.getCacheKey(), md2.getCacheKey());
assertNotEquals(md3.getCacheKey(), md2.getCacheKey());
}
Aggregations