You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2011/11/07 14:36:34 UTC

svn commit: r1198733 [11/13] - in /incubator/jena/Scratch/AFS/Dev/trunk: src-archive/riot/comms/ src-archive/riot/comms/client/ src-archive/riot/comms/server0/ src-archive/riot/comms/server1/nio/ src-archive/riot/comms/server1/socket/ src-archive/riot/...

Modified: incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/TestSSE_Basic.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/TestSSE_Basic.java?rev=1198733&r1=1198732&r2=1198733&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/TestSSE_Basic.java (original)
+++ incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/TestSSE_Basic.java Mon Nov  7 13:36:30 2011
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -16,392 +16,392 @@
  * limitations under the License.
  */
 
-package riot;
-
-import org.junit.AfterClass ;
-import org.junit.BeforeClass ;
-import org.junit.Test ;
-import org.openjena.atlas.junit.BaseTest ;
-import org.openjena.riot.ErrorHandlerFactory ;
-import org.openjena.riot.RiotException ;
-
-import com.hp.hpl.jena.datatypes.xsd.XSDDatatype ;
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.sparql.ARQConstants ;
-import com.hp.hpl.jena.sparql.core.Var ;
-import com.hp.hpl.jena.sparql.graph.NodeConst ;
-import com.hp.hpl.jena.sparql.sse.Item ;
-import com.hp.hpl.jena.sparql.sse.ItemException ;
-import com.hp.hpl.jena.sparql.util.NodeFactory ;
-
-public class TestSSE_Basic extends BaseTest
-{
-    // Tests not requiring URI resolution or prefix name handling.
-    
-    static Node int1 = Node.createLiteral("1", null, XSDDatatype.XSDinteger) ;
-    static Node int2 = Node.createLiteral("2", null, XSDDatatype.XSDinteger) ;
-    static Node int3 = Node.createLiteral("3", null, XSDDatatype.XSDinteger) ;
-    static Node strLangEN = Node.createLiteral("xyz", "en", null) ;
-
-    static Node typeLit1 = NodeFactory.createLiteralNode("123", null, "http://example/type") ;
-    
-    
-    static Item int1i = Item.createNode(int1) ;
-    static Item int2i = Item.createNode(int2) ;
-    static Item int3i = Item.createNode(int3) ;
-    
-//    public static TestSuite suite()
-//    {
-//        TestSuite ts = new TestSuite(TestSSE_Basic.class) ;
-//        ts.setName("SSE Basic") ;
-//        return ts ;
-//    }
-
-    static public @BeforeClass  void beforeClass() { ErrorHandlerFactory.setTestLogging(false) ; }  
-    static public @AfterClass   void afterClass()  { ErrorHandlerFactory.setTestLogging(true) ; }
-    
-    
-    
-    // ---- Parsing : not check for the correct outcome
-    @Test public void testParseTerm_01() { parse("'xyz'") ; }
-    @Test public void testParseTerm_02() { parse("'xyz'@en") ; }
-    
-    @Test(expected=RiotException.class)
-    public void testParseTerm_03() { parse("'xyz' @en") ; }
-
-    @Test public void testParseSymbol_01() { parse("a") ; }
-    
-    @Test(expected=RiotException.class)
-    public void testParseSymbol_02() { parse("'a") ; }
-    // TODO Parser needs fixing
-    //@Test public void testParseSymbol_03() { parse("@a") ; }
-    @Test(expected=RiotException.class)
-    public void testParseSymbol_04() { parse("a@") ; }
-    
-    
-    @Test public void testParseList_01() { parse("()") ; }
-    @Test public void testParseList_02() { parse("(a)") ; }
-    @Test public void testParseList_03() { parse(" (a)") ; }
-    @Test public void testParseList_04() { parse("( a)") ; }
-    @Test public void testParseList_05() { parse("(a )") ; }
-    @Test public void testParseList_06() { parse("(a) ") ; }
-    @Test public void testParseList_07() { parse("('a') ") ; }
-    @Test public void testParseList_08() { parse("(<a>) ") ; }
-    
-    @Test(expected=RiotException.class) public void testParse_10() { parse("'foo' @en") ; }
-
-    // ---- Terms 
-    @Test public void testLit_01() { testNode("'foo'") ; } 
-    @Test public void testLit_02() { testNode("\"foo\"") ; } 
-    @Test public void testLit_03() { testNode("''") ; }
-    @Test public void testLit_04() { testNode("\"\"") ; }
-    @Test public void testLit_05() { testNode("'foo'@en") ; } 
-    @Test(expected=RiotException.class) public void testLit_06() { parse("'foo' @en") ; } 
-    @Test(expected=RiotException.class) public void testLit_07() { parse("'") ; }
-    @Test(expected=RiotException.class) public void testLit_08() { parse("'\"") ; }
-    @Test(expected=RiotException.class) public void testLit_09() { parse("'''") ; } 
-    @Test(expected=RiotException.class) public void testLit_10() { parse("''@") ; }
-    
-    @Test public void testLit_11() { testNode("'''abc\\ndef'''", Node.createLiteral("abc\ndef")) ; }
-    
-    @Test public void testLit_12()
-    { 
-        Node n = Node.createLiteral("A\tB") ;
-        testNode("'''A\\tB'''", n) ;
-    }
-    
-    @Test public void testLit_13() { testNode("'abc\\ndef'") ; }
-    
-    @Test public void testNum_1() { testNode("1") ; }
-    @Test public void testNum_2() { testNode("1.1") ; }
-    @Test public void testNum_3() { testNode("1.0e6") ; }
-
-    @Test public void testNum_4() { testNode("1 ", NodeConst.nodeOne) ; }
-    
-    @Test(expected=RiotException.class) public void testNum_5() { parseNode("1 1") ; }
- 
-    @Test public void testURI_1() { testNode("<http://example/base>") ; }
-    @Test(expected=RiotException.class) public void testURI_2() { parseNode("http://example/baseNoDelimiters") ; }
-    
-    @Test public void testURI_3() { parseNode("<http://example/ space>") ; }
-    
-    // Four \ is two \ in the lexical URI string (java escape) is one in the URI (SSE esscape).  
-    @Test public void testURI_4() { testNode("<http://example/base\\\\name>", Node.createURI("http://example/base\\name")) ; }
-    
-    @Test public void testVar_01() { testVar("?x") ; }
-    @Test public void testVar_02() { testVar("?") ; }
-    @Test public void testVar_03() { testVar("?0") ; }
-    // See ARQConstants.anonVarMarker
-    @Test public void testVar_04() { testVar("??x") ; }
-    @Test public void testVar_05() { testVar("??") ; }
-    @Test public void testVar_06() { testVar("??0") ; }
-    
-    // See ARQConstants.allocVarMarker
-    @Test public void testVar_07() { testVar("?"+ARQConstants.allocVarMarker+"0") ; }
-    @Test public void testVar_08() { testVar("?"+ARQConstants.allocVarMarker) ; }
-
-    // Default allocations
-    @Test public void testVar_09()
-    { 
-        Node v = parseNode("?") ;
-        assertTrue( v instanceof Var ) ;
-        String vn = ((Var)v).getVarName() ;
-        assertFalse(vn.equals("")) ;
-    }
-    
-    @Test public void testVar_10()
-    { 
-        Node v = parseNode("?"+ARQConstants.allocVarAnonMarker) ;
-        assertTrue( v instanceof Var ) ;
-        String vn = ((Var)v).getVarName() ;
-        assertFalse(vn.equals(ARQConstants.allocVarAnonMarker)) ;
-    }
-    
-    @Test public void testWS_1() { parseNode("?x ") ; }
-    @Test public void testWS_2() { parseNode(" ?x") ; }
-    
-    // ---- Nodes
-    
-    @Test public void testNode_1()    { testNode("3", int3) ; }
-    @Test public void testNode_2()    { testNode("<http://example/node1>", Node.createURI("http://example/node1")) ; } 
-    @Test public void testTypedLit_1() { testNode("\"123\"^^<http://example/type>", typeLit1) ; }
-    @Test public void testTypedLit_2() { testNode("'123'^^<http://example/type>", typeLit1) ; }
-    @Test public void testTypedLit_3() { testNode("'3'^^<"+XSDDatatype.XSDinteger.getURI()+">", int3) ; }
-
-    // --- Symbols
-    
-    @Test public void testSymbol_1()    { testSymbol("word") ; }
-    @Test public void testSymbol_2()    { testSymbol("+") ; }
-    
-    @Test public void testSymbol_3()    { testSymbol("-") ; }
-    
-    // XXX Parser broken
-//    @Test public void testSymbol_3()    { testSymbol("^^") ; }
-//    @Test public void testSymbol_4()    { testSymbol("^^<foo>") ; }
-//    @Test public void testSymbol_5()    { testSymbol("@") ; }
-//    @Test public void testSymbol_6()    { testSymbol("@en") ; }
-    
-    // --- nil
-    
-    @Test public void testNil_1()    { testItem("nil", Item.nil) ; }
-    @Test public void testNil_2()    { testNotItem("null", Item.nil) ; }
-    @Test public void testNil_3()    { testNotItem("()", Item.nil) ; }
-    @Test public void testNil_4()
-    { 
-        Item x = Item.createList() ;
-        x.getList().add(Item.nil) ;
-        testItem("(nil)", x) ;
-    }
-
-    // ---- Lists
-    
-    @Test public void testList_1()
-    { 
-        Item item = parse("()") ;
-        assertTrue(item.isList()) ;
-        assertEquals(item.getList().size(), 0 ) ;
-    }
-
-    @Test public void testList_2()    { testList("(1)", int1i) ; }
-    @Test public void testList_3()    { testList("(1 2)", int1i, int2i) ; }
-    @Test public void testList_4()    { testList("(1 a)", int1i, Item.createSymbol("a")) ; }
-    
-    @Test public void testList_5()
-    { 
-        Item list = Item.createList() ;
-        list.getList().add(int1i) ;
-        testList("((1) a)", list, Item.createSymbol("a")) ;
-    }
-    
-    @Test public void testList_6()
-    { testList("(+ 1)", Item.createSymbol("+"), int1i) ; }
-
-    @Test public void testList_7()
-    { testList("[+ 1]", Item.createSymbol("+"), int1i) ; }
-    
-    
-    @Test public void testNum_01()
-    { 
-        Item item = parse("1") ;
-        assertEquals(1, item.getInt()) ;
-    }
-        
-    @Test public void testNum_02()
-    { 
-        Item item = parse("3") ;
-        assertEquals(3d, item.getDouble(), 0) ;
-    }
-
-    @Test public void testNum_03()
-    { 
-        Item item = parse("2.5") ;      // Exact double
-        assertEquals(2.5d, item.getDouble(), 0) ;
-    }
-    
-    @Test public void testNum_04()
-    { 
-        Item item = parse("abc") ;
-        try {
-            item.getInt() ;
-            fail("Succeeded where exception expected") ;
-        } catch (ItemException ex) {}
-    }
-
-    @Test public void testNum_05()
-    { 
-        Item item = parse("<x>") ;
-        try {
-            item.getInt() ;
-            fail("Succeeded where exception expected") ;
-        } catch (ItemException ex) {}
-    }
-    
-    
-    @Test public void testMisc_01()    { testEquals("()") ; }
-    @Test public void testMisc_02()    { testEquals("(a)") ; }
-    @Test public void testMisc_10()    { testNotEquals("(a)", "a") ; }
-    @Test public void testMisc_11()    { testNotEquals("(a)", "()") ; }
-    @Test public void testMisc_12()    { testNotEquals("(a)", "(<a>)") ; }
-    
-    @Test public void testTaggedList_1()
-    {
-        Item x = Item.createTagged("TAG") ;
-        assertTrue(x.isTagged()) ;
-        assertTrue(x.isTagged("TAG")) ;
-    }
-    
-    @Test public void testTaggedList_2()
-    {
-        Item x = Item.createTagged("TAG") ;
-        Item.addPair(x.getList(), "KEY", "VALUE") ;
-        
-        Item y = Item.find(x.getList(), "KEY") ;
-        assertNotNull(y) ;
-        
-        Item z = Item.find(x.getList(), "KEYKEY") ;
-        assertNull(z) ;
-    }
-    
-    
-    
-     
-    // ---- Workers ----
-    
-    private void testEquals(String x)
-    {
-        Item item1 = parse(x) ;
-        Item item2 = parse(x) ;
-        assertTrue(item1.equals(item2)) ;
-        assertTrue(item2.equals(item1)) ;
-    }
-    
-    private void testNotEquals(String x1, String x2)
-    {
-        Item item1 = parse(x1) ;
-        Item item2 = parse(x2) ;
-        assertFalse(item1.equals(item2)) ;
-        assertFalse(item2.equals(item1)) ;
-    }
-    
-    private Item parse(String str)
-    {
-        Item item = ParserSSE.parse(str) ;
-        return item ;
-    }
-    
-    private Node parseNode(String str)
-    {
-        Item item = ParserSSE.parse(str) ;
-        return item.getNode() ;
-    }
-    
-    private void testSymbol(String str)
-    {
-        Item item = parse(str) ;
-        assertTrue(item.isSymbol()) ;
-        assertEquals(item.getSymbol(), str) ;
-    }
-    
-    private void testList(String str, Item item1)
-    {
-        Item item = parse(str) ;
-        assertTrue(item.isList()) ;
-        
-        Item i = item.getList().get(0) ;
-        
-        assertEquals(1, item.getList().size()) ;
-        assertEquals(item.getList().get(0), item1) ;
-    }
-
-    private void testList(String str, Item item1, Item item2)
-    {
-        Item item = parse(str) ;
-        assertTrue(item.isList()) ;
-        assertEquals(2, item.getList().size()) ;
-        assertEquals(item.getList().get(0), item1) ;
-        assertEquals(item.getList().get(1), item2) ;
-    }
-
-    private void testList(String str, Item item1, Item item2, Item item3)
-    {
-        Item item = parse(str) ;
-        assertTrue(item.isList()) ;
-        assertEquals(3, item.getList().size()) ;
-        assertEquals(item.getList().get(0), item1) ;
-        assertEquals(item.getList().get(1), item2) ;
-        assertEquals(item.getList().get(2), item3) ;
-    }
-    
-    private void testItem(String str, Item result)
-    {
-        Item item = parse(str) ;
-        assertEquals(result, item) ;
-    }
-    
-    private void testNotItem(String str, Item result)
-    {
-        Item item = parse(str) ;
-        assertFalse(result.equals(item)) ;
-    }
-
-    private void testNode(String str)
-    {
-        Node node = parseNode(str) ;
-    }
-    
-    private void testVar(String str)
-    {
-        Node node = parseNode(str) ;
-        assertTrue( node instanceof Var ) ;
-    }
-    
-    private void testNode(String str, Node result)
-    {
-        Node node = parseNode(str) ;
-        assertEquals(result, node) ;
-    }
-
-    
-//    private void parse(String str)
-//    {
-//        try {
-//            Item item = parse(str) ;
-//            //System.out.println(str+" => "+item) ;
-//            fail("Did not get a parse failure") ;
-//        } 
-//        catch (RiotParseException ex) {}
-//        catch (ARQException ex) {}
-//    }
-//    
-//    private void parseNode(String str)
-//    {
-//        try {
-//            Node node = parseNode(str) ;
-//            //System.out.println(str+" => "+item) ;
-//            fail("Did not get a parse failure") ;
-//        } 
-//        catch (RiotParseException ex) {}
-//        catch (ARQException ex) {}
-//    }
-
+package riot;
+
+import org.junit.AfterClass ;
+import org.junit.BeforeClass ;
+import org.junit.Test ;
+import org.openjena.atlas.junit.BaseTest ;
+import org.openjena.riot.ErrorHandlerFactory ;
+import org.openjena.riot.RiotException ;
+
+import com.hp.hpl.jena.datatypes.xsd.XSDDatatype ;
+import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.sparql.ARQConstants ;
+import com.hp.hpl.jena.sparql.core.Var ;
+import com.hp.hpl.jena.sparql.graph.NodeConst ;
+import com.hp.hpl.jena.sparql.sse.Item ;
+import com.hp.hpl.jena.sparql.sse.ItemException ;
+import com.hp.hpl.jena.sparql.util.NodeFactory ;
+
+public class TestSSE_Basic extends BaseTest
+{
+    // Tests not requiring URI resolution or prefix name handling.
+    
+    static Node int1 = Node.createLiteral("1", null, XSDDatatype.XSDinteger) ;
+    static Node int2 = Node.createLiteral("2", null, XSDDatatype.XSDinteger) ;
+    static Node int3 = Node.createLiteral("3", null, XSDDatatype.XSDinteger) ;
+    static Node strLangEN = Node.createLiteral("xyz", "en", null) ;
+
+    static Node typeLit1 = NodeFactory.createLiteralNode("123", null, "http://example/type") ;
+    
+    
+    static Item int1i = Item.createNode(int1) ;
+    static Item int2i = Item.createNode(int2) ;
+    static Item int3i = Item.createNode(int3) ;
+    
+//    public static TestSuite suite()
+//    {
+//        TestSuite ts = new TestSuite(TestSSE_Basic.class) ;
+//        ts.setName("SSE Basic") ;
+//        return ts ;
+//    }
+
+    static public @BeforeClass  void beforeClass() { ErrorHandlerFactory.setTestLogging(false) ; }  
+    static public @AfterClass   void afterClass()  { ErrorHandlerFactory.setTestLogging(true) ; }
+    
+    
+    
+    // ---- Parsing : not check for the correct outcome
+    @Test public void testParseTerm_01() { parse("'xyz'") ; }
+    @Test public void testParseTerm_02() { parse("'xyz'@en") ; }
+    
+    @Test(expected=RiotException.class)
+    public void testParseTerm_03() { parse("'xyz' @en") ; }
+
+    @Test public void testParseSymbol_01() { parse("a") ; }
+    
+    @Test(expected=RiotException.class)
+    public void testParseSymbol_02() { parse("'a") ; }
+    // TODO Parser needs fixing
+    //@Test public void testParseSymbol_03() { parse("@a") ; }
+    @Test(expected=RiotException.class)
+    public void testParseSymbol_04() { parse("a@") ; }
+    
+    
+    @Test public void testParseList_01() { parse("()") ; }
+    @Test public void testParseList_02() { parse("(a)") ; }
+    @Test public void testParseList_03() { parse(" (a)") ; }
+    @Test public void testParseList_04() { parse("( a)") ; }
+    @Test public void testParseList_05() { parse("(a )") ; }
+    @Test public void testParseList_06() { parse("(a) ") ; }
+    @Test public void testParseList_07() { parse("('a') ") ; }
+    @Test public void testParseList_08() { parse("(<a>) ") ; }
+    
+    @Test(expected=RiotException.class) public void testParse_10() { parse("'foo' @en") ; }
+
+    // ---- Terms 
+    @Test public void testLit_01() { testNode("'foo'") ; } 
+    @Test public void testLit_02() { testNode("\"foo\"") ; } 
+    @Test public void testLit_03() { testNode("''") ; }
+    @Test public void testLit_04() { testNode("\"\"") ; }
+    @Test public void testLit_05() { testNode("'foo'@en") ; } 
+    @Test(expected=RiotException.class) public void testLit_06() { parse("'foo' @en") ; } 
+    @Test(expected=RiotException.class) public void testLit_07() { parse("'") ; }
+    @Test(expected=RiotException.class) public void testLit_08() { parse("'\"") ; }
+    @Test(expected=RiotException.class) public void testLit_09() { parse("'''") ; } 
+    @Test(expected=RiotException.class) public void testLit_10() { parse("''@") ; }
+    
+    @Test public void testLit_11() { testNode("'''abc\\ndef'''", Node.createLiteral("abc\ndef")) ; }
+    
+    @Test public void testLit_12()
+    { 
+        Node n = Node.createLiteral("A\tB") ;
+        testNode("'''A\\tB'''", n) ;
+    }
+    
+    @Test public void testLit_13() { testNode("'abc\\ndef'") ; }
+    
+    @Test public void testNum_1() { testNode("1") ; }
+    @Test public void testNum_2() { testNode("1.1") ; }
+    @Test public void testNum_3() { testNode("1.0e6") ; }
+
+    @Test public void testNum_4() { testNode("1 ", NodeConst.nodeOne) ; }
+    
+    @Test(expected=RiotException.class) public void testNum_5() { parseNode("1 1") ; }
+ 
+    @Test public void testURI_1() { testNode("<http://example/base>") ; }
+    @Test(expected=RiotException.class) public void testURI_2() { parseNode("http://example/baseNoDelimiters") ; }
+    
+    @Test public void testURI_3() { parseNode("<http://example/ space>") ; }
+    
+    // Four \ is two \ in the lexical URI string (java escape) is one in the URI (SSE esscape).  
+    @Test public void testURI_4() { testNode("<http://example/base\\\\name>", Node.createURI("http://example/base\\name")) ; }
+    
+    @Test public void testVar_01() { testVar("?x") ; }
+    @Test public void testVar_02() { testVar("?") ; }
+    @Test public void testVar_03() { testVar("?0") ; }
+    // See ARQConstants.anonVarMarker
+    @Test public void testVar_04() { testVar("??x") ; }
+    @Test public void testVar_05() { testVar("??") ; }
+    @Test public void testVar_06() { testVar("??0") ; }
+    
+    // See ARQConstants.allocVarMarker
+    @Test public void testVar_07() { testVar("?"+ARQConstants.allocVarMarker+"0") ; }
+    @Test public void testVar_08() { testVar("?"+ARQConstants.allocVarMarker) ; }
+
+    // Default allocations
+    @Test public void testVar_09()
+    { 
+        Node v = parseNode("?") ;
+        assertTrue( v instanceof Var ) ;
+        String vn = ((Var)v).getVarName() ;
+        assertFalse(vn.equals("")) ;
+    }
+    
+    @Test public void testVar_10()
+    { 
+        Node v = parseNode("?"+ARQConstants.allocVarAnonMarker) ;
+        assertTrue( v instanceof Var ) ;
+        String vn = ((Var)v).getVarName() ;
+        assertFalse(vn.equals(ARQConstants.allocVarAnonMarker)) ;
+    }
+    
+    @Test public void testWS_1() { parseNode("?x ") ; }
+    @Test public void testWS_2() { parseNode(" ?x") ; }
+    
+    // ---- Nodes
+    
+    @Test public void testNode_1()    { testNode("3", int3) ; }
+    @Test public void testNode_2()    { testNode("<http://example/node1>", Node.createURI("http://example/node1")) ; } 
+    @Test public void testTypedLit_1() { testNode("\"123\"^^<http://example/type>", typeLit1) ; }
+    @Test public void testTypedLit_2() { testNode("'123'^^<http://example/type>", typeLit1) ; }
+    @Test public void testTypedLit_3() { testNode("'3'^^<"+XSDDatatype.XSDinteger.getURI()+">", int3) ; }
+
+    // --- Symbols
+    
+    @Test public void testSymbol_1()    { testSymbol("word") ; }
+    @Test public void testSymbol_2()    { testSymbol("+") ; }
+    
+    @Test public void testSymbol_3()    { testSymbol("-") ; }
+    
+    // XXX Parser broken
+//    @Test public void testSymbol_3()    { testSymbol("^^") ; }
+//    @Test public void testSymbol_4()    { testSymbol("^^<foo>") ; }
+//    @Test public void testSymbol_5()    { testSymbol("@") ; }
+//    @Test public void testSymbol_6()    { testSymbol("@en") ; }
+    
+    // --- nil
+    
+    @Test public void testNil_1()    { testItem("nil", Item.nil) ; }
+    @Test public void testNil_2()    { testNotItem("null", Item.nil) ; }
+    @Test public void testNil_3()    { testNotItem("()", Item.nil) ; }
+    @Test public void testNil_4()
+    { 
+        Item x = Item.createList() ;
+        x.getList().add(Item.nil) ;
+        testItem("(nil)", x) ;
+    }
+
+    // ---- Lists
+    
+    @Test public void testList_1()
+    { 
+        Item item = parse("()") ;
+        assertTrue(item.isList()) ;
+        assertEquals(item.getList().size(), 0 ) ;
+    }
+
+    @Test public void testList_2()    { testList("(1)", int1i) ; }
+    @Test public void testList_3()    { testList("(1 2)", int1i, int2i) ; }
+    @Test public void testList_4()    { testList("(1 a)", int1i, Item.createSymbol("a")) ; }
+    
+    @Test public void testList_5()
+    { 
+        Item list = Item.createList() ;
+        list.getList().add(int1i) ;
+        testList("((1) a)", list, Item.createSymbol("a")) ;
+    }
+    
+    @Test public void testList_6()
+    { testList("(+ 1)", Item.createSymbol("+"), int1i) ; }
+
+    @Test public void testList_7()
+    { testList("[+ 1]", Item.createSymbol("+"), int1i) ; }
+    
+    
+    @Test public void testNum_01()
+    { 
+        Item item = parse("1") ;
+        assertEquals(1, item.getInt()) ;
+    }
+        
+    @Test public void testNum_02()
+    { 
+        Item item = parse("3") ;
+        assertEquals(3d, item.getDouble(), 0) ;
+    }
+
+    @Test public void testNum_03()
+    { 
+        Item item = parse("2.5") ;      // Exact double
+        assertEquals(2.5d, item.getDouble(), 0) ;
+    }
+    
+    @Test public void testNum_04()
+    { 
+        Item item = parse("abc") ;
+        try {
+            item.getInt() ;
+            fail("Succeeded where exception expected") ;
+        } catch (ItemException ex) {}
+    }
+
+    @Test public void testNum_05()
+    { 
+        Item item = parse("<x>") ;
+        try {
+            item.getInt() ;
+            fail("Succeeded where exception expected") ;
+        } catch (ItemException ex) {}
+    }
+    
+    
+    @Test public void testMisc_01()    { testEquals("()") ; }
+    @Test public void testMisc_02()    { testEquals("(a)") ; }
+    @Test public void testMisc_10()    { testNotEquals("(a)", "a") ; }
+    @Test public void testMisc_11()    { testNotEquals("(a)", "()") ; }
+    @Test public void testMisc_12()    { testNotEquals("(a)", "(<a>)") ; }
+    
+    @Test public void testTaggedList_1()
+    {
+        Item x = Item.createTagged("TAG") ;
+        assertTrue(x.isTagged()) ;
+        assertTrue(x.isTagged("TAG")) ;
+    }
+    
+    @Test public void testTaggedList_2()
+    {
+        Item x = Item.createTagged("TAG") ;
+        Item.addPair(x.getList(), "KEY", "VALUE") ;
+        
+        Item y = Item.find(x.getList(), "KEY") ;
+        assertNotNull(y) ;
+        
+        Item z = Item.find(x.getList(), "KEYKEY") ;
+        assertNull(z) ;
+    }
+    
+    
+    
+     
+    // ---- Workers ----
+    
+    private void testEquals(String x)
+    {
+        Item item1 = parse(x) ;
+        Item item2 = parse(x) ;
+        assertTrue(item1.equals(item2)) ;
+        assertTrue(item2.equals(item1)) ;
+    }
+    
+    private void testNotEquals(String x1, String x2)
+    {
+        Item item1 = parse(x1) ;
+        Item item2 = parse(x2) ;
+        assertFalse(item1.equals(item2)) ;
+        assertFalse(item2.equals(item1)) ;
+    }
+    
+    private Item parse(String str)
+    {
+        Item item = ParserSSE.parse(str) ;
+        return item ;
+    }
+    
+    private Node parseNode(String str)
+    {
+        Item item = ParserSSE.parse(str) ;
+        return item.getNode() ;
+    }
+    
+    private void testSymbol(String str)
+    {
+        Item item = parse(str) ;
+        assertTrue(item.isSymbol()) ;
+        assertEquals(item.getSymbol(), str) ;
+    }
+    
+    private void testList(String str, Item item1)
+    {
+        Item item = parse(str) ;
+        assertTrue(item.isList()) ;
+        
+        Item i = item.getList().get(0) ;
+        
+        assertEquals(1, item.getList().size()) ;
+        assertEquals(item.getList().get(0), item1) ;
+    }
+
+    private void testList(String str, Item item1, Item item2)
+    {
+        Item item = parse(str) ;
+        assertTrue(item.isList()) ;
+        assertEquals(2, item.getList().size()) ;
+        assertEquals(item.getList().get(0), item1) ;
+        assertEquals(item.getList().get(1), item2) ;
+    }
+
+    private void testList(String str, Item item1, Item item2, Item item3)
+    {
+        Item item = parse(str) ;
+        assertTrue(item.isList()) ;
+        assertEquals(3, item.getList().size()) ;
+        assertEquals(item.getList().get(0), item1) ;
+        assertEquals(item.getList().get(1), item2) ;
+        assertEquals(item.getList().get(2), item3) ;
+    }
+    
+    private void testItem(String str, Item result)
+    {
+        Item item = parse(str) ;
+        assertEquals(result, item) ;
+    }
+    
+    private void testNotItem(String str, Item result)
+    {
+        Item item = parse(str) ;
+        assertFalse(result.equals(item)) ;
+    }
+
+    private void testNode(String str)
+    {
+        Node node = parseNode(str) ;
+    }
+    
+    private void testVar(String str)
+    {
+        Node node = parseNode(str) ;
+        assertTrue( node instanceof Var ) ;
+    }
+    
+    private void testNode(String str, Node result)
+    {
+        Node node = parseNode(str) ;
+        assertEquals(result, node) ;
+    }
+
+    
+//    private void parse(String str)
+//    {
+//        try {
+//            Item item = parse(str) ;
+//            //System.out.println(str+" => "+item) ;
+//            fail("Did not get a parse failure") ;
+//        } 
+//        catch (RiotParseException ex) {}
+//        catch (ARQException ex) {}
+//    }
+//    
+//    private void parseNode(String str)
+//    {
+//        try {
+//            Node node = parseNode(str) ;
+//            //System.out.println(str+" => "+item) ;
+//            fail("Did not get a parse failure") ;
+//        } 
+//        catch (RiotParseException ex) {}
+//        catch (ARQException ex) {}
+//    }
+
 }

Modified: incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/TestSSE_Builder.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/TestSSE_Builder.java?rev=1198733&r1=1198732&r2=1198733&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/TestSSE_Builder.java (original)
+++ incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/TestSSE_Builder.java Mon Nov  7 13:36:30 2011
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -16,74 +16,74 @@
  * limitations under the License.
  */
 
-package riot;
-
-
-import org.junit.Test ;
-import org.openjena.atlas.junit.BaseTest ;
-
-import com.hp.hpl.jena.sparql.algebra.Op ;
-import com.hp.hpl.jena.sparql.algebra.op.OpLabel ;
-import com.hp.hpl.jena.sparql.algebra.op.OpNull ;
-import com.hp.hpl.jena.sparql.algebra.op.OpTable ;
-import com.hp.hpl.jena.sparql.sse.Item ;
-import com.hp.hpl.jena.sparql.sse.SSE ;
-import com.hp.hpl.jena.sparql.sse.builders.BuilderNode ;
-
-public class TestSSE_Builder extends BaseTest
-{
-//    public static TestSuite suite()
-//    {
-//        TestSuite ts = new TestSuite(TestSSE_Builder.class) ;
-//        ts.setName("SSE Op") ;
-//        return ts ;
-//    }
-    
-    @Test public void test_01() { SSE.parseTriple("[triple ?s ?p ?o]") ; }
-    @Test public void test_02() { SSE.parseTriple("[?s ?p ?o]") ; }
-    @Test public void test_03() { SSE.parseTriple("[?s ?p ?o]") ; }
-    @Test public void test_04() { SSE.parseTriple("(?s ?p ?o)") ; }
-    @Test public void test_05() { SSE.parseQuad("(_ ?s ?p ?o)") ; }
-    @Test public void test_06() { SSE.parseQuad("(quad _ ?s ?p ?o)") ; }
-    
-    @Test public void test_07() { SSE.parseExpr("1") ; }
-    @Test public void test_08() { SSE.parseExpr("(+ 1 2)") ; }
-    
-    @Test public void testOp_01() { opSame("(null)") ; }
-    @Test public void testOp_02() { opSame("(null)", OpNull.create()) ; }
-    @Test public void testOp_03() { opSame("(bgp [triple ?s ?p ?o])") ; }
-
-    @Test public void testOp_04() { opSame("(label 'ABC' (table unit))", OpLabel.create("ABC", OpTable.unit())) ; }
-    
-    private static void opSame(String str)
-    {
-        opSame(str, SSE.parseOp(str)) ;
-    }
-    
-    private static void opSame(String str , Op other)
-    {
-        Op op = SSE.parseOp(str) ;
-        assertEquals(op, other) ;
-    }
-    
-    @Test public void testBuildInt_01()
-    { 
-        Item item = SSE.parseItem("1") ;
-        int i = BuilderNode.buildInt(item) ;
-        assertEquals(1, i) ;
-    }
-
-    @Test public void testBuildInt_02()
-    { 
-        Item item = SSE.parseItem("1") ;
-        int i = BuilderNode.buildInt(item, 23) ;
-        assertEquals(1, i) ;
-    }
-
-    @Test public void testBuildInt_03()
-    { 
-        Item item = SSE.parseItem("_") ;
-        int i = BuilderNode.buildInt(item, 23) ;
-        assertEquals(23, i) ;
-    }
+package riot;
+
+
+import org.junit.Test ;
+import org.openjena.atlas.junit.BaseTest ;
+
+import com.hp.hpl.jena.sparql.algebra.Op ;
+import com.hp.hpl.jena.sparql.algebra.op.OpLabel ;
+import com.hp.hpl.jena.sparql.algebra.op.OpNull ;
+import com.hp.hpl.jena.sparql.algebra.op.OpTable ;
+import com.hp.hpl.jena.sparql.sse.Item ;
+import com.hp.hpl.jena.sparql.sse.SSE ;
+import com.hp.hpl.jena.sparql.sse.builders.BuilderNode ;
+
+public class TestSSE_Builder extends BaseTest
+{
+//    public static TestSuite suite()
+//    {
+//        TestSuite ts = new TestSuite(TestSSE_Builder.class) ;
+//        ts.setName("SSE Op") ;
+//        return ts ;
+//    }
+    
+    @Test public void test_01() { SSE.parseTriple("[triple ?s ?p ?o]") ; }
+    @Test public void test_02() { SSE.parseTriple("[?s ?p ?o]") ; }
+    @Test public void test_03() { SSE.parseTriple("[?s ?p ?o]") ; }
+    @Test public void test_04() { SSE.parseTriple("(?s ?p ?o)") ; }
+    @Test public void test_05() { SSE.parseQuad("(_ ?s ?p ?o)") ; }
+    @Test public void test_06() { SSE.parseQuad("(quad _ ?s ?p ?o)") ; }
+    
+    @Test public void test_07() { SSE.parseExpr("1") ; }
+    @Test public void test_08() { SSE.parseExpr("(+ 1 2)") ; }
+    
+    @Test public void testOp_01() { opSame("(null)") ; }
+    @Test public void testOp_02() { opSame("(null)", OpNull.create()) ; }
+    @Test public void testOp_03() { opSame("(bgp [triple ?s ?p ?o])") ; }
+
+    @Test public void testOp_04() { opSame("(label 'ABC' (table unit))", OpLabel.create("ABC", OpTable.unit())) ; }
+    
+    private static void opSame(String str)
+    {
+        opSame(str, SSE.parseOp(str)) ;
+    }
+    
+    private static void opSame(String str , Op other)
+    {
+        Op op = SSE.parseOp(str) ;
+        assertEquals(op, other) ;
+    }
+    
+    @Test public void testBuildInt_01()
+    { 
+        Item item = SSE.parseItem("1") ;
+        int i = BuilderNode.buildInt(item) ;
+        assertEquals(1, i) ;
+    }
+
+    @Test public void testBuildInt_02()
+    { 
+        Item item = SSE.parseItem("1") ;
+        int i = BuilderNode.buildInt(item, 23) ;
+        assertEquals(1, i) ;
+    }
+
+    @Test public void testBuildInt_03()
+    { 
+        Item item = SSE.parseItem("_") ;
+        int i = BuilderNode.buildInt(item, 23) ;
+        assertEquals(23, i) ;
+    }
 }

Modified: incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/TestSSE_Forms.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/TestSSE_Forms.java?rev=1198733&r1=1198732&r2=1198733&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/TestSSE_Forms.java (original)
+++ incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/TestSSE_Forms.java Mon Nov  7 13:36:30 2011
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -16,155 +16,155 @@
  * limitations under the License.
  */
 
-package riot;
-
-import org.junit.Test ;
-import org.openjena.atlas.junit.BaseTest ;
-
-import com.hp.hpl.jena.datatypes.xsd.XSDDatatype ;
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.shared.PrefixMapping ;
-import com.hp.hpl.jena.shared.impl.PrefixMappingImpl ;
-import com.hp.hpl.jena.sparql.sse.Item ;
-import com.hp.hpl.jena.vocabulary.XSD ;
-
-public class TestSSE_Forms extends BaseTest
-{
-    static PrefixMapping pmap = new PrefixMappingImpl() ;
-    static { 
-        pmap.setNsPrefix("xsd", XSD.getURI()) ;
-        pmap.setNsPrefix("ex", "http://example/") ;
-    }
-//    public static TestSuite suite()
-//    {
-//        TestSuite ts = new TestSuite(TestSSE_Forms.class) ;
-//        ts.setName("SSE Resolve") ;
-//        
-//        SSE.getDefaultPrefixMapRead().removeNsPrefix("") ;
-//        SSE.getDefaultPrefixMapRead().removeNsPrefix("ex") ;
-////        SSE.setDefaultPrefixMapRead(null) ;
-////        SSE.setDefaultPrefixMapWrite(null) ;
-//        return ts ;
-//    }
-
-    // ---- Assume ParseHandlerResolver from here on
-    
-    @Test public void testBase_01()
-    { 
-        Item r = Item.createNode(Node.createURI("http://example/x")) ; 
-        testItem("(base <http://example/> <x>)", r) ;
-    }
-    
-    @Test public void testBase_02()
-    { 
-        Item r = Item.createNode(Node.createURI("http://example/x")) ; 
-        testItem("(base <http://HOST/> (base <http://example/xyz> <x>))", r) ;
-    }
-
-    @Test public void testBase_03()
-    { 
-        Item r = parse("(1 <http://example/xyz>)") ;
-        testItem("(base <http://example/> (1 <xyz>))", r) ;
-    }
-    
-    @Test public void testBase_04()
-    { 
-        Item r = parse("(1 <http://example/xyz>)") ;
-        testItem("(1 (base <http://example/> <xyz>))", r) ;
-    }
-    
-    @Test public void testBase_05()
-    { 
-        Item r = parse("(<http://example/xyz> <http://EXAMPLE/other#foo>)") ;
-        testItem("((base <http://example/> <xyz>) (base <http://EXAMPLE/other> <#foo>))", r) ;
-    }
-    
-    @Test public void testBase_06()
-    { 
-        Item r = parse("(<http://example/xyz> <http://EXAMPLE/other#foo>)") ;
-        testItem("(base <http://example/> (<xyz> (base <http://EXAMPLE/other> <#foo>)))", r) ;
-    }
-
-    @Test public void testBase_07()
-    { 
-        Item r = parse("(<http://example/xyz> <http://EXAMPLE/other#foo>)") ;
-        testItem("(base <http://EXAMPLE/other#> ((base <http://example/> <xyz>) <#foo>))", r) ;
-    }
-    
-    // ----
-    
-    @Test public void testPrefix_01()
-    { 
-        Item r = Item.createNode(Node.createURI("http://example/abc")) ;
-        testItem("(prefix ((ex: <http://example/>)) ex:abc)", r);
-    }
-
-    @Test public void testPrefix_02()
-    { 
-        Item r = Item.createNode(Node.createURI("http://EXAMPLE/abc")) ;
-        testItem("(prefix ((ex: <http://example/>)) (prefix ((ex: <http://EXAMPLE/>)) ex:abc))", r);
-    }
-    
-    @Test public void testPrefix_03()
-    { 
-        Item r = parse("(<http://example/abc>)") ;
-        testItem("(prefix ((ex: <http://example/>)) (ex:abc))", r);
-    }
-    
-    @Test public void testPrefix_04()
-    { 
-        Item r = parse("(<http://EXAMPLE/abc>)") ;
-        testItem("(prefix ((ex: <http://example/>)) ( (prefix ((ex: <http://EXAMPLE/>)) ex:abc) ))", r);
-    }
-    
-    @Test public void testPrefix_05()
-    { 
-        Item r = parse("(<http://example/abc>)") ;
-        testItem("(prefix ((ex: <http://example/>)) ( (prefix ((x: <http://EXAMPLE/>)) ex:abc) ))", r);
-    }
-    
-    // ---- Form
-    
-    @Test public void testForm_01()
-    { 
-        // Special form of nothing.
-        Item item = parse("(prefix ((ex: <http://example/>)))") ;
-        assertNull(item) ;
-    }
-    
-    @Test public void testForm_02()
-    { 
-        // Special form of nothing.
-        Item item = parse("(base <http://example/>)") ;
-        assertNull(item) ;
-    }
-    // ----
-    
-    // URI resolving.
-    
-    @Test public void testTypedLit_r1()
-    { 
-        Node node = Node.createLiteral("3", null, XSDDatatype.XSDinteger) ; 
-        testItem("'3'^^xsd:integer", Item.createNode(node)) ;
-    }
-
-
-
-    @Test public void testBasePrefix_01()
-    { 
-        Item r = parse("<http://example/abc>") ;
-        testItem("(base <http://example/> (prefix ((x: <>)) x:abc) )", r);
-    }
-    
-    private void testItem(String str, Item result)
-    {
-        Item item = parse(str) ;
-        assertEquals(result, item) ;
-    }
-    
-    private Item parse(String str)
-    {
-        Item item = ParserSSE.parse(str) ;
-        return item ;
-    }
+package riot;
+
+import org.junit.Test ;
+import org.openjena.atlas.junit.BaseTest ;
+
+import com.hp.hpl.jena.datatypes.xsd.XSDDatatype ;
+import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.shared.PrefixMapping ;
+import com.hp.hpl.jena.shared.impl.PrefixMappingImpl ;
+import com.hp.hpl.jena.sparql.sse.Item ;
+import com.hp.hpl.jena.vocabulary.XSD ;
+
+public class TestSSE_Forms extends BaseTest
+{
+    static PrefixMapping pmap = new PrefixMappingImpl() ;
+    static { 
+        pmap.setNsPrefix("xsd", XSD.getURI()) ;
+        pmap.setNsPrefix("ex", "http://example/") ;
+    }
+//    public static TestSuite suite()
+//    {
+//        TestSuite ts = new TestSuite(TestSSE_Forms.class) ;
+//        ts.setName("SSE Resolve") ;
+//        
+//        SSE.getDefaultPrefixMapRead().removeNsPrefix("") ;
+//        SSE.getDefaultPrefixMapRead().removeNsPrefix("ex") ;
+////        SSE.setDefaultPrefixMapRead(null) ;
+////        SSE.setDefaultPrefixMapWrite(null) ;
+//        return ts ;
+//    }
+
+    // ---- Assume ParseHandlerResolver from here on
+    
+    @Test public void testBase_01()
+    { 
+        Item r = Item.createNode(Node.createURI("http://example/x")) ; 
+        testItem("(base <http://example/> <x>)", r) ;
+    }
+    
+    @Test public void testBase_02()
+    { 
+        Item r = Item.createNode(Node.createURI("http://example/x")) ; 
+        testItem("(base <http://HOST/> (base <http://example/xyz> <x>))", r) ;
+    }
+
+    @Test public void testBase_03()
+    { 
+        Item r = parse("(1 <http://example/xyz>)") ;
+        testItem("(base <http://example/> (1 <xyz>))", r) ;
+    }
+    
+    @Test public void testBase_04()
+    { 
+        Item r = parse("(1 <http://example/xyz>)") ;
+        testItem("(1 (base <http://example/> <xyz>))", r) ;
+    }
+    
+    @Test public void testBase_05()
+    { 
+        Item r = parse("(<http://example/xyz> <http://EXAMPLE/other#foo>)") ;
+        testItem("((base <http://example/> <xyz>) (base <http://EXAMPLE/other> <#foo>))", r) ;
+    }
+    
+    @Test public void testBase_06()
+    { 
+        Item r = parse("(<http://example/xyz> <http://EXAMPLE/other#foo>)") ;
+        testItem("(base <http://example/> (<xyz> (base <http://EXAMPLE/other> <#foo>)))", r) ;
+    }
+
+    @Test public void testBase_07()
+    { 
+        Item r = parse("(<http://example/xyz> <http://EXAMPLE/other#foo>)") ;
+        testItem("(base <http://EXAMPLE/other#> ((base <http://example/> <xyz>) <#foo>))", r) ;
+    }
+    
+    // ----
+    
+    @Test public void testPrefix_01()
+    { 
+        Item r = Item.createNode(Node.createURI("http://example/abc")) ;
+        testItem("(prefix ((ex: <http://example/>)) ex:abc)", r);
+    }
+
+    @Test public void testPrefix_02()
+    { 
+        Item r = Item.createNode(Node.createURI("http://EXAMPLE/abc")) ;
+        testItem("(prefix ((ex: <http://example/>)) (prefix ((ex: <http://EXAMPLE/>)) ex:abc))", r);
+    }
+    
+    @Test public void testPrefix_03()
+    { 
+        Item r = parse("(<http://example/abc>)") ;
+        testItem("(prefix ((ex: <http://example/>)) (ex:abc))", r);
+    }
+    
+    @Test public void testPrefix_04()
+    { 
+        Item r = parse("(<http://EXAMPLE/abc>)") ;
+        testItem("(prefix ((ex: <http://example/>)) ( (prefix ((ex: <http://EXAMPLE/>)) ex:abc) ))", r);
+    }
+    
+    @Test public void testPrefix_05()
+    { 
+        Item r = parse("(<http://example/abc>)") ;
+        testItem("(prefix ((ex: <http://example/>)) ( (prefix ((x: <http://EXAMPLE/>)) ex:abc) ))", r);
+    }
+    
+    // ---- Form
+    
+    @Test public void testForm_01()
+    { 
+        // Special form of nothing.
+        Item item = parse("(prefix ((ex: <http://example/>)))") ;
+        assertNull(item) ;
+    }
+    
+    @Test public void testForm_02()
+    { 
+        // Special form of nothing.
+        Item item = parse("(base <http://example/>)") ;
+        assertNull(item) ;
+    }
+    // ----
+    
+    // URI resolving.
+    
+    @Test public void testTypedLit_r1()
+    { 
+        Node node = Node.createLiteral("3", null, XSDDatatype.XSDinteger) ; 
+        testItem("'3'^^xsd:integer", Item.createNode(node)) ;
+    }
+
+
+
+    @Test public void testBasePrefix_01()
+    { 
+        Item r = parse("<http://example/abc>") ;
+        testItem("(base <http://example/> (prefix ((x: <>)) x:abc) )", r);
+    }
+    
+    private void testItem(String str, Item result)
+    {
+        Item item = parse(str) ;
+        assertEquals(result, item) ;
+    }
+    
+    private Item parse(String str)
+    {
+        Item item = ParserSSE.parse(str) ;
+        return item ;
+    }
 }

Modified: incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TestTokenIO.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TestTokenIO.java?rev=1198733&r1=1198732&r2=1198733&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TestTokenIO.java (original)
+++ incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TestTokenIO.java Mon Nov  7 13:36:30 2011
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -16,202 +16,202 @@
  * limitations under the License.
  */
 
-package riot.io;
-
-import static org.openjena.riot.tokens.Token.tokenForChar ;
-import static org.openjena.riot.tokens.Token.tokenForNode ;
-
-import java.io.ByteArrayInputStream ;
-import java.io.ByteArrayOutputStream ;
-import java.io.IOException ;
-import java.nio.ByteBuffer ;
-import java.util.List ;
-
-import org.junit.AfterClass ;
-import org.junit.Before ;
-import org.junit.BeforeClass ;
-import org.junit.Test ;
-import org.openjena.atlas.io.BufferingWriter ;
-import org.openjena.atlas.junit.BaseTest ;
-import org.openjena.atlas.lib.Chars ;
-import org.openjena.atlas.lib.Sink ;
-import org.openjena.atlas.logging.Log ;
-import org.openjena.riot.tokens.Token ;
-import org.openjena.riot.tokens.TokenType ;
-import org.openjena.riot.tokens.Tokenizer ;
-import org.openjena.riot.tokens.TokenizerFactory ;
-import riot.io.TokenInputStream ;
-import riot.io.TokenInputStreamBase ;
-import riot.io.TokenOutputStreamWriter ;
-
-import com.hp.hpl.jena.graph.Node ;
-import com.hp.hpl.jena.sparql.sse.SSE ;
-
-public class TestTokenIO extends BaseTest
-{
-    static Node n1 = SSE.parseNode("<x>") ;
-    static Node n2 = SSE.parseNode("<http://example/y>") ;
-    static Node n3 = SSE.parseNode("<http://example/z>") ;
-    
-    static Node n4 = SSE.parseNode("'literal'") ;
-    static Node n5 = SSE.parseNode("'literal'@en") ;
-    static Node n6 = SSE.parseNode("123") ;
-    
-    static Node n7 = SSE.parseNode("'123'^^<http://example/myType>") ;
-
-    // Where to send things.
-    private SinkToBytes sink = new SinkToBytes() ;
-    private BufferingWriter w = new BufferingWriter(sink) ;
-    private TokenOutputStreamWriter out = new TokenOutputStreamWriter("OUT", w) ;
-
-    @BeforeClass public static void setupClass()
-    {
-        Log.enable("Token") ;
-    }
-    
-    @AfterClass public static void teardownClass()
-    {
-        Log.enable("Token", "warn") ;
-    }
-
-    
-    @Before public void setup()
-    { 
-        
-    }
-    
-    @Test public void tokens1()
-    {
-        send(n7) ;
-        expect(tokenForNode(n7)) ;
-    }
-    
-    @Test public void tokens2()
-    {
-        out.startTuple() ;
-        send(n7) ;
-        out.endTuple() ;
-        expect(tokenForNode(n7), tokenForChar(Chars.CH_DOT)) ;
-    }
-    
-    @Test public void tokens3()
-    {
-        send(n1, n4, n5, n6, n7) ;
-        
-        // Because tokenForNode sets the type as TokenType.STRING
-        Token t4 = tokenForNode(n4) ;
-        t4.setType(TokenType.STRING2) ;
-        
-        expect(tokenForNode(n1),
-               t4,
-               tokenForNode(n5),
-               tokenForNode(n6),
-               tokenForNode(n7)) ;
-    }
-
-    
-    @Test public void comms1()
-    {
-        send(n1) ;
-        expect(n1) ;
-    }
-    
-    @Test public void comms2()
-    {
-        send(n1, n2, n3) ;
-        expect(n1, n2, n3) ; 
-    }
-    
-    // Prefixes.
-    
-    @Test public void prefix1()
-    {
-        out.setPrefixMapping("", "http://example/") ;
-        send(n2) ;
-        expect(n2) ; 
-    }
-    
-    // ---- 
-    
-    private void send(Node... nodes)
-    {
-        for ( Node n : nodes )
-            out.sendNode(n) ;
-        out.flush() ;
-        
-    }
-    
-    private void expect(Node... nodes)
-    {
-        byte b[] = sink.bytes() ;
-        Tokenizer tokenizer = TokenizerFactory.makeTokenizerUTF8(new ByteArrayInputStream(b)) ;
-        //tokenizer = new PrintTokenizer("Read", tokenizer) ;
-        
-        // Expand prefixed names.
-        TokenInputStream in = new TokenInputStreamBase("IN", tokenizer) ;
-        
-        int idx = 0 ;
-        while ( in.hasNext() )
-        {
-            List<Token> tokens = in.next() ;
-            for ( Token t : tokens )
-            {
-                Node n = nodes[idx++] ;
-                assertFalse("Directive", t.hasType(TokenType.DIRECTIVE)) ;
-                assertEquals(n, t.asNode()) ;
-            }
-        }
-        tokenizer.close();
-    }
-    
-    private void expect(Token ...tokens)
-    {
-        out.flush() ;
-        byte b[] = sink.bytes() ;
-
-        //String s = StrUtils.fromUTF8bytes(b) ;
-        //System.out.println(s) ;
-        
-        Tokenizer tokenizer = TokenizerFactory.makeTokenizerUTF8(new ByteArrayInputStream(b)) ;
-        
-        for ( Token t : tokens )
-        {
-            
-            Token t2 = tokenizer.next() ;
-            //System.out.println(t2) ;
-            assertEquals(t, t2) ;
-        }
-        
-        assertFalse("Remaining tokens", tokenizer.hasNext()) ;
-        tokenizer.close();
-    }
-
-    
-    static class SinkToBytes implements Sink<ByteBuffer>
-    {
-        ByteArrayOutputStream out = new ByteArrayOutputStream() ;
-        
-        @Override
-        public void send(ByteBuffer item)
-        { 
-            for ( int i = item.position() ; i < item.limit() ; i++ )
-            {
-                byte b = item.get() ;
-                out.write(b) ;
-            }
-        }
-
-        public byte[] bytes() { return out.toByteArray() ; }
-        
-        @Override
-        public void close()
-        { try { out.close() ; } catch (IOException ex) {} }
-
-        @Override
-        public void flush()
-        { try { out.flush() ; } catch (IOException ex) {} }
-        
-       
-         
-    }
+package riot.io;
+
+import static org.openjena.riot.tokens.Token.tokenForChar ;
+import static org.openjena.riot.tokens.Token.tokenForNode ;
+
+import java.io.ByteArrayInputStream ;
+import java.io.ByteArrayOutputStream ;
+import java.io.IOException ;
+import java.nio.ByteBuffer ;
+import java.util.List ;
+
+import org.junit.AfterClass ;
+import org.junit.Before ;
+import org.junit.BeforeClass ;
+import org.junit.Test ;
+import org.openjena.atlas.io.BufferingWriter ;
+import org.openjena.atlas.junit.BaseTest ;
+import org.openjena.atlas.lib.Chars ;
+import org.openjena.atlas.lib.Sink ;
+import org.openjena.atlas.logging.Log ;
+import org.openjena.riot.tokens.Token ;
+import org.openjena.riot.tokens.TokenType ;
+import org.openjena.riot.tokens.Tokenizer ;
+import org.openjena.riot.tokens.TokenizerFactory ;
+import riot.io.TokenInputStream ;
+import riot.io.TokenInputStreamBase ;
+import riot.io.TokenOutputStreamWriter ;
+
+import com.hp.hpl.jena.graph.Node ;
+import com.hp.hpl.jena.sparql.sse.SSE ;
+
+public class TestTokenIO extends BaseTest
+{
+    static Node n1 = SSE.parseNode("<x>") ;
+    static Node n2 = SSE.parseNode("<http://example/y>") ;
+    static Node n3 = SSE.parseNode("<http://example/z>") ;
+    
+    static Node n4 = SSE.parseNode("'literal'") ;
+    static Node n5 = SSE.parseNode("'literal'@en") ;
+    static Node n6 = SSE.parseNode("123") ;
+    
+    static Node n7 = SSE.parseNode("'123'^^<http://example/myType>") ;
+
+    // Where to send things.
+    private SinkToBytes sink = new SinkToBytes() ;
+    private BufferingWriter w = new BufferingWriter(sink) ;
+    private TokenOutputStreamWriter out = new TokenOutputStreamWriter("OUT", w) ;
+
+    @BeforeClass public static void setupClass()
+    {
+        Log.enable("Token") ;
+    }
+    
+    @AfterClass public static void teardownClass()
+    {
+        Log.enable("Token", "warn") ;
+    }
+
+    
+    @Before public void setup()
+    { 
+        
+    }
+    
+    @Test public void tokens1()
+    {
+        send(n7) ;
+        expect(tokenForNode(n7)) ;
+    }
+    
+    @Test public void tokens2()
+    {
+        out.startTuple() ;
+        send(n7) ;
+        out.endTuple() ;
+        expect(tokenForNode(n7), tokenForChar(Chars.CH_DOT)) ;
+    }
+    
+    @Test public void tokens3()
+    {
+        send(n1, n4, n5, n6, n7) ;
+        
+        // Because tokenForNode sets the type as TokenType.STRING
+        Token t4 = tokenForNode(n4) ;
+        t4.setType(TokenType.STRING2) ;
+        
+        expect(tokenForNode(n1),
+               t4,
+               tokenForNode(n5),
+               tokenForNode(n6),
+               tokenForNode(n7)) ;
+    }
+
+    
+    @Test public void comms1()
+    {
+        send(n1) ;
+        expect(n1) ;
+    }
+    
+    @Test public void comms2()
+    {
+        send(n1, n2, n3) ;
+        expect(n1, n2, n3) ; 
+    }
+    
+    // Prefixes.
+    
+    @Test public void prefix1()
+    {
+        out.setPrefixMapping("", "http://example/") ;
+        send(n2) ;
+        expect(n2) ; 
+    }
+    
+    // ---- 
+    
+    private void send(Node... nodes)
+    {
+        for ( Node n : nodes )
+            out.sendNode(n) ;
+        out.flush() ;
+        
+    }
+    
+    private void expect(Node... nodes)
+    {
+        byte b[] = sink.bytes() ;
+        Tokenizer tokenizer = TokenizerFactory.makeTokenizerUTF8(new ByteArrayInputStream(b)) ;
+        //tokenizer = new PrintTokenizer("Read", tokenizer) ;
+        
+        // Expand prefixed names.
+        TokenInputStream in = new TokenInputStreamBase("IN", tokenizer) ;
+        
+        int idx = 0 ;
+        while ( in.hasNext() )
+        {
+            List<Token> tokens = in.next() ;
+            for ( Token t : tokens )
+            {
+                Node n = nodes[idx++] ;
+                assertFalse("Directive", t.hasType(TokenType.DIRECTIVE)) ;
+                assertEquals(n, t.asNode()) ;
+            }
+        }
+        tokenizer.close();
+    }
+    
+    private void expect(Token ...tokens)
+    {
+        out.flush() ;
+        byte b[] = sink.bytes() ;
+
+        //String s = StrUtils.fromUTF8bytes(b) ;
+        //System.out.println(s) ;
+        
+        Tokenizer tokenizer = TokenizerFactory.makeTokenizerUTF8(new ByteArrayInputStream(b)) ;
+        
+        for ( Token t : tokens )
+        {
+            
+            Token t2 = tokenizer.next() ;
+            //System.out.println(t2) ;
+            assertEquals(t, t2) ;
+        }
+        
+        assertFalse("Remaining tokens", tokenizer.hasNext()) ;
+        tokenizer.close();
+    }
+
+    
+    static class SinkToBytes implements Sink<ByteBuffer>
+    {
+        ByteArrayOutputStream out = new ByteArrayOutputStream() ;
+        
+        @Override
+        public void send(ByteBuffer item)
+        { 
+            for ( int i = item.position() ; i < item.limit() ; i++ )
+            {
+                byte b = item.get() ;
+                out.write(b) ;
+            }
+        }
+
+        public byte[] bytes() { return out.toByteArray() ; }
+        
+        @Override
+        public void close()
+        { try { out.close() ; } catch (IOException ex) {} }
+
+        @Override
+        public void flush()
+        { try { out.flush() ; } catch (IOException ex) {} }
+        
+       
+         
+    }
 }

Modified: incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenInputStream.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenInputStream.java?rev=1198733&r1=1198732&r2=1198733&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenInputStream.java (original)
+++ incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenInputStream.java Mon Nov  7 13:36:30 2011
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -16,16 +16,16 @@
  * limitations under the License.
  */
 
-package riot.io;
-
-import java.util.Iterator ;
-import java.util.List ;
-
-import org.openjena.atlas.lib.Closeable ;
-import org.openjena.riot.tokens.Token ;
-
-/** A stream of tokens */
-public interface TokenInputStream extends Iterator<List<Token>>, Iterable<List<Token>>, Closeable
-{
-    
+package riot.io;
+
+import java.util.Iterator ;
+import java.util.List ;
+
+import org.openjena.atlas.lib.Closeable ;
+import org.openjena.riot.tokens.Token ;
+
+/** A stream of tokens */
+public interface TokenInputStream extends Iterator<List<Token>>, Iterable<List<Token>>, Closeable
+{
+    
 }

Modified: incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenInputStreamBase.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenInputStreamBase.java?rev=1198733&r1=1198732&r2=1198733&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenInputStreamBase.java (original)
+++ incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenInputStreamBase.java Mon Nov  7 13:36:30 2011
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -16,165 +16,165 @@
  * limitations under the License.
  */
 
-package riot.io;
-
-import java.util.ArrayList ;
-import java.util.HashMap ;
-import java.util.Iterator ;
-import java.util.List ;
-import java.util.Map ;
-import java.util.NoSuchElementException ;
-
-import org.openjena.riot.tokens.PrintTokenizer ;
-import org.openjena.riot.tokens.Token ;
-import static org.openjena.riot.tokens.TokenType.* ;
-import org.openjena.riot.tokens.Tokenizer ;
-import org.slf4j.Logger ;
-import org.slf4j.LoggerFactory ;
-import riot.comms.CommsException ;
-
-/** Tokenizer that sorts out prefixes and groups into sequences of token */
-public class TokenInputStreamBase implements TokenInputStream
-{
-    private static Logger log = LoggerFactory.getLogger(TokenInputStreamBase.class) ;
-    private boolean finished = false ;
-    private final Tokenizer tokens ;
-    private List<Token> list ;
-    private Map<String, String> map = new HashMap<String, String>() ;
-    private String label ;
-    
-    public TokenInputStreamBase(String label, Tokenizer tokens)
-    {
-        if ( false ) tokens = new PrintTokenizer("InputStream: ", tokens) ;
-        this.tokens = tokens ;
-        this.label = label ;
-    }
-
-    @Override
-    public boolean hasNext()
-    {
-        if ( finished )
-            return false ;
-        
-        if ( list != null ) // Already got the reply.
-            return true ;
-
-        try {
-            if ( ! tokens.hasNext() )
-            {
-                finished = true ;
-                return false ;
-            }
-            list = buildOneLine() ;
-            if ( false && log.isDebugEnabled() )
-                log.debug("Tokens: "+list) ;
-            if ( list == null )
-                finished = true ;
-            return list != null ;
-        } catch (Exception ex) { finished = true ; return false ; }
-    }
-
-    private List<Token> buildOneLine()
-    {
-        List<Token> tuple = new ArrayList<Token>() ;
-        boolean isDirective = false ;
-        for( ; tokens.hasNext() ; )
-        {
-            Token token = tokens.next() ;
-            
-            if ( token.hasType(DIRECTIVE) )
-                isDirective = true ;
-            
-            if ( token.hasType(DOT) )
-            {
-                if ( tuple.size() > 0 &&  tuple.get(0).hasType(DIRECTIVE))
-                {
-                    directive(tuple) ;
-                    tuple.clear();
-                    isDirective = false ;
-                    // Start again.
-                    continue ;
-                }
-                return tuple ;
-            }
-
-            // Fixup prefix names.
-            if ( !isDirective && token.hasType(PREFIXED_NAME) )
-            {
-                String ns = map.get(token.getImage()) ;
-                String iri ;
-                if ( ns == null)
-                {
-                    log.warn("Can't resolve '"+token.toString(false)+"'", ns) ;
-                    iri = "unresolved:"+token.getImage()+":"+token.getImage2() ;
-                }
-                else
-                    iri = ns+token.getImage2() ; 
-                token.setType(IRI) ;
-                token.setImage(iri) ;
-                token.setImage2(null) ;
-            }
-            
-            tuple.add(token) ;
-        }
-
-        // No final DOT
-        return tuple ;
-    }
-
-    private void directive(List<Token> tuple)
-    {
-        if ( tuple.size() != 3 )
-            throw new CommsException("Bad directive: "+tuple) ;
-        
-        String x = tuple.get(0).getImage() ;
-        
-        if ( x.equals("prefix") )
-        {
-            // Raw - unresolved prefix name.
-            if ( ! tuple.get(1).hasType(PREFIXED_NAME) )
-                throw new CommsException("@prefix requires a prefix (found '"+tuple.get(1)+"')") ;
-            if ( tuple.get(1).getImage2().length() != 0 )
-                throw new CommsException("@prefix requires a prefix and no suffix (found '"+tuple.get(1)+"')") ;
-            String prefix = tuple.get(1).getImage() ;
-            
-            if ( ! tuple.get(2).hasType(IRI) )
-                throw new CommsException("@prefix requires an IRI (found '"+tuple.get(1)+"')") ;
-            String iriStr = tuple.get(2).getImage() ;
-            map.put(prefix, iriStr) ;
-            return ;
-        }
-        throw new CommsException("Unregcognized directive: "+x) ;
-    }
-    
-    @Override
-    public List<Token> next()
-    {
-        if ( ! hasNext() )
-            throw new NoSuchElementException() ;
-        List<Token> r = list ;
-        if ( log.isDebugEnabled() )
-        {
-            if ( label != null )
-                log.debug("<< "+label+": "+r) ;
-            else
-                log.debug("<< "+r.toString()) ;
-        }
-        list = null ;
-        return r ;
-    }
-
-    @Override
-    public void remove()
-    { throw new UnsupportedOperationException() ; }
-
-    @Override
-    public Iterator<List<Token>> iterator()
-    {
-        return this ;
-    }
-
-    @Override
-    public void close()
-    {}
+package riot.io;
+
+import java.util.ArrayList ;
+import java.util.HashMap ;
+import java.util.Iterator ;
+import java.util.List ;
+import java.util.Map ;
+import java.util.NoSuchElementException ;
+
+import org.openjena.riot.tokens.PrintTokenizer ;
+import org.openjena.riot.tokens.Token ;
+import static org.openjena.riot.tokens.TokenType.* ;
+import org.openjena.riot.tokens.Tokenizer ;
+import org.slf4j.Logger ;
+import org.slf4j.LoggerFactory ;
+import riot.comms.CommsException ;
+
+/** Tokenizer that sorts out prefixes and groups into sequences of token */
+public class TokenInputStreamBase implements TokenInputStream
+{
+    private static Logger log = LoggerFactory.getLogger(TokenInputStreamBase.class) ;
+    private boolean finished = false ;
+    private final Tokenizer tokens ;
+    private List<Token> list ;
+    private Map<String, String> map = new HashMap<String, String>() ;
+    private String label ;
+    
+    public TokenInputStreamBase(String label, Tokenizer tokens)
+    {
+        if ( false ) tokens = new PrintTokenizer("InputStream: ", tokens) ;
+        this.tokens = tokens ;
+        this.label = label ;
+    }
+
+    @Override
+    public boolean hasNext()
+    {
+        if ( finished )
+            return false ;
+        
+        if ( list != null ) // Already got the reply.
+            return true ;
+
+        try {
+            if ( ! tokens.hasNext() )
+            {
+                finished = true ;
+                return false ;
+            }
+            list = buildOneLine() ;
+            if ( false && log.isDebugEnabled() )
+                log.debug("Tokens: "+list) ;
+            if ( list == null )
+                finished = true ;
+            return list != null ;
+        } catch (Exception ex) { finished = true ; return false ; }
+    }
+
+    private List<Token> buildOneLine()
+    {
+        List<Token> tuple = new ArrayList<Token>() ;
+        boolean isDirective = false ;
+        for( ; tokens.hasNext() ; )
+        {
+            Token token = tokens.next() ;
+            
+            if ( token.hasType(DIRECTIVE) )
+                isDirective = true ;
+            
+            if ( token.hasType(DOT) )
+            {
+                if ( tuple.size() > 0 &&  tuple.get(0).hasType(DIRECTIVE))
+                {
+                    directive(tuple) ;
+                    tuple.clear();
+                    isDirective = false ;
+                    // Start again.
+                    continue ;
+                }
+                return tuple ;
+            }
+
+            // Fixup prefix names.
+            if ( !isDirective && token.hasType(PREFIXED_NAME) )
+            {
+                String ns = map.get(token.getImage()) ;
+                String iri ;
+                if ( ns == null)
+                {
+                    log.warn("Can't resolve '"+token.toString(false)+"'", ns) ;
+                    iri = "unresolved:"+token.getImage()+":"+token.getImage2() ;
+                }
+                else
+                    iri = ns+token.getImage2() ; 
+                token.setType(IRI) ;
+                token.setImage(iri) ;
+                token.setImage2(null) ;
+            }
+            
+            tuple.add(token) ;
+        }
+
+        // No final DOT
+        return tuple ;
+    }
+
+    private void directive(List<Token> tuple)
+    {
+        if ( tuple.size() != 3 )
+            throw new CommsException("Bad directive: "+tuple) ;
+        
+        String x = tuple.get(0).getImage() ;
+        
+        if ( x.equals("prefix") )
+        {
+            // Raw - unresolved prefix name.
+            if ( ! tuple.get(1).hasType(PREFIXED_NAME) )
+                throw new CommsException("@prefix requires a prefix (found '"+tuple.get(1)+"')") ;
+            if ( tuple.get(1).getImage2().length() != 0 )
+                throw new CommsException("@prefix requires a prefix and no suffix (found '"+tuple.get(1)+"')") ;
+            String prefix = tuple.get(1).getImage() ;
+            
+            if ( ! tuple.get(2).hasType(IRI) )
+                throw new CommsException("@prefix requires an IRI (found '"+tuple.get(1)+"')") ;
+            String iriStr = tuple.get(2).getImage() ;
+            map.put(prefix, iriStr) ;
+            return ;
+        }
+        throw new CommsException("Unregcognized directive: "+x) ;
+    }
+    
+    @Override
+    public List<Token> next()
+    {
+        if ( ! hasNext() )
+            throw new NoSuchElementException() ;
+        List<Token> r = list ;
+        if ( log.isDebugEnabled() )
+        {
+            if ( label != null )
+                log.debug("<< "+label+": "+r) ;
+            else
+                log.debug("<< "+r.toString()) ;
+        }
+        list = null ;
+        return r ;
+    }
+
+    @Override
+    public void remove()
+    { throw new UnsupportedOperationException() ; }
+
+    @Override
+    public Iterator<List<Token>> iterator()
+    {
+        return this ;
+    }
+
+    @Override
+    public void close()
+    {}
 }

Modified: incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenInputStreamWrapper.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenInputStreamWrapper.java?rev=1198733&r1=1198732&r2=1198733&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenInputStreamWrapper.java (original)
+++ incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenInputStreamWrapper.java Mon Nov  7 13:36:30 2011
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -16,32 +16,32 @@
  * limitations under the License.
  */
 
-package riot.io;
-
-import java.util.Iterator ;
-import java.util.List ;
-
-import org.openjena.atlas.lib.Closeable ;
-import org.openjena.riot.tokens.Token ;
-
-public class TokenInputStreamWrapper implements Iterator<List<Token>>, Iterable<List<Token>>, Closeable
-{
-    private TokenInputStream stream ;
-    
-    public TokenInputStreamWrapper(TokenInputStream stream) { this.stream = stream ; }
-
-    @Override
-    public boolean hasNext()                    { return stream.hasNext() ; }
-
-    @Override
-    public List<Token> next()                   { return stream.next() ; }
-
-    @Override
-    public void remove()                        { stream.remove() ; }
-
-    @Override
-    public Iterator<List<Token>> iterator()     { return stream.iterator() ; }
-
-    @Override
-    public void close()                         { stream.close(); }
+package riot.io;
+
+import java.util.Iterator ;
+import java.util.List ;
+
+import org.openjena.atlas.lib.Closeable ;
+import org.openjena.riot.tokens.Token ;
+
+public class TokenInputStreamWrapper implements Iterator<List<Token>>, Iterable<List<Token>>, Closeable
+{
+    private TokenInputStream stream ;
+    
+    public TokenInputStreamWrapper(TokenInputStream stream) { this.stream = stream ; }
+
+    @Override
+    public boolean hasNext()                    { return stream.hasNext() ; }
+
+    @Override
+    public List<Token> next()                   { return stream.next() ; }
+
+    @Override
+    public void remove()                        { stream.remove() ; }
+
+    @Override
+    public Iterator<List<Token>> iterator()     { return stream.iterator() ; }
+
+    @Override
+    public void close()                         { stream.close(); }
 }

Modified: incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenOutputStream.java?rev=1198733&r1=1198732&r2=1198733&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenOutputStream.java (original)
+++ incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenOutputStream.java Mon Nov  7 13:36:30 2011
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -16,35 +16,35 @@
  * limitations under the License.
  */
 
-package riot.io;
-
-import org.openjena.atlas.io.BufferingWriter ;
-import org.openjena.atlas.lib.Closeable ;
-import org.openjena.atlas.lib.Sync ;
-import org.openjena.riot.tokens.Token ;
-
-import com.hp.hpl.jena.graph.Node ;
-
-public interface TokenOutputStream extends Closeable, Sync
-{
-    public void sendToken(Token token) ;
-    public void sendNode(Node node) ;
-    public void sendString(String string) ;
-    public void sendWord(String word) ;
-    public void sendControl(char character) ;
-    public void sendNumber(long number) ;
-
-    public void startTuple() ;
-    public void endTuple() ;
-    
-    public void startSection() ;
-    public void endSection() ;
-    
-    public BufferingWriter getWriter() ;
-    
-    public void flush() ;
-    // Remove this when TDB jar gets updated.
-    @Override
-    public void sync() ;
-
+package riot.io;
+
+import org.openjena.atlas.io.BufferingWriter ;
+import org.openjena.atlas.lib.Closeable ;
+import org.openjena.atlas.lib.Sync ;
+import org.openjena.riot.tokens.Token ;
+
+import com.hp.hpl.jena.graph.Node ;
+
+public interface TokenOutputStream extends Closeable, Sync
+{
+    public void sendToken(Token token) ;
+    public void sendNode(Node node) ;
+    public void sendString(String string) ;
+    public void sendWord(String word) ;
+    public void sendControl(char character) ;
+    public void sendNumber(long number) ;
+
+    public void startTuple() ;
+    public void endTuple() ;
+    
+    public void startSection() ;
+    public void endSection() ;
+    
+    public BufferingWriter getWriter() ;
+    
+    public void flush() ;
+    // Remove this when TDB jar gets updated.
+    @Override
+    public void sync() ;
+
 }

Modified: incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenOutputStreamWrapper.java
URL: http://svn.apache.org/viewvc/incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenOutputStreamWrapper.java?rev=1198733&r1=1198732&r2=1198733&view=diff
==============================================================================
--- incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenOutputStreamWrapper.java (original)
+++ incubator/jena/Scratch/AFS/Dev/trunk/src/main/java/riot/io/TokenOutputStreamWrapper.java Mon Nov  7 13:36:30 2011
@@ -1,4 +1,4 @@
-/**
+/*
  * 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
@@ -16,63 +16,63 @@
  * limitations under the License.
  */
 
-package riot.io;
-
-import org.openjena.atlas.io.BufferingWriter ;
-import org.openjena.riot.tokens.Token ;
-
-import com.hp.hpl.jena.graph.Node ;
-
-
-public class TokenOutputStreamWrapper implements TokenOutputStream
-{
-    private TokenOutputStream stream ;
-
-    public TokenOutputStreamWrapper(TokenOutputStream stream)
-    {
-        this.stream = stream ;
-    }
-    
-    @Override
-    public void startSection()              { stream.startSection() ; }
-
-    @Override
-    public void endSection()                { stream.endSection() ; }
-
-    @Override
-    public void startTuple()                { stream.startTuple() ; }
-
-    @Override
-    public void endTuple()                  { stream.endTuple() ; }
-
-    @Override
-    public BufferingWriter getWriter()      { return stream.getWriter() ; }
-
-    @Override
-    public void sendToken(Token token)      { stream.sendToken(token)  ; }
-    
-
-    @Override
-    public void sendControl(char character) { stream.sendControl(character) ; }
-
-    @Override
-    public void sendNode(Node node)         { stream.sendNode(node) ; }
-
-    @Override
-    public void sendNumber(long number)     { stream.sendNumber(number) ; }
-
-    @Override
-    public void sendString(String string)   { stream.sendString(string) ; }
-
-    @Override
-    public void sendWord(String word)       { stream.sendWord(word) ; }
-
-    @Override
-    public void close()                     { stream.close(); }
-
-    @Override
-    public void flush()                     { stream.flush(); }
-
-    @Override
-    public void sync()                      { stream.sync() ; }
+package riot.io;
+
+import org.openjena.atlas.io.BufferingWriter ;
+import org.openjena.riot.tokens.Token ;
+
+import com.hp.hpl.jena.graph.Node ;
+
+
+public class TokenOutputStreamWrapper implements TokenOutputStream
+{
+    private TokenOutputStream stream ;
+
+    public TokenOutputStreamWrapper(TokenOutputStream stream)
+    {
+        this.stream = stream ;
+    }
+    
+    @Override
+    public void startSection()              { stream.startSection() ; }
+
+    @Override
+    public void endSection()                { stream.endSection() ; }
+
+    @Override
+    public void startTuple()                { stream.startTuple() ; }
+
+    @Override
+    public void endTuple()                  { stream.endTuple() ; }
+
+    @Override
+    public BufferingWriter getWriter()      { return stream.getWriter() ; }
+
+    @Override
+    public void sendToken(Token token)      { stream.sendToken(token)  ; }
+    
+
+    @Override
+    public void sendControl(char character) { stream.sendControl(character) ; }
+
+    @Override
+    public void sendNode(Node node)         { stream.sendNode(node) ; }
+
+    @Override
+    public void sendNumber(long number)     { stream.sendNumber(number) ; }
+
+    @Override
+    public void sendString(String string)   { stream.sendString(string) ; }
+
+    @Override
+    public void sendWord(String word)       { stream.sendWord(word) ; }
+
+    @Override
+    public void close()                     { stream.close(); }
+
+    @Override
+    public void flush()                     { stream.flush(); }
+
+    @Override
+    public void sync()                      { stream.sync() ; }
 }