commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1301007 - in /commons/proper/digester/trunk/core/src/test: java/org/apache/commons/digester3/binder/Digester163TestCase.java resources/org/apache/commons/digester3/binder/test.xml
Date Thu, 15 Mar 2012 14:36:48 GMT
Author: simonetripodi
Date: Thu Mar 15 14:36:48 2012
New Revision: 1301007

URL: http://svn.apache.org/viewvc?rev=1301007&view=rev
Log:
yet another attempt to make the loader failing

Modified:
    commons/proper/digester/trunk/core/src/test/java/org/apache/commons/digester3/binder/Digester163TestCase.java
    commons/proper/digester/trunk/core/src/test/resources/org/apache/commons/digester3/binder/test.xml

Modified: commons/proper/digester/trunk/core/src/test/java/org/apache/commons/digester3/binder/Digester163TestCase.java
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/core/src/test/java/org/apache/commons/digester3/binder/Digester163TestCase.java?rev=1301007&r1=1301006&r2=1301007&view=diff
==============================================================================
--- commons/proper/digester/trunk/core/src/test/java/org/apache/commons/digester3/binder/Digester163TestCase.java
(original)
+++ commons/proper/digester/trunk/core/src/test/java/org/apache/commons/digester3/binder/Digester163TestCase.java
Thu Mar 15 14:36:48 2012
@@ -34,7 +34,6 @@ import org.apache.commons.digester3.xmlr
 import org.junit.Before;
 import org.junit.Test;
 
-
 /**
  * Test.
  */
@@ -43,10 +42,10 @@ public class Digester163TestCase
 
     public static final int MAX_THREADS = 4;
 
-    private DigesterLoader loader;
+    private DigesterLoader loader = null;
 
     @Before
-    public void setUp()
+    public void before()
     {
         loader = newLoader( new FromXmlRulesModule()
         {
@@ -64,10 +63,12 @@ public class Digester163TestCase
     public void test()
         throws InterruptedException
     {
-        ThreadPoolExecutor executor = new ThreadPoolExecutor( MAX_THREADS, MAX_THREADS,
+        ThreadPoolExecutor executor = new ThreadPoolExecutor( MAX_THREADS,
+                                                              MAX_THREADS,
                                                               Long.MAX_VALUE,
                                                               TimeUnit.NANOSECONDS,
                                                               new LinkedBlockingQueue<Runnable>()
);
+        final LinkedBlockingQueue<Exception> exceptions = new LinkedBlockingQueue<Exception>();
         for ( int i = 0; i < MAX_THREADS * 2; i++ )
         {
             executor.submit( new Runnable()
@@ -75,17 +76,19 @@ public class Digester163TestCase
 
                 public void run()
                 {
-                    Digester dig = loader.newDigester();
+
+                    Digester dig = null;
                     InputStream in = null;
                     try
                     {
-                        in = this.getClass().getClassLoader().getResourceAsStream( "test.xml"
);
+                        dig = loader.newDigester();
+                        in = Digester163TestCase.class.getResourceAsStream( "test.xml" );
                         Entity et = dig.parse( in );
                         assertEquals( "Author 1", et.getAuthor() );
                     }
                     catch ( Exception e )
                     {
-                        fail( e.getMessage() );
+                        exceptions.add( e );
                     }
                     finally
                     {
@@ -101,6 +104,7 @@ public class Digester163TestCase
                             }
                         }
                     }
+
                 }
             } );
         }
@@ -116,6 +120,13 @@ public class Digester163TestCase
                 break;
             }
         }
-    }
 
+        Exception e = exceptions.poll();
+        if ( e != null )
+        {
+            e.printStackTrace();
+            fail( "Throwable caught -> " + e.getMessage() != null ? e.getMessage() : ""
);
+        }
+
+    }
 }

Modified: commons/proper/digester/trunk/core/src/test/resources/org/apache/commons/digester3/binder/test.xml
URL: http://svn.apache.org/viewvc/commons/proper/digester/trunk/core/src/test/resources/org/apache/commons/digester3/binder/test.xml?rev=1301007&r1=1301006&r2=1301007&view=diff
==============================================================================
--- commons/proper/digester/trunk/core/src/test/resources/org/apache/commons/digester3/binder/test.xml
(original)
+++ commons/proper/digester/trunk/core/src/test/resources/org/apache/commons/digester3/binder/test.xml
Thu Mar 15 14:36:48 2012
@@ -15,12 +15,10 @@
    See the License for the specific language governing permissions and
    limitations under the License.
 -->
-<root>
-  <container>
-    <header>
-      <authors>
-        <author>Author 1</author>
-      </authors>
-    </header>
-  </container>
-</root>
+<container>
+  <header>
+    <authors>
+      <author>Author 1</author>
+    </authors>
+  </header>
+</container>



Mime
View raw message