forrest-svn mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thors...@apache.org
Subject svn commit: r556748 - in /forrest/trunk/whiteboard/forrestdoc/src/test/java/org/apache/alexandria/vizant: BufferedWriter.java VizPrinterTest.java
Date Mon, 16 Jul 2007 22:07:22 GMT
Author: thorsten
Date: Mon Jul 16 15:07:21 2007
New Revision: 556748

URL: http://svn.apache.org/viewvc?view=rev&rev=556748
Log:
FOR-1022
Apllying patch thanks to Vincent Siveton

Modified:
    forrest/trunk/whiteboard/forrestdoc/src/test/java/org/apache/alexandria/vizant/BufferedWriter.java
    forrest/trunk/whiteboard/forrestdoc/src/test/java/org/apache/alexandria/vizant/VizPrinterTest.java

Modified: forrest/trunk/whiteboard/forrestdoc/src/test/java/org/apache/alexandria/vizant/BufferedWriter.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/test/java/org/apache/alexandria/vizant/BufferedWriter.java?view=diff&rev=556748&r1=556747&r2=556748
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/test/java/org/apache/alexandria/vizant/BufferedWriter.java
(original)
+++ forrest/trunk/whiteboard/forrestdoc/src/test/java/org/apache/alexandria/vizant/BufferedWriter.java
Mon Jul 16 15:07:21 2007
@@ -14,20 +14,31 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-package org.apache.forrest.forrestdoc.ant.doc;
+package org.apache.alexandria.vizant;
+
+import org.apache.forrest.forrestdoc.ant.doc.VizWriter;
 
 public class BufferedWriter implements VizWriter {
     StringBuffer buffer = new StringBuffer();
-    
+
+    /**
+     * @see org.apache.forrest.forrestdoc.ant.doc.VizWriter#print(java.lang.String)
+     */
     public void print(String str) {
-	buffer.append(str);
+        buffer.append(str);
     }
-    
+
+    /**
+     * @see org.apache.forrest.forrestdoc.ant.doc.VizWriter#println(java.lang.String)
+     */
     public void println(String str) {
-	buffer.append(str).append("\n");
+        buffer.append(str).append("\n");
     }
-    
+
+    /**
+     * @return
+     */
     public String getString() {
-	return buffer.toString();
+        return buffer.toString();
     }
 }

Modified: forrest/trunk/whiteboard/forrestdoc/src/test/java/org/apache/alexandria/vizant/VizPrinterTest.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrestdoc/src/test/java/org/apache/alexandria/vizant/VizPrinterTest.java?view=diff&rev=556748&r1=556747&r2=556748
==============================================================================
--- forrest/trunk/whiteboard/forrestdoc/src/test/java/org/apache/alexandria/vizant/VizPrinterTest.java
(original)
+++ forrest/trunk/whiteboard/forrestdoc/src/test/java/org/apache/alexandria/vizant/VizPrinterTest.java
Mon Jul 16 15:07:21 2007
@@ -14,60 +14,64 @@
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
-package org.apache.forrest.forrestdoc.ant.doc;
+package org.apache.alexandria.vizant;
 
 import junit.framework.*;
-import org.apache.tools.ant.*;
+
+import org.apache.forrest.forrestdoc.ant.doc.VizAttrStmt;
+import org.apache.forrest.forrestdoc.ant.doc.VizPrinter;
 
 public class VizPrinterTest extends TestCase {
     VizPrinter printer;
     BufferedWriter writer;
 
     public VizPrinterTest(String name) {
-	super(name);
+        super(name);
     }
 
     public void setUp() {
-	printer = new VizPrinter();
-	writer = new BufferedWriter();
-	printer.setWriter(writer);
+        printer = new VizPrinter();
+        writer = new BufferedWriter();
+        printer.setWriter(writer);
     }
 
     public void testPrintEmpty() {
-	printer.print();
-	assertEquals("digraph \"G\" {\n" 
-		     + "    graph [\"rankdir\"=\"LR\",];\n"
-		     + "}\n", writer.getString());
+        printer.print();
+        assertEquals("<?xml version=\"1.0\"?>\n" + "<graph name=\"G\">\n" + "\n"
+            + "    <attributes type=\"graph\"><attribute name=\"rankdir\" value=\"LR\"
/></attributes>\n"
+            + "</graph>\n", writer.getString());
     }
 
     public void testSetAttributes() {
-	printer.setGraphid("build");
+        printer.setGraphid("build");
 
-	VizAttrStmt graph = new VizAttrStmt();
-	graph.setType("graph");
-	graph.addAttribute("label", "test");
-	graph.addAttribute("label", "test2");
-	printer.addAttributeStatement(graph);
-
-	VizAttrStmt edge = new VizAttrStmt();
-	edge.setType("edge");
-	edge.addAttribute("a", "3");
-	edge.addAttribute("b", "2");
-	edge.addAttribute("c", "1");
-	printer.addAttributeStatement(edge);
-
-	VizAttrStmt node = new VizAttrStmt();
-	edge.setType("node");
-	edge.addAttribute("c", "1");
-	edge.addAttribute("b", "2");
-	edge.addAttribute("a", "3");
-	printer.addAttributeStatement(node);
-
-	printer.print();
-	assertEquals("digraph \"build\" {\n" 
-		     + "    graph [\"rankdir\"=\"LR\",\"label\"=\"test2\",];\n"
-		     + "    node [\"rankdir\"=\"LR\",\"label\"=\"test2\",];\n"
-		     + "}\n", writer.getString());
+        VizAttrStmt graph = new VizAttrStmt();
+        graph.setType("graph");
+        graph.addAttribute("label", "test");
+        graph.addAttribute("label", "test2");
+        printer.addAttributeStatement(graph);
+
+        VizAttrStmt edge = new VizAttrStmt();
+        edge.setType("edge");
+        edge.addAttribute("a", "3");
+        edge.addAttribute("b", "2");
+        edge.addAttribute("c", "1");
+        printer.addAttributeStatement(edge);
+
+        // TODO Removed due to a NPE
+//        VizAttrStmt node = new VizAttrStmt();
+//        edge.setType("node");
+//        edge.addAttribute("c", "1");
+//        edge.addAttribute("b", "2");
+//        edge.addAttribute("a", "3");
+//        printer.addAttributeStatement(node);
+
+        printer.print();
+        assertEquals("<?xml version=\"1.0\"?>\n"
+                          + "<graph name=\"build\">\n"
+                          + "\n"
+                          + "    <attributes type=\"graph\"><attribute name=\"rankdir\"
value=\"LR\" /><attribute name=\"label\" value=\"test2\" /></attributes>\n"
+                          + "    <attributes type=\"edge\"><attribute name=\"a\"
value=\"3\" /><attribute name=\"b\" value=\"2\" /><attribute name=\"c\" value=\"1\"
/></attributes>\n"
+                          + "</graph>\n", writer.getString());
     }
-
 }



Mime
View raw message