Package org.apache.torque.test.dbobject

Examples of org.apache.torque.test.dbobject.Nopk


        return result;
    }

    private static void fillNopks(PkSchemaData result)
    {
        Nopk nopk1 = new Nopk();
        nopk1.setName("nopk1");
        nopk1.setIntcol(1);
        result.getNopkList().add(nopk1);

        Nopk nopk2 = new Nopk();
        nopk2.setName("nopk2");
        nopk2.setIntcol(2);
        result.getNopkList().add(nopk2);

        Nopk nopk3 = new Nopk();
        nopk3.setName("nopk3");
        nopk3.setIntcol(3);
        result.getNopkList().add(nopk3);
    }
View Full Code Here


    {
        // prepare
        Criteria criteria = new Criteria();
        NopkPeer.doDelete(criteria);

        Nopk nopk = new Nopk();
        nopk.setName("name");
        nopk.save();

        // execute
        nopk.save();

        // verify
        assertEquals("name", nopk.getName());

        criteria = new Criteria().where(NopkPeer.NAME, "name");
        List<Nopk> nopkList = NopkPeer.doSelect(criteria);
        assertEquals(1, nopkList.size());
View Full Code Here

    {
        // prepare
        Criteria criteria = new Criteria();
        NopkPeer.doDelete(criteria);

        Nopk nopk = new Nopk();
        nopk.setName("name");
        nopk.save();

        // execute
        nopk.save();

        // verify
        assertEquals("name", nopk.getName());

        criteria = new Criteria().where(NopkPeer.NAME, "name");
        List<Nopk> nopkList = NopkPeer.doSelect(criteria);
        assertEquals(1, nopkList.size());
View Full Code Here

    {
        // prepare
        Criteria criteria = new Criteria();
        NopkPeer.doDelete(criteria);

        Nopk nopk = new Nopk();
        nopk.setName("name");
        nopk.save();

        // execute
        try
        {
            nopk.setName("otherName");
            nopk.save();

            //verify
            fail("Exception expected");
        }
        catch (TorqueException e)
View Full Code Here

                authors.get(0).getName());
        assertEquals("Second Author's name should be \"OtherName\"",
                "OtherName",
                authors.get(1).getName());

        Nopk nopk = new Nopk();
        nopk.setName("name");
        nopk.save();

        // check the doPupdate Peer methods throw exceptions on a modified
        // object without primary keys
        try
        {
            NopkPeer.doUpdate(new Nopk());
            fail("A Torque exception should be thrown (2)");
        }
        catch (TorqueException e)
        {
        }

        connection = Transaction.begin(NopkPeer.DATABASE_NAME);
        try
        {
            NopkPeer.doUpdate(new Nopk(),connection);
            fail("A Torque exception should be thrown (3)");
        }
        catch (TorqueException e)
        {
        }
View Full Code Here

    {
        PkSchemaData.clearTablesInDatabase();
        PkSchemaData testData = PkSchemaData.getDefaultTestData();
        testData.save();

        Nopk toDelete = testData.getNopkList().get(1);
        toDelete.setName("nopk1Changed");

        // check that three entries are in the Nopk table
        List<Nopk> nopkList = getNopkList();
        assertEquals(3, nopkList.size());
        // check toDelete object is in database
        // equals does not work without pk so check intcol
        assertEquals(2, nopkList.get(1).getIntcol());

        // call delete method and check result.
        int deleted = NopkPeer.doDelete(toDelete);
        assertEquals(0, deleted);
        // flag is true even if nothing was deleted
        assertTrue(toDelete.isDeleted());

        // check that there are all entries remaining in the database
        // and the toDelete object is still there
        // (use intcol for latter as equals does not work)
        nopkList = getNopkList();
View Full Code Here

    {
        PkSchemaData.clearTablesInDatabase();
        PkSchemaData testData = PkSchemaData.getDefaultTestData();
        testData.save();

        Nopk toDelete = testData.getNopkList().get(1);

        // check that isDeleted() is false before deletion
        assertFalse(toDelete.isDeleted());
        // check that three entries are in the Nopk table
        List<Nopk> nopkList = getNopkList();
        assertEquals(3, nopkList.size());
        // check toDelete object is in database
        // equals does not work without pk so check intcol
        assertEquals(2, nopkList.get(1).getIntcol());

        // call delete method and check result.
        int deleted = NopkPeer.doDelete(toDelete);
        assertEquals(1, deleted);
        assertTrue(toDelete.isDeleted());

        // check that there are two entries remaining in the database
        // and the toDelete object was deleted
        // (use intcol for latter as equals does not work)
        nopkList = getNopkList();
View Full Code Here

TOP

Related Classes of org.apache.torque.test.dbobject.Nopk

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.