{
ObjectContentManager ocm = this.getObjectContentManager();
// Test Boolean value
QueryManager queryManager = this.getQueryManager();
Filter filter = queryManager.createFilter(Atomic.class);
filter.addEqualTo("booleanObject", new Boolean(true));
Query query = queryManager.createQuery(filter);
long start = System.currentTimeMillis();
Collection result = ocm.getObjects(query);
log.info("getObjects : " + (System.currentTimeMillis() - start));
assertTrue("Invalid number of objects - should be = 50", result.size() == 50);
filter = queryManager.createFilter(Atomic.class);
filter.addEqualTo("booleanPrimitive", new Boolean(false));
query = queryManager.createQuery(filter);
start = System.currentTimeMillis();
result = ocm.getObjects(query);
log.info("getObjects 2 : " + (System.currentTimeMillis() - start));
assertTrue("Invalid number of objects - should be = 0", result.size() == 0);
// Test int value
filter = queryManager.createFilter(Atomic.class);
filter.addBetween("integerObject", new Integer(0), new Integer(500));
query = queryManager.createQuery(filter);
result = ocm.getObjects(query);
assertTrue("Invalid number of objects - should be = 5", result.size() == 5);
filter = queryManager.createFilter(Atomic.class);
filter.addLessOrEqualThan("intPrimitive", new Integer(236));
query = queryManager.createQuery(filter);
result = ocm.getObjects(query);
assertTrue("Invalid number of objects - should be = 36", result.size() == 36);
//Test Date & Calendar
filter = queryManager.createFilter(Atomic.class);
Calendar calendar = Calendar.getInstance();
calendar.set(2012, Calendar.DECEMBER, 01);
filter.addLessThan("calendar", calendar);
query = queryManager.createQuery(filter);
result = ocm.getObjects(query);
assertTrue("Invalid number of objects - should be = 100 ", result.size() == 100);
filter = queryManager.createFilter(Atomic.class);
calendar = Calendar.getInstance();
calendar.set(1975, Calendar.DECEMBER, 01);
filter.addLessThan("calendar", calendar);
query = queryManager.createQuery(filter);
result = ocm.getObjects(query);
assertTrue("Invalid number of objects - should be = 0 ", result.size() == 0);
filter = queryManager.createFilter(Atomic.class);
filter.addEqualTo("date", date);
query = queryManager.createQuery(filter);
result = ocm.getObjects(query);
assertTrue("Invalid number of objects - should be = 100 ", result.size() == 100);
filter = queryManager.createFilter(Atomic.class);
filter.addBetween("date", date, new Date());
query = queryManager.createQuery(filter);
result = ocm.getObjects(query);
assertTrue("Invalid number of objects - should be = 100 ", result.size() == 100);
filter = queryManager.createFilter(Atomic.class);
filter.addGreaterThan("date", date);
query = queryManager.createQuery(filter);
result = ocm.getObjects(query);
assertTrue("Invalid number of objects - should be = 0 ", result.size() == 0);
// Test contains method
filter = queryManager.createFilter(Atomic.class);
filter.addContains(".", "JCR");
query = queryManager.createQuery(filter);
result = ocm.getObjects(query);
assertTrue("Invalid number of objects - should be = 50 ", result.size() == 50);
filter = queryManager.createFilter(Atomic.class);
filter.addContains("string", "JCR");
query = queryManager.createQuery(filter);
result = ocm.getObjects(query);
assertTrue("Invalid number of objects - should be = 50 ", result.size() == 50);
filter = queryManager.createFilter(Atomic.class);
filter.addContains("string", "ocm");
query = queryManager.createQuery(filter);
result = ocm.getObjects(query);
assertTrue("Invalid number of objects - should be = 0 ", result.size() == 0);