commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r903752 - in /commons/proper/digester/trunk/src/test/org/apache/commons/digester: DigesterTestCase.java LocationTrackerTestCase.java XIncludeTestCase.java XMLSchemaTestCase.java
Date Wed, 27 Jan 2010 17:38:26 GMT
Author: sebb
Date: Wed Jan 27 17:38:26 2010
New Revision: 903752

URL: http://svn.apache.org/viewvc?rev=903752&view=rev
Log:
Tab police

Modified:
    commons/proper/digester/trunk/src/test/org/apache/commons/digester/DigesterTestCase.java
    commons/proper/digester/trunk/src/test/org/apache/commons/digester/LocationTrackerTestCase.java
    commons/proper/digester/trunk/src/test/org/apache/commons/digester/XIncludeTestCase.java
    commons/proper/digester/trunk/src/test/org/apache/commons/digester/XMLSchemaTestCase.java

Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/DigesterTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/DigesterTestCase.java?rev=903752&r1=903751&r2=903752&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/DigesterTestCase.java
(original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/DigesterTestCase.java
Wed Jan 27 17:38:26 2010
@@ -570,95 +570,95 @@
     
     /** Utility class for method testStackAction */
     private static class TrackingStackAction implements StackAction {
-    	public ArrayList<String> events = new ArrayList<String>();
-    	public Object onPush(Digester d, String stackName, Object o) {
-    		String msg = "push:" + stackName + ":" + o.toString();
-    		events.add(msg);
-    		
-    		String str = o.toString();
-    		if (str.startsWith("replpush")) {
-    			return new String(str);
-    		} else {
-    			return o;
-    		}
-    	}
-    	public Object onPop(Digester d, String stackName, Object o) {
-    		String msg = "pop:" + stackName + ":" + o.toString();
-    		events.add(msg);
-    		String str = o.toString();
-    		if (str.startsWith("replpop")) {
-    			return new String(str);
-    		} else {
-    			return o;
-    		}
-    	}
+        public ArrayList<String> events = new ArrayList<String>();
+        public Object onPush(Digester d, String stackName, Object o) {
+            String msg = "push:" + stackName + ":" + o.toString();
+            events.add(msg);
+            
+            String str = o.toString();
+            if (str.startsWith("replpush")) {
+                return new String(str);
+            } else {
+                return o;
+            }
+        }
+        public Object onPop(Digester d, String stackName, Object o) {
+            String msg = "pop:" + stackName + ":" + o.toString();
+            events.add(msg);
+            String str = o.toString();
+            if (str.startsWith("replpop")) {
+                return new String(str);
+            } else {
+                return o;
+            }
+        }
     }
 
     /**
      * Test custom StackAction subclasses.
      */
     public void testStackAction() {
-    	TrackingStackAction action = new TrackingStackAction();
-    	
-    	Object obj1 = new String("obj1");
-    	Object obj2 = new String("obj2");
-    	Object obj3 = new String("replpop.obj3");
-    	Object obj4 = new String("replpush.obj4");
-
-    	Object obj8 = new String("obj8");
-    	Object obj9 = new String("obj9");
-
-    	Digester d = new Digester();
-    	d.setStackAction(action);
-
-    	assertEquals(0, action.events.size());
-    	d.push(obj1);
-    	d.push(obj2);
-    	d.push(obj3);
-    	d.push(obj4);
-
-    	assertNotNull(d.peek(0));
-    	// for obj4, a copy should have been pushed
-    	assertFalse(obj4 == d.peek(0));
-    	assertEquals(obj4, d.peek(0));
-    	// for obj3, replacement only occurs on pop
-    	assertSame(obj3, d.peek(1));
-    	assertSame(obj2, d.peek(2));
-    	assertSame(obj1, d.peek(3));
-
-    	Object obj4a = d.pop();
-    	Object obj3a = d.pop();
-    	Object obj2a = d.pop();
-    	Object obj1a = d.pop();
-    	
-    	assertFalse(obj4 == obj4a);
-    	assertEquals(obj4, obj4a);
-    	assertFalse(obj3 == obj4a);
-    	assertEquals(obj3, obj3a);
-    	assertSame(obj2, obj2a);
-    	assertSame(obj1, obj1a);
-
-    	d.push("stack1", obj8);
-    	d.push("stack1", obj9);
-    	Object obj9a = d.pop("stack1");
-    	Object obj8a = d.pop("stack1");
-
-    	assertSame(obj8, obj8a);
-    	assertSame(obj9, obj9a);
-
-    	assertEquals(12, action.events.size());
-    	assertEquals("push:null:obj1", action.events.get(0));
-    	assertEquals("push:null:obj2", action.events.get(1));
-    	assertEquals("push:null:replpop.obj3", action.events.get(2));
-    	assertEquals("push:null:replpush.obj4", action.events.get(3));
-    	assertEquals("pop:null:replpush.obj4", action.events.get(4));
-    	assertEquals("pop:null:replpop.obj3", action.events.get(5));
-    	assertEquals("pop:null:obj2", action.events.get(6));
-    	assertEquals("pop:null:obj1", action.events.get(7));
-
-    	assertEquals("push:stack1:obj8", action.events.get(8));
-    	assertEquals("push:stack1:obj9", action.events.get(9));
-    	assertEquals("pop:stack1:obj9", action.events.get(10));
-    	assertEquals("pop:stack1:obj8", action.events.get(11));
+        TrackingStackAction action = new TrackingStackAction();
+        
+        Object obj1 = new String("obj1");
+        Object obj2 = new String("obj2");
+        Object obj3 = new String("replpop.obj3");
+        Object obj4 = new String("replpush.obj4");
+
+        Object obj8 = new String("obj8");
+        Object obj9 = new String("obj9");
+
+        Digester d = new Digester();
+        d.setStackAction(action);
+
+        assertEquals(0, action.events.size());
+        d.push(obj1);
+        d.push(obj2);
+        d.push(obj3);
+        d.push(obj4);
+
+        assertNotNull(d.peek(0));
+        // for obj4, a copy should have been pushed
+        assertFalse(obj4 == d.peek(0));
+        assertEquals(obj4, d.peek(0));
+        // for obj3, replacement only occurs on pop
+        assertSame(obj3, d.peek(1));
+        assertSame(obj2, d.peek(2));
+        assertSame(obj1, d.peek(3));
+
+        Object obj4a = d.pop();
+        Object obj3a = d.pop();
+        Object obj2a = d.pop();
+        Object obj1a = d.pop();
+        
+        assertFalse(obj4 == obj4a);
+        assertEquals(obj4, obj4a);
+        assertFalse(obj3 == obj4a);
+        assertEquals(obj3, obj3a);
+        assertSame(obj2, obj2a);
+        assertSame(obj1, obj1a);
+
+        d.push("stack1", obj8);
+        d.push("stack1", obj9);
+        Object obj9a = d.pop("stack1");
+        Object obj8a = d.pop("stack1");
+
+        assertSame(obj8, obj8a);
+        assertSame(obj9, obj9a);
+
+        assertEquals(12, action.events.size());
+        assertEquals("push:null:obj1", action.events.get(0));
+        assertEquals("push:null:obj2", action.events.get(1));
+        assertEquals("push:null:replpop.obj3", action.events.get(2));
+        assertEquals("push:null:replpush.obj4", action.events.get(3));
+        assertEquals("pop:null:replpush.obj4", action.events.get(4));
+        assertEquals("pop:null:replpop.obj3", action.events.get(5));
+        assertEquals("pop:null:obj2", action.events.get(6));
+        assertEquals("pop:null:obj1", action.events.get(7));
+
+        assertEquals("push:stack1:obj8", action.events.get(8));
+        assertEquals("push:stack1:obj9", action.events.get(9));
+        assertEquals("pop:stack1:obj9", action.events.get(10));
+        assertEquals("pop:stack1:obj8", action.events.get(11));
     }
 }

Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/LocationTrackerTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/LocationTrackerTestCase.java?rev=903752&r1=903751&r2=903752&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/LocationTrackerTestCase.java
(original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/LocationTrackerTestCase.java
Wed Jan 27 17:38:26 2010
@@ -36,49 +36,49 @@
  */
 
 public class LocationTrackerTestCase extends TestCase {
-	
-	private static class LocationTracker implements StackAction {
-		public Map<Object, String> locations = new HashMap<Object, String>();
-
-    	public Object onPush(Digester d, String stackName, Object o) {
-    		if (stackName == null) {
-    			// we only care about the real object stack
-	    		
-	    		// note that a Locator object can also provide 
-	    		// publicId and systemId info.
-	    		Locator l = d.getDocumentLocator();
-	    		StringBuffer locn = new StringBuffer();
-	    		locn.append("line=");
-	    		locn.append(l.getLineNumber());
-	    		locations.put(o, locn.toString());
-    		}
-    		return o;
-    	}
-
-    	public Object onPop(Digester d, String stackName, Object o) {
-    		return o;
-    	}
-	}
-
-	public void testAll() throws Exception {
-	    final String TEST_XML =
-	        "<?xml version='1.0'?>\n"
-	    	+ "<box id='root'>\n"
-	    	+ "  <subBox id='box1'/>\n" 
-	    	+ "  <ignoreme/>\n"
-	    	+ "  <subBox id='box2'/> <subBox id='box3'/>\n" 
-	    	+ "</box>";
-	    
-	    LocationTracker locnTracker = new LocationTracker();
 
-	    Digester digester = new Digester();
-	    digester.setStackAction(locnTracker);
+    private static class LocationTracker implements StackAction {
+        public Map<Object, String> locations = new HashMap<Object, String>();
+
+        public Object onPush(Digester d, String stackName, Object o) {
+            if (stackName == null) {
+                // we only care about the real object stack
+                
+                // note that a Locator object can also provide 
+                // publicId and systemId info.
+                Locator l = d.getDocumentLocator();
+                StringBuffer locn = new StringBuffer();
+                locn.append("line=");
+                locn.append(l.getLineNumber());
+                locations.put(o, locn.toString());
+            }
+            return o;
+        }
+
+        public Object onPop(Digester d, String stackName, Object o) {
+            return o;
+        }
+    }
+
+    public void testAll() throws Exception {
+        final String TEST_XML =
+            "<?xml version='1.0'?>\n"
+            + "<box id='root'>\n"
+            + "  <subBox id='box1'/>\n" 
+            + "  <ignoreme/>\n"
+            + "  <subBox id='box2'/> <subBox id='box3'/>\n" 
+            + "</box>";
+        
+        LocationTracker locnTracker = new LocationTracker();
+
+        Digester digester = new Digester();
+        digester.setStackAction(locnTracker);
         digester.addObjectCreate("box", Box.class);
         digester.addSetProperties("box");
         digester.addObjectCreate("box/subBox", Box.class);
         digester.addSetProperties("box/subBox");
         digester.addSetNext("box/subBox", "addChild");
-	    
+
         Object result = digester.parse(new StringReader(TEST_XML));
         assertNotNull(result);
         Box root = (Box) result;

Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/XIncludeTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/XIncludeTestCase.java?rev=903752&r1=903751&r2=903752&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/XIncludeTestCase.java
(original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/XIncludeTestCase.java
Wed Jan 27 17:38:26 2010
@@ -103,9 +103,9 @@
      */
     public void testXInclude() throws SAXException, IOException {
 
-    	// Turn on XInclude processing
-    	digester.setNamespaceAware(true);
-    	digester.setXIncludeAware(true);
+        // Turn on XInclude processing
+        digester.setNamespaceAware(true);
+        digester.setXIncludeAware(true);
 
         // Configure the digester as required
         digester.addObjectCreate("employee", Employee.class);

Modified: commons/proper/digester/trunk/src/test/org/apache/commons/digester/XMLSchemaTestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/src/test/org/apache/commons/digester/XMLSchemaTestCase.java?rev=903752&r1=903751&r2=903752&view=diff
==============================================================================
--- commons/proper/digester/trunk/src/test/org/apache/commons/digester/XMLSchemaTestCase.java
(original)
+++ commons/proper/digester/trunk/src/test/org/apache/commons/digester/XMLSchemaTestCase.java
Wed Jan 27 17:38:26 2010
@@ -78,14 +78,14 @@
         digester = new Digester();
 
         // Use the test schema
-    	digester.setNamespaceAware(true);
-    	Schema test13schema = SchemaFactory.
-    	    newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).
-    	    newSchema(this.getClass().getClassLoader().
-    	        getResource("org/apache/commons/digester/Test13.xsd"));
-    	digester.setXMLSchema(test13schema);
+        digester.setNamespaceAware(true);
+        Schema test13schema = SchemaFactory.
+            newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).
+            newSchema(this.getClass().getClassLoader().
+                getResource("org/apache/commons/digester/Test13.xsd"));
+        digester.setXMLSchema(test13schema);
 
-    	// Configure the digester as required
+        // Configure the digester as required
         digester.addObjectCreate("employee", Employee.class);
         digester.addCallMethod("employee/firstName", "setFirstName", 0);
         digester.addCallMethod("employee/lastName", "setLastName", 0);
@@ -128,9 +128,9 @@
      */
     public void testGoodDocument() throws SAXException, IOException {
 
-    	// Listen to validation errors
-    	TestErrorHandler teh = new TestErrorHandler();
-    	digester.setErrorHandler(teh);
+        // Listen to validation errors
+        TestErrorHandler teh = new TestErrorHandler();
+        digester.setErrorHandler(teh);
 
         // Parse our test input
         Employee employee = (Employee) digester.parse(getInputStream("Test13-01.xml"));
@@ -147,12 +147,12 @@
 
     public void testBadDocument() throws SAXException, IOException {
 
-    	// Listen to validation errors
-    	TestErrorHandler teh = new TestErrorHandler();
-    	digester.setErrorHandler(teh);
+        // Listen to validation errors
+        TestErrorHandler teh = new TestErrorHandler();
+        digester.setErrorHandler(teh);
 
         // Parse our test input
-    	digester.parse(getInputStream("Test13-02.xml"));
+        digester.parse(getInputStream("Test13-02.xml"));
         assertFalse("Test13-02 should generate errors in Schema validation", teh.clean);
 
     }
@@ -176,17 +176,17 @@
     }
 
     static final class TestErrorHandler implements ErrorHandler {
-    	public boolean clean = true;
-    	public TestErrorHandler() { }
-    	public void error(SAXParseException exception) {
-    		clean = false;
-    	}
-    	public void fatalError(SAXParseException exception) {
-    		clean = false;
-    	}
-    	public void warning(SAXParseException exception) {
-    		clean = false;
-    	}
+        public boolean clean = true;
+        public TestErrorHandler() { }
+        public void error(SAXParseException exception) {
+            clean = false;
+        }
+        public void fatalError(SAXParseException exception) {
+            clean = false;
+        }
+        public void warning(SAXParseException exception) {
+            clean = false;
+        }
     }
 
 }



Mime
View raw message