use of org.apache.cayenne.testdo.testmap.ArtGroup in project cayenne by apache.
the class CDOReflexiveRelIT method testAddDeleteWithCommit.
@Test
public void testAddDeleteWithCommit() {
ArtGroup parentGroup = context.newObject(ArtGroup.class);
parentGroup.setName("parent");
ArtGroup childGroup1 = context.newObject(ArtGroup.class);
childGroup1.setName("child1");
childGroup1.setToParentGroup(parentGroup);
context.commitChanges();
context.deleteObjects(parentGroup);
context.commitChanges();
}
use of org.apache.cayenne.testdo.testmap.ArtGroup in project cayenne by apache.
the class CDOReflexiveRelIT method testReplaceDeleteWithCommit.
@Test
public void testReplaceDeleteWithCommit() {
ArtGroup parentGroup1 = context.newObject(ArtGroup.class);
parentGroup1.setName("parent1");
ArtGroup parentGroup2 = context.newObject(ArtGroup.class);
parentGroup2.setName("parent2");
ArtGroup childGroup1 = context.newObject(ArtGroup.class);
childGroup1.setName("child1");
childGroup1.setToParentGroup(parentGroup1);
childGroup1.setToParentGroup(parentGroup2);
context.commitChanges();
context.deleteObjects(parentGroup1);
context.deleteObjects(parentGroup2);
context.commitChanges();
}
use of org.apache.cayenne.testdo.testmap.ArtGroup in project cayenne by apache.
the class CDOReflexiveRelIT method testReplaceDeleteNoCommit.
@Test
public void testReplaceDeleteNoCommit() {
ArtGroup parentGroup1 = context.newObject(ArtGroup.class);
parentGroup1.setName("parent1");
ArtGroup parentGroup2 = context.newObject(ArtGroup.class);
parentGroup2.setName("parent2");
ArtGroup childGroup1 = context.newObject(ArtGroup.class);
childGroup1.setName("child1");
childGroup1.setToParentGroup(parentGroup1);
childGroup1.setToParentGroup(parentGroup2);
context.deleteObjects(parentGroup1);
context.deleteObjects(parentGroup2);
}
use of org.apache.cayenne.testdo.testmap.ArtGroup in project cayenne by apache.
the class CDOReflexiveRelIT method testCommitReplaceCommit.
@Test
public void testCommitReplaceCommit() {
ArtGroup parentGroup1 = context.newObject(ArtGroup.class);
parentGroup1.setName("parent1");
ArtGroup parentGroup2 = context.newObject(ArtGroup.class);
parentGroup2.setName("parent2");
ArtGroup childGroup1 = context.newObject(ArtGroup.class);
childGroup1.setName("child1");
childGroup1.setToParentGroup(parentGroup1);
context.commitChanges();
childGroup1.setToParentGroup(parentGroup2);
context.commitChanges();
}
use of org.apache.cayenne.testdo.testmap.ArtGroup in project cayenne by apache.
the class CayenneDataObjectFlattenedRelIT method testAddRemoveFlattenedRelationship2.
@Test
public void testAddRemoveFlattenedRelationship2() throws Exception {
create1Artist2ArtGroupDataSet();
Artist a1 = Cayenne.objectForPK(context, Artist.class, 33001);
SelectQuery q = new SelectQuery(ArtGroup.class);
List<?> results = context.performQuery(q);
assertEquals(2, results.size());
ArtGroup g1 = (ArtGroup) results.get(0);
ArtGroup g2 = (ArtGroup) results.get(1);
a1.addToGroupArray(g1);
a1.addToGroupArray(g2);
// test that there is no delete query issued when a flattened join is first
// added and then deleted AND there are some other changes (CAY-548)
a1.removeFromGroupArray(g1);
MockDataNode nodeWrapper = MockDataNode.interceptNode(runtime.getDataDomain(), runtime.getDataDomain().getDataNodes().iterator().next());
try {
context.commitChanges();
} finally {
nodeWrapper.stopInterceptNode();
}
assertEquals(1, nodeWrapper.getRunCount());
}
Aggregations