Package org.apache.cayenne.testdo.testmap

Examples of org.apache.cayenne.testdo.testmap.ArtGroup


    }

    public void testReflexiveRelationshipInsertOrder4() {
        // multiple children, one created before parent, one after

        ArtGroup childGroup1 = context.newObject(ArtGroup.class);
        childGroup1.setName("child1");

        ArtGroup parentGroup = context.newObject(ArtGroup.class);
        parentGroup.setName("parent");

        childGroup1.setToParentGroup(parentGroup);

        ArtGroup childGroup2 = context.newObject(ArtGroup.class);
        childGroup2.setName("subchild");
        childGroup2.setToParentGroup(childGroup1);

        context.commitChanges();
    }
View Full Code Here


      e.printStackTrace();
      fail("Should not have thrown an exception :"+e.getMessage());
  }

  public void testAddDeleteNoCommit() {
    ArtGroup parentGroup=(ArtGroup)ctxt.newObject("ArtGroup");
    parentGroup.setName("parent");

    ArtGroup childGroup1=(ArtGroup)ctxt.newObject("ArtGroup");
    childGroup1.setName("child1");
    childGroup1.setToParentGroup(parentGroup);

    try {
      ctxt.deleteObject(parentGroup);
    } catch (Exception e) {
      this.failWithException(e);
View Full Code Here

      this.failWithException(e);
    }
  }
 
  public void testAddDeleteWithCommit() {
    ArtGroup parentGroup=(ArtGroup)ctxt.newObject("ArtGroup");
    parentGroup.setName("parent");

    ArtGroup childGroup1=(ArtGroup)ctxt.newObject("ArtGroup");
    childGroup1.setName("child1");
    childGroup1.setToParentGroup(parentGroup);
    ctxt.commitChanges();

    try {
      ctxt.deleteObject(parentGroup);
      ctxt.commitChanges();
View Full Code Here

    }
   
  }
 
  public void testReplaceDeleteNoCommit() {
    ArtGroup parentGroup1=(ArtGroup)ctxt.newObject("ArtGroup");
    parentGroup1.setName("parent1");
    ArtGroup parentGroup2=(ArtGroup)ctxt.newObject("ArtGroup");
    parentGroup2.setName("parent2");

    ArtGroup childGroup1=(ArtGroup)ctxt.newObject("ArtGroup");
    childGroup1.setName("child1");
    childGroup1.setToParentGroup(parentGroup1);


    childGroup1.setToParentGroup(parentGroup2);
    try {
      ctxt.deleteObject(parentGroup1);
      ctxt.deleteObject(parentGroup2);
    } catch (Exception e) {
      this.failWithException(e);
View Full Code Here

      this.failWithException(e);
    }   
  }
 
  public void testReplaceDeleteWithCommit() {
    ArtGroup parentGroup1=(ArtGroup)ctxt.newObject("ArtGroup");
    parentGroup1.setName("parent1");
    ArtGroup parentGroup2=(ArtGroup)ctxt.newObject("ArtGroup");
    parentGroup2.setName("parent2");

    ArtGroup childGroup1=(ArtGroup)ctxt.newObject("ArtGroup");
    childGroup1.setName("child1");
    childGroup1.setToParentGroup(parentGroup1);
    childGroup1.setToParentGroup(parentGroup2);
    ctxt.commitChanges();

    try {
      ctxt.deleteObject(parentGroup1);
      ctxt.deleteObject(parentGroup2);
View Full Code Here

      this.failWithException(e);
    }   
  }
 
  public void testCommitReplaceCommit() {
    ArtGroup parentGroup1=(ArtGroup)ctxt.newObject("ArtGroup");
    parentGroup1.setName("parent1");
    ArtGroup parentGroup2=(ArtGroup)ctxt.newObject("ArtGroup");
    parentGroup2.setName("parent2");

    ArtGroup childGroup1=(ArtGroup)ctxt.newObject("ArtGroup");
    childGroup1.setName("child1");
    childGroup1.setToParentGroup(parentGroup1);
    ctxt.commitChanges();
    childGroup1.setToParentGroup(parentGroup2);
    ctxt.commitChanges();
  }
View Full Code Here

    childGroup1.setToParentGroup(parentGroup2);
    ctxt.commitChanges();
  }

  public void testComplexInsertUpdateOrdering() {
    ArtGroup parentGroup=(ArtGroup)ctxt.newObject("ArtGroup");
    parentGroup.setName("parent");
    ctxt.commitChanges();
   
    //Check that the update and insert both work write
    ArtGroup childGroup1=(ArtGroup)ctxt.newObject("ArtGroup");
    childGroup1.setName("child1");
    childGroup1.setToParentGroup(parentGroup);
    ctxt.commitChanges();
  }
View Full Code Here

                "g1"));
        List results = context.performQuery(q);
        assertEquals(1, results.size());

        assertFalse(context.hasChanges());
        ArtGroup group = (ArtGroup) results.get(0);
        a1.addToGroupArray(group);
        assertTrue(context.hasChanges());

        List groupList = a1.getGroupArray();
        assertEquals(1, groupList.size());
View Full Code Here

                "name",
                "g1"));
        List results = context.performQuery(q);
        assertEquals(1, results.size());

        ArtGroup group = (ArtGroup) results.get(0);
        a1.addToGroupArray(group);

        List groupList = a1.getGroupArray();
        assertEquals(1, groupList.size());
        assertEquals("g1", ((ArtGroup) groupList.get(0)).getName());
View Full Code Here

        createTestData("testRemoveFromFlattenedRelationship");
        DataContext context = createDataContext();

        Artist a1 = Cayenne.objectForPK(context, Artist.class, 33001);

        ArtGroup group = a1.getGroupArray().get(0);
        a1.removeFromGroupArray(group);

        List groupList = a1.getGroupArray();
        assertEquals(0, groupList.size());
View Full Code Here

TOP

Related Classes of org.apache.cayenne.testdo.testmap.ArtGroup

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.