Package org.apache.torque.test.dbobject

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


        ForeignKeySchemaData.clearTablesInDatabase();
        ForeignKeySchemaData testData
                = ForeignKeySchemaData.getDefaultTestData();
        testData.save();

        CompIntegerVarcharPk compIntegerVarcharPk
                = testData.getCompositeIntegerVarcharPkList().get(2);
        List<CompIntegerVarcharFk> fkList
                = new ArrayList<CompIntegerVarcharFk>();
        // object already associated to this object
        fkList.add(testData.getCompositeIntegerVarcharFkList().get(1));
        // object already associated to another object
        fkList.add(testData.getCompositeIntegerVarcharFkList().get(0));
        // object not associated yet
        fkList.add(testData.getCompositeIntegerVarcharFkList().get(3));
        // new object
        CompIntegerVarcharFk newCompIntegerVarcharFk
                = new CompIntegerVarcharFk();
        newCompIntegerVarcharFk.setName("newCompositeIntegerVarcharFk");
        fkList.add(newCompIntegerVarcharFk);

        CompIntegerVarcharPkPeer.setAndSaveCompIntegerVarcharFks(
                    compIntegerVarcharPk,
                    fkList);

        List<CompIntegerVarcharFk> cachedFks
                = compIntegerVarcharPk.getCompIntegerVarcharFks();
        assertEquals(4, cachedFks.size());
        assertEquals(
                testData.getCompositeIntegerVarcharFkList().get(1).getId(),
                cachedFks.get(0).getId());
        assertEquals(
                compIntegerVarcharPk.getId1(),
                cachedFks.get(0).getFk1());
        assertEquals(
                compIntegerVarcharPk.getId2(),
                cachedFks.get(0).getFk2());
        assertEquals(
                testData.getCompositeIntegerVarcharFkList().get(1).getName(),
                cachedFks.get(0).getName());
        assertEquals(
                testData.getCompositeIntegerVarcharFkList().get(0).getId(),
                cachedFks.get(1).getId());
        assertEquals(
                compIntegerVarcharPk.getId1(),
                cachedFks.get(1).getFk1());
        assertEquals(
                compIntegerVarcharPk.getId2(),
                cachedFks.get(1).getFk2());
        assertEquals(
                testData.getCompositeIntegerVarcharFkList().get(0).getName(),
                cachedFks.get(1).getName());
        assertEquals(
                testData.getCompositeIntegerVarcharFkList().get(3).getId(),
                cachedFks.get(2).getId());
        assertEquals(
                compIntegerVarcharPk.getId1(),
                cachedFks.get(2).getFk1());
        assertEquals(
                compIntegerVarcharPk.getId2(),
                cachedFks.get(2).getFk2());
        assertEquals(
                testData.getCompositeIntegerVarcharFkList().get(3).getName(),
                cachedFks.get(2).getName());
        assertEquals(
                newCompIntegerVarcharFk.getId(),
                cachedFks.get(3).getId());
        assertEquals(
                compIntegerVarcharPk.getId1(),
                cachedFks.get(3).getFk1());
        assertEquals(
                compIntegerVarcharPk.getId2(),
                cachedFks.get(3).getFk2());
        assertEquals(
                newCompIntegerVarcharFk.getName(),
                cachedFks.get(3).getName());
View Full Code Here


    }

    private static void fillCompositeIntegerVarcharPks(
            ForeignKeySchemaData result)
    {
        CompIntegerVarcharPk compositeIntegerVarcharPk1
                = new CompIntegerVarcharPk();
        compositeIntegerVarcharPk1.setName("compositeIntegerVarcharPk1");
        compositeIntegerVarcharPk1.setId1(10);
        compositeIntegerVarcharPk1.setId2("x");
        compositeIntegerVarcharPk1.setIntegerColumn(100);
        compositeIntegerVarcharPk1.setVarcharColumn("a");
        result.getCompositeIntegerVarcharPkList().add(
                compositeIntegerVarcharPk1);

        CompIntegerVarcharPk compositeIntegerVarcharPk2
                = new CompIntegerVarcharPk();
        compositeIntegerVarcharPk2.setName("compositeIntegerVarcharPk2");
        compositeIntegerVarcharPk2.setId1(10);
        compositeIntegerVarcharPk2.setId2("y");
        compositeIntegerVarcharPk2.setIntegerColumn(100);
        compositeIntegerVarcharPk2.setVarcharColumn("b");
        result.getCompositeIntegerVarcharPkList().add(
                compositeIntegerVarcharPk2);

        CompIntegerVarcharPk compositeIntegerVarcharPk3
                = new CompIntegerVarcharPk();
        compositeIntegerVarcharPk3.setName("compositeIntegerVarcharPk3");
        compositeIntegerVarcharPk3.setId1(11);
        compositeIntegerVarcharPk3.setId2("x");
        compositeIntegerVarcharPk3.setIntegerColumn(200);
        compositeIntegerVarcharPk3.setVarcharColumn("a");
        result.getCompositeIntegerVarcharPkList().add(
                compositeIntegerVarcharPk3);
    }
View Full Code Here

TOP

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

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.