Package org.apache.art

Examples of org.apache.art.BooleanTestEntity


    }

    public void testUpdateNoQualifierBoolean() throws Exception {

        ObjectContext context = createDataContext();
        BooleanTestEntity o1 = context
                .newObject(BooleanTestEntity.class);
        o1.setBooleanColumn(Boolean.TRUE);

        BooleanTestEntity o2 = context
                .newObject(BooleanTestEntity.class);
        o2.setBooleanColumn(Boolean.FALSE);

        BooleanTestEntity o3 = context
                .newObject(BooleanTestEntity.class);
        o3.setBooleanColumn(Boolean.FALSE);

        context.commitChanges();

        EJBQLQuery check = new EJBQLQuery("select count(p) from BooleanTestEntity p "
                + "WHERE p.booleanColumn = true");
View Full Code Here


    }

    public void testBooleanBoolean() throws Exception {

        // populate (testing insert as well)
        BooleanTestEntity trueObject = (BooleanTestEntity) context
                .newObject("BooleanTestEntity");
        trueObject.setBooleanColumn(Boolean.TRUE);
        BooleanTestEntity falseObject = (BooleanTestEntity) context
                .newObject("BooleanTestEntity");
        falseObject.setBooleanColumn(Boolean.FALSE);
        context.commitChanges();

        // this will clear cache as a side effect
        context = createDataContext();

        // fetch true...
        Expression trueQ = ExpressionFactory.matchExp("booleanColumn", Boolean.TRUE);
        List trueResult = context.performQuery(new SelectQuery(
                BooleanTestEntity.class,
                trueQ));
        assertEquals(1, trueResult.size());

        BooleanTestEntity trueRefetched = (BooleanTestEntity) trueResult.get(0);
        assertEquals(Boolean.TRUE, trueRefetched.getBooleanColumn());

        // CAY-320. Simplifying the use of booleans to allow identity comparison.
        assertNotSame(trueRefetched, trueObject);
        assertSame(Boolean.TRUE, trueRefetched.getBooleanColumn());

        // fetch false
        Expression falseQ = ExpressionFactory.matchExp("booleanColumn", Boolean.FALSE);
        List falseResult = context.performQuery(new SelectQuery(
                BooleanTestEntity.class,
                falseQ));
        assertEquals(1, falseResult.size());

        BooleanTestEntity falseRefetched = (BooleanTestEntity) falseResult.get(0);
        assertEquals(Boolean.FALSE, falseRefetched.getBooleanColumn());

        // CAY-320. Simplifying the use of booleans to allow identity comparison.
        assertNotSame(falseRefetched, falseObject);
        assertSame(Boolean.FALSE, falseRefetched.getBooleanColumn());
    }
View Full Code Here

public class BooleanExpressionTest extends TestCase {
    public void testCAY1185() {
        Expression expTrue = Expression.fromString("booleanColumn = true");
        Expression expFalse = Expression.fromString("booleanColumn = false");

        BooleanTestEntity entity = new BooleanTestEntity();
        entity.setBooleanColumn(true);
        assertTrue(expTrue.match(entity));
        assertFalse(expFalse.match(entity));

        entity.setBooleanColumn(false);
        assertFalse(expTrue.match(entity));
        assertTrue(expFalse.match(entity));
    }
View Full Code Here

TOP

Related Classes of org.apache.art.BooleanTestEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.