Package org.apache.art

Examples of org.apache.art.GeneratedColumnTestEntity


     * Tests a bug casued by the ID Java type mismatch vs the default JDBC type of the ID
     * column.
     */
    public void testCAY823() throws Exception {
        DataContext context = createDataContext();
        GeneratedColumnTestEntity idObject = context
                .newObject(GeneratedColumnTestEntity.class);

        String name = "n_" + System.currentTimeMillis();
        idObject.setName(name);

        idObject.getObjectContext().commitChanges();

        ObjectId id = idObject.getObjectId();
        context.invalidateObjects(Collections.singleton(idObject));

        SelectQuery q = new SelectQuery(GeneratedColumnTestEntity.class);
        q.setPageSize(10);
        List results = context.performQuery(q);
View Full Code Here


        assertEquals(id, ((Persistent) results.get(0)).getObjectId());
    }

    public void testNewObject() throws Exception {
        DataContext context = createDataContext();
        GeneratedColumnTestEntity idObject = context
                .newObject(GeneratedColumnTestEntity.class);

        String name = "n_" + System.currentTimeMillis();
        idObject.setName(name);

        idObject.getObjectContext().commitChanges();

        // this will throw an exception if id wasn't generated one way or another
        int id = DataObjectUtils.intPKForObject(idObject);
        assertTrue(id >= 0);

        // make sure that id is the same as id in the DB
        context.invalidateObjects(Collections.singleton(idObject));
        GeneratedColumnTestEntity object = DataObjectUtils
                .objectForPK(context, GeneratedColumnTestEntity.class, id);
        assertNotNull(object);
        assertEquals(name, object.getName());
    }
View Full Code Here

    /**
     * Tests CAY-422 bug.
     */
    public void testUnrelatedUpdate() throws Exception {
        DataContext context = createDataContext();
        GeneratedColumnTestEntity m = context
                .newObject(GeneratedColumnTestEntity.class);

        m.setName("m");

        GeneratedColumnDep d = context
                .newObject(GeneratedColumnDep.class);
        d.setName("d");
        d.setToMaster(m);
View Full Code Here

     * CAY-341 for the original bug.
     */
    public void testMultipleNewObjectsSeparateTables() throws Exception {
        DataContext context = createDataContext();

        GeneratedColumnTestEntity idObject1 = context
                .newObject(GeneratedColumnTestEntity.class);
        idObject1.setName("o1");

        GeneratedColumnTest2 idObject2 = context
                .newObject(GeneratedColumnTest2.class);
        idObject2.setName("o2");

View Full Code Here

        }

        context.invalidateObjects(Arrays.asList(idObjects));

        for (int i = 0; i < ids.length; i++) {
            GeneratedColumnTestEntity object = DataObjectUtils
                    .objectForPK(context, GeneratedColumnTestEntity.class, ids[i]);
            assertNotNull(object);
            assertEquals(names[i], object.getName());
        }
    }
View Full Code Here

        }
    }

    public void testUpdateDependentWithNewMaster() throws Exception {
        DataContext context = createDataContext();
        GeneratedColumnTestEntity master1 = context
                .newObject(GeneratedColumnTestEntity.class);
        master1.setName("aaa");

        GeneratedColumnDep dependent = context
                .newObject(GeneratedColumnDep.class);
        dependent.setName("aaa");
        dependent.setToMaster(master1);

        context.commitChanges();

        // change master
        GeneratedColumnTestEntity master2 = context
                .newObject(GeneratedColumnTestEntity.class);
        master2.setName("bbb");

        // TESTING THIS
        dependent.setToMaster(master2);
        context.commitChanges();
View Full Code Here

        // build such table");
    }

    public void testPropagateToDependent() throws Exception {
        DataContext context = createDataContext();
        GeneratedColumnTestEntity idObject = context
                .newObject(GeneratedColumnTestEntity.class);
        idObject.setName("aaa");

        GeneratedColumnDep dependent = idObject
                .getObjectContext()
                .newObject(GeneratedColumnDep.class);
        dependent.setName("aaa");
        dependent.setToMaster(idObject);
View Full Code Here

TOP

Related Classes of org.apache.art.GeneratedColumnTestEntity

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.