Package org.apache.art

Examples of org.apache.art.ArtGroup


        assertEquals(0, joins2.size());
    }

    public void testNullifyToMany() {
        // ArtGroup childGroupsArray
        ArtGroup parentGroup = (ArtGroup) context.newObject("ArtGroup");
        parentGroup.setName("Parent");

        ArtGroup childGroup = (ArtGroup) context.newObject("ArtGroup");
        childGroup.setName("Child");
        parentGroup.addToChildGroupsArray(childGroup);

        // Preconditions - good to check to be sure
        assertEquals(parentGroup, childGroup.getToParentGroup());
        assertTrue(parentGroup.getChildGroupsArray().contains(childGroup));

        context.commitChanges();

        context.deleteObject(parentGroup);

        // The things we are testing.
        assertNull(childGroup.getToParentGroup());

        // Although deleted, the property should be null (good cleanup policy)
        // assertFalse(parentGroup.getChildGroupsArray().contains(childGroup));
        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

        assertEquals(0, plist.size());
    }

    public void testReflexiveRelationshipInsertOrder1() {
        DataContext dc = this.createDataContext();
        ArtGroup parentGroup = (ArtGroup) dc.newObject("ArtGroup");
        parentGroup.setName("parent");

        ArtGroup childGroup1 = (ArtGroup) dc.newObject("ArtGroup");
        childGroup1.setName("child1");
        childGroup1.setToParentGroup(parentGroup);
        dc.commitChanges();
    }
View Full Code Here

    }

    public void testReflexiveRelationshipInsertOrder2() {
        // Create in a different order and see what happens
        DataContext dc = this.createDataContext();
        ArtGroup childGroup1 = (ArtGroup) dc.newObject("ArtGroup");
        childGroup1.setName("child1");

        ArtGroup parentGroup = (ArtGroup) dc.newObject("ArtGroup");
        parentGroup.setName("parent");

        childGroup1.setToParentGroup(parentGroup);

        dc.commitChanges();
    }
View Full Code Here

    }

    public void testReflexiveRelationshipInsertOrder3() {
        // Tey multiple children, one created before parent, one after
        DataContext dc = this.createDataContext();
        ArtGroup childGroup1 = (ArtGroup) dc.newObject("ArtGroup");
        childGroup1.setName("child1");

        ArtGroup parentGroup = (ArtGroup) dc.newObject("ArtGroup");
        parentGroup.setName("parent");

        childGroup1.setToParentGroup(parentGroup);

        ArtGroup childGroup2 = (ArtGroup) dc.newObject("ArtGroup");
        childGroup2.setName("child2");
        childGroup2.setToParentGroup(parentGroup);

        dc.commitChanges();
    }
View Full Code Here

TOP

Related Classes of org.apache.art.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.