openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mik...@apache.org
Subject svn commit: r757280 [10/23] - in /openjpa/branches/1.0.x: openjpa-examples/src/main/java/hellojpa/ openjpa-examples/src/main/java/relations/ openjpa-jdbc-5/src/main/java/org/apache/openjpa/jdbc/meta/strats/ openjpa-jdbc/src/main/java/org/apache/openjpa...
Date Sun, 22 Mar 2009 23:45:35 GMT
Propchange: openjpa/branches/1.0.x/openjpa-lib/src/main/java/org/apache/openjpa/lib/xml/XMLWriter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/TestConfigurationProviderPrefixes.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/TestConfigurations.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/TestXMLCaseConversions.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/TestXMLCaseConversions.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/TestXMLCaseConversions.java
(original)
+++ openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/TestXMLCaseConversions.java
Sun Mar 22 23:45:15 2009
@@ -1,63 +1,63 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.    
- */
-package org.apache.openjpa.lib.conf;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-
-import junit.framework.TestCase;
-
-
-public class TestXMLCaseConversions extends TestCase {
-
-    public void testToXMLName() {
-        assertEquals("easy-xml-conversion", 
-            ConfigurationImpl.toXMLName("easyXmlConversion"));
-        assertEquals("initial-caps", 
-            ConfigurationImpl.toXMLName("InitialCaps"));
-        assertEquals("nodash", 
-            ConfigurationImpl.toXMLName("nodash"));
-        assertEquals("anothernodash", 
-            ConfigurationImpl.toXMLName("Anothernodash"));
-        assertEquals("multiple-caps", 
-            ConfigurationImpl.toXMLName("MUltipleCaps"));
-        assertEquals("trailing-multi-caps", 
-            ConfigurationImpl.toXMLName("TrailingMultiCAPS"));
-        assertEquals("two-i-nner-caps", 
-            ConfigurationImpl.toXMLName("TwoINnerCaps"));
-        assertEquals("four-inn-er-caps", 
-            ConfigurationImpl.toXMLName("FourINNErCaps"));
-        assertEquals("inner-3-number", 
-            ConfigurationImpl.toXMLName("Inner3Number"));
-        assertEquals("inner-03-number", 
-            ConfigurationImpl.toXMLName("Inner03Number"));
-    }
-    
-    public static void main(String[] args) throws IOException {
-        BufferedReader r = new BufferedReader (new FileReader(new File(args[0])));
-        while (true) {
-            String s = r.readLine();
-            if (s == null)
-                break;
-            System.out.println(s + ": " + ConfigurationImpl.toXMLName(s));
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.openjpa.lib.conf;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+
+public class TestXMLCaseConversions extends TestCase {
+
+    public void testToXMLName() {
+        assertEquals("easy-xml-conversion", 
+            ConfigurationImpl.toXMLName("easyXmlConversion"));
+        assertEquals("initial-caps", 
+            ConfigurationImpl.toXMLName("InitialCaps"));
+        assertEquals("nodash", 
+            ConfigurationImpl.toXMLName("nodash"));
+        assertEquals("anothernodash", 
+            ConfigurationImpl.toXMLName("Anothernodash"));
+        assertEquals("multiple-caps", 
+            ConfigurationImpl.toXMLName("MUltipleCaps"));
+        assertEquals("trailing-multi-caps", 
+            ConfigurationImpl.toXMLName("TrailingMultiCAPS"));
+        assertEquals("two-i-nner-caps", 
+            ConfigurationImpl.toXMLName("TwoINnerCaps"));
+        assertEquals("four-inn-er-caps", 
+            ConfigurationImpl.toXMLName("FourINNErCaps"));
+        assertEquals("inner-3-number", 
+            ConfigurationImpl.toXMLName("Inner3Number"));
+        assertEquals("inner-03-number", 
+            ConfigurationImpl.toXMLName("Inner03Number"));
+    }
+    
+    public static void main(String[] args) throws IOException {
+        BufferedReader r = new BufferedReader (new FileReader(new File(args[0])));
+        while (true) {
+            String s = r.readLine();
+            if (s == null)
+                break;
+            System.out.println(s + ": " + ConfigurationImpl.toXMLName(s));
+        }
+    }
+}

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/TestXMLCaseConversions.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/test/ConfigurationTestProductDerivation.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/test/ConfigurationTestProductDerivation.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/test/ConfigurationTestProductDerivation.java
(original)
+++ openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/test/ConfigurationTestProductDerivation.java
Sun Mar 22 23:45:15 2009
@@ -1,109 +1,109 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.    
- */
-package org.apache.openjpa.lib.conf.test;
-
-import java.io.InputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.util.MissingResourceException;
-import java.util.Properties;
-
-import org.apache.openjpa.lib.conf.AbstractProductDerivation;
-import org.apache.openjpa.lib.conf.Configuration;
-import org.apache.openjpa.lib.conf.ConfigurationProvider;
-import org.apache.openjpa.lib.conf.MapConfigurationProvider;
-import org.apache.openjpa.lib.conf.ProductDerivation;
-
-/**
- * A Product Derivation to test loading of global and default configuration with
- * System settings.  Reads its global from a file specified by 
- * <code>"openjpatest.properties"</code> system property.
- *
- * @author Pinaki Poddar
- * @author Abe White
- */
-public class ConfigurationTestProductDerivation 
-    extends AbstractProductDerivation {
-    
-    public static boolean closed = false;
-
-    public int getType() {
-        return ProductDerivation.TYPE_PRODUCT;
-    }
-    
-    public void beforeConfigurationClose(Configuration conf) {
-        closed = true;
-    }
-
-    public ConfigurationProvider loadGlobals(ClassLoader loader)
-        throws IOException {
-        return load(null, loader);
-    }
-
-    public ConfigurationProvider load(String rsrc, ClassLoader loader)
-        throws IOException {
-        if (rsrc == null)
-            rsrc = System.getProperty("openjpatest.properties");
-        if (rsrc == null || !rsrc.endsWith(".properties"))
-            return null;
-
-        URL url = findResource(rsrc, loader);
-        if (url == null)
-            throw new MissingResourceException(rsrc, getClass().getName(), 
-                rsrc);
-
-        InputStream in = url.openStream();
-        Properties props = new Properties();
-        if (in != null) {
-            try {
-                props.load(in);
-                return new MapConfigurationProvider(props);
-            } finally {
-                try { in.close(); } catch (Exception e) {}
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Locate the given resource.
-     */
-    private URL findResource(String rsrc, ClassLoader loader)
-        throws IOException {
-        if (loader != null)
-            return loader.getResource(rsrc);
-
-        // in jbuilder the classloader can be null
-        URL url = null;
-        loader = getClass().getClassLoader();
-        if (loader != null)
-            url = loader.getResource(rsrc);
-        if (url == null) {
-            loader = Thread.currentThread().getContextClassLoader();
-            if (loader != null)
-                url = loader.getResource(rsrc);
-        }
-        if (url == null) {
-            loader = ClassLoader.getSystemClassLoader();
-            if (loader != null)
-                url = loader.getResource(rsrc);
-        }
-        return url;
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package org.apache.openjpa.lib.conf.test;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.MissingResourceException;
+import java.util.Properties;
+
+import org.apache.openjpa.lib.conf.AbstractProductDerivation;
+import org.apache.openjpa.lib.conf.Configuration;
+import org.apache.openjpa.lib.conf.ConfigurationProvider;
+import org.apache.openjpa.lib.conf.MapConfigurationProvider;
+import org.apache.openjpa.lib.conf.ProductDerivation;
+
+/**
+ * A Product Derivation to test loading of global and default configuration with
+ * System settings.  Reads its global from a file specified by 
+ * <code>"openjpatest.properties"</code> system property.
+ *
+ * @author Pinaki Poddar
+ * @author Abe White
+ */
+public class ConfigurationTestProductDerivation 
+    extends AbstractProductDerivation {
+    
+    public static boolean closed = false;
+
+    public int getType() {
+        return ProductDerivation.TYPE_PRODUCT;
+    }
+    
+    public void beforeConfigurationClose(Configuration conf) {
+        closed = true;
+    }
+
+    public ConfigurationProvider loadGlobals(ClassLoader loader)
+        throws IOException {
+        return load(null, loader);
+    }
+
+    public ConfigurationProvider load(String rsrc, ClassLoader loader)
+        throws IOException {
+        if (rsrc == null)
+            rsrc = System.getProperty("openjpatest.properties");
+        if (rsrc == null || !rsrc.endsWith(".properties"))
+            return null;
+
+        URL url = findResource(rsrc, loader);
+        if (url == null)
+            throw new MissingResourceException(rsrc, getClass().getName(), 
+                rsrc);
+
+        InputStream in = url.openStream();
+        Properties props = new Properties();
+        if (in != null) {
+            try {
+                props.load(in);
+                return new MapConfigurationProvider(props);
+            } finally {
+                try { in.close(); } catch (Exception e) {}
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Locate the given resource.
+     */
+    private URL findResource(String rsrc, ClassLoader loader)
+        throws IOException {
+        if (loader != null)
+            return loader.getResource(rsrc);
+
+        // in jbuilder the classloader can be null
+        URL url = null;
+        loader = getClass().getClassLoader();
+        if (loader != null)
+            url = loader.getResource(rsrc);
+        if (url == null) {
+            loader = Thread.currentThread().getContextClassLoader();
+            if (loader != null)
+                url = loader.getResource(rsrc);
+        }
+        if (url == null) {
+            loader = ClassLoader.getSystemClassLoader();
+            if (loader != null)
+                url = loader.getResource(rsrc);
+        }
+        return url;
+    }
+}

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/test/ConfigurationTestProductDerivation.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/test/TestConfigurationImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/conf/test/TestPluginValue.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/TestDepthFirstAnalysis.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/TestDepthFirstAnalysis.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/TestDepthFirstAnalysis.java
(original)
+++ openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/TestDepthFirstAnalysis.java
Sun Mar 22 23:45:15 2009
@@ -1,152 +1,152 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openjpa.lib.graph;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.openjpa.lib.test.AbstractTestCase;
-
-/**
- * <p>Tests the {@link DepthFirstAnalysis} type.</p>
- *
- * @author Abe White
- */
-public class TestDepthFirstAnalysis
-    extends AbstractTestCase {
-
-    private DepthFirstAnalysis _dfa = null;
-
-    public void setUp() {
-        setUpGraph1();   
-    }
-    
-    public void setUpGraph1() {
-        Graph graph = new Graph();
-        Object node1 = new Object();
-        Object node2 = new Object();
-        Object node3 = new Object();
-        Object node4 = new Object();
-        graph.addNode(node1);
-        graph.addNode(node2);
-        graph.addNode(node3);
-        graph.addNode(node4);
-        graph.addEdge(new Edge(node1, node2, true));
-        graph.addEdge(new Edge(node2, node3, true));
-        graph.addEdge(new Edge(node3, node1, true));
-        graph.addEdge(new Edge(node3, node4, true));
-        graph.addEdge(new Edge(node2, node2, true));
-        _dfa = new DepthFirstAnalysis(graph);
-    }
-
-    public void setUpGraph2() {
-        Graph graph = new Graph();
-        Integer node1 = new Integer(1);
-        Integer node2 = new Integer(2);
-        Integer node3 = new Integer(3);
-        Integer node4 = new Integer(4);
-        Integer node5 = new Integer(5);
-        graph.addNode(node2);  // has to be first node for testcase
-        graph.addNode(node5);
-        graph.addNode(node4);
-        graph.addNode(node3);
-        graph.addNode(node1);
-        graph.addEdge(new Edge(node5, node4, true));
-        graph.addEdge(new Edge(node4, node3, true));
-        graph.addEdge(new Edge(node3, node3, true));
-        graph.addEdge(new Edge(node3, node2, true));
-        graph.addEdge(new Edge(node2, node5, true));
-        graph.addEdge(new Edge(node2, node4, true));
-        graph.addEdge(new Edge(node1, node4, true));
-        _dfa = new DepthFirstAnalysis(graph);
-    }
-
-    public void testNodeSorting() {
-        Collection nodes = _dfa.getSortedNodes();
-        assertEquals(4, nodes.size());
-
-        int time = 0;
-        Object node;
-        for (Iterator itr = nodes.iterator(); itr.hasNext();) {
-            node = itr.next();
-            assertTrue(time <= _dfa.getFinishedTime(node));
-            time = _dfa.getFinishedTime(node);
-        }
-    }
-
-    public void testEdgeTyping() {
-        Collection edges = _dfa.getEdges(Edge.TYPE_BACK);
-        assertEquals(2, edges.size());
-        Iterator itr = edges.iterator();
-        Edge edge0 = (Edge) itr.next();
-        Edge edge1 = (Edge) itr.next();
-        assertTrue((edge0.getTo().equals(edge0.getFrom()))
-                || edge1.getTo().equals(edge1.getFrom()));
-    }
-
-    public void testBackEdges() {
-        setUpGraph2();
-        Collection edges = _dfa.getEdges(Edge.TYPE_BACK);
-        assertEquals(2, edges.size());
-        Iterator itr = edges.iterator();
-        Edge edge0 = (Edge) itr.next();
-        Edge edge1 = (Edge) itr.next();
-        if (edge0.getTo().equals(edge0.getFrom())) {
-            assertTrue(edge0.getCycle() != null && edge0.getCycle().size() == 1);
-            List cycle = edge1.getCycle();
-            assertTrue(cycle != null && cycle.size() == 4);
-            assertTrue(((Edge)cycle.get(0)).getFrom().equals(((Edge)cycle.get(3)).getTo()));
-        } else if (edge1.getTo().equals(edge1.getFrom())) {
-            assertTrue(edge1.getCycle() != null && edge1.getCycle().size() == 1);
           
-            assertTrue(edge1 == edge1.getCycle());
-            List cycle = edge0.getCycle();
-            assertTrue(cycle != null && cycle.size() == 4);
-            assertTrue(((Edge)cycle.get(0)).getFrom().equals(((Edge)cycle.get(3)).getTo()));
-        } else {
-            // should not happen
-            assertFalse(true);
-        }
-    }
-    
-    public void testForwardEdges() {
-        setUpGraph2();
-        Collection edges = _dfa.getEdges(Edge.TYPE_FORWARD);
-        assertEquals(2, edges.size());
-        Iterator itr = edges.iterator();
-        Edge edge0 = (Edge) itr.next();
-        Edge edge1 = (Edge) itr.next();
-        if (edge0.getCycle() == null) {
-            List cycle = edge1.getCycle();
-            assertTrue(cycle != null && cycle.size() == 3);
-            assertTrue(((Edge)cycle.get(0)).getFrom().equals(((Edge)cycle.get(2)).getTo()));
-        } else if (edge1.getCycle() == null) {
-            List cycle = edge0.getCycle();
-            assertTrue(cycle != null && cycle.size() == 3);
-            assertTrue(((Edge)cycle.get(0)).getFrom().equals(((Edge)cycle.get(2)).getTo()));
-        } else {
-            // should not happen
-            assertFalse(true);
-        }
-    }
-    
-    public static void main(String[] args) {
-        main(TestDepthFirstAnalysis.class);
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.lib.graph;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.openjpa.lib.test.AbstractTestCase;
+
+/**
+ * <p>Tests the {@link DepthFirstAnalysis} type.</p>
+ *
+ * @author Abe White
+ */
+public class TestDepthFirstAnalysis
+    extends AbstractTestCase {
+
+    private DepthFirstAnalysis _dfa = null;
+
+    public void setUp() {
+        setUpGraph1();   
+    }
+    
+    public void setUpGraph1() {
+        Graph graph = new Graph();
+        Object node1 = new Object();
+        Object node2 = new Object();
+        Object node3 = new Object();
+        Object node4 = new Object();
+        graph.addNode(node1);
+        graph.addNode(node2);
+        graph.addNode(node3);
+        graph.addNode(node4);
+        graph.addEdge(new Edge(node1, node2, true));
+        graph.addEdge(new Edge(node2, node3, true));
+        graph.addEdge(new Edge(node3, node1, true));
+        graph.addEdge(new Edge(node3, node4, true));
+        graph.addEdge(new Edge(node2, node2, true));
+        _dfa = new DepthFirstAnalysis(graph);
+    }
+
+    public void setUpGraph2() {
+        Graph graph = new Graph();
+        Integer node1 = new Integer(1);
+        Integer node2 = new Integer(2);
+        Integer node3 = new Integer(3);
+        Integer node4 = new Integer(4);
+        Integer node5 = new Integer(5);
+        graph.addNode(node2);  // has to be first node for testcase
+        graph.addNode(node5);
+        graph.addNode(node4);
+        graph.addNode(node3);
+        graph.addNode(node1);
+        graph.addEdge(new Edge(node5, node4, true));
+        graph.addEdge(new Edge(node4, node3, true));
+        graph.addEdge(new Edge(node3, node3, true));
+        graph.addEdge(new Edge(node3, node2, true));
+        graph.addEdge(new Edge(node2, node5, true));
+        graph.addEdge(new Edge(node2, node4, true));
+        graph.addEdge(new Edge(node1, node4, true));
+        _dfa = new DepthFirstAnalysis(graph);
+    }
+
+    public void testNodeSorting() {
+        Collection nodes = _dfa.getSortedNodes();
+        assertEquals(4, nodes.size());
+
+        int time = 0;
+        Object node;
+        for (Iterator itr = nodes.iterator(); itr.hasNext();) {
+            node = itr.next();
+            assertTrue(time <= _dfa.getFinishedTime(node));
+            time = _dfa.getFinishedTime(node);
+        }
+    }
+
+    public void testEdgeTyping() {
+        Collection edges = _dfa.getEdges(Edge.TYPE_BACK);
+        assertEquals(2, edges.size());
+        Iterator itr = edges.iterator();
+        Edge edge0 = (Edge) itr.next();
+        Edge edge1 = (Edge) itr.next();
+        assertTrue((edge0.getTo().equals(edge0.getFrom()))
+                || edge1.getTo().equals(edge1.getFrom()));
+    }
+
+    public void testBackEdges() {
+        setUpGraph2();
+        Collection edges = _dfa.getEdges(Edge.TYPE_BACK);
+        assertEquals(2, edges.size());
+        Iterator itr = edges.iterator();
+        Edge edge0 = (Edge) itr.next();
+        Edge edge1 = (Edge) itr.next();
+        if (edge0.getTo().equals(edge0.getFrom())) {
+            assertTrue(edge0.getCycle() != null && edge0.getCycle().size() == 1);
+            List cycle = edge1.getCycle();
+            assertTrue(cycle != null && cycle.size() == 4);
+            assertTrue(((Edge)cycle.get(0)).getFrom().equals(((Edge)cycle.get(3)).getTo()));
+        } else if (edge1.getTo().equals(edge1.getFrom())) {
+            assertTrue(edge1.getCycle() != null && edge1.getCycle().size() == 1);
           
+            assertTrue(edge1 == edge1.getCycle());
+            List cycle = edge0.getCycle();
+            assertTrue(cycle != null && cycle.size() == 4);
+            assertTrue(((Edge)cycle.get(0)).getFrom().equals(((Edge)cycle.get(3)).getTo()));
+        } else {
+            // should not happen
+            assertFalse(true);
+        }
+    }
+    
+    public void testForwardEdges() {
+        setUpGraph2();
+        Collection edges = _dfa.getEdges(Edge.TYPE_FORWARD);
+        assertEquals(2, edges.size());
+        Iterator itr = edges.iterator();
+        Edge edge0 = (Edge) itr.next();
+        Edge edge1 = (Edge) itr.next();
+        if (edge0.getCycle() == null) {
+            List cycle = edge1.getCycle();
+            assertTrue(cycle != null && cycle.size() == 3);
+            assertTrue(((Edge)cycle.get(0)).getFrom().equals(((Edge)cycle.get(2)).getTo()));
+        } else if (edge1.getCycle() == null) {
+            List cycle = edge0.getCycle();
+            assertTrue(cycle != null && cycle.size() == 3);
+            assertTrue(((Edge)cycle.get(0)).getFrom().equals(((Edge)cycle.get(2)).getTo()));
+        } else {
+            // should not happen
+            assertFalse(true);
+        }
+    }
+    
+    public static void main(String[] args) {
+        main(TestDepthFirstAnalysis.class);
+    }
+}

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/TestDepthFirstAnalysis.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/TestGraph.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/TestGraph.java?rev=757280&r1=757279&r2=757280&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/TestGraph.java
(original)
+++ openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/TestGraph.java
Sun Mar 22 23:45:15 2009
@@ -1,148 +1,148 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.openjpa.lib.graph;
-
-import java.util.Collection;
-import java.util.Iterator;
-
-import org.apache.openjpa.lib.test.AbstractTestCase;
-
-/**
- * <p>Tests the {@link Graph} type, and in so doing implicitly tests the
- * {@link Edge} as well.</p>
- *
- * @author Abe White
- */
-public class TestGraph
-    extends AbstractTestCase {
-
-    private Graph _graph = new Graph();
-    private Object _node1 = new Object();
-    private Object _node2 = new Object();
-    private Object _node3 = new Object();
-    private Edge _edge1 = new Edge(_node1, _node2, true);
-    private Edge _edge2 = new Edge(_node2, _node3, true);
-    private Edge _edge3 = new Edge(_node1, _node3, false);
-    private Edge _edge4 = new Edge(_node2, _node2, false);
-
-    public void setUp() {
-        _graph.addNode(_node1);
-        _graph.addNode(_node2);
-        _graph.addNode(_node3);
-        _graph.addEdge(_edge1);
-        _graph.addEdge(_edge2);
-        _graph.addEdge(_edge3);
-        _graph.addEdge(_edge4);
-    }
-
-    /**
-     * Tests adding and retrieving nodes and edges.
-     */
-    public void testAddRetrieve() {
-        assertEquals(3, _graph.getNodes().size());
-        assertEquals(4, _graph.getEdges().size());
-
-        Collection edges = _graph.getEdgesFrom(_node1);
-        assertEquals(2, edges.size());
-        Iterator itr = edges.iterator();
-        Edge edge0 = (Edge) itr.next();
-        Edge edge1 = (Edge) itr.next();
-        assertTrue((edge0 == _edge1 && edge1 == _edge3)
-            || (edge0 == _edge3 && edge1 == _edge1));
-
-        edges = _graph.getEdgesTo(_node1);
-        assertEquals(1, edges.size());
-        assertEquals(_edge3, edges.iterator().next());
-
-        edges = _graph.getEdges(_node1, _node3);
-        assertEquals(1, edges.size());
-        assertEquals(_edge3, edges.iterator().next());
-        edges = _graph.getEdges(_node3, _node1);
-        assertEquals(1, edges.size());
-        assertEquals(_edge3, edges.iterator().next());
-
-        edges = _graph.getEdgesFrom(_node2);
-        assertEquals(2, edges.size());
-        itr = edges.iterator();
-        edge0 = (Edge) itr.next();
-        edge1 = (Edge) itr.next();
-        assertTrue((edge0 == _edge2 && edge1 == _edge4)
-            || (edge0 == _edge4 && edge1 == _edge2));
-
-        edges = _graph.getEdgesTo(_node2);
-        assertEquals(2, edges.size());
-        itr = edges.iterator();
-        edge0 = (Edge) itr.next();
-        edge1 = (Edge) itr.next();
-        assertTrue((edge0 == _edge1 && edge1 == _edge4)
-            || (edge0 == _edge4 && edge1 == _edge1));
-
-        edges = _graph.getEdges(_node2, _node2);
-        assertEquals(1, edges.size());
-        assertEquals(_edge4, edges.iterator().next());
-
-        edges = _graph.getEdgesFrom(_node3);
-        assertEquals(1, edges.size());
-        assertEquals(_edge3, edges.iterator().next());
-    }
-
-    /**
-     * Test removing edges.
-     */
-    public void testRemoveEdges() {
-        assertTrue(_graph.removeEdge(_edge2));
-        Collection edges = _graph.getEdgesFrom(_node2);
-        assertEquals(1, edges.size());
-        assertEquals(_edge4, edges.iterator().next());
-
-        assertTrue(_graph.removeEdge(_edge3));
-        edges = _graph.getEdgesFrom(_node1);
-        assertEquals(1, edges.size());
-        assertEquals(_edge1, edges.iterator().next());
-        edges = _graph.getEdgesTo(_node1);
-        assertEquals(0, edges.size());
-        edges = _graph.getEdgesTo(_node3);
-        assertEquals(0, edges.size());
-        edges = _graph.getEdgesFrom(_node3);
-        assertEquals(0, edges.size());
-    }
-
-    /**
-     * Test removing nodes.
-     */
-    public void testRemoveNodes() {
-        assertTrue(_graph.removeNode(_node3));
-        Collection edges = _graph.getEdges();
-        assertEquals(2, edges.size());
-        Iterator itr = edges.iterator();
-        Edge edge0 = (Edge) itr.next();
-        Edge edge1 = (Edge) itr.next();
-        assertTrue((edge0 == _edge1 && edge1 == _edge4)
-            || (edge0 == _edge4 && edge1 == _edge1));
-        edges = _graph.getEdgesFrom(_node1);
-        assertEquals(1, edges.size());
-        assertEquals(_edge1, edges.iterator().next());
-        edges = _graph.getEdgesTo(_node1);
-        assertEquals(0, edges.size());
-    }
-
-    public static void main(String[] args) {
-        main(TestGraph.class);
-	}
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.openjpa.lib.graph;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.apache.openjpa.lib.test.AbstractTestCase;
+
+/**
+ * <p>Tests the {@link Graph} type, and in so doing implicitly tests the
+ * {@link Edge} as well.</p>
+ *
+ * @author Abe White
+ */
+public class TestGraph
+    extends AbstractTestCase {
+
+    private Graph _graph = new Graph();
+    private Object _node1 = new Object();
+    private Object _node2 = new Object();
+    private Object _node3 = new Object();
+    private Edge _edge1 = new Edge(_node1, _node2, true);
+    private Edge _edge2 = new Edge(_node2, _node3, true);
+    private Edge _edge3 = new Edge(_node1, _node3, false);
+    private Edge _edge4 = new Edge(_node2, _node2, false);
+
+    public void setUp() {
+        _graph.addNode(_node1);
+        _graph.addNode(_node2);
+        _graph.addNode(_node3);
+        _graph.addEdge(_edge1);
+        _graph.addEdge(_edge2);
+        _graph.addEdge(_edge3);
+        _graph.addEdge(_edge4);
+    }
+
+    /**
+     * Tests adding and retrieving nodes and edges.
+     */
+    public void testAddRetrieve() {
+        assertEquals(3, _graph.getNodes().size());
+        assertEquals(4, _graph.getEdges().size());
+
+        Collection edges = _graph.getEdgesFrom(_node1);
+        assertEquals(2, edges.size());
+        Iterator itr = edges.iterator();
+        Edge edge0 = (Edge) itr.next();
+        Edge edge1 = (Edge) itr.next();
+        assertTrue((edge0 == _edge1 && edge1 == _edge3)
+            || (edge0 == _edge3 && edge1 == _edge1));
+
+        edges = _graph.getEdgesTo(_node1);
+        assertEquals(1, edges.size());
+        assertEquals(_edge3, edges.iterator().next());
+
+        edges = _graph.getEdges(_node1, _node3);
+        assertEquals(1, edges.size());
+        assertEquals(_edge3, edges.iterator().next());
+        edges = _graph.getEdges(_node3, _node1);
+        assertEquals(1, edges.size());
+        assertEquals(_edge3, edges.iterator().next());
+
+        edges = _graph.getEdgesFrom(_node2);
+        assertEquals(2, edges.size());
+        itr = edges.iterator();
+        edge0 = (Edge) itr.next();
+        edge1 = (Edge) itr.next();
+        assertTrue((edge0 == _edge2 && edge1 == _edge4)
+            || (edge0 == _edge4 && edge1 == _edge2));
+
+        edges = _graph.getEdgesTo(_node2);
+        assertEquals(2, edges.size());
+        itr = edges.iterator();
+        edge0 = (Edge) itr.next();
+        edge1 = (Edge) itr.next();
+        assertTrue((edge0 == _edge1 && edge1 == _edge4)
+            || (edge0 == _edge4 && edge1 == _edge1));
+
+        edges = _graph.getEdges(_node2, _node2);
+        assertEquals(1, edges.size());
+        assertEquals(_edge4, edges.iterator().next());
+
+        edges = _graph.getEdgesFrom(_node3);
+        assertEquals(1, edges.size());
+        assertEquals(_edge3, edges.iterator().next());
+    }
+
+    /**
+     * Test removing edges.
+     */
+    public void testRemoveEdges() {
+        assertTrue(_graph.removeEdge(_edge2));
+        Collection edges = _graph.getEdgesFrom(_node2);
+        assertEquals(1, edges.size());
+        assertEquals(_edge4, edges.iterator().next());
+
+        assertTrue(_graph.removeEdge(_edge3));
+        edges = _graph.getEdgesFrom(_node1);
+        assertEquals(1, edges.size());
+        assertEquals(_edge1, edges.iterator().next());
+        edges = _graph.getEdgesTo(_node1);
+        assertEquals(0, edges.size());
+        edges = _graph.getEdgesTo(_node3);
+        assertEquals(0, edges.size());
+        edges = _graph.getEdgesFrom(_node3);
+        assertEquals(0, edges.size());
+    }
+
+    /**
+     * Test removing nodes.
+     */
+    public void testRemoveNodes() {
+        assertTrue(_graph.removeNode(_node3));
+        Collection edges = _graph.getEdges();
+        assertEquals(2, edges.size());
+        Iterator itr = edges.iterator();
+        Edge edge0 = (Edge) itr.next();
+        Edge edge1 = (Edge) itr.next();
+        assertTrue((edge0 == _edge1 && edge1 == _edge4)
+            || (edge0 == _edge4 && edge1 == _edge1));
+        edges = _graph.getEdgesFrom(_node1);
+        assertEquals(1, edges.size());
+        assertEquals(_edge1, edges.iterator().next());
+        edges = _graph.getEdgesTo(_node1);
+        assertEquals(0, edges.size());
+    }
+
+    public static void main(String[] args) {
+        main(TestGraph.class);
+	}
+}

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/graph/TestGraph.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/rop/ResultListTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/rop/TestEagerResultList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/rop/TestLazyForwardResultList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/rop/TestListResultList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/rop/TestMergedResultObjectProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/rop/TestOrderedMergedResultObjectProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/rop/TestRandomAccessResultList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/rop/TestRangeResultObjectProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/rop/TestSimpleResultList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/rop/TestSoftRandomAccessResultList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: openjpa/branches/1.0.x/openjpa-lib/src/test/java/org/apache/openjpa/lib/rop/TestWindowResultList.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message