use of org.apache.openejb.test.entity.cmr.manytomany.GameLocal in project tomee by apache.
the class ManyToManyComplexPkTests method testBSetADropExisting.
public void testBSetADropExisting() throws Exception {
resetDB();
beginTransaction();
try {
GameLocal game = findGame(new Integer(11));
game.setPlatforms(new HashSet<PlatformLocal>());
game = findGame(new Integer(22));
game.setPlatforms(new HashSet<PlatformLocal>());
} finally {
completeTransaction();
}
assertAllUnlinked();
}
use of org.apache.openejb.test.entity.cmr.manytomany.GameLocal in project tomee by apache.
the class ManyToManyComplexPkTests method testASetBDropExisting.
public void testASetBDropExisting() throws Exception {
resetDB();
beginTransaction();
try {
PlatformLocal platform = findPlatform(new Integer(1));
platform.setGames(new HashSet<GameLocal>());
platform = findPlatform(new Integer(2));
platform.setGames(new HashSet<GameLocal>());
platform = findPlatform(new Integer(3));
platform.setGames(new HashSet<GameLocal>());
} finally {
completeTransaction();
}
assertAllUnlinked();
}
use of org.apache.openejb.test.entity.cmr.manytomany.GameLocal in project tomee by apache.
the class ManyToManyComplexPkTests method testBSetAExistingBNewA.
public void testBSetAExistingBNewA() throws Exception {
resetDB();
beginTransaction();
try {
final PlatformLocal platform = createPlatform(new Integer(4));
final GameLocal game = findGame(new Integer(11));
final Set<PlatformLocal> platformSets = game.getPlatforms();
platformSets.add(platform);
} finally {
completeTransaction();
}
assertLinked(4, 11);
}
use of org.apache.openejb.test.entity.cmr.manytomany.GameLocal in project tomee by apache.
the class ManyToManyComplexPkTests method testASetBExistingBNewA.
public void testASetBExistingBNewA() throws Exception {
resetDB();
beginTransaction();
try {
final PlatformLocal platform = createPlatform(new Integer(4));
final GameLocal game = findGame(new Integer(11));
final Set<GameLocal> gameSets = platform.getGames();
gameSets.add(game);
} finally {
completeTransaction();
}
assertLinked(4, 11);
}
use of org.apache.openejb.test.entity.cmr.manytomany.GameLocal in project tomee by apache.
the class ManyToManyTests method testIteratorAndRemove.
public void testIteratorAndRemove() throws Exception {
resetDB();
beginTransaction();
final Set games;
try {
final PlatformLocal platform = findPlatform(new Integer(1));
final GameLocal game = findGame(new Integer(11));
games = platform.getGames();
assertFalse(games.isEmpty());
assertEquals(2, games.size());
final Iterator iterator = games.iterator();
assertTrue(games.contains(game));
platform.remove();
assertFalse(games.contains(game));
assertEquals(0, games.size());
try {
iterator.next();
fail("expected iterator.next() to throw an ConcurrentModificationException");
} catch (final ConcurrentModificationException expected) {
}
} finally {
completeTransaction();
}
}
Aggregations