You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by an...@apache.org on 2014/07/07 21:07:53 UTC

svn commit: r1608563 [27/38] - in /tomee/tomee/branches/tomee-1.7.x/itests: failover-ejb/src/main/java/org/apache/openejb/itest/failover/ejb/ failover/src/main/java/org/apache/openejb/itest/failover/ failover/src/main/java/org/apache/openejb/server/con...

Modified: tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/ManyToManyComplexPkTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/ManyToManyComplexPkTests.java?rev=1608563&r1=1608562&r2=1608563&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/ManyToManyComplexPkTests.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/ManyToManyComplexPkTests.java Mon Jul  7 19:07:41 2014
@@ -58,11 +58,11 @@ public class ManyToManyComplexPkTests ex
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
-            Set<GameLocal> gameSets = platform.getGames();
+            final PlatformLocal platform = findPlatform(new Integer(1));
+            final Set<GameLocal> gameSets = platform.getGames();
             assertEquals(2, gameSets.size());
-            for (Iterator iter = gameSets.iterator(); iter.hasNext();) {
-                GameLocal game = (GameLocal) iter.next();
+            for (final Iterator iter = gameSets.iterator(); iter.hasNext();) {
+                final GameLocal game = (GameLocal) iter.next();
                 if (game.getId().equals(new Integer(11))) {
                     assertEquals("value11", game.getName());
                 } else if (game.getId().equals(new Integer(22))) {
@@ -80,12 +80,12 @@ public class ManyToManyComplexPkTests ex
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
+            final PlatformLocal platform = findPlatform(new Integer(1));
             try {
                 platform.setGames(null);
                 fail("expected platform.setGames(null) to throw an IllegalArgumentException");
-            } catch (TransactionRolledbackLocalException e) {
-                Throwable cause = e.getCause();
+            } catch (final TransactionRolledbackLocalException e) {
+                final Throwable cause = e.getCause();
                 assertNotNull("cause is null", cause);
                 assertTrue("cause is not a instance of IllegalArgumentException", cause instanceof IllegalArgumentException);
             }
@@ -98,11 +98,11 @@ public class ManyToManyComplexPkTests ex
         resetDB();
         beginTransaction();
         try {
-            GameLocal game = findGame(new Integer(22));
-            Set aSet = game.getPlatforms();
+            final GameLocal game = findGame(new Integer(22));
+            final Set aSet = game.getPlatforms();
             assertEquals(3, aSet.size());
-            for (Iterator iter = aSet.iterator(); iter.hasNext();) {
-                PlatformLocal platform = (PlatformLocal) iter.next();
+            for (final Iterator iter = aSet.iterator(); iter.hasNext();) {
+                final PlatformLocal platform = (PlatformLocal) iter.next();
                 if (platform.getId().equals(new Integer(1))) {
                     assertEquals("value1", platform.getName());
                 } else if (platform.getId().equals(new Integer(2))) {
@@ -154,9 +154,9 @@ public class ManyToManyComplexPkTests ex
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = createPlatform(new Integer(4));
-            GameLocal game = createGame(new Integer(33));
-            Set<GameLocal> gameSets = platform.getGames();
+            final PlatformLocal platform = createPlatform(new Integer(4));
+            final GameLocal game = createGame(new Integer(33));
+            final Set<GameLocal> gameSets = platform.getGames();
             gameSets.add(game);
         } finally {
             completeTransaction();
@@ -169,9 +169,9 @@ public class ManyToManyComplexPkTests ex
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = createPlatform(new Integer(4));
-            GameLocal game = createGame(new Integer(33));
-            Set<PlatformLocal> platformSets = game.getPlatforms();
+            final PlatformLocal platform = createPlatform(new Integer(4));
+            final GameLocal game = createGame(new Integer(33));
+            final Set<PlatformLocal> platformSets = game.getPlatforms();
             platformSets.add(platform);
         } finally {
             completeTransaction();
@@ -184,9 +184,9 @@ public class ManyToManyComplexPkTests ex
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = createPlatform(new Integer(4));
-            GameLocal game = findGame(new Integer(11));
-            Set<GameLocal> gameSets = platform.getGames();
+            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();
@@ -199,9 +199,9 @@ public class ManyToManyComplexPkTests ex
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = createPlatform(new Integer(4));
-            GameLocal game = findGame(new Integer(11));
-            Set<PlatformLocal> platformSets = game.getPlatforms();
+            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();
@@ -214,9 +214,9 @@ public class ManyToManyComplexPkTests ex
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
-            GameLocal game = createGame(new Integer(33));
-            Set<GameLocal> gameSets = platform.getGames();
+            final PlatformLocal platform = findPlatform(new Integer(1));
+            final GameLocal game = createGame(new Integer(33));
+            final Set<GameLocal> gameSets = platform.getGames();
             gameSets.add(game);
         } finally {
             completeTransaction();
@@ -229,9 +229,9 @@ public class ManyToManyComplexPkTests ex
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
-            GameLocal game = createGame(new Integer(33));
-            Set<PlatformLocal> platformSets = game.getPlatforms();
+            final PlatformLocal platform = findPlatform(new Integer(1));
+            final GameLocal game = createGame(new Integer(33));
+            final Set<PlatformLocal> platformSets = game.getPlatforms();
             platformSets.add(platform);
         } finally {
             completeTransaction();
@@ -244,7 +244,7 @@ public class ManyToManyComplexPkTests ex
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
+            final PlatformLocal platform = findPlatform(new Integer(1));
             platform.remove();
         } finally {
             completeTransaction();
@@ -257,19 +257,19 @@ public class ManyToManyComplexPkTests ex
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
-            Set games = platform.getGames();
+            final PlatformLocal platform = findPlatform(new Integer(1));
+            final Set games = platform.getGames();
 
             try {
                 games.add(new Object());
                 fail("expected games.add(new Object()) to throw an IllegalArgumentException");
-            } catch (IllegalArgumentException e) {
+            } catch (final IllegalArgumentException e) {
             }
 
             try {
                 games.addAll(Arrays.asList(new Object()));
                 fail("expected games.addAll(Arrays.asList(new Object())) to throw an IllegalArgumentException");
-            } catch (IllegalArgumentException expected) {
+            } catch (final IllegalArgumentException expected) {
             }
         } finally {
             completeTransaction();
@@ -282,7 +282,7 @@ public class ManyToManyComplexPkTests ex
         Set games;
         GameLocal newGame;
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
+            final PlatformLocal platform = findPlatform(new Integer(1));
             newGame = createGame(new Integer(33));
             games = platform.getGames();
         } finally {
@@ -292,8 +292,8 @@ public class ManyToManyComplexPkTests ex
         // CMR collections should still be readable
         assertFalse(games.isEmpty());
         assertEquals(2, games.size());
-        for (Iterator iter = games.iterator(); iter.hasNext();) {
-            GameLocal game = (GameLocal) iter.next();
+        for (final Iterator iter = games.iterator(); iter.hasNext();) {
+            final GameLocal game = (GameLocal) iter.next();
             if (game.getId().equals(new Integer(11))) {
                 assertEquals("value11", game.getName());
             } else if (game.getId().equals(new Integer(22))) {
@@ -307,28 +307,28 @@ public class ManyToManyComplexPkTests ex
         try {
             games.add(newGame);
             fail("expected games.add(game) to throw an IllegalStateException");
-        } catch (IllegalStateException expected) {
+        } catch (final IllegalStateException expected) {
         }
         try {
             games.addAll(Arrays.asList(newGame));
             fail("expected games.addAll(Arrays.asList(game)) to throw an IllegalStateException");
-        } catch (IllegalStateException expected) {
+        } catch (final IllegalStateException expected) {
         }
         try {
             games.remove(newGame);
             fail("expected games.remove(game) to throw an IllegalStateException");
-        } catch (IllegalStateException expected) {
+        } catch (final IllegalStateException expected) {
         }
         try {
             games.removeAll(Arrays.asList(newGame));
             fail("expected games.removeAll(game) to throw an IllegalStateException");
-        } catch (IllegalStateException expected) {
+        } catch (final IllegalStateException expected) {
         }
-        Iterator iterator = games.iterator();
+        final Iterator iterator = games.iterator();
         try {
             iterator.remove();
             fail("expected iterator.remove() to throw an ConcurrentModificationException");
-        } catch (ConcurrentModificationException expected) {
+        } catch (final ConcurrentModificationException expected) {
         }
     }
 
@@ -338,7 +338,7 @@ public class ManyToManyComplexPkTests ex
         Set games;
         GameLocal newGame;
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
+            final PlatformLocal platform = findPlatform(new Integer(1));
             newGame = createGame(new Integer(33));
             games = platform.getGames();
         } finally {
@@ -350,8 +350,8 @@ public class ManyToManyComplexPkTests ex
             // CMR collections should still be readable
             assertFalse(games.isEmpty());
             assertEquals(2, games.size());
-            for (Iterator iter = games.iterator(); iter.hasNext();) {
-                GameLocal game = (GameLocal) iter.next();
+            for (final Iterator iter = games.iterator(); iter.hasNext();) {
+                final GameLocal game = (GameLocal) iter.next();
                 if (game.getId().equals(new Integer(11))) {
                     assertEquals("value11", game.getName());
                 } else if (game.getId().equals(new Integer(22))) {
@@ -365,28 +365,28 @@ public class ManyToManyComplexPkTests ex
             try {
                 games.add(newGame);
                 fail("expected games.add(game) to throw an IllegalStateException");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
             }
             try {
                 games.addAll(Arrays.asList(newGame));
                 fail("expected games.addAll(Arrays.asList(game)) to throw an IllegalStateException");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
             }
             try {
                 games.remove(newGame);
                 fail("expected games.remove(game) to throw an IllegalStateException");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
             }
             try {
                 games.removeAll(Arrays.asList(newGame));
                 fail("expected games.removeAll(game) to throw an IllegalStateException");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
             }
-            Iterator iterator = games.iterator();
+            final Iterator iterator = games.iterator();
             try {
                 iterator.remove();
                 fail("expected iterator.remove() to throw an ConcurrentModificationException");
-            } catch (ConcurrentModificationException expected) {
+            } catch (final ConcurrentModificationException expected) {
             }
         } finally {
             completeTransaction();
@@ -396,15 +396,15 @@ public class ManyToManyComplexPkTests ex
     public void testIteratorConcurrentModification() throws Exception {
         resetDB();
         beginTransaction();
-        Set games;
+        final Set games;
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
-            GameLocal game = findGame(new Integer(11));
+            final PlatformLocal platform = findPlatform(new Integer(1));
+            final GameLocal game = findGame(new Integer(11));
             games = platform.getGames();
             assertFalse(games.isEmpty());
             assertEquals(2, games.size());
 
-            Iterator iterator = games.iterator();
+            final Iterator iterator = games.iterator();
 
             games.remove(game);
             assertEquals(1, games.size());
@@ -412,7 +412,7 @@ public class ManyToManyComplexPkTests ex
             try {
                 iterator.next();
                 fail("expected iterator.next() to throw an ConcurrentModificationException");
-            } catch (ConcurrentModificationException expected) {
+            } catch (final ConcurrentModificationException expected) {
             }
         } finally {
             completeTransaction();
@@ -422,15 +422,15 @@ public class ManyToManyComplexPkTests ex
     public void testIteratorAndRemove() throws Exception {
         resetDB();
         beginTransaction();
-        Set games;
+        final Set games;
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
-            GameLocal game = findGame(new Integer(11));
+            final PlatformLocal platform = findPlatform(new Integer(1));
+            final GameLocal game = findGame(new Integer(11));
             games = platform.getGames();
             assertFalse(games.isEmpty());
             assertEquals(2, games.size());
 
-            Iterator iterator = games.iterator();
+            final Iterator iterator = games.iterator();
 
             assertTrue(games.contains(game));
             platform.remove();
@@ -440,16 +440,16 @@ public class ManyToManyComplexPkTests ex
             try {
                 iterator.next();
                 fail("expected iterator.next() to throw an ConcurrentModificationException");
-            } catch (ConcurrentModificationException expected) {
+            } catch (final ConcurrentModificationException expected) {
             }
         } finally {
             completeTransaction();
         }
     }
 
-    private void assertPlatformDeleted(int platformId) throws Exception {
-        Connection c = ds.getConnection();
-        Statement s = c.createStatement();
+    private void assertPlatformDeleted(final int platformId) throws Exception {
+        final Connection c = ds.getConnection();
+        final Statement s = c.createStatement();
 
         ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM ComplexGame_ComplexPlatform WHERE Platforms_id=" + platformId);
         assertTrue(rs.next());
@@ -466,10 +466,10 @@ public class ManyToManyComplexPkTests ex
     }
 
     private void assertAllUnlinked() throws Exception {
-        Connection c = ds.getConnection();
-        Statement s = c.createStatement();
+        final Connection c = ds.getConnection();
+        final Statement s = c.createStatement();
 
-        ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM ComplexGame_ComplexPlatform");
+        final ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM ComplexGame_ComplexPlatform");
         assertTrue(rs.next());
         assertEquals(0, rs.getInt(1));
         rs.close();
@@ -478,9 +478,9 @@ public class ManyToManyComplexPkTests ex
         c.close();
     }
 
-    private void assertLinked(int platformId, int gameId) throws Exception {
-        Connection c = ds.getConnection();
-        Statement s = c.createStatement();
+    private void assertLinked(final int platformId, final int gameId) throws Exception {
+        final Connection c = ds.getConnection();
+        final Statement s = c.createStatement();
 
         ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM ComplexGame_ComplexPlatform WHERE Platforms_id = " + platformId + " AND Games_id = " + gameId);
         assertTrue(rs.next());
@@ -500,41 +500,41 @@ public class ManyToManyComplexPkTests ex
         c.close();
     }
 
-    private GameLocal createGame(int gameId) throws CreateException {
-        GameLocal menu = gameLocalHome.create(new GamePk(gameId, "value" + gameId));
+    private GameLocal createGame(final int gameId) throws CreateException {
+        final GameLocal menu = gameLocalHome.create(new GamePk(gameId, "value" + gameId));
         return menu;
     }
 
-    private GameLocal findGame(int gameId) throws FinderException {
+    private GameLocal findGame(final int gameId) throws FinderException {
         return gameLocalHome.findByPrimaryKey(new GamePk(gameId, "value" + gameId));
     }
 
-    private PlatformLocal createPlatform(int platformId) throws CreateException {
-        PlatformLocal platform = platformLocalHome.create(new PlatformPk(platformId, "value" + platformId));
+    private PlatformLocal createPlatform(final int platformId) throws CreateException {
+        final PlatformLocal platform = platformLocalHome.create(new PlatformPk(platformId, "value" + platformId));
         return platform;
     }
 
-    private PlatformLocal findPlatform(int platformId) throws FinderException {
+    private PlatformLocal findPlatform(final int platformId) throws FinderException {
         return platformLocalHome.findByPrimaryKey(new PlatformPk(platformId, "value" + platformId));
     }
 
     private void resetDB() throws Exception {
-        Connection connection = ds.getConnection();
+        final Connection connection = ds.getConnection();
         Statement statement = null;
         try {
             statement = connection.createStatement();
 
             try {
                 statement.execute("DELETE FROM ComplexGame_ComplexPlatform");
-            } catch (SQLException ignored) {
+            } catch (final SQLException ignored) {
             }
             try {
                 statement.execute("DELETE FROM ComplexGame");
-            } catch (SQLException ignored) {
+            } catch (final SQLException ignored) {
             }
             try {
                 statement.execute("DELETE FROM ComplexPlatform");
-            } catch (SQLException ignored) {
+            } catch (final SQLException ignored) {
             }
         } finally {
             close(statement);
@@ -543,16 +543,16 @@ public class ManyToManyComplexPkTests ex
 
         beginTransaction();
         try {
-            PlatformLocal platform1 = createPlatform(1);
+            final PlatformLocal platform1 = createPlatform(1);
             assertNotNull("platform1.getGames() is null", platform1.getGames());
-            PlatformLocal platform2 = createPlatform(2);
+            final PlatformLocal platform2 = createPlatform(2);
             assertNotNull("platform2.getGames() is null", platform2.getGames());
-            PlatformLocal platform3 = createPlatform(3);
+            final PlatformLocal platform3 = createPlatform(3);
             assertNotNull("platform3.getGames() is null", platform3.getGames());
 
-            GameLocal game1 = createGame(11);
+            final GameLocal game1 = createGame(11);
             assertNotNull("game1.getPlatforms() is null", game1.getPlatforms());
-            GameLocal game2 = createGame(22);
+            final GameLocal game2 = createGame(22);
             assertNotNull("game2.getPlatforms() is null", game2.getPlatforms());
 
             platform1.getGames().add(game1);

Modified: tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/ManyToManyTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/ManyToManyTests.java?rev=1608563&r1=1608562&r2=1608563&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/ManyToManyTests.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/ManyToManyTests.java Mon Jul  7 19:07:41 2014
@@ -56,11 +56,11 @@ public class ManyToManyTests extends Abs
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
-            Set<GameLocal> gameSets = platform.getGames();
+            final PlatformLocal platform = findPlatform(new Integer(1));
+            final Set<GameLocal> gameSets = platform.getGames();
             assertEquals(2, gameSets.size());
-            for (Iterator iter = gameSets.iterator(); iter.hasNext();) {
-                GameLocal game = (GameLocal) iter.next();
+            for (final Iterator iter = gameSets.iterator(); iter.hasNext();) {
+                final GameLocal game = (GameLocal) iter.next();
                 if (game.getId().equals(new Integer(11))) {
                     assertEquals("value11", game.getName());
                 } else if (game.getId().equals(new Integer(22))) {
@@ -78,12 +78,12 @@ public class ManyToManyTests extends Abs
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
+            final PlatformLocal platform = findPlatform(new Integer(1));
             try {
                 platform.setGames(null);
                 fail("expected platform.setGames(null) to throw an IllegalArgumentException");
-            } catch (TransactionRolledbackLocalException e) {
-                Throwable cause = e.getCause();
+            } catch (final TransactionRolledbackLocalException e) {
+                final Throwable cause = e.getCause();
                 assertNotNull("cause is null", cause);
                 assertTrue("cause is not a instance of IllegalArgumentException", cause instanceof IllegalArgumentException);
             }
@@ -96,11 +96,11 @@ public class ManyToManyTests extends Abs
         resetDB();
         beginTransaction();
         try {
-            GameLocal game = findGame(new Integer(22));
-            Set aSet = game.getPlatforms();
+            final GameLocal game = findGame(new Integer(22));
+            final Set aSet = game.getPlatforms();
             assertEquals(3, aSet.size());
-            for (Iterator iter = aSet.iterator(); iter.hasNext();) {
-                PlatformLocal platform = (PlatformLocal) iter.next();
+            for (final Iterator iter = aSet.iterator(); iter.hasNext();) {
+                final PlatformLocal platform = (PlatformLocal) iter.next();
                 if (platform.getId().equals(new Integer(1))) {
                     assertEquals("value1", platform.getName());
                 } else if (platform.getId().equals(new Integer(2))) {
@@ -152,9 +152,9 @@ public class ManyToManyTests extends Abs
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = createPlatform(new Integer(4));
-            GameLocal game = createGame(new Integer(33));
-            Set<GameLocal> gameSets = platform.getGames();
+            final PlatformLocal platform = createPlatform(new Integer(4));
+            final GameLocal game = createGame(new Integer(33));
+            final Set<GameLocal> gameSets = platform.getGames();
             gameSets.add(game);
         } finally {
             completeTransaction();
@@ -167,9 +167,9 @@ public class ManyToManyTests extends Abs
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = createPlatform(new Integer(4));
-            GameLocal game = createGame(new Integer(33));
-            Set<PlatformLocal> platformSets = game.getPlatforms();
+            final PlatformLocal platform = createPlatform(new Integer(4));
+            final GameLocal game = createGame(new Integer(33));
+            final Set<PlatformLocal> platformSets = game.getPlatforms();
             platformSets.add(platform);
         } finally {
             completeTransaction();
@@ -182,9 +182,9 @@ public class ManyToManyTests extends Abs
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = createPlatform(new Integer(4));
-            GameLocal game = findGame(new Integer(11));
-            Set<GameLocal> gameSets = platform.getGames();
+            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();
@@ -197,9 +197,9 @@ public class ManyToManyTests extends Abs
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = createPlatform(new Integer(4));
-            GameLocal game = findGame(new Integer(11));
-            Set<PlatformLocal> platformSets = game.getPlatforms();
+            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();
@@ -212,9 +212,9 @@ public class ManyToManyTests extends Abs
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
-            GameLocal game = createGame(new Integer(33));
-            Set<GameLocal> gameSets = platform.getGames();
+            final PlatformLocal platform = findPlatform(new Integer(1));
+            final GameLocal game = createGame(new Integer(33));
+            final Set<GameLocal> gameSets = platform.getGames();
             gameSets.add(game);
         } finally {
             completeTransaction();
@@ -227,9 +227,9 @@ public class ManyToManyTests extends Abs
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
-            GameLocal game = createGame(new Integer(33));
-            Set<PlatformLocal> platformSets = game.getPlatforms();
+            final PlatformLocal platform = findPlatform(new Integer(1));
+            final GameLocal game = createGame(new Integer(33));
+            final Set<PlatformLocal> platformSets = game.getPlatforms();
             platformSets.add(platform);
         } finally {
             completeTransaction();
@@ -242,7 +242,7 @@ public class ManyToManyTests extends Abs
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
+            final PlatformLocal platform = findPlatform(new Integer(1));
             platform.remove();
         } finally {
             completeTransaction();
@@ -254,19 +254,19 @@ public class ManyToManyTests extends Abs
         resetDB();
         beginTransaction();
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
-            Set games = platform.getGames();
+            final PlatformLocal platform = findPlatform(new Integer(1));
+            final Set games = platform.getGames();
 
             try {
                 games.add(new Object());
                 fail("expected games.add(new Object()) to throw an IllegalArgumentException");
-            } catch (IllegalArgumentException e) {
+            } catch (final IllegalArgumentException e) {
             }
 
             try {
                 games.addAll(Arrays.asList(new Object()));
                 fail("expected games.addAll(Arrays.asList(new Object())) to throw an IllegalArgumentException");
-            } catch (IllegalArgumentException expected) {
+            } catch (final IllegalArgumentException expected) {
             }
         } finally {
             completeTransaction();
@@ -279,7 +279,7 @@ public class ManyToManyTests extends Abs
         Set games;
         GameLocal newGame;
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
+            final PlatformLocal platform = findPlatform(new Integer(1));
             newGame = createGame(new Integer(33));
             games = platform.getGames();
         } finally {
@@ -289,8 +289,8 @@ public class ManyToManyTests extends Abs
         // CMR collections should still be readable
         assertFalse(games.isEmpty());
         assertEquals(2, games.size());
-        for (Iterator iter = games.iterator(); iter.hasNext();) {
-            GameLocal game = (GameLocal) iter.next();
+        for (final Iterator iter = games.iterator(); iter.hasNext();) {
+            final GameLocal game = (GameLocal) iter.next();
             if (game.getId().equals(new Integer(11))) {
                 assertEquals("value11", game.getName());
             } else if (game.getId().equals(new Integer(22))) {
@@ -304,28 +304,28 @@ public class ManyToManyTests extends Abs
         try {
             games.add(newGame);
             fail("expected games.add(game) to throw an IllegalStateException");
-        } catch (IllegalStateException expected) {
+        } catch (final IllegalStateException expected) {
         }
         try {
             games.addAll(Arrays.asList(newGame));
             fail("expected games.addAll(Arrays.asList(game)) to throw an IllegalStateException");
-        } catch (IllegalStateException expected) {
+        } catch (final IllegalStateException expected) {
         }
         try {
             games.remove(newGame);
             fail("expected games.remove(game) to throw an IllegalStateException");
-        } catch (IllegalStateException expected) {
+        } catch (final IllegalStateException expected) {
         }
         try {
             games.removeAll(Arrays.asList(newGame));
             fail("expected games.removeAll(game) to throw an IllegalStateException");
-        } catch (IllegalStateException expected) {
+        } catch (final IllegalStateException expected) {
         }
-        Iterator iterator = games.iterator();
+        final Iterator iterator = games.iterator();
         try {
             iterator.remove();
             fail("expected iterator.remove() to throw an ConcurrentModificationException");
-        } catch (ConcurrentModificationException expected) {
+        } catch (final ConcurrentModificationException expected) {
         }
     }
 
@@ -335,7 +335,7 @@ public class ManyToManyTests extends Abs
         Set games;
         GameLocal newGame;
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
+            final PlatformLocal platform = findPlatform(new Integer(1));
             newGame = createGame(new Integer(33));
             games = platform.getGames();
         } finally {
@@ -347,8 +347,8 @@ public class ManyToManyTests extends Abs
             // CMR collections should still be readable
             assertFalse(games.isEmpty());
             assertEquals(2, games.size());
-            for (Iterator iter = games.iterator(); iter.hasNext();) {
-                GameLocal game = (GameLocal) iter.next();
+            for (final Iterator iter = games.iterator(); iter.hasNext();) {
+                final GameLocal game = (GameLocal) iter.next();
                 if (game.getId().equals(new Integer(11))) {
                     assertEquals("value11", game.getName());
                 } else if (game.getId().equals(new Integer(22))) {
@@ -362,28 +362,28 @@ public class ManyToManyTests extends Abs
             try {
                 games.add(newGame);
                 fail("expected games.add(game) to throw an IllegalStateException");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
             }
             try {
                 games.addAll(Arrays.asList(newGame));
                 fail("expected games.addAll(Arrays.asList(game)) to throw an IllegalStateException");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
             }
             try {
                 games.remove(newGame);
                 fail("expected games.remove(game) to throw an IllegalStateException");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
             }
             try {
                 games.removeAll(Arrays.asList(newGame));
                 fail("expected games.removeAll(game) to throw an IllegalStateException");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
             }
-            Iterator iterator = games.iterator();
+            final Iterator iterator = games.iterator();
             try {
                 iterator.remove();
                 fail("expected iterator.remove() to throw an ConcurrentModificationException");
-            } catch (ConcurrentModificationException expected) {
+            } catch (final ConcurrentModificationException expected) {
             }
         } finally {
             completeTransaction();
@@ -393,15 +393,15 @@ public class ManyToManyTests extends Abs
     public void testIteratorConcurrentModification() throws Exception {
         resetDB();
         beginTransaction();
-        Set games;
+        final Set games;
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
-            GameLocal game = findGame(new Integer(11));
+            final PlatformLocal platform = findPlatform(new Integer(1));
+            final GameLocal game = findGame(new Integer(11));
             games = platform.getGames();
             assertFalse(games.isEmpty());
             assertEquals(2, games.size());
 
-            Iterator iterator = games.iterator();
+            final Iterator iterator = games.iterator();
 
             games.remove(game);
             assertEquals(1, games.size());
@@ -409,7 +409,7 @@ public class ManyToManyTests extends Abs
             try {
                 iterator.next();
                 fail("expected iterator.next() to throw an ConcurrentModificationException");
-            } catch (ConcurrentModificationException expected) {
+            } catch (final ConcurrentModificationException expected) {
             }
         } finally {
             completeTransaction();
@@ -419,15 +419,15 @@ public class ManyToManyTests extends Abs
     public void testIteratorAndRemove() throws Exception {
         resetDB();
         beginTransaction();
-        Set games;
+        final Set games;
         try {
-            PlatformLocal platform = findPlatform(new Integer(1));
-            GameLocal game = findGame(new Integer(11));
+            final PlatformLocal platform = findPlatform(new Integer(1));
+            final GameLocal game = findGame(new Integer(11));
             games = platform.getGames();
             assertFalse(games.isEmpty());
             assertEquals(2, games.size());
 
-            Iterator iterator = games.iterator();
+            final Iterator iterator = games.iterator();
 
             assertTrue(games.contains(game));
             platform.remove();
@@ -437,16 +437,16 @@ public class ManyToManyTests extends Abs
             try {
                 iterator.next();
                 fail("expected iterator.next() to throw an ConcurrentModificationException");
-            } catch (ConcurrentModificationException expected) {
+            } catch (final ConcurrentModificationException expected) {
             }
         } finally {
             completeTransaction();
         }
     }
 
-    private void assertPlatformDeleted(int platformId) throws Exception {
-        Connection c = ds.getConnection();
-        Statement s = c.createStatement();
+    private void assertPlatformDeleted(final int platformId) throws Exception {
+        final Connection c = ds.getConnection();
+        final Statement s = c.createStatement();
 
         ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM Game_Platform WHERE Platforms_id=" + platformId);
         assertTrue(rs.next());
@@ -463,10 +463,10 @@ public class ManyToManyTests extends Abs
     }
 
     private void assertAllUnlinked() throws Exception {
-        Connection c = ds.getConnection();
-        Statement s = c.createStatement();
+        final Connection c = ds.getConnection();
+        final Statement s = c.createStatement();
 
-        ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM Game_Platform");
+        final ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM Game_Platform");
         assertTrue(rs.next());
         assertEquals(0, rs.getInt(1));
         rs.close();
@@ -475,9 +475,9 @@ public class ManyToManyTests extends Abs
         c.close();
     }
 
-    private void assertLinked(int platformId, int gameId) throws Exception {
-        Connection c = ds.getConnection();
-        Statement s = c.createStatement();
+    private void assertLinked(final int platformId, final int gameId) throws Exception {
+        final Connection c = ds.getConnection();
+        final Statement s = c.createStatement();
 
         ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM Game_Platform WHERE Platforms_id = " + platformId + " AND Games_id = " + gameId);
         assertTrue(rs.next());
@@ -497,43 +497,43 @@ public class ManyToManyTests extends Abs
         c.close();
     }
 
-    private GameLocal createGame(int gameId) throws CreateException {
-        GameLocal menu = gameLocalHome.create(gameId);
+    private GameLocal createGame(final int gameId) throws CreateException {
+        final GameLocal menu = gameLocalHome.create(gameId);
         menu.setName("value" + gameId);
         return menu;
     }
 
-    private GameLocal findGame(int gameId) throws FinderException {
+    private GameLocal findGame(final int gameId) throws FinderException {
         return gameLocalHome.findByPrimaryKey(gameId);
     }
 
-    private PlatformLocal createPlatform(int platformId) throws CreateException {
-        PlatformLocal platform = platformLocalHome.create(platformId);
+    private PlatformLocal createPlatform(final int platformId) throws CreateException {
+        final PlatformLocal platform = platformLocalHome.create(platformId);
         platform.setName("value" + platformId);
         return platform;
     }
 
-    private PlatformLocal findPlatform(int platformId) throws FinderException {
+    private PlatformLocal findPlatform(final int platformId) throws FinderException {
         return platformLocalHome.findByPrimaryKey(platformId);
     }
 
     private void resetDB() throws Exception {
-        Connection connection = ds.getConnection();
+        final Connection connection = ds.getConnection();
         Statement statement = null;
         try {
             statement = connection.createStatement();
 
             try {
                 statement.execute("DELETE FROM Game_Platform");
-            } catch (SQLException ignored) {
+            } catch (final SQLException ignored) {
             }
             try {
                 statement.execute("DELETE FROM Game");
-            } catch (SQLException ignored) {
+            } catch (final SQLException ignored) {
             }
             try {
                 statement.execute("DELETE FROM Platform");
-            } catch (SQLException ignored) {
+            } catch (final SQLException ignored) {
             }
         } finally {
             close(statement);
@@ -542,16 +542,16 @@ public class ManyToManyTests extends Abs
 
         beginTransaction();
         try {
-            PlatformLocal platform1 = createPlatform(1);
+            final PlatformLocal platform1 = createPlatform(1);
             assertNotNull("platform1.getGames() is null", platform1.getGames());
-            PlatformLocal platform2 = createPlatform(2);
+            final PlatformLocal platform2 = createPlatform(2);
             assertNotNull("platform2.getGames() is null", platform2.getGames());
-            PlatformLocal platform3 = createPlatform(3);
+            final PlatformLocal platform3 = createPlatform(3);
             assertNotNull("platform3.getGames() is null", platform3.getGames());
 
-            GameLocal game1 = createGame(11);
+            final GameLocal game1 = createGame(11);
             assertNotNull("game1.getPlatforms() is null", game1.getPlatforms());
-            GameLocal game2 = createGame(22);
+            final GameLocal game2 = createGame(22);
             assertNotNull("game2.getPlatforms() is null", game2.getPlatforms());
 
             platform1.getGames().add(game1);

Modified: tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/OneToManyComplexPkTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/OneToManyComplexPkTests.java?rev=1608563&r1=1608562&r2=1608563&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/OneToManyComplexPkTests.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/OneToManyComplexPkTests.java Mon Jul  7 19:07:41 2014
@@ -57,11 +57,11 @@ public class OneToManyComplexPkTests ext
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(1);
-            Set bSet = artist.getPerformed();
+            final ArtistLocal artist = findArtist(1);
+            final Set bSet = artist.getPerformed();
             assertEquals(2, bSet.size());
-            for (Object value : bSet) {
-                SongLocal song = (SongLocal) value;
+            for (final Object value : bSet) {
+                final SongLocal song = (SongLocal) value;
                 if (song.getId().equals(11)) {
                     assertEquals("value11", song.getName());
                 } else if (song.getId().equals(22)) {
@@ -99,7 +99,7 @@ public class OneToManyComplexPkTests ext
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(1);
+            final ArtistLocal artist = findArtist(1);
             artist.setPerformed(new HashSet<SongLocal>());
         } finally {
             completeTransaction();
@@ -127,9 +127,9 @@ public class OneToManyComplexPkTests ext
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(2);
-            SongLocal song = findSong(22);
-            Set<SongLocal> songSets = new HashSet<SongLocal>();
+            final ArtistLocal artist = findArtist(2);
+            final SongLocal song = findSong(22);
+            final Set<SongLocal> songSets = new HashSet<SongLocal>();
             songSets.add(song);
             artist.setPerformed(songSets);
         } finally {
@@ -143,8 +143,8 @@ public class OneToManyComplexPkTests ext
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(2);
-            SongLocal song = findSong(22);
+            final ArtistLocal artist = findArtist(2);
+            final SongLocal song = findSong(22);
             song.setPerformer(artist);
         } finally {
             completeTransaction();
@@ -156,9 +156,9 @@ public class OneToManyComplexPkTests ext
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(2);
-            SongLocal song = findSong(11);
-            Set<SongLocal> songSets = artist.getPerformed();
+            final ArtistLocal artist = findArtist(2);
+            final SongLocal song = findSong(11);
+            final Set<SongLocal> songSets = artist.getPerformed();
             songSets.add(song);
         } finally {
             completeTransaction();
@@ -171,8 +171,8 @@ public class OneToManyComplexPkTests ext
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(2);
-            SongLocal song = findSong(11);
+            final ArtistLocal artist = findArtist(2);
+            final SongLocal song = findSong(11);
             song.setPerformer(artist);
         } finally {
             completeTransaction();
@@ -185,9 +185,9 @@ public class OneToManyComplexPkTests ext
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(1);
-            SongLocal song = createSong(33);
-            Set<SongLocal> songSets = artist.getPerformed();
+            final ArtistLocal artist = findArtist(1);
+            final SongLocal song = createSong(33);
+            final Set<SongLocal> songSets = artist.getPerformed();
             songSets.add(song);
         } finally {
             completeTransaction();
@@ -199,8 +199,8 @@ public class OneToManyComplexPkTests ext
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(1);
-            SongLocal song = createSong(33);
+            final ArtistLocal artist = findArtist(1);
+            final SongLocal song = createSong(33);
             song.setPerformer(artist);
         } finally {
             completeTransaction();
@@ -213,9 +213,9 @@ public class OneToManyComplexPkTests ext
         resetDB();
         beginTransaction();
         try {
-            SongLocal song = findSong(11);
-            ArtistLocal artist = song.getPerformer();
-            Set<SongLocal> songs = artist.getPerformed();
+            final SongLocal song = findSong(11);
+            final ArtistLocal artist = song.getPerformer();
+            final Set<SongLocal> songs = artist.getPerformed();
             assertTrue(songs.contains(song));
             song.remove();
             assertFalse(songs.contains(song));
@@ -231,9 +231,9 @@ public class OneToManyComplexPkTests ext
         resetDB();
         beginTransaction();
         try {
-            SongLocal song = findSong(11);
+            final SongLocal song = findSong(11);
 
-            Integer field3 = song.getBpm();
+            final Integer field3 = song.getBpm();
             assertEquals(song.getPerformer().getPrimaryKey(), field3);
         } finally {
             completeTransaction();
@@ -245,11 +245,11 @@ public class OneToManyComplexPkTests ext
         resetDB();
         beginTransaction();
         try {
-            SongLocal song = findSong(11);
+            final SongLocal song = findSong(11);
 
             song.setBpm(2);
 
-            ArtistLocal artist = song.getPerformer();
+            final ArtistLocal artist = song.getPerformer();
             assertEquals(new Integer(2), artist.getId());
             assertEquals("value2", artist.getName());
         } finally {
@@ -262,22 +262,22 @@ public class OneToManyComplexPkTests ext
 
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(1);
+            final ArtistLocal artist = findArtist(1);
             artist.setPerformed(new HashSet<SongLocal>());
-            Set<SongLocal> songs = artist.getComposed();
-            Set<SongLocal> bsCopies = new HashSet<SongLocal>(songs);
+            final Set<SongLocal> songs = artist.getComposed();
+            final Set<SongLocal> bsCopies = new HashSet<SongLocal>(songs);
             assertFalse(songs.isEmpty());
             artist.remove();
             assertTrue(songs.isEmpty());
-            for (SongLocal songLocal : bsCopies) {
+            for (final SongLocal songLocal : bsCopies) {
                 assertNull(songLocal.getComposer());
             }
         } finally {
             completeTransaction();
         }
-        Connection c = ds.getConnection();
-        Statement s = c.createStatement();
-        ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM ComplexSong");
+        final Connection c = ds.getConnection();
+        final Statement s = c.createStatement();
+        final ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM ComplexSong");
         assertTrue(rs.next());
         assertEquals(2, rs.getInt(1));
         rs.close();
@@ -290,17 +290,17 @@ public class OneToManyComplexPkTests ext
 
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(1);
-            Set<SongLocal> songs = artist.getPerformed();
+            final ArtistLocal artist = findArtist(1);
+            final Set<SongLocal> songs = artist.getPerformed();
             assertFalse(songs.isEmpty());
             artist.remove();
             assertTrue(songs.isEmpty());
         } finally {
             completeTransaction();
         }
-        Connection c = ds.getConnection();
-        Statement s = c.createStatement();
-        ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM ComplexSong");
+        final Connection c = ds.getConnection();
+        final Statement s = c.createStatement();
+        final ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM ComplexSong");
         assertTrue(rs.next());
         assertEquals(0, rs.getInt(1));
         rs.close();
@@ -312,19 +312,19 @@ public class OneToManyComplexPkTests ext
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(new Integer(1));
-            Set songs = artist.getComposed();
+            final ArtistLocal artist = findArtist(new Integer(1));
+            final Set songs = artist.getComposed();
 
             try {
                 songs.add(new Object());
                 fail("expected games.add(new Object()) to throw an IllegalArgumentException");
-            } catch (IllegalArgumentException e) {
+            } catch (final IllegalArgumentException e) {
             }
 
             try {
                 songs.addAll(Arrays.asList(new Object()));
                 fail("expected games.addAll(Arrays.asList(new Object())) to throw an IllegalArgumentException");
-            } catch (IllegalArgumentException expected) {
+            } catch (final IllegalArgumentException expected) {
             }
         } finally {
             completeTransaction();
@@ -337,7 +337,7 @@ public class OneToManyComplexPkTests ext
         Set songs;
         SongLocal newSong;
         try {
-            ArtistLocal artist = findArtist(new Integer(1));
+            final ArtistLocal artist = findArtist(new Integer(1));
             newSong = createSong(new Integer(33));
             songs = artist.getComposed();
         } finally {
@@ -347,8 +347,8 @@ public class OneToManyComplexPkTests ext
         // CMR collections should still be readable
         assertFalse(songs.isEmpty());
         assertEquals(2, songs.size());
-        for (Iterator iter = songs.iterator(); iter.hasNext();) {
-            SongLocal song = (SongLocal) iter.next();
+        for (final Iterator iter = songs.iterator(); iter.hasNext();) {
+            final SongLocal song = (SongLocal) iter.next();
             if (song.getId().equals(new Integer(11))) {
                 assertEquals("value11", song.getName());
             } else if (song.getId().equals(new Integer(22))) {
@@ -362,28 +362,28 @@ public class OneToManyComplexPkTests ext
         try {
             songs.add(newSong);
             fail("expected songs.add(newSong) to throw an IllegalStateException");
-        } catch (IllegalStateException expected) {
+        } catch (final IllegalStateException expected) {
         }
         try {
             songs.addAll(Arrays.asList(newSong));
             fail("expected songs.addAll(Arrays.asList(newSong)) to throw an IllegalStateException");
-        } catch (IllegalStateException expected) {
+        } catch (final IllegalStateException expected) {
         }
         try {
             songs.remove(newSong);
             fail("expected songs.remove(newSong) to throw an IllegalStateException");
-        } catch (IllegalStateException expected) {
+        } catch (final IllegalStateException expected) {
         }
         try {
             songs.removeAll(Arrays.asList(newSong));
             fail("expected songs.removeAll(Arrays.asList(newSong)) to throw an IllegalStateException");
-        } catch (IllegalStateException expected) {
+        } catch (final IllegalStateException expected) {
         }
-        Iterator iterator = songs.iterator();
+        final Iterator iterator = songs.iterator();
         try {
             iterator.remove();
             fail("expected iterator.remove() to throw an ConcurrentModificationException");
-        } catch (ConcurrentModificationException expected) {
+        } catch (final ConcurrentModificationException expected) {
         }
     }
 
@@ -393,7 +393,7 @@ public class OneToManyComplexPkTests ext
         Set songs;
         SongLocal newSong;
         try {
-            ArtistLocal artist = findArtist(new Integer(1));
+            final ArtistLocal artist = findArtist(new Integer(1));
             newSong = createSong(new Integer(33));
             songs = artist.getComposed();
         } finally {
@@ -405,8 +405,8 @@ public class OneToManyComplexPkTests ext
             // CMR collections should still be readable
             assertFalse(songs.isEmpty());
             assertEquals(2, songs.size());
-            for (Iterator iter = songs.iterator(); iter.hasNext();) {
-                SongLocal song = (SongLocal) iter.next();
+            for (final Iterator iter = songs.iterator(); iter.hasNext();) {
+                final SongLocal song = (SongLocal) iter.next();
                 if (song.getId().equals(new Integer(11))) {
                     assertEquals("value11", song.getName());
                 } else if (song.getId().equals(new Integer(22))) {
@@ -420,28 +420,28 @@ public class OneToManyComplexPkTests ext
             try {
                 songs.add(newSong);
                 fail("expected songs.add(newSong) to throw an IllegalStateException");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
             }
             try {
                 songs.addAll(Arrays.asList(newSong));
                 fail("expected songs.addAll(Arrays.asList(newSong)) to throw an IllegalStateException");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
             }
             try {
                 songs.remove(newSong);
                 fail("expected songs.remove(newSong) to throw an IllegalStateException");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
             }
             try {
                 songs.removeAll(Arrays.asList(newSong));
                 fail("expected songs.removeAll(Arrays.asList(newSong)) to throw an IllegalStateException");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
             }
-            Iterator iterator = songs.iterator();
+            final Iterator iterator = songs.iterator();
             try {
                 iterator.remove();
                 fail("expected iterator.remove() to throw an ConcurrentModificationException");
-            } catch (ConcurrentModificationException expected) {
+            } catch (final ConcurrentModificationException expected) {
             }
         } finally {
             completeTransaction();
@@ -452,13 +452,13 @@ public class OneToManyComplexPkTests ext
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(new Integer(1));
-            SongLocal song = findSong(new Integer(11));
-            Set songs = artist.getComposed();
+            final ArtistLocal artist = findArtist(new Integer(1));
+            final SongLocal song = findSong(new Integer(11));
+            final Set songs = artist.getComposed();
             assertFalse(songs.isEmpty());
             assertEquals(2, songs.size());
 
-            Iterator iterator = songs.iterator();
+            final Iterator iterator = songs.iterator();
 
             songs.remove(song);
             assertEquals(1, songs.size());
@@ -466,7 +466,7 @@ public class OneToManyComplexPkTests ext
             try {
                 iterator.next();
                 fail("expected iterator.next() to throw an ConcurrentModificationException");
-            } catch (ConcurrentModificationException expected) {
+            } catch (final ConcurrentModificationException expected) {
             }
         } finally {
             completeTransaction();
@@ -477,13 +477,13 @@ public class OneToManyComplexPkTests ext
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(new Integer(1));
-            SongLocal song = findSong(new Integer(11));
-            Set games = artist.getComposed();
+            final ArtistLocal artist = findArtist(new Integer(1));
+            final SongLocal song = findSong(new Integer(11));
+            final Set games = artist.getComposed();
             assertFalse(games.isEmpty());
             assertEquals(2, games.size());
 
-            Iterator iterator = games.iterator();
+            final Iterator iterator = games.iterator();
 
             assertTrue(games.contains(song));
             artist.remove();
@@ -493,34 +493,34 @@ public class OneToManyComplexPkTests ext
             try {
                 iterator.next();
                 fail("expected iterator.next() to throw an ConcurrentModificationException");
-            } catch (ConcurrentModificationException expected) {
+            } catch (final ConcurrentModificationException expected) {
             }
         } finally {
             completeTransaction();
         }
     }
 
-    private ArtistLocal createArtist(int artistId) throws CreateException {
-        ArtistLocal artist = artistLocalHome.create(new ArtistPk(artistId, "value" + artistId));
+    private ArtistLocal createArtist(final int artistId) throws CreateException {
+        final ArtistLocal artist = artistLocalHome.create(new ArtistPk(artistId, "value" + artistId));
         return artist;
     }
 
-    private ArtistLocal findArtist(int artistId) throws FinderException {
+    private ArtistLocal findArtist(final int artistId) throws FinderException {
         return artistLocalHome.findByPrimaryKey(new ArtistPk(artistId, "value" + artistId));
     }
 
-    private SongLocal createSong(int songId) throws CreateException {
-        SongLocal song = songLocalHome.create(new SongPk(songId, "value" + songId));
+    private SongLocal createSong(final int songId) throws CreateException {
+        final SongLocal song = songLocalHome.create(new SongPk(songId, "value" + songId));
         return song;
     }
 
-    private SongLocal findSong(int songId) throws FinderException {
+    private SongLocal findSong(final int songId) throws FinderException {
         return songLocalHome.findByPrimaryKey(new SongPk(songId, "value" + songId));
     }
 
-    private void assertLinked(int artistId, int... songIds) throws Exception {
-        Connection c = ds.getConnection();
-        Statement s = c.createStatement();
+    private void assertLinked(final int artistId, final int... songIds) throws Exception {
+        final Connection c = ds.getConnection();
+        final Statement s = c.createStatement();
         ResultSet rs = s.executeQuery("SELECT name FROM ComplexArtist WHERE id = " + artistId);
         assertTrue(rs.next());
         assertEquals("value" + artistId, rs.getString("name"));
@@ -533,7 +533,7 @@ public class OneToManyComplexPkTests ext
         rs.close();
 
         // assert each of the listed b pks is linked to a
-        for (int songId : songIds) {
+        for (final int songId : songIds) {
             rs = s.executeQuery("SELECT name, performer_id FROM ComplexSong WHERE id = " + songId);
             assertTrue(rs.next());
             assertEquals("value" + songId, rs.getString("name"));
@@ -544,10 +544,10 @@ public class OneToManyComplexPkTests ext
         close(c);
     }
 
-    private void assertUnlinked(int aPk) throws Exception {
-        Connection c = ds.getConnection();
-        Statement s = c.createStatement();
-        ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM ComplexSong WHERE performer_id = " + aPk);
+    private void assertUnlinked(final int aPk) throws Exception {
+        final Connection c = ds.getConnection();
+        final Statement s = c.createStatement();
+        final ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM ComplexSong WHERE performer_id = " + aPk);
         assertTrue(rs.next());
         assertEquals(0, rs.getInt(1));
         close(rs);
@@ -556,29 +556,29 @@ public class OneToManyComplexPkTests ext
     }
 
     private void resetDB() throws Exception {
-        Connection connection = ds.getConnection();
+        final Connection connection = ds.getConnection();
         Statement statement = null;
         try {
             statement = connection.createStatement();
 
             try {
                 statement.execute("DELETE FROM ComplexArtist");
-            } catch (SQLException ignored) {
+            } catch (final SQLException ignored) {
             }
             try {
                 statement.execute("DELETE FROM ComplexSong");
-            } catch (SQLException ignored) {
+            } catch (final SQLException ignored) {
             }
         } finally {
             close(statement);
             close(connection);
         }
 
-        ArtistLocal artist1 = createArtist(1);
+        final ArtistLocal artist1 = createArtist(1);
         createArtist(2);
 
-        SongLocal song1 = createSong(11);
-        SongLocal song2 = createSong(22);
+        final SongLocal song1 = createSong(11);
+        final SongLocal song2 = createSong(22);
 
         song1.setPerformer(artist1);
         song2.setPerformer(artist1);

Modified: tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/OneToManyTests.java
URL: http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/OneToManyTests.java?rev=1608563&r1=1608562&r2=1608563&view=diff
==============================================================================
--- tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/OneToManyTests.java (original)
+++ tomee/tomee/branches/tomee-1.7.x/itests/openejb-itests-client/src/main/java/org/apache/openejb/test/entity/cmr/OneToManyTests.java Mon Jul  7 19:07:41 2014
@@ -55,11 +55,11 @@ public class OneToManyTests extends Abst
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(1);
-            Set bSet = artist.getPerformed();
+            final ArtistLocal artist = findArtist(1);
+            final Set bSet = artist.getPerformed();
             assertEquals(2, bSet.size());
-            for (Object value : bSet) {
-                SongLocal song = (SongLocal) value;
+            for (final Object value : bSet) {
+                final SongLocal song = (SongLocal) value;
                 if (song.getId().equals(11)) {
                     assertEquals("value11", song.getName());
                 } else if (song.getId().equals(22)) {
@@ -97,7 +97,7 @@ public class OneToManyTests extends Abst
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(1);
+            final ArtistLocal artist = findArtist(1);
             artist.setPerformed(new HashSet<SongLocal>());
         } finally {
             completeTransaction();
@@ -125,9 +125,9 @@ public class OneToManyTests extends Abst
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(2);
-            SongLocal song = findSong(22);
-            Set<SongLocal> songSets = new HashSet<SongLocal>();
+            final ArtistLocal artist = findArtist(2);
+            final SongLocal song = findSong(22);
+            final Set<SongLocal> songSets = new HashSet<SongLocal>();
             songSets.add(song);
             artist.setPerformed(songSets);
         } finally {
@@ -141,8 +141,8 @@ public class OneToManyTests extends Abst
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(2);
-            SongLocal song = findSong(22);
+            final ArtistLocal artist = findArtist(2);
+            final SongLocal song = findSong(22);
             song.setPerformer(artist);
         } finally {
             completeTransaction();
@@ -154,9 +154,9 @@ public class OneToManyTests extends Abst
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(2);
-            SongLocal song = findSong(11);
-            Set<SongLocal> songSets = artist.getPerformed();
+            final ArtistLocal artist = findArtist(2);
+            final SongLocal song = findSong(11);
+            final Set<SongLocal> songSets = artist.getPerformed();
             songSets.add(song);
         } finally {
             completeTransaction();
@@ -169,8 +169,8 @@ public class OneToManyTests extends Abst
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(2);
-            SongLocal song = findSong(11);
+            final ArtistLocal artist = findArtist(2);
+            final SongLocal song = findSong(11);
             song.setPerformer(artist);
         } finally {
             completeTransaction();
@@ -183,9 +183,9 @@ public class OneToManyTests extends Abst
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(1);
-            SongLocal song = createSong(33);
-            Set<SongLocal> songSets = artist.getPerformed();
+            final ArtistLocal artist = findArtist(1);
+            final SongLocal song = createSong(33);
+            final Set<SongLocal> songSets = artist.getPerformed();
             songSets.add(song);
         } finally {
             completeTransaction();
@@ -197,8 +197,8 @@ public class OneToManyTests extends Abst
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(1);
-            SongLocal song = createSong(33);
+            final ArtistLocal artist = findArtist(1);
+            final SongLocal song = createSong(33);
             song.setPerformer(artist);
         } finally {
             completeTransaction();
@@ -211,9 +211,9 @@ public class OneToManyTests extends Abst
         resetDB();
         beginTransaction();
         try {
-            SongLocal song = findSong(11);
-            ArtistLocal artist = song.getPerformer();
-            Set<SongLocal> songs = artist.getPerformed();
+            final SongLocal song = findSong(11);
+            final ArtistLocal artist = song.getPerformer();
+            final Set<SongLocal> songs = artist.getPerformed();
             assertTrue(songs.contains(song));
             song.remove();
             assertFalse(songs.contains(song));
@@ -229,9 +229,9 @@ public class OneToManyTests extends Abst
         resetDB();
         beginTransaction();
         try {
-            SongLocal song = findSong(11);
+            final SongLocal song = findSong(11);
 
-            Integer field3 = song.getBpm();
+            final Integer field3 = song.getBpm();
             assertEquals(song.getPerformer().getPrimaryKey(), field3);
         } finally {
             completeTransaction();
@@ -243,11 +243,11 @@ public class OneToManyTests extends Abst
         resetDB();
         beginTransaction();
         try {
-            SongLocal song = findSong(11);
+            final SongLocal song = findSong(11);
 
             song.setBpm(2);
 
-            ArtistLocal artist = song.getPerformer();
+            final ArtistLocal artist = song.getPerformer();
             assertEquals(new Integer(2), artist.getId());
             assertEquals("value2", artist.getName());
         } finally {
@@ -260,22 +260,22 @@ public class OneToManyTests extends Abst
 
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(1);
+            final ArtistLocal artist = findArtist(1);
             artist.setPerformed(new HashSet<SongLocal>());
-            Set<SongLocal> songs = artist.getComposed();
-            Set<SongLocal> bsCopies = new HashSet<SongLocal>(songs);
+            final Set<SongLocal> songs = artist.getComposed();
+            final Set<SongLocal> bsCopies = new HashSet<SongLocal>(songs);
             assertSame(songs, artist.getComposed());
             artist.remove();
             assertTrue("CMR collection is not empty " + System.identityHashCode(songs), songs.isEmpty());
-            for (SongLocal songLocal : bsCopies) {
+            for (final SongLocal songLocal : bsCopies) {
                 assertNull(songLocal.getComposer());
             }
         } finally {
             completeTransaction();
         }
-        Connection c = ds.getConnection();
-        Statement s = c.createStatement();
-        ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM Song");
+        final Connection c = ds.getConnection();
+        final Statement s = c.createStatement();
+        final ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM Song");
         assertTrue(rs.next());
         assertEquals(2, rs.getInt(1));
         rs.close();
@@ -288,17 +288,17 @@ public class OneToManyTests extends Abst
 
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(1);
-            Set<SongLocal> songs = artist.getPerformed();
+            final ArtistLocal artist = findArtist(1);
+            final Set<SongLocal> songs = artist.getPerformed();
             assertFalse(songs.isEmpty());
             artist.remove();
             assertTrue(songs.isEmpty());
         } finally {
             completeTransaction();
         }
-        Connection c = ds.getConnection();
-        Statement s = c.createStatement();
-        ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM Song");
+        final Connection c = ds.getConnection();
+        final Statement s = c.createStatement();
+        final ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM Song");
         assertTrue(rs.next());
         assertEquals(0, rs.getInt(1));
         rs.close();
@@ -310,19 +310,19 @@ public class OneToManyTests extends Abst
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(new Integer(1));
-            Set songs = artist.getComposed();
+            final ArtistLocal artist = findArtist(new Integer(1));
+            final Set songs = artist.getComposed();
 
             try {
                 songs.add(new Object());
                 fail("expected games.add(new Object()) to throw an IllegalArgumentException");
-            } catch (IllegalArgumentException e) {
+            } catch (final IllegalArgumentException e) {
             }
 
             try {
                 songs.addAll(Arrays.asList(new Object()));
                 fail("expected games.addAll(Arrays.asList(new Object())) to throw an IllegalArgumentException");
-            } catch (IllegalArgumentException expected) {
+            } catch (final IllegalArgumentException expected) {
             }
         } finally {
             completeTransaction();
@@ -335,7 +335,7 @@ public class OneToManyTests extends Abst
         Set songs;
         SongLocal newSong;
         try {
-            ArtistLocal artist = findArtist(new Integer(1));
+            final ArtistLocal artist = findArtist(new Integer(1));
             newSong = createSong(new Integer(33));
             songs = artist.getComposed();
         } finally {
@@ -345,8 +345,8 @@ public class OneToManyTests extends Abst
         // CMR collections should still be readable
         assertFalse(songs.isEmpty());
         assertEquals(2, songs.size());
-        for (Iterator iter = songs.iterator(); iter.hasNext();) {
-            SongLocal song = (SongLocal) iter.next();
+        for (final Iterator iter = songs.iterator(); iter.hasNext();) {
+            final SongLocal song = (SongLocal) iter.next();
             if (song.getId().equals(new Integer(11))) {
                 assertEquals("value11", song.getName());
             } else if (song.getId().equals(new Integer(22))) {
@@ -360,28 +360,28 @@ public class OneToManyTests extends Abst
         try {
             songs.add(newSong);
             fail("expected songs.add(newSong) to throw an IllegalStateException");
-        } catch (IllegalStateException expected) {
+        } catch (final IllegalStateException expected) {
         }
         try {
             songs.addAll(Arrays.asList(newSong));
             fail("expected songs.addAll(Arrays.asList(newSong)) to throw an IllegalStateException");
-        } catch (IllegalStateException expected) {
+        } catch (final IllegalStateException expected) {
         }
         try {
             songs.remove(newSong);
             fail("expected songs.remove(newSong) to throw an IllegalStateException");
-        } catch (IllegalStateException expected) {
+        } catch (final IllegalStateException expected) {
         }
         try {
             songs.removeAll(Arrays.asList(newSong));
             fail("expected songs.removeAll(Arrays.asList(newSong)) to throw an IllegalStateException");
-        } catch (IllegalStateException expected) {
+        } catch (final IllegalStateException expected) {
         }
-        Iterator iterator = songs.iterator();
+        final Iterator iterator = songs.iterator();
         try {
             iterator.remove();
             fail("expected iterator.remove() to throw an ConcurrentModificationException");
-        } catch (ConcurrentModificationException expected) {
+        } catch (final ConcurrentModificationException expected) {
         }
     }
 
@@ -391,7 +391,7 @@ public class OneToManyTests extends Abst
         Set songs;
         SongLocal newSong;
         try {
-            ArtistLocal artist = findArtist(new Integer(1));
+            final ArtistLocal artist = findArtist(new Integer(1));
             newSong = createSong(new Integer(33));
             songs = artist.getComposed();
         } finally {
@@ -403,8 +403,8 @@ public class OneToManyTests extends Abst
             // CMR collections should still be readable
             assertFalse(songs.isEmpty());
             assertEquals(2, songs.size());
-            for (Iterator iter = songs.iterator(); iter.hasNext();) {
-                SongLocal song = (SongLocal) iter.next();
+            for (final Iterator iter = songs.iterator(); iter.hasNext();) {
+                final SongLocal song = (SongLocal) iter.next();
                 if (song.getId().equals(new Integer(11))) {
                     assertEquals("value11", song.getName());
                 } else if (song.getId().equals(new Integer(22))) {
@@ -418,28 +418,28 @@ public class OneToManyTests extends Abst
             try {
                 songs.add(newSong);
                 fail("expected songs.add(newSong) to throw an IllegalStateException");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
             }
             try {
                 songs.addAll(Arrays.asList(newSong));
                 fail("expected songs.addAll(Arrays.asList(newSong)) to throw an IllegalStateException");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
             }
             try {
                 songs.remove(newSong);
                 fail("expected songs.remove(newSong) to throw an IllegalStateException");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
             }
             try {
                 songs.removeAll(Arrays.asList(newSong));
                 fail("expected songs.removeAll(Arrays.asList(newSong)) to throw an IllegalStateException");
-            } catch (IllegalStateException expected) {
+            } catch (final IllegalStateException expected) {
             }
-            Iterator iterator = songs.iterator();
+            final Iterator iterator = songs.iterator();
             try {
                 iterator.remove();
                 fail("expected iterator.remove() to throw an ConcurrentModificationException");
-            } catch (ConcurrentModificationException expected) {
+            } catch (final ConcurrentModificationException expected) {
             }
         } finally {
             completeTransaction();
@@ -450,13 +450,13 @@ public class OneToManyTests extends Abst
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(new Integer(1));
-            SongLocal song = findSong(new Integer(11));
-            Set songs = artist.getComposed();
+            final ArtistLocal artist = findArtist(new Integer(1));
+            final SongLocal song = findSong(new Integer(11));
+            final Set songs = artist.getComposed();
             assertFalse(songs.isEmpty());
             assertEquals(2, songs.size());
 
-            Iterator iterator = songs.iterator();
+            final Iterator iterator = songs.iterator();
 
             songs.remove(song);
             assertEquals(1, songs.size());
@@ -464,7 +464,7 @@ public class OneToManyTests extends Abst
             try {
                 iterator.next();
                 fail("expected iterator.next() to throw an ConcurrentModificationException");
-            } catch (ConcurrentModificationException expected) {
+            } catch (final ConcurrentModificationException expected) {
             }
         } finally {
             completeTransaction();
@@ -475,13 +475,13 @@ public class OneToManyTests extends Abst
         resetDB();
         beginTransaction();
         try {
-            ArtistLocal artist = findArtist(new Integer(1));
-            SongLocal song = findSong(new Integer(11));
-            Set games = artist.getComposed();
+            final ArtistLocal artist = findArtist(new Integer(1));
+            final SongLocal song = findSong(new Integer(11));
+            final Set games = artist.getComposed();
             assertFalse(games.isEmpty());
             assertEquals(2, games.size());
 
-            Iterator iterator = games.iterator();
+            final Iterator iterator = games.iterator();
 
             assertTrue(games.contains(song));
             artist.remove();
@@ -491,36 +491,36 @@ public class OneToManyTests extends Abst
             try {
                 iterator.next();
                 fail("expected iterator.next() to throw an ConcurrentModificationException");
-            } catch (ConcurrentModificationException expected) {
+            } catch (final ConcurrentModificationException expected) {
             }
         } finally {
             completeTransaction();
         }
     }
 
-    private ArtistLocal createArtist(int songId) throws CreateException {
-        ArtistLocal artist = artistLocalHome.create(songId);
+    private ArtistLocal createArtist(final int songId) throws CreateException {
+        final ArtistLocal artist = artistLocalHome.create(songId);
         artist.setName("value" + songId);
         return artist;
     }
 
-    private ArtistLocal findArtist(int artistId) throws FinderException {
+    private ArtistLocal findArtist(final int artistId) throws FinderException {
         return artistLocalHome.findByPrimaryKey(artistId);
     }
 
-    private SongLocal createSong(int songId) throws CreateException {
-        SongLocal song = songLocalHome.create(songId);
+    private SongLocal createSong(final int songId) throws CreateException {
+        final SongLocal song = songLocalHome.create(songId);
         song.setName("value" + songId);
         return song;
     }
 
-    private SongLocal findSong(int songId) throws FinderException {
+    private SongLocal findSong(final int songId) throws FinderException {
         return songLocalHome.findByPrimaryKey(songId);
     }
 
-    private void assertLinked(int artistId, int... songIds) throws Exception {
-        Connection c = ds.getConnection();
-        Statement s = c.createStatement();
+    private void assertLinked(final int artistId, final int... songIds) throws Exception {
+        final Connection c = ds.getConnection();
+        final Statement s = c.createStatement();
         ResultSet rs = s.executeQuery("SELECT name FROM Artist WHERE id = " + artistId);
         assertTrue(rs.next());
         assertEquals("value" + artistId, rs.getString("name"));
@@ -533,7 +533,7 @@ public class OneToManyTests extends Abst
         rs.close();
 
         // assert each of the listed b pks is linked to a
-        for (int songId : songIds) {
+        for (final int songId : songIds) {
             rs = s.executeQuery("SELECT name, performer_id FROM Song WHERE id = " + songId);
             assertTrue(rs.next());
             assertEquals("value" + songId, rs.getString("name"));
@@ -544,10 +544,10 @@ public class OneToManyTests extends Abst
         close(c);
     }
 
-    private void assertUnlinked(int aPk) throws Exception {
-        Connection c = ds.getConnection();
-        Statement s = c.createStatement();
-        ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM Song WHERE performer_id = " + aPk);
+    private void assertUnlinked(final int aPk) throws Exception {
+        final Connection c = ds.getConnection();
+        final Statement s = c.createStatement();
+        final ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM Song WHERE performer_id = " + aPk);
         assertTrue(rs.next());
         assertEquals(0, rs.getInt(1));
         close(rs);
@@ -556,29 +556,29 @@ public class OneToManyTests extends Abst
     }
 
     private void resetDB() throws Exception {
-        Connection connection = ds.getConnection();
+        final Connection connection = ds.getConnection();
         Statement statement = null;
         try {
             statement = connection.createStatement();
 
             try {
                 statement.execute("DELETE FROM Artist");
-            } catch (SQLException ignored) {
+            } catch (final SQLException ignored) {
             }
             try {
                 statement.execute("DELETE FROM Song");
-            } catch (SQLException ignored) {
+            } catch (final SQLException ignored) {
             }
         } finally {
             close(statement);
             close(connection);
         }
 
-        ArtistLocal artist1 = createArtist(1);
+        final ArtistLocal artist1 = createArtist(1);
         createArtist(2);
 
-        SongLocal song1 = createSong(11);
-        SongLocal song2 = createSong(22);
+        final SongLocal song1 = createSong(11);
+        final SongLocal song2 = createSong(22);
 
         song1.setPerformer(artist1);
         song2.setPerformer(artist1);