[webbeans-commits] Webbeans SVN: r1501 - ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas and 5 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Thu Feb 12 17:56:14 EST 2009


Author: pete.muir at jboss.org
Date: 2009-02-12 17:56:14 -0500 (Thu, 12 Feb 2009)
New Revision: 1501

Added:
   ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java
   ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/FileSystemContainersImpl.java
   ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/JBossTestServicesContainersImpl.java
   ri/trunk/jboss-tck-runner/src/test/resources/jndi.properties
Removed:
   ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ContainersImpl.java
Modified:
   ri/trunk/jboss-tck-runner/pom.xml
   ri/trunk/jboss-tck-runner/src/main/resources/META-INF/web-beans-tck.properties
   ri/trunk/jboss-tck-runner/src/test/resources/log4j.xml
   tck/trunk/api/src/main/java/org/jboss/jsr299/tck/spi/Containers.java
   tck/trunk/api/src/main/java/org/jboss/jsr299/tck/spi/helpers/ForwardingContainers.java
   tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractTest.java
Log:
Switch to JMX based deployer

Modified: ri/trunk/jboss-tck-runner/pom.xml
===================================================================
--- ri/trunk/jboss-tck-runner/pom.xml	2009-02-12 21:58:35 UTC (rev 1500)
+++ ri/trunk/jboss-tck-runner/pom.xml	2009-02-12 22:56:14 UTC (rev 1501)
@@ -28,6 +28,11 @@
       </dependency>
       
       <dependency>
+         <groupId>org.jboss.test</groupId>
+         <artifactId>jboss-test</artifactId>
+      </dependency>
+      
+      <dependency>
          <groupId>org.testng</groupId>
          <artifactId>testng</artifactId>
          <scope>test</scope>
@@ -40,6 +45,14 @@
          <scope>test</scope>
       </dependency>
       
+      <dependency>
+         <groupId>org.jboss.jbossas</groupId>
+         <artifactId>jboss-as-client</artifactId>
+         <scope>test</scope>
+         <type>pom</type>
+      </dependency>
+      
+      
    </dependencies>
    
    <build>

Added: ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java
===================================================================
--- ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java	                        (rev 0)
+++ ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java	2009-02-12 22:56:14 UTC (rev 1501)
@@ -0,0 +1,79 @@
+package org.jboss.webbeans.tck.integration.jbossas;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.apache.log4j.Logger;
+import org.jboss.jsr299.tck.api.Configurable;
+import org.jboss.jsr299.tck.api.Configuration;
+import org.jboss.jsr299.tck.spi.Containers;
+
+public abstract class AbstractContainersImpl implements Configurable, Containers
+{
+   
+   private static Logger log = Logger.getLogger(AbstractContainersImpl.class);
+   
+   private Configuration configuration;
+   protected boolean validated;
+
+   protected static void copy(InputStream inputStream, File file) throws IOException
+   {
+      OutputStream os = new FileOutputStream(file);
+      try 
+      {
+         byte[] buf = new byte[1024];
+         int i = 0;
+         while ((i = inputStream.read(buf)) != -1) 
+         {
+             os.write(buf, 0, i);
+         }
+     } 
+     finally 
+     {
+         os.close();
+     }
+   }
+
+   public void setConfiguration(Configuration configuration)
+   {
+      this.configuration = configuration;
+   }
+
+   protected void validate()
+   {
+      // Check that JBoss is up!
+      String url = "http://" + configuration.getHost() + "/";
+      try
+      {
+         URLConnection connection = new URL(url).openConnection();
+         if (!(connection instanceof HttpURLConnection))
+         {
+            throw new IllegalStateException("Not an http connection! " + connection);
+         }
+         HttpURLConnection httpConnection = (HttpURLConnection) connection;
+         httpConnection.connect();
+         if (httpConnection.getResponseCode() != HttpURLConnection.HTTP_OK)
+         {
+            throw new IllegalStateException("Error connecting to JBoss AS at " + url);
+         }
+      }
+      catch (Exception e) 
+      {
+         throw new IllegalStateException("Cannot connect to JBoss AS", e);
+      }
+      log.info("Successfully connected to JBoss AS at " + url);
+      
+   }
+
+   public AbstractContainersImpl()
+   {
+      super();
+   }
+   
+}
\ No newline at end of file


Property changes on: ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Deleted: ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ContainersImpl.java
===================================================================
--- ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ContainersImpl.java	2009-02-12 21:58:35 UTC (rev 1500)
+++ ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ContainersImpl.java	2009-02-12 22:56:14 UTC (rev 1501)
@@ -1,130 +0,0 @@
-package org.jboss.webbeans.tck.integration.jbossas;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-
-import org.apache.log4j.Logger;
-import org.jboss.jsr299.tck.api.Configurable;
-import org.jboss.jsr299.tck.api.Configuration;
-import org.jboss.jsr299.tck.spi.Containers;
-
-
-public class ContainersImpl implements Containers, Configurable
-{
-   
-   private Logger log = Logger.getLogger(ContainersImpl.class);
-   
-   public static final String JBOSS_HOME_PROPERTY_NAME = "jbossHome";
-   
-   private File deployDir;
-   private Configuration configuration;
-   
-   private boolean validated;
-   
-   public void setConfiguration(Configuration configuration)
-   {
-      this.configuration = configuration;
-      
-     
-   }
-   
-   protected void validate()
-   {
-      String jbossHome = System.getProperty(JBOSS_HOME_PROPERTY_NAME);
-      if (jbossHome == null)
-      {
-         throw new IllegalArgumentException("-DjbossHome must be set");
-      }
-      deployDir = new File(jbossHome, "server/default/deploy");
-      if (!deployDir.isDirectory())
-      {
-         throw new IllegalArgumentException(deployDir.getPath() + " is not a directory"); 
-      }
-      log.info("Deploying TCK artifacts to " + deployDir.getPath());
-      
-      // Check that JBoss is up!
-      String url = "http://" + configuration.getHost() + "/";
-      try
-      {
-         URLConnection connection = new URL(url).openConnection();
-         if (!(connection instanceof HttpURLConnection))
-         {
-            throw new IllegalStateException("Not an http connection! " + connection);
-         }
-         HttpURLConnection httpConnection = (HttpURLConnection) connection;
-         httpConnection.connect();
-         if (httpConnection.getResponseCode() != HttpURLConnection.HTTP_OK)
-         {
-            throw new IllegalStateException("Error connecting to JBoss AS at " + url);
-         }
-      }
-      catch (Exception e) 
-      {
-         throw new IllegalStateException("Cannot connect to JBoss AS", e);
-      }
-      log.info("Successfully connected to JBoss AS at " + url);
-      
-   }
-   
-   public ContainersImpl() throws MalformedURLException, IOException
-   {
-      
-   }
-   
-   
-   
-   public void deploy(InputStream archive, String name) throws IOException
-   {
-      if (!validated)
-      {
-         validate();
-      }
-      File file = new File(deployDir, name);
-      log.info("Deploying test " + name);
-      file.createNewFile();
-      copy(archive, file);
-   }
-   
-   private static void copy(InputStream inputStream, File file) throws IOException
-   {
-      OutputStream os = new FileOutputStream(file);
-      try 
-      {
-         byte[] buf = new byte[1024];
-         int i = 0;
-         while ((i = inputStream.read(buf)) != -1) 
-         {
-             os.write(buf, 0, i);
-         }
-     } 
-     finally 
-     {
-         os.close();
-     }
-   }
-   
-   public void undeploy(String name) throws IOException
-   {
-      File file = new File(deployDir, name);
-      if (file.exists())
-      {
-         file.delete();
-      }
-      try
-      {
-         // Give the app a chance to undeploy
-         Thread.sleep(1000);
-      }
-      catch (InterruptedException e)
-      {
-         Thread.currentThread().interrupt();
-      }
-   }
-   
-}

Added: ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/FileSystemContainersImpl.java
===================================================================
--- ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/FileSystemContainersImpl.java	                        (rev 0)
+++ ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/FileSystemContainersImpl.java	2009-02-12 22:56:14 UTC (rev 1501)
@@ -0,0 +1,65 @@
+package org.jboss.webbeans.tck.integration.jbossas;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.apache.log4j.Logger;
+import org.jboss.jsr299.tck.api.Configurable;
+import org.jboss.jsr299.tck.spi.Containers;
+
+
+public class FileSystemContainersImpl extends AbstractContainersImpl
+{
+   
+   private static Logger log = Logger.getLogger(FileSystemContainersImpl.class);
+   
+   public static final String JBOSS_HOME_PROPERTY_NAME = "jbossHome";
+   
+   private File deployDir;
+   
+   public FileSystemContainersImpl() throws IOException
+   {
+      String jbossHome = System.getProperty(JBOSS_HOME_PROPERTY_NAME);
+      if (jbossHome == null)
+      {
+         throw new IllegalArgumentException("-DjbossHome must be set");
+      }
+      deployDir = new File(jbossHome, "server/default/deploy");
+      if (!deployDir.isDirectory())
+      {
+         throw new IllegalArgumentException(deployDir.getPath() + " is not a directory"); 
+      }
+      log.info("Deploying TCK artifacts to " + deployDir.getPath());
+   }
+   
+   public void deploy(InputStream archive, String name) throws IOException
+   {
+      if (!validated)
+      {
+         validate();
+      }
+      File file = new File(deployDir, name);
+      log.info("Deploying test " + name);
+      file.createNewFile();
+      copy(archive, file);
+   }
+   
+   public void undeploy(String name) throws IOException
+   {
+      File file = new File(deployDir, name);
+      if (file.exists())
+      {
+         file.delete();
+      }
+      try
+      {
+         // Give the app a chance to undeploy
+         Thread.sleep(1000);
+      }
+      catch (InterruptedException e)
+      {
+         Thread.currentThread().interrupt();
+      }
+   }
+   
+}


Property changes on: ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/FileSystemContainersImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Copied: ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/JBossTestServicesContainersImpl.java (from rev 1495, ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ContainersImpl.java)
===================================================================
--- ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/JBossTestServicesContainersImpl.java	                        (rev 0)
+++ ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/JBossTestServicesContainersImpl.java	2009-02-12 22:56:14 UTC (rev 1501)
@@ -0,0 +1,59 @@
+package org.jboss.webbeans.tck.integration.jbossas;
+import java.io.File;
+import java.io.InputStream;
+
+import org.apache.log4j.Logger;
+import org.jboss.test.JBossTestServices;
+
+
+public class JBossTestServicesContainersImpl extends AbstractContainersImpl
+{
+   
+   private Logger log = Logger.getLogger(JBossTestServicesContainersImpl.class);
+   
+   private final JBossTestServices testServices;
+   private final File tmpdir;
+   
+   public JBossTestServicesContainersImpl() throws Exception
+   {
+      this.testServices = new JBossTestServices(JBossTestServicesContainersImpl.class);
+      testServices.setUpLogging();
+      testServices.init();
+      tmpdir = new File(System.getProperty("java.io.tmpdir"), "org.jboss.webbeans.tck.integration.jbossas");
+      tmpdir.mkdir();
+      tmpdir.deleteOnExit();
+   }
+   
+   public void deploy(InputStream archiveStream, String name) throws Exception
+   {
+      if (!validated)
+      {
+         validate();
+      }
+      File archive = new File(tmpdir, name);
+      archive.deleteOnExit();
+      copy(archiveStream, archive);
+      testServices.deploy(getTmpArchiveName(name)); 
+   }
+   
+   public void undeploy(String name) throws Exception
+   {
+      testServices.undeploy(getTmpArchiveName(name));
+      try
+      {
+         // Give the app a chance to undeploy
+         Thread.sleep(1000);
+      }
+      catch (InterruptedException e)
+      {
+         Thread.currentThread().interrupt();
+      }
+   }
+   
+   private String getTmpArchiveName(String name)
+   {
+      File file = new File(tmpdir, name);
+      return file.toURI().toString();
+   }
+   
+}


Property changes on: ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/JBossTestServicesContainersImpl.java
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/jboss-tck-runner/src/main/resources/META-INF/web-beans-tck.properties
===================================================================
--- ri/trunk/jboss-tck-runner/src/main/resources/META-INF/web-beans-tck.properties	2009-02-12 21:58:35 UTC (rev 1500)
+++ ri/trunk/jboss-tck-runner/src/main/resources/META-INF/web-beans-tck.properties	2009-02-12 22:56:14 UTC (rev 1501)
@@ -1,4 +1,4 @@
-org.jboss.jsr299.tck.spi.Containers=org.jboss.webbeans.tck.integration.jbossas.ContainersImpl
+org.jboss.jsr299.tck.spi.Containers=org.jboss.webbeans.tck.integration.jbossas.JBossTestServicesContainersImpl
 org.jboss.jsr299.tck.api.TestLauncher=org.jboss.jsr299.tck.impl.runner.servlet.ServletTestLauncher
 org.jboss.jsr299.tck.connectDelay=1500
 org.jboss.jsr299.tck.connectRetries=8
\ No newline at end of file

Added: ri/trunk/jboss-tck-runner/src/test/resources/jndi.properties
===================================================================
--- ri/trunk/jboss-tck-runner/src/test/resources/jndi.properties	                        (rev 0)
+++ ri/trunk/jboss-tck-runner/src/test/resources/jndi.properties	2009-02-12 22:56:14 UTC (rev 1501)
@@ -0,0 +1,4 @@
+#jboss JNDI properties
+java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
+java.naming.provider.url=jnp://localhost:1099
+java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
\ No newline at end of file


Property changes on: ri/trunk/jboss-tck-runner/src/test/resources/jndi.properties
___________________________________________________________________
Name: svn:mime-type
   + text/plain

Modified: ri/trunk/jboss-tck-runner/src/test/resources/log4j.xml
===================================================================
--- ri/trunk/jboss-tck-runner/src/test/resources/log4j.xml	2009-02-12 21:58:35 UTC (rev 1500)
+++ ri/trunk/jboss-tck-runner/src/test/resources/log4j.xml	2009-02-12 22:56:14 UTC (rev 1501)
@@ -14,6 +14,11 @@
     <category name="org.jboss">
         <priority value="ERROR"/>
     </category>
+    
+    <category name="org.jboss.test">
+        <priority value="ERROR"/>
+    </category>
+    
     <category name="com.arjuna">
         <priority value="ERROR"/>
     </category>
@@ -44,11 +49,11 @@
     <!-- ############### Web Beans logging ################### -->
 
     <category name="org.jboss.webbeans">
-        <priority value="ERROR"/>
+        <priority value="WARN"/>
     </category>
     
     <category name="org.jboss.jsr299">
-        <priority value="INFO"/>
+        <priority value="WARN"/>
     </category>
     
     <root>

Modified: tck/trunk/api/src/main/java/org/jboss/jsr299/tck/spi/Containers.java
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/jsr299/tck/spi/Containers.java	2009-02-12 21:58:35 UTC (rev 1500)
+++ tck/trunk/api/src/main/java/org/jboss/jsr299/tck/spi/Containers.java	2009-02-12 22:56:14 UTC (rev 1501)
@@ -16,8 +16,8 @@
     * @param archive
     * @return
     */
-   public void deploy(InputStream archive, String name) throws IOException;
+   public void deploy(InputStream archive, String name) throws Exception, IOException;
    
-   public void undeploy(String name) throws IOException;
+   public void undeploy(String name) throws Exception, IOException;
       
 }
\ No newline at end of file

Modified: tck/trunk/api/src/main/java/org/jboss/jsr299/tck/spi/helpers/ForwardingContainers.java
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/jsr299/tck/spi/helpers/ForwardingContainers.java	2009-02-12 21:58:35 UTC (rev 1500)
+++ tck/trunk/api/src/main/java/org/jboss/jsr299/tck/spi/helpers/ForwardingContainers.java	2009-02-12 22:56:14 UTC (rev 1501)
@@ -10,12 +10,12 @@
    
    protected abstract Containers delegate();
    
-   public void deploy(InputStream archive, String name) throws IOException
+   public void deploy(InputStream archive, String name) throws IOException, Exception
    {
       delegate().deploy(archive, name);
    }
    
-   public void undeploy(String name) throws IOException
+   public void undeploy(String name) throws IOException, Exception
    {
       delegate().undeploy(name);
    }

Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractTest.java	2009-02-12 21:58:35 UTC (rev 1500)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractTest.java	2009-02-12 22:56:14 UTC (rev 1501)
@@ -110,7 +110,7 @@
    }
    
    @BeforeClass
-   public final void beforeClass() throws IOException
+   public final void beforeClass() throws Exception
    {
       configuration = ConfigurationImpl.get();
       if (!isInContainer())
@@ -164,7 +164,7 @@
    }
    
    @AfterClass
-   public void afterClass() throws IOException
+   public void afterClass() throws Exception
    {
       if (artifact != null&& !(configuration.isStandalone() && artifact.isUnit()) && !isInContainer())
       {




More information about the weld-commits mailing list