Package org.apache.torque.test

Examples of org.apache.torque.test.BitTest


        Criteria criteria = new Criteria();
        criteria.add(BitTestPeer.ID, (Object) null, Criteria.NOT_EQUAL);
        BitTestPeer.doDelete(criteria);

        // insert Data
        BitTest bitTest = new BitTest();
        bitTest.setId("t1");
        bitTest.setBitValue(true);
        bitTest.save();
        bitTest = new BitTest();
        bitTest.setId("f1");
        bitTest.setBitValue(false);
        bitTest.save();

        // read data
        bitTest = BitTestPeer.retrieveByPK(new StringKey("t1"));
        assertTrue("BIT should be true but is: "
                + bitTest.getBitValue(), bitTest.getBitValue());

        bitTest = BitTestPeer.retrieveByPK(new StringKey("f1"));
        assertFalse("BIT should be false but is: "
                + bitTest.getBitValue(), bitTest.getBitValue());

        // query data
        criteria.clear();
        criteria.add(BitTestPeer.BIT_VALUE, new Boolean(true));
        List bitTestList = BitTestPeer.doSelect(criteria);
        assertTrue("Should have read 1 dataset "
                + "but read " + bitTestList.size(),
                bitTestList.size() == 1);
        bitTest = (BitTest) bitTestList.get(0);
        // use trim() for testkey because some databases will return the
        // testkey filled up with blanks, as it is defined as char(10)
        assertTrue("Primary key of data set should be t1 but is "
                + bitTest.getId().trim(),
                "t1".equals(bitTest.getId().trim()));

        criteria.clear();
        criteria.add(BitTestPeer.BIT_VALUE, new Boolean(false));
        bitTestList = BitTestPeer.doSelect(criteria);
        assertTrue("Should have read 1 dataset "
                + "but read " + bitTestList.size(),
                bitTestList.size() == 1);
        bitTest = (BitTest) bitTestList.get(0);
        assertTrue("Primary key of data set should be f1 but is "
                + bitTest.getId().trim(),
                "f1".equals(bitTest.getId().trim()));

    }
View Full Code Here


        Criteria criteria = new Criteria();
        criteria.add(BitTestPeer.ID, (Object) null, Criteria.NOT_EQUAL);
        BitTestPeer.doDelete(criteria);
       
        // insert Data
        BitTest bitTest = new BitTest();
        bitTest.setId("t1");
        bitTest.setBitValue(true);
        bitTest.save();
        bitTest = new BitTest();
        bitTest.setId("f1");
        bitTest.setBitValue(false);
        bitTest.save();

        // read data
        bitTest = BitTestPeer.retrieveByPK(new StringKey("t1"));
        assertTrue("BIT should be true but is: "
                + bitTest.getBitValue(), bitTest.getBitValue());
       
        bitTest = BitTestPeer.retrieveByPK(new StringKey("f1"));
        assertFalse("BIT should be false but is: "
                + bitTest.getBitValue(), bitTest.getBitValue());
       
        // query data
        criteria.clear();
        criteria.add(BitTestPeer.BIT_VALUE, new Boolean(true));
        List bitTestList = BitTestPeer.doSelect(criteria);
        assertTrue("Should have read 1 dataset "
                + "but read " + bitTestList.size(),
                bitTestList.size() == 1);
        bitTest = (BitTest) bitTestList.get(0);
        // use trim() for testkey because some databases will return the
        // testkey filled up with blanks, as it is defined as char(10)
        assertTrue("Primary key of data set should be t1 but is "
                + bitTest.getId().trim(),
                "t1".equals(bitTest.getId().trim()));

        criteria.clear();
        criteria.add(BitTestPeer.BIT_VALUE, new Boolean(false));
        bitTestList = BitTestPeer.doSelect(criteria);
        assertTrue("Should have read 1 dataset "
                + "but read " + bitTestList.size(),
                bitTestList.size() == 1);
        bitTest = (BitTest) bitTestList.get(0);
        assertTrue("Primary key of data set should be f1 but is "
                + bitTest.getId().trim(),
                "f1".equals(bitTest.getId().trim()));

    }
View Full Code Here

TOP

Related Classes of org.apache.torque.test.BitTest

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.