[jboss-svn-commits] JBoss Common SVN: r2970 - in jbossxb/trunk: src/test/java/org/jboss/test/javaee/metadata and 2 other directories.

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Thu Feb 5 06:28:14 EST 2009


Author: alex.loubyansky at jboss.com
Date: 2009-02-05 06:28:14 -0500 (Thu, 05 Feb 2009)
New Revision: 2970

Removed:
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/JBossXBTestDelegate.java
Modified:
   jbossxb/trunk/pom.xml
   jbossxb/trunk/src/test/java/org/jboss/test/javaee/metadata/JavaEEMetaDataTestDelegate.java
   jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/AbstractBuilderTest.java
   jbossxb/trunk/src/test/java/org/jboss/test/xml/JBossXBTestDelegate.java
Log:
JBXB-173

Modified: jbossxb/trunk/pom.xml
===================================================================
--- jbossxb/trunk/pom.xml	2009-01-20 20:41:04 UTC (rev 2969)
+++ jbossxb/trunk/pom.xml	2009-02-05 11:28:14 UTC (rev 2970)
@@ -33,7 +33,7 @@
           <includes>
             <include>**/*TestCase.java</include>
           </includes>
-          <forkMode>pertest</forkMode> <!-- required to correctly run the PojoServer tests -->
+          <!-- forkMode>pertest</forkMode -->
         </configuration>
       </plugin>    
     </plugins>

Modified: jbossxb/trunk/src/test/java/org/jboss/test/javaee/metadata/JavaEEMetaDataTestDelegate.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/javaee/metadata/JavaEEMetaDataTestDelegate.java	2009-01-20 20:41:04 UTC (rev 2969)
+++ jbossxb/trunk/src/test/java/org/jboss/test/javaee/metadata/JavaEEMetaDataTestDelegate.java	2009-02-05 11:28:14 UTC (rev 2970)
@@ -23,7 +23,7 @@
 
 import java.lang.reflect.Method;
 
-import org.jboss.test.xb.builder.JBossXBTestDelegate;
+import org.jboss.test.xml.JBossXBTestDelegate;
 import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
 import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
 

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/AbstractBuilderTest.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/AbstractBuilderTest.java	2009-01-20 20:41:04 UTC (rev 2969)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/AbstractBuilderTest.java	2009-02-05 11:28:14 UTC (rev 2970)
@@ -37,6 +37,7 @@
 import org.jboss.xb.binding.sunday.unmarshalling.TermBinding;
 import org.jboss.xb.builder.JBossXBBuilder;
 import org.jboss.xb.builder.runtime.BuilderParticleHandler;
+import org.jboss.test.xml.JBossXBTestDelegate;
 
 /**
  * AbstractBuilderTest.

Deleted: jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/JBossXBTestDelegate.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/JBossXBTestDelegate.java	2009-01-20 20:41:04 UTC (rev 2969)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xb/builder/JBossXBTestDelegate.java	2009-02-05 11:28:14 UTC (rev 2970)
@@ -1,196 +0,0 @@
-/*
-* JBoss, Home of Professional Open Source
-* Copyright 2006, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
-package org.jboss.test.xb.builder;
-
-import java.lang.reflect.Method;
-import java.net.URL;
-
-import org.jboss.net.protocol.URLStreamHandlerFactory;
-import org.jboss.test.AbstractTestDelegate;
-import org.jboss.xb.binding.Unmarshaller;
-import org.jboss.xb.binding.UnmarshallerFactory;
-import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
-import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
-import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
-import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
-
-/**
- * JBossXBTestDelegate.
- * 
- * @author <a href="adrian at jboss.com">Adrian Brock</a>
- * @version $Revision: 40492 $
- */
-public class JBossXBTestDelegate extends AbstractTestDelegate
-{
-   /** Whether initialization has been done */
-   private static boolean done = false;
-
-   /** The unmarshaller factory */
-   protected UnmarshallerFactory unmarshallerFactory;
-
-   /** The resolver */
-   protected SchemaBindingResolver defaultResolver;
-   
-   /**
-    * Initialize
-    */
-   public synchronized static void init()
-   {
-      if (done)
-         return;
-      done = true;
-      URL.setURLStreamHandlerFactory(new URLStreamHandlerFactory());
-      URLStreamHandlerFactory.preload();
-      String handlerPkgs = System.getProperty("java.protocol.handler.pkgs");
-      if (handlerPkgs != null)
-         handlerPkgs += "|org.jboss.net.protocol";
-      else
-         handlerPkgs = "org.jboss.net.protocol";
-      System.setProperty("java.protocol.handler.pkgs", handlerPkgs);
-   }
-
-   /**
-    * Create a new JBossXBTestDelegate.
-    * 
-    * @param clazz the test class
-    */
-   public JBossXBTestDelegate(Class<?> clazz)
-   {
-      super(clazz);
-   }
-
-   @Override
-   public void setUp() throws Exception
-   {
-      super.setUp();
-      init();
-      unmarshallerFactory = UnmarshallerFactory.newInstance();
-      initResolver();
-   }
-   
-   protected void initResolver() throws Exception
-   {
-      try
-      {
-         Method method = clazz.getMethod("initResolver", null);
-         defaultResolver = (SchemaBindingResolver) method.invoke(null, null);
-      }
-      catch (NoSuchMethodException ignored)
-      {
-         defaultResolver = new DefaultSchemaResolver();
-      }
-   }
-   
-   /**
-    * Unmarshal an object
-    * 
-    * @param url the url
-    * @param resolver the resolver
-    * @return the object
-    * @throws Exception for any error
-    */
-   public Object unmarshal(String url, SchemaBindingResolver resolver) throws Exception
-   {
-      if (resolver == null)
-         resolver = defaultResolver;
-      
-      long start = System.currentTimeMillis();
-      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
-      log.debug("Initialized parsing in " + (System.currentTimeMillis() - start) + "ms");
-      try
-      {
-         Object result = unmarshaller.unmarshal(url, resolver);
-         log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms");
-         return result;
-      }
-      catch (Exception e)
-      {
-         log.debug("Error during parsing: " + url, e);
-         throw e;
-      }
-   }
-
-   /**
-    * Unmarshal an object
-    *
-    * @param url the url
-    * @return the object
-    * @throws Exception for any error
-    */
-   public Object unmarshal(String url) throws Exception
-   {
-      long start = System.currentTimeMillis();
-      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
-      log.debug("Initialized parsing in " + (System.currentTimeMillis() - start) + "ms");
-      try
-      {
-         Object result = unmarshaller.unmarshal(url, SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver());
-         log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms");
-         return result;
-      }
-      catch (Exception e)
-      {
-         log.debug("Error during parsing: " + url, e);
-         throw e;
-      }
-   }
-   
-   /**
-    * Unmarshal an object
-    * 
-    * @param url the url
-    * @param schema the schema
-    * @return the object
-    * @throws Exception for any error
-    */
-   public Object unmarshal(String url, SchemaBinding schema) throws Exception
-   {
-      long start = System.currentTimeMillis();
-      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
-      log.debug("Initialized parsing in " + (System.currentTimeMillis() - start) + "ms");
-      try
-      {
-         Object result = unmarshaller.unmarshal(url, schema);
-         log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms");
-         return result;
-      }
-      catch (Exception e)
-      {
-         log.debug("Error during parsing: " + url, e);
-         throw e;
-      }
-   }
-   
-   /**
-    * Bind a schema
-    * 
-    * @param url the url
-    * @param resolver the resolver
-    * @return the object
-    * @throws Exception for any error
-    */
-   public SchemaBinding bind(String url, SchemaBindingResolver resolver) throws Exception
-   {
-      return XsdBinder.bind(url, resolver);
-   }
-}

Modified: jbossxb/trunk/src/test/java/org/jboss/test/xml/JBossXBTestDelegate.java
===================================================================
--- jbossxb/trunk/src/test/java/org/jboss/test/xml/JBossXBTestDelegate.java	2009-01-20 20:41:04 UTC (rev 2969)
+++ jbossxb/trunk/src/test/java/org/jboss/test/xml/JBossXBTestDelegate.java	2009-02-05 11:28:14 UTC (rev 2970)
@@ -31,6 +31,7 @@
 import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
 import org.jboss.xb.binding.sunday.unmarshalling.SchemaBinding;
 import org.jboss.xb.binding.sunday.unmarshalling.SchemaBindingResolver;
+import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
 import org.jboss.xb.binding.sunday.unmarshalling.XsdBinder;
 
 /**
@@ -130,6 +131,31 @@
    
    /**
     * Unmarshal an object
+    *
+    * @param url the url
+    * @return the object
+    * @throws Exception for any error
+    */
+   public Object unmarshal(String url) throws Exception
+   {
+      long start = System.currentTimeMillis();
+      Unmarshaller unmarshaller = unmarshallerFactory.newUnmarshaller();
+      log.debug("Initialized parsing in " + (System.currentTimeMillis() - start) + "ms");
+      try
+      {
+         Object result = unmarshaller.unmarshal(url, SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver());
+         log.debug("Total parse for " + url + " took " + (System.currentTimeMillis() - start) + "ms");
+         return result;
+      }
+      catch (Exception e)
+      {
+         log.debug("Error during parsing: " + url, e);
+         throw e;
+      }
+   }
+
+   /**
+    * Unmarshal an object
     * 
     * @param url the url
     * @param schema the schema




More information about the jboss-svn-commits mailing list