commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From marcospera...@apache.org
Subject svn commit: r1328639 - in /commons/sandbox/graph/trunk/src: main/java/org/apache/commons/graph/ main/java/org/apache/commons/graph/flow/ main/java/org/apache/commons/graph/weight/ main/java/org/apache/commons/graph/weight/primitive/ test/java/org/apach...
Date Sat, 21 Apr 2012 12:02:04 GMT
Author: marcosperanza
Date: Sat Apr 21 12:02:03 2012
New Revision: 1328639

URL: http://svn.apache.org/viewvc?rev=1328639&view=rev
Log:
[SANDBOX-386] Make Graph components Serializable

Added:
    commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/GraphSerializationTestCase.java
  (with props)
Modified:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Mapper.java
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/VertexPair.java
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/DefaultMaxFlowAlgorithmSelector.java
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/Monoid.java
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigDecimalWeightBaseOperations.java
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigIntegerWeightBaseOperations.java
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/DoubleWeightBaseOperations.java
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/FloatWeightBaseOperations.java
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/IntegerWeightBaseOperations.java
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/LongWeightBaseOperations.java
    commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledEdge.java
    commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledVertex.java
    commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledWeightedEdge.java
    commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseWeightedEdge.java

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Mapper.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Mapper.java?rev=1328639&r1=1328638&r2=1328639&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Mapper.java (original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Mapper.java Sat Apr
21 12:02:03 2012
@@ -1,5 +1,7 @@
 package org.apache.commons.graph;
 
+import java.io.Serializable;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -19,7 +21,7 @@ package org.apache.commons.graph;
  * under the License.
  */
 
-public interface Mapper<I, O>
+public interface Mapper<I, O> extends Serializable
 {
 
     O map( I input );

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/VertexPair.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/VertexPair.java?rev=1328639&r1=1328638&r2=1328639&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/VertexPair.java (original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/VertexPair.java Sat
Apr 21 12:02:03 2012
@@ -22,13 +22,16 @@ package org.apache.commons.graph;
 import static java.lang.String.format;
 import static org.apache.commons.graph.utils.Assertions.checkNotNull;
 
+import java.io.Serializable;
+
 /**
  * Indicates a {@link Vertex} pair.
  *
  * @param <V> the Graph vertices type
  */
-public final class VertexPair<V>
+public final class VertexPair<V> implements Serializable
 {
+    private static final long serialVersionUID = 2333503391707156055L;
 
     /** The head vertex. */
     private final V head;

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/DefaultMaxFlowAlgorithmSelector.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/DefaultMaxFlowAlgorithmSelector.java?rev=1328639&r1=1328638&r2=1328639&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/DefaultMaxFlowAlgorithmSelector.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/DefaultMaxFlowAlgorithmSelector.java
Sat Apr 21 12:02:03 2012
@@ -167,6 +167,7 @@ final class DefaultMaxFlowAlgorithmSelec
 
     }
 
+    @SuppressWarnings( "serial" ) //the algorithm isn't serializable.
     private static final class MapperWrapper<WE, W, WO extends OrderedMonoid<W>>
         implements Mapper<EdgeWrapper<WE>, W>
     {

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/Monoid.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/Monoid.java?rev=1328639&r1=1328638&r2=1328639&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/Monoid.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/Monoid.java
Sat Apr 21 12:02:03 2012
@@ -1,5 +1,7 @@
 package org.apache.commons.graph.weight;
 
+import java.io.Serializable;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -24,7 +26,7 @@ package org.apache.commons.graph.weight;
  *
  * @param <E> the type of the elements in the {@link Monoid}
  */
-public interface Monoid<E>
+public interface Monoid<E> extends Serializable
 {
 
     /**

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigDecimalWeightBaseOperations.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigDecimalWeightBaseOperations.java?rev=1328639&r1=1328638&r2=1328639&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigDecimalWeightBaseOperations.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigDecimalWeightBaseOperations.java
Sat Apr 21 12:02:03 2012
@@ -33,6 +33,8 @@ public class BigDecimalWeightBaseOperati
     implements OrderedMonoid<BigDecimal>
 {
 
+    private static final long serialVersionUID = -317234195461348466L;
+
     /**
      * {@inheritDoc}
      */

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigIntegerWeightBaseOperations.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigIntegerWeightBaseOperations.java?rev=1328639&r1=1328638&r2=1328639&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigIntegerWeightBaseOperations.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/BigIntegerWeightBaseOperations.java
Sat Apr 21 12:02:03 2012
@@ -33,6 +33,8 @@ public class BigIntegerWeightBaseOperati
     implements OrderedMonoid<BigInteger>
 {
 
+    private static final long serialVersionUID = 4118152508299694652L;
+
     /**
      * {@inheritDoc}
      */

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/DoubleWeightBaseOperations.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/DoubleWeightBaseOperations.java?rev=1328639&r1=1328638&r2=1328639&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/DoubleWeightBaseOperations.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/DoubleWeightBaseOperations.java
Sat Apr 21 12:02:03 2012
@@ -28,6 +28,7 @@ import org.apache.commons.graph.weight.O
 public class DoubleWeightBaseOperations
     implements OrderedMonoid<Double>
 {
+    private static final long serialVersionUID = 4440399710792243877L;
 
     /**
      * {@inheritDoc}

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/FloatWeightBaseOperations.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/FloatWeightBaseOperations.java?rev=1328639&r1=1328638&r2=1328639&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/FloatWeightBaseOperations.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/FloatWeightBaseOperations.java
Sat Apr 21 12:02:03 2012
@@ -29,6 +29,8 @@ public class FloatWeightBaseOperations
     implements OrderedMonoid<Float>
 {
 
+    private static final long serialVersionUID = 8542498901286671169L;
+
     /**
      * {@inheritDoc}
      */

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/IntegerWeightBaseOperations.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/IntegerWeightBaseOperations.java?rev=1328639&r1=1328638&r2=1328639&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/IntegerWeightBaseOperations.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/IntegerWeightBaseOperations.java
Sat Apr 21 12:02:03 2012
@@ -29,6 +29,8 @@ public class IntegerWeightBaseOperations
     implements OrderedMonoid<Integer>
 {
 
+    private static final long serialVersionUID = -8641477350652350485L;
+
     /**
      * {@inheritDoc}
      */

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/LongWeightBaseOperations.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/LongWeightBaseOperations.java?rev=1328639&r1=1328638&r2=1328639&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/LongWeightBaseOperations.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/weight/primitive/LongWeightBaseOperations.java
Sat Apr 21 12:02:03 2012
@@ -29,6 +29,8 @@ public class LongWeightBaseOperations
     implements OrderedMonoid<Long>
 {
 
+    private static final long serialVersionUID = 3149327896191098756L;
+
     /**
      * {@inheritDoc}
      */

Modified: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledEdge.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledEdge.java?rev=1328639&r1=1328638&r2=1328639&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledEdge.java
(original)
+++ commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledEdge.java
Sat Apr 21 12:02:03 2012
@@ -22,9 +22,12 @@ package org.apache.commons.graph.model;
 import static java.lang.String.format;
 import static org.apache.commons.graph.utils.Assertions.checkNotNull;
 
-public class BaseLabeledEdge
+import java.io.Serializable;
+
+public class BaseLabeledEdge implements Serializable
 {
 
+    private static final long serialVersionUID = -4985890761880816592L;
     private final String label;
 
     public BaseLabeledEdge( String label )

Modified: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledVertex.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledVertex.java?rev=1328639&r1=1328638&r2=1328639&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledVertex.java
(original)
+++ commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledVertex.java
Sat Apr 21 12:02:03 2012
@@ -22,9 +22,12 @@ package org.apache.commons.graph.model;
 import static java.lang.String.format;
 import static org.apache.commons.graph.utils.Assertions.checkNotNull;
 
-public class BaseLabeledVertex
+import java.io.Serializable;
+
+public class BaseLabeledVertex implements Serializable
 {
 
+    private static final long serialVersionUID = -5167021719818162490L;
     private final String label;
 
     public BaseLabeledVertex( String label )

Modified: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledWeightedEdge.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledWeightedEdge.java?rev=1328639&r1=1328638&r2=1328639&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledWeightedEdge.java
(original)
+++ commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseLabeledWeightedEdge.java
Sat Apr 21 12:02:03 2012
@@ -29,6 +29,8 @@ public class BaseLabeledWeightedEdge<W>
     extends BaseLabeledEdge
 {
 
+    private static final long serialVersionUID = 5935967858178091436L;
+
     private final W weight;
 
     public BaseLabeledWeightedEdge( String label, W weight )

Modified: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseWeightedEdge.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseWeightedEdge.java?rev=1328639&r1=1328638&r2=1328639&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseWeightedEdge.java
(original)
+++ commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/BaseWeightedEdge.java
Sat Apr 21 12:02:03 2012
@@ -1,11 +1,15 @@
 package org.apache.commons.graph.model;
 
+import java.io.Serializable;
+
 import org.apache.commons.graph.Mapper;
 
 public final class BaseWeightedEdge<W>
-    implements Mapper<BaseLabeledWeightedEdge<W>, W>
+    implements Mapper<BaseLabeledWeightedEdge<W>, W>, Serializable
 {
 
+    private static final long serialVersionUID = -2024378704087762740L;
+
     public W map( BaseLabeledWeightedEdge<W> edge )
     {
         return edge.getWeight();

Added: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/GraphSerializationTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/GraphSerializationTestCase.java?rev=1328639&view=auto
==============================================================================
--- commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/GraphSerializationTestCase.java
(added)
+++ commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/GraphSerializationTestCase.java
Sat Apr 21 12:02:03 2012
@@ -0,0 +1,201 @@
+package org.apache.commons.graph.model;
+
+import static junit.framework.Assert.assertEquals;
+import static org.apache.commons.graph.CommonsGraph.newDirectedMutableGraph;
+import static org.apache.commons.graph.CommonsGraph.newUndirectedMutableGraph;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+
+import org.apache.commons.graph.CommonsGraph;
+import org.apache.commons.graph.Graph;
+import org.apache.commons.graph.MutableGraph;
+import org.apache.commons.graph.builder.AbstractGraphConnection;
+import org.apache.commons.graph.builder.GraphConnection;
+import org.apache.commons.graph.weight.primitive.DoubleWeightBaseOperations;
+import org.junit.After;
+import org.junit.Test;
+
+/**
+ * Provides a simple test case to test the Graph serialization.
+ */
+public class GraphSerializationTestCase
+{
+
+    private final static String FILE_NAME = "target/serialiazedGraph.dat";
+
+    @After
+    public void cleanUp()
+    {
+        File f = new File( FILE_NAME );
+        if ( f.exists() )
+        {
+            f.delete();
+        }
+    }
+
+    @Test
+    public void serializeUndirectedGraph()
+        throws Exception
+    {
+
+        MutableGraph<BaseLabeledVertex, BaseLabeledEdge> g = newUndirectedMutableGraph(
buildGraphConnections() );
+
+        checkSerialization( g );
+    }
+
+    @Test
+    public void serializeDirectedGraph()
+        throws Exception
+    {
+
+        MutableGraph<BaseLabeledVertex, BaseLabeledEdge> g = newDirectedMutableGraph(
buildGraphConnections() );
+
+        checkSerialization( g );
+    }
+
+    @Test
+    public void serializeUndirectedWeightdGraph()
+        throws Exception
+    {
+
+        MutableGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>> g =
+            newUndirectedMutableGraph( buildWeightedGraphConnections() );
+
+        checkSerialization( g );
+    }
+
+    @Test
+    public void serializeDirectedWeightdGraph()
+        throws Exception
+    {
+
+        MutableGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>> g =
+            newDirectedMutableGraph( buildWeightedGraphConnections() );
+
+        checkSerialization( g );
+    }
+
+    @Test
+    public void serializeSpanningTree()
+        throws Exception
+    {
+        final MutableSpanningTree<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double> spanningTree =
+            new MutableSpanningTree<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double>(
+                                                                                        
        new DoubleWeightBaseOperations(),
+                                                                                        
        new BaseWeightedEdge<Double>() );
+
+        CommonsGraph.populate( spanningTree ).withConnections( buildWeightedGraphConnections()
);
+
+        checkSerialization( spanningTree );
+    }
+
+    @Test
+    public void serializePath()
+        throws Exception
+    {
+
+        BaseLabeledVertex start = new BaseLabeledVertex( "start" );
+        BaseLabeledVertex goal = new BaseLabeledVertex( "goal" );
+        BaseLabeledVertex a = new BaseLabeledVertex( "a" );
+        BaseLabeledVertex b = new BaseLabeledVertex( "b" );
+        BaseLabeledVertex c = new BaseLabeledVertex( "c" );
+
+        InMemoryWeightedPath<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double> g =
+            new InMemoryWeightedPath<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>,
Double>(
+                                                                                        
         start,
+                                                                                        
         goal,
+                                                                                        
         new DoubleWeightBaseOperations(),
+                                                                                        
         new BaseWeightedEdge<Double>() );
+
+        g.addConnectionInTail( start, new BaseLabeledWeightedEdge<Double>( "start <->
a", 1.5D ), a );
+        g.addConnectionInTail( a, new BaseLabeledWeightedEdge<Double>( "a <->
b", 2D ), b );
+        g.addConnectionInTail( b, new BaseLabeledWeightedEdge<Double>( "b <->
c", 3D ), c );
+        g.addConnectionInTail( c, new BaseLabeledWeightedEdge<Double>( "c <->
goal", 3D ), goal );
+
+        checkSerialization( g );
+
+    }
+
+    /**
+     * @param g
+     * @throws FileNotFoundException
+     * @throws IOException
+     * @throws ClassNotFoundException
+     */
+    private void checkSerialization( Graph<BaseLabeledVertex, ? extends Serializable>
g )
+        throws FileNotFoundException, IOException, ClassNotFoundException
+    {
+        FileOutputStream fout = new FileOutputStream( FILE_NAME );
+        ObjectOutputStream oos = new ObjectOutputStream( fout );
+        oos.writeObject( g );
+        oos.close();
+
+        FileInputStream fin = new FileInputStream( FILE_NAME );
+        ObjectInputStream ois = new ObjectInputStream( fin );
+        Object cloned = ois.readObject();
+        ois.close();
+
+        assertEquals( g, cloned );
+    }
+
+    private GraphConnection<BaseLabeledVertex, BaseLabeledEdge> buildGraphConnections()
+    {
+
+        GraphConnection<BaseLabeledVertex, BaseLabeledEdge> connections =
+            new AbstractGraphConnection<BaseLabeledVertex, BaseLabeledEdge>()
+            {
+                @Override
+                public void connect()
+                {
+                    BaseLabeledVertex a = new BaseLabeledVertex( "a" );
+                    BaseLabeledVertex b = new BaseLabeledVertex( "b" );
+                    BaseLabeledVertex c = new BaseLabeledVertex( "c" );
+                    BaseLabeledVertex d = new BaseLabeledVertex( "d" );
+                    addVertex( a );
+                    addVertex( b );
+                    addVertex( c );
+                    addVertex( d );
+
+                    addEdge( new BaseLabeledEdge( "a -> c" ) ).from( a ).to( c );
+                    addEdge( new BaseLabeledEdge( "c -> d" ) ).from( c ).to( d );
+                    addEdge( new BaseLabeledEdge( "d -> b" ) ).from( d ).to( b );
+
+                }
+            };
+        return connections;
+    }
+
+    private GraphConnection<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>>
buildWeightedGraphConnections()
+    {
+
+        GraphConnection<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>> connections
=
+            new AbstractGraphConnection<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>>()
+            {
+                @Override
+                public void connect()
+                {
+                    BaseLabeledVertex a = new BaseLabeledVertex( "a" );
+                    BaseLabeledVertex b = new BaseLabeledVertex( "b" );
+                    BaseLabeledVertex c = new BaseLabeledVertex( "c" );
+                    BaseLabeledVertex d = new BaseLabeledVertex( "d" );
+                    addVertex( a );
+                    addVertex( b );
+                    addVertex( c );
+                    addVertex( d );
+
+                    addEdge( new BaseLabeledWeightedEdge<Double>( "a -> c", 1D )
).from( a ).to( c );
+                    addEdge( new BaseLabeledWeightedEdge<Double>( "c -> d", 1D )
).from( c ).to( d );
+                    addEdge( new BaseLabeledWeightedEdge<Double>( "d -> b", 1D )
).from( d ).to( b );
+
+                }
+            };
+        return connections;
+    }
+}
\ No newline at end of file

Propchange: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/GraphSerializationTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/GraphSerializationTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/graph/trunk/src/test/java/org/apache/commons/graph/model/GraphSerializationTestCase.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message