openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dwo...@apache.org
Subject svn commit: r813990 - in /openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations: MapKeyChild.java MapKeyParent.java TestParallelEagerMap.java
Date Fri, 11 Sep 2009 19:27:09 GMT
Author: dwoods
Date: Fri Sep 11 19:27:08 2009
New Revision: 813990

URL: http://svn.apache.org/viewvc?rev=813990&view=rev
Log:
OPENJPA-1184 apply source formatting to new files

Modified:
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/MapKeyChild.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/MapKeyParent.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestParallelEagerMap.java

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/MapKeyChild.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/MapKeyChild.java?rev=813990&r1=813989&r2=813990&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/MapKeyChild.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/MapKeyChild.java
Fri Sep 11 19:27:08 2009
@@ -21,10 +21,8 @@
 import java.io.Serializable;
 
 import javax.persistence.Basic;
-import javax.persistence.CascadeType;
 import javax.persistence.Column;
 import javax.persistence.Entity;
-import javax.persistence.FetchType;
 import javax.persistence.GeneratedValue;
 import javax.persistence.Id;
 import javax.persistence.JoinColumn;
@@ -38,30 +36,30 @@
     private long id;
 
     @Basic
-    @Column(length=32)
+    @Column(length = 32)
     private String mapKey;
 
-	@ManyToOne
-	@JoinColumn
+    @ManyToOne
+    @JoinColumn
     private MapKeyParent parent;
 
-    public long getId() { 
-        return id; 
+    public long getId() {
+        return id;
+    }
+
+    public MapKeyParent getParent() {
+        return this.parent;
+    }
+
+    public void setParent(MapKeyParent parent) {
+        this.parent = parent;
+    }
+
+    public String getMapKey() {
+        return this.mapKey;
+    }
+
+    public void setMapKey(String mapKey) {
+        this.mapKey = mapKey;
     }
-    
-	public MapKeyParent getParent() {
-		return this.parent;
-	}
-
-	public void setParent(MapKeyParent parent) {
-		this.parent = parent;
-	}
-
-	public String getMapKey() {
-		return this.mapKey;
-	}
-
-	public void setMapKey(String mapKey) {
-		this.mapKey = mapKey;
-	}
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/MapKeyParent.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/MapKeyParent.java?rev=813990&r1=813989&r2=813990&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/MapKeyParent.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/MapKeyParent.java
Fri Sep 11 19:27:08 2009
@@ -29,7 +29,6 @@
 import javax.persistence.MapKey;
 import javax.persistence.OneToMany;
 
-
 @Entity
 public class MapKeyParent implements Serializable {
 
@@ -37,22 +36,20 @@
     @GeneratedValue
     private long id;
 
-	@OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, 
-			fetch=FetchType.EAGER)
-	@MapKey(name = "mapKey")
-    private Map<String,MapKeyChild> children;
+    @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
+    @MapKey(name = "mapKey")
+    private Map<String, MapKeyChild> children;
 
+    public long getId() {
+        return id;
+    }
 
-    public long getId() { 
-        return id; 
+    public Map<String, MapKeyChild> getChildren() {
+        return this.children;
     }
 
-	public Map<String, MapKeyChild> getChildren() {
-		return this.children;
-	}
-
-	public void setChildren(Map<String, MapKeyChild> children) {
-		this.children = children;
-	}
+    public void setChildren(Map<String, MapKeyChild> children) {
+        this.children = children;
+    }
 
 }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestParallelEagerMap.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestParallelEagerMap.java?rev=813990&r1=813989&r2=813990&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestParallelEagerMap.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/relations/TestParallelEagerMap.java
Fri Sep 11 19:27:08 2009
@@ -24,44 +24,45 @@
 import org.apache.openjpa.persistence.OpenJPAEntityManager;
 import org.apache.openjpa.persistence.test.SingleEMFTestCase;
 
-public class TestParallelEagerMap
-    extends SingleEMFTestCase {
+public class TestParallelEagerMap extends SingleEMFTestCase {
 
     public void setUp() {
-    	super.setUp(CLEAR_TABLES, MapKeyParent.class, MapKeyChild.class,
-    			"openjpa.jdbc.EagerFetchMode", "parallel");
+        super.setUp(CLEAR_TABLES, MapKeyParent.class, MapKeyChild.class,
+            "openjpa.jdbc.EagerFetchMode", "parallel");
     }
 
     public void testParentNotNull() {
-    	
-    	MapKeyParent[] parents = { new MapKeyParent(), new MapKeyParent() };
-    	for( MapKeyParent parent : parents ) {
-	    	Map<String,MapKeyChild> children = new HashMap<String,MapKeyChild>();
-	    	for(String key : new String[]{"childA"}) {
-	    		MapKeyChild child = new MapKeyChild();
-	    		child.setParent(parent);
-	    		child.setMapKey(key);
-	    		children.put(key, child);
-	    	}
-	    	parent.setChildren(children);
-    	}
-    	
-    	OpenJPAEntityManager em = emf.createEntityManager();
-    	em.getTransaction().begin();
-    	for(MapKeyParent parent : parents) {
-    		em.persist(parent);
-    	}
-    	em.getTransaction().commit();
-    	em.close();
-    	
-    	em = emf.createEntityManager();
-    	MapKeyParent parent2 = (MapKeyParent)em.createQuery(
-    			"SELECT p FROM MapKeyParent p WHERE p.id=" + parents[0].getId() + 
-    			" OR p.id=" + parents[1].getId()).getResultList().get(1);
-    	em.close();
-    	
-    	for(MapKeyChild child : parent2.getChildren().values()) {
-    		assertNotNull("Parent should not be null", child.getParent());
-    	}
+
+        MapKeyParent[] parents = { new MapKeyParent(), new MapKeyParent() };
+        for (MapKeyParent parent : parents) {
+            Map<String, MapKeyChild> children =
+                new HashMap<String, MapKeyChild>();
+            for (String key : new String[] { "childA" }) {
+                MapKeyChild child = new MapKeyChild();
+                child.setParent(parent);
+                child.setMapKey(key);
+                children.put(key, child);
+            }
+            parent.setChildren(children);
+        }
+
+        OpenJPAEntityManager em = emf.createEntityManager();
+        em.getTransaction().begin();
+        for (MapKeyParent parent : parents) {
+            em.persist(parent);
+        }
+        em.getTransaction().commit();
+        em.close();
+
+        em = emf.createEntityManager();
+        MapKeyParent parent2 =
+            (MapKeyParent) em.createQuery(
+                "SELECT p FROM MapKeyParent p WHERE p.id=" + parents[0].getId()
+                    + " OR p.id=" + parents[1].getId()).getResultList().get(1);
+        em.close();
+
+        for (MapKeyChild child : parent2.getChildren().values()) {
+            assertNotNull("Parent should not be null", child.getParent());
+        }
     }
 }



Mime
View raw message