[webbeans-commits] Webbeans SVN: r1427 - tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api and 16 other directories.

webbeans-commits at lists.jboss.org webbeans-commits at lists.jboss.org
Fri Feb 6 09:49:37 EST 2009


Author: pete.muir at jboss.org
Date: 2009-02-06 09:49:37 -0500 (Fri, 06 Feb 2009)
New Revision: 1427

Added:
   tck/trunk/impl/${project.build.dir}extory/
   tck/trunk/impl/${project.build.dir}extory/jsr-299-artifacts/
   tck/trunk/impl/${project.build.dir}extory/jsr-299-artifacts/org.jboss.webbeans.tck.unit.definition.bean.BeanDefinitionTest.war
Modified:
   ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/ContainersImpl.java
   tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/TCKConfiguration.java
   tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/TestSuite.java
   tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Containers.java
   tck/trunk/impl/pom.xml
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/AbstractTest.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/InContainerTestRunner.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/ArtifactDescriptor.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/ArtifactScanner.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/DeclarativeArtifactProcessor.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/jsr299/TCKArtifactDescriptor.java
   tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/war/WarArtifactDescriptor.java
   tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/InContainerTestRunnerTest.java
   tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/ArtifactTest.java
   tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/all/ArtifactTest.java
   tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/declarativeArtifact/unspecified/ArtifactTest.java
   tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/declarativeArtifact/war/ArtifactTest.java
   tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/subpackages/ArtifactTest.java
   tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/war/ArtifactTest.java
Log:
Easy way to dump artifacts

Modified: ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/ContainersImpl.java
===================================================================
--- ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/ContainersImpl.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ ri/trunk/webbeans-ri/src/test/java/org/jboss/webbeans/test/tck/ContainersImpl.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -3,7 +3,6 @@
 import java.io.InputStream;
 import java.lang.annotation.Annotation;
 import java.util.List;
-import java.util.jar.JarInputStream;
 
 import javax.el.ELContext;
 import javax.inject.manager.Manager;
@@ -40,7 +39,7 @@
       throw new UnsupportedOperationException();
    }
    
-   public Manager deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, JarInputStream archive)
+   public Manager deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, InputStream archive)
    {
       throw new UnsupportedOperationException();
    }

Modified: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/TCKConfiguration.java
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/TCKConfiguration.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/TCKConfiguration.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -39,7 +39,7 @@
       }
       else
       {
-         this.testSuite = new TestSuite(null);
+         this.testSuite = new TestSuite();
       }
    }
 

Modified: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/TestSuite.java
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/TestSuite.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/api/src/main/java/org/jboss/webbeans/tck/api/TestSuite.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -5,17 +5,14 @@
    
    public static final String PROPERTY_NAME = TestSuite.class.getName();
    
-   private String outputDirectory;
+   private String outputDirectory = System.getProperty("java.io.tmpdir") + "/jsr-299-tck/";
    private boolean standalone = true;
    private int deploymentDelay = 5000;
    private boolean writeDeployedArchivesToDisk;
    
-   private String debugOutputDirectory = System.getProperty("java.io.tmpdir") + "/jsr-299-tck/";
-   
-   public TestSuite(String outputDirectory)
+   public TestSuite()
    {
-      super();
-      this.outputDirectory = outputDirectory;
+      
    }
 
    public String getOutputDirectory()
@@ -23,6 +20,11 @@
       return outputDirectory;
    }
    
+   public void setOutputDirectory(String outputDirectory)
+   {
+      this.outputDirectory = outputDirectory;
+   }
+   
    public boolean isStandalone()
    {
       return standalone;
@@ -43,16 +45,6 @@
       this.deploymentDelay = deploymentDelay;
    }
    
-   public String getDebugOutputDirectory()
-   {
-      return debugOutputDirectory;
-   }
-   
-   public void setDebugOutputDirectory(String debugOutputDirectory)
-   {
-      this.debugOutputDirectory = debugOutputDirectory;
-   }
-   
    public boolean isWriteDeployedArchivesToDisk()
    {
       return writeDeployedArchivesToDisk;

Modified: tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Containers.java
===================================================================
--- tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Containers.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/api/src/main/java/org/jboss/webbeans/tck/spi/Containers.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -3,7 +3,6 @@
 import java.io.InputStream;
 import java.lang.annotation.Annotation;
 import java.util.List;
-import java.util.jar.JarInputStream;
 
 import javax.inject.manager.Manager;
 
@@ -31,7 +30,7 @@
     */
    public <T> T evaluateMethodExpression(String expression, Class<T> expectedType, Class<?>[] expectedParamTypes, Object[] expectedParams);
    
-   public Manager deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, JarInputStream archive);
+   public Manager deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, InputStream archive);
    
    /**
     * The compressed archive, represented as an stream of bytes

Added: tck/trunk/impl/${project.build.dir}extory/jsr-299-artifacts/org.jboss.webbeans.tck.unit.definition.bean.BeanDefinitionTest.war
===================================================================
(Binary files differ)


Property changes on: tck/trunk/impl/${project.build.dir}extory/jsr-299-artifacts/org.jboss.webbeans.tck.unit.definition.bean.BeanDefinitionTest.war
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Modified: tck/trunk/impl/pom.xml
===================================================================
--- tck/trunk/impl/pom.xml	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/impl/pom.xml	2009-02-06 14:49:37 UTC (rev 1427)
@@ -159,6 +159,40 @@
         </plugins>
      </build>
    </profile>
+   <profile>
+      <id>write-artifacts-to-disk</id>
+      <activation>
+         <property>
+            <name>dumpArtifacts</name>
+         </property>
+      </activation>
+      <build>
+         <plugins>
+            <plugin>
+              <groupId>org.apache.maven.plugins</groupId>
+              <artifactId>maven-antrun-plugin</artifactId>
+              <executions>
+                <execution>
+                  <id>package</id>
+                  <phase>package</phase>
+                  <configuration>
+                    <tasks>
+                      <java classname="org.jboss.webbeans.tck.impl.InContainerTestRunner" classpathref="maven.compile.classpath" failonerror="true" fork="true">
+                         <jvmarg line="-DcreateArtifacts=true"/>
+                         <jvmarg line="-DoutputDirectory=${project.build.directory}/jsr-299-artifacts" />
+                      </java>
+                      <echo>Dumped artifacts to ${project.build.directory}/jsr-299-artifacts</echo>
+                    </tasks>
+                  </configuration>
+                  <goals>
+                    <goal>run</goal>
+                  </goals>
+                </execution>
+              </executions>
+            </plugin>
+         </plugins>
+      </build>
+   </profile>
  </profiles>   
 
 </project>

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/AbstractTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/AbstractTest.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/AbstractTest.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -91,8 +91,8 @@
          Class<?> declaringClass = testMethod.getDeclaringClass();
          if (declaringClass.isAnnotationPresent(Artifact.class) || declaringClass.isAnnotationPresent(EjbArtifact.class))
          {
-            DeclarativeArtifactProcessor processor = new DeclarativeArtifactProcessor(declaringClass);
-            ArtifactDescriptor artifact = processor.getArtifact(true);
+            DeclarativeArtifactProcessor processor = new DeclarativeArtifactProcessor(declaringClass, true);
+            ArtifactDescriptor artifact = processor.getArtifact();
             Set<Class<?>> classes = artifact.getClasses();
             if (getEnabledDeploymentTypes().size() > 0)
             {

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/InContainerTestRunner.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/InContainerTestRunner.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/InContainerTestRunner.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -2,12 +2,9 @@
 
 import static org.jboss.webbeans.tck.impl.WebBeansTCKImpl.configuration;
 
-import java.io.BufferedOutputStream;
 import java.io.File;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.OutputStream;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
@@ -18,7 +15,6 @@
 import org.jboss.webbeans.tck.impl.packaging.ArtifactDescriptor;
 import org.jboss.webbeans.tck.impl.packaging.ArtifactScanner;
 import org.jboss.webbeans.tck.impl.packaging.DeclarativeArtifactProcessor;
-import org.jboss.webbeans.tck.impl.util.Files;
 import org.jboss.webbeans.tck.spi.Containers;
 
 
@@ -27,20 +23,53 @@
    
    private static final Logger log = Logger.getLogger(ArtifactScanner.class);
    
+   private final TestSuite testSuite;
+   private final Containers containers;
+   
    public InContainerTestRunner()
    {
+      testSuite = configuration().getTestSuite();
+      containers = configuration().getContainers();
+   }
+   
+   protected InContainerTestRunner(TestSuite testSuite, Containers containers)
+   {
+      super();
+      this.testSuite = testSuite;
+      this.containers = containers;
+   }
 
+   public static void main(String[] args)
+   {
+      if (System.getProperty("createArtifacts") != null)
+      {
+         TestSuite testSuite = new TestSuite();
+         if (System.getProperty("outputDirectory") != null)
+         {
+            testSuite.setOutputDirectory(System.getProperty("outputDirectory"));
+         }
+         testSuite.setStandalone(false);
+         testSuite.setWriteDeployedArchivesToDisk(true);
+         InContainerTestRunner runner = new InContainerTestRunner(testSuite, null);
+         runner.writeArtifactsOutputDirectory(runner.createArtifacts());
+      }
    }
    
    public void run()
    {
-      run(configuration().getTestSuite(), configuration().getContainers());
+      List<ArtifactDescriptor> artifacts = createArtifacts();
+      if (testSuite.isWriteDeployedArchivesToDisk())
+      {
+         writeArtifactsOutputDirectory(artifacts);
+      }
+      deployArtifacts(artifacts);
    }
    
-   protected void run(TestSuite testSuite, Containers containers)
+   protected List<ArtifactDescriptor> createArtifacts()
    {
       Set<Class<?>> classes = new HashSet<Class<?>>();
       classes.addAll(new ArtifactScanner("org.jboss.webbeans.tck.integration").getClasses());
+
       if (!testSuite.isStandalone())
       {
          classes.addAll(new ArtifactScanner("org.jboss.webbeans.tck.unit").getClasses());
@@ -48,42 +77,45 @@
       List<ArtifactDescriptor> artifacts = new ArrayList<ArtifactDescriptor>();
       for (Class<?> clazz : classes)
       {
-         artifacts.add(new DeclarativeArtifactProcessor(clazz).getArtifact());
+         artifacts.add(new DeclarativeArtifactProcessor(clazz, testSuite.isStandalone()).getArtifact());
       }
-      // We've now collected all the artifacts, so we can file them at the 
-      // container
-      if (testSuite.isWriteDeployedArchivesToDisk())
+      return artifacts;
+   }
+   
+   protected void writeArtifactsOutputDirectory(List<ArtifactDescriptor> artifacts) 
+   {
+      File file = new File(testSuite.getOutputDirectory());
+      if (!file.exists())
       {
-         File file = new File(testSuite.getDebugOutputDirectory());
-         if (!file.exists())
+         file.mkdirs();
+      }
+      else if (file.isFile())
+      {
+         throw new IllegalStateException("Cannot use debug directory " + testSuite.getOutputDirectory() + ", it already exists");
+      }
+      log.info("Writing artifacts to " + testSuite.getOutputDirectory());
+      for (ArtifactDescriptor artifact : artifacts)
+      {
+         try
          {
-            file.mkdirs();
+            artifact.writeArtifactToDisk(testSuite.getOutputDirectory());
+            log.info("Written artifact to disk " + artifact);
          }
-         else if (file.isFile())
+         catch (IOException e)
          {
-            throw new IllegalStateException("Cannot use debug directory " + testSuite.getDebugOutputDirectory() + ", it already exists");
+            log.warn("Error writing artifact to disk " + artifact, e);
          }
       }
+   }
+   
+   protected void deployArtifacts(List<ArtifactDescriptor> artifacts)
+   {
       for (ArtifactDescriptor artifact : artifacts)
       {
          try
          {
-            InputStream jar = artifact.asJar();
-            if (testSuite.isWriteDeployedArchivesToDisk())
-            {
-               try
-               {
-                  File file = new File(testSuite.getDebugOutputDirectory(), artifact.getDeclaringClass().getName() + artifact.getExtension());
-                  file.createNewFile();
-                  OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
-                  Files.copy(jar, os);
-                  os.close();
-               }
-               catch (IOException e)
-               {
-                  log.error("Error writing artifact to disk " + artifact, e);
-               }
-            }
+            InputStream jar = artifact.getJar();
+            
             containers.deploy(jar);
             jar.close();
             try

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/ArtifactDescriptor.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/ArtifactDescriptor.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/ArtifactDescriptor.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -4,6 +4,7 @@
 import static org.jboss.webbeans.tck.impl.util.Reflections.loadResourceAsStream;
 import static org.jboss.webbeans.tck.impl.util.Reflections.loadResources;
 
+import java.io.BufferedOutputStream;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -29,6 +30,8 @@
 
 public class ArtifactDescriptor
 {
+  
+   private static final Logger log = Logger.getLogger(ArtifactScanner.class);
    
    /**
     * Implementation of {@link Scanner} which can scan a {@link URLClassLoader}
@@ -187,6 +190,10 @@
    private final Set<ResourceDescriptor> resources;
    private final Class<?> declaringClass;
    
+   // Cache
+   private InputStream jar;
+   private File explodedJar;
+   
    public ArtifactDescriptor(Class<?> declaringClass)
    {
       classes = new HashSet<Class<?>>();
@@ -194,13 +201,29 @@
       this.declaringClass = declaringClass;
    }
    
-   public InputStream asJar() throws IOException
+   public InputStream getJar() throws IOException
    { 
-      return new Zipper(create()).zip();
+      if (jar == null)
+      {
+         jar = new Zipper(getExplodedJar()).zip();
+      }
+      return jar;
    }
    
-   public File create() throws IOException
+   public File getExplodedJar() throws IOException
    {
+      if (explodedJar == null)
+      {
+         create();
+      }
+      return explodedJar;
+   }
+   
+   public void create() throws IOException
+   {
+      explodedJar = null;
+      jar = null;
+      
       File root = new File(System.getProperty("java.io.tmpdir") + "/" + getClass().getName() + "." + random.nextInt());
       root.mkdir();
       root.deleteOnExit();
@@ -218,7 +241,7 @@
          file.deleteOnExit();
          copy(resourceDescriptor.getSource().openStream(), file);
       }
-      return root;
+      this.explodedJar = root;
    }
    
    private static void copyClass(Class<?> clazz, File root) throws IOException
@@ -249,6 +272,15 @@
       return root;
    }
    
+   public void writeArtifactToDisk(String outputDirectory) throws IOException
+   {
+      File file = new File(outputDirectory, getDeclaringClass().getName() + getExtension());
+      file.createNewFile();
+      OutputStream os = new BufferedOutputStream(new FileOutputStream(file));
+      Files.copy(getJar(), os);
+      os.close();
+   }
+   
    private static String getClassFileName(String className)
    {
       return className.replace('.', '/') + ".class";

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/ArtifactScanner.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/ArtifactScanner.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/ArtifactScanner.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -9,10 +9,15 @@
 import java.io.IOException;
 import java.net.URL;
 import java.net.URLDecoder;
+import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.Set;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipException;
+import java.util.zip.ZipFile;
 
 import org.apache.log4j.Logger;
+import org.jboss.webbeans.tck.impl.util.Reflections;
 
 public class ArtifactScanner
 {
@@ -55,7 +60,7 @@
       }
    }
    
-   private void handle(Set<String> paths)
+   private void handle(Set<String> paths) throws IOException
    {
       for ( String urlPath: paths )
       {
@@ -65,8 +70,32 @@
       }
    }
    
-   private void handle(File file, String packageName)
+   private void handleArchiveByFile(File file) throws IOException
    {
+      try
+      {
+         log.trace("archive: " + file);
+         ZipFile zip = new ZipFile(file);
+         Enumeration<? extends ZipEntry> entries = zip.entries();
+         while ( entries.hasMoreElements() )
+         {
+            ZipEntry entry = entries.nextElement();
+            String name = entry.getName();
+            if (name.startsWith(packageName) && name.endsWith(".class"))
+            {
+               String className = name.replace("/", ".").replace(".class", "");
+               classes.add(Reflections.loadClass(className));
+            }
+         }
+      }
+      catch (ZipException e)
+      {
+         throw new RuntimeException("Error handling file " + file, e);
+      }
+   }
+   
+   private void handle(File file, String packageName) throws IOException
+   {
       if ( file.isDirectory() )
       {
          packageName = packageName + "." + file.getName();
@@ -78,19 +107,20 @@
       else if (file.getName().endsWith(".class") && ! file.getName().contains("$"))
       {
          String className = packageName + "." + file.getName().substring(0, file.getName().length() - 6);
-         try
+         Class<?> clazz = Reflections.loadClass(className);
+         if (clazz != null && clazz.isAnnotationPresent(Artifact.class) || clazz.isAnnotationPresent(EjbArtifact.class))
          {
-            Class<?> clazz = Class.forName(className);
-            if (clazz.isAnnotationPresent(Artifact.class) || clazz.isAnnotationPresent(EjbArtifact.class))
-            {
-               classes.add(clazz);
-            }
+            classes.add(clazz);
          }
-         catch (ClassNotFoundException e)
+         else if (clazz == null)
          {
-            log.warn("Unable to load class " + className, e);
+            log.warn("Unable to load class " + className);
          }
       }
+      else if (file.getName().endsWith(".jar"))
+      {
+         handleArchiveByFile(file);
+      }
    }
    
    public Set<Class<?>> getClasses()

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/DeclarativeArtifactProcessor.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/DeclarativeArtifactProcessor.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/DeclarativeArtifactProcessor.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -27,10 +27,12 @@
    private final Collection<ResourceDescriptor> resources;
    private final Collection<Class<?>> classes;
    
-   private Class<?> declaringClass;
+   private final Class<?> declaringClass;
+   private final boolean standalone;
 
-   public DeclarativeArtifactProcessor(Class<?> declaringClass)
+   public DeclarativeArtifactProcessor(Class<?> declaringClass, boolean standalone)
    {
+      this.standalone = standalone;
       this.declaringClass = declaringClass;
       
       if (declaringClass.isAnnotationPresent(Artifact.class))
@@ -117,11 +119,6 @@
    
    public TCKArtifactDescriptor getArtifact()
    {
-      return getArtifact(true);
-   }
-   
-   public TCKArtifactDescriptor getArtifact(boolean standalone)
-   {
       final TCKArtifactDescriptor artifact;
       if (packagingType.equals(WAR))
       {
@@ -131,18 +128,19 @@
       {
          throw new UnsupportedOperationException();
       }
-      else if (ejbs && standalone)
+      else if (!standalone && ejbs)
       {
          throw new UnsupportedOperationException();
       }
-      else if (standalone)
+      else if (!standalone)
       {
-         artifact = new TCKArtifactDescriptor(declaringClass, beansXml);
+         artifact = new WarArtifactDescriptor(declaringClass, beansXml, null);
       }
       else
       {
-         artifact = new WarArtifactDescriptor(declaringClass, beansXml, null);
+         artifact = new TCKArtifactDescriptor(declaringClass, beansXml);
       }
+      
       if (addDeclaringPackage)
       {
          artifact.addPackage(declaringClass.getPackage());

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/jsr299/TCKArtifactDescriptor.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/jsr299/TCKArtifactDescriptor.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/jsr299/TCKArtifactDescriptor.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -40,10 +40,4 @@
       this.unit = unit;
    }
    
-   @Override
-   public String getExtension()
-   {
-      return ".war";
-   }
-   
 }

Modified: tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/war/WarArtifactDescriptor.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/war/WarArtifactDescriptor.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/impl/src/main/java/org/jboss/webbeans/tck/impl/packaging/war/WarArtifactDescriptor.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -42,4 +42,9 @@
       return "war, " + super.toString();
    }
    
+   @Override
+   public String getExtension()
+   {
+      return ".war";
+   }
 }

Modified: tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/InContainerTestRunnerTest.java
===================================================================
--- tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/InContainerTestRunnerTest.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/InContainerTestRunnerTest.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -3,7 +3,6 @@
 import java.io.InputStream;
 import java.lang.annotation.Annotation;
 import java.util.List;
-import java.util.jar.JarInputStream;
 
 import javax.inject.manager.Manager;
 
@@ -16,11 +15,11 @@
    
    private static class MockInContainerTestRunner extends InContainerTestRunner
    {
-      
-      @Override
-      public void run(TestSuite testSuite, Containers containers)
+
+      public MockInContainerTestRunner(TestSuite testSuite, Containers containers)
       {
-         super.run(testSuite, containers);
+         super(testSuite, containers);
+         // TODO Auto-generated constructor stub
       }
       
    }
@@ -28,7 +27,7 @@
    private static class MockContainers implements Containers
    {
 
-      public Manager deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, JarInputStream archive)
+      public Manager deploy(List<Class<? extends Annotation>> enabledDeploymentTypes, InputStream archive)
       {
          // TODO Auto-generated method stub
          return null;
@@ -57,11 +56,11 @@
    //@Test
    public void testRunner()
    {
-      TestSuite testSuite = new TestSuite(null);
+      TestSuite testSuite = new TestSuite();
       testSuite.setWriteDeployedArchivesToDisk(true);
       testSuite.setDeploymentDelay(0);
-      MockInContainerTestRunner runner = new MockInContainerTestRunner();
-      runner.run(testSuite, new MockContainers());
+      MockInContainerTestRunner runner = new MockInContainerTestRunner(testSuite, new MockContainers());
+      runner.run();
    }
    
 }

Modified: tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/ArtifactTest.java
===================================================================
--- tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/ArtifactTest.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/ArtifactTest.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -16,7 +16,7 @@
    public void testDefaultTCKArtifact() throws Exception
    {
       ArtifactDescriptor artifactDescriptor = new TCKArtifactDescriptor(null, null);
-      File root = artifactDescriptor.create();
+      File root = artifactDescriptor.getExplodedJar();
       assert getPackageAsFile(Reflections.class.getPackage(), root).listFiles().length > 0;
       assert getPackageAsFile(NewLiteral.class.getPackage(), root).listFiles().length > 0;
       assert getPackageAsFile(AbstractTest.class.getPackage(), root).listFiles().length > 0;

Modified: tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/all/ArtifactTest.java
===================================================================
--- tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/all/ArtifactTest.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/all/ArtifactTest.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -15,7 +15,7 @@
    {
       ArtifactDescriptor artifactDescriptor = new ArtifactDescriptor(null);
       artifactDescriptor.addPackage(ArtifactTest.class.getPackage());
-      File root = artifactDescriptor.create();
+      File root = artifactDescriptor.getExplodedJar();
       File currentPackage = getCurrentPackageAsFile(root);
       assert currentPackage.listFiles().length == 6;
       File[] cowClasses = currentPackage.listFiles(new FilenameFilter()

Modified: tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/declarativeArtifact/unspecified/ArtifactTest.java
===================================================================
--- tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/declarativeArtifact/unspecified/ArtifactTest.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/declarativeArtifact/unspecified/ArtifactTest.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -14,11 +14,11 @@
    @Test
    public void testDefaultDeclartiveArtifact() throws Exception
    {
-      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyTest.class);
+      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyTest.class, true);
       TCKArtifactDescriptor artifact =  declarativeArtifactProcessor.getArtifact();
       assert !artifact.isEjbs();
       assert artifact.isUnit();
-      File root = artifact.create();
+      File root = artifact.getExplodedJar();
       File currentPackage = getCurrentPackageAsFile(root);
       File[] cowClasses = currentPackage.listFiles(new FilenameFilter()
       {
@@ -66,9 +66,9 @@
    @Test
    public void testClassesSpecifiedArtifact() throws Exception
    {
-      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyClassesSpecifiedTest.class);
+      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyClassesSpecifiedTest.class, true);
       TCKArtifactDescriptor artifact =  declarativeArtifactProcessor.getArtifact();
-      File root = artifact.create();
+      File root = artifact.getExplodedJar();
       File currentPackage = getCurrentPackageAsFile(root);
       assert currentPackage.listFiles().length == 1;
       File[] pestPackages = currentPackage.listFiles(new FilenameFilter()
@@ -89,9 +89,9 @@
    @Test
    public void testResourcesSpecifiedArtifact() throws Exception
    {
-      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyResourcesSpecifiedTest.class);
+      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyResourcesSpecifiedTest.class, false);
       TCKArtifactDescriptor artifact =  declarativeArtifactProcessor.getArtifact();
-      File root = artifact.create();
+      File root = artifact.getExplodedJar();
       assert root.listFiles(META_INF_FILTER).length == 1;
       File metaInf = root.listFiles(META_INF_FILTER)[0];
       assert metaInf.listFiles().length == 2;
@@ -109,16 +109,16 @@
    @Test
    public void testIntegrationTestDeclartiveArtifact() throws Exception
    {
-      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyIntegrationTest.class);
+      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyIntegrationTest.class, false);
       assert !declarativeArtifactProcessor.getArtifact().isUnit();
    }
    
    @Test
    public void testCustomBeansXml() throws Exception
    {
-      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyCustomBeansXmlTest.class);
+      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyCustomBeansXmlTest.class, false);
       TCKArtifactDescriptor artifact =  declarativeArtifactProcessor.getArtifact();
-      File root = artifact.create();
+      File root = artifact.getExplodedJar();
       assert root.listFiles(META_INF_FILTER).length == 1;
       File metaInf = root.listFiles(META_INF_FILTER)[0];
       assert metaInf.listFiles().length == 1;
@@ -131,14 +131,14 @@
    //@Test
    public void testEjbTestDeclartiveArtifact() throws Exception
    {
-      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyEjbTest.class);
+      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyEjbTest.class, false);
       assert declarativeArtifactProcessor.getArtifact().isEjbs();
    }
    
    @Test(expectedExceptions=IllegalArgumentException.class)
    public void testWrongPackaging()
    {
-      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyWarUnitTest_Broken.class);
+      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyWarUnitTest_Broken.class, false);
    }
    
 }

Modified: tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/declarativeArtifact/war/ArtifactTest.java
===================================================================
--- tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/declarativeArtifact/war/ArtifactTest.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/declarativeArtifact/war/ArtifactTest.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -13,9 +13,9 @@
    @Test
    public void testDefaultWebXml() throws Exception
    {
-      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyTest.class);
+      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyTest.class, false);
       TCKArtifactDescriptor artifact =  declarativeArtifactProcessor.getArtifact();
-      File root = artifact.create();
+      File root = artifact.getExplodedJar();
       assert root.listFiles(WEB_INF_FILTER).length == 1;
       File webInf = root.listFiles(WEB_INF_FILTER)[0];
       assert webInf.getName().equals("WEB-INF");
@@ -31,9 +31,9 @@
    @Test
    public void testCustomWebXml() throws Exception
    {
-      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyCustomWebXmlTest.class);
+      DeclarativeArtifactProcessor declarativeArtifactProcessor = new DeclarativeArtifactProcessor(DummyCustomWebXmlTest.class, false);
       TCKArtifactDescriptor artifact =  declarativeArtifactProcessor.getArtifact();
-      File root = artifact.create();
+      File root = artifact.getExplodedJar();
       assert root.listFiles(WEB_INF_FILTER).length == 1;
       File webInf = root.listFiles(WEB_INF_FILTER)[0];
       assert webInf.getName().equals("WEB-INF");

Modified: tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/subpackages/ArtifactTest.java
===================================================================
--- tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/subpackages/ArtifactTest.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/subpackages/ArtifactTest.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -15,7 +15,7 @@
    {
       ArtifactDescriptor artifactDescriptor = new ArtifactDescriptor(null);
       artifactDescriptor.addPackage(ArtifactTest.class.getPackage());
-      File root = artifactDescriptor.create();
+      File root = artifactDescriptor.getExplodedJar();
       File currentPackage = getCurrentPackageAsFile(root);
       assert currentPackage.listFiles().length == 4;
       File[] cowClasses = currentPackage.listFiles(new FilenameFilter()

Modified: tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/war/ArtifactTest.java
===================================================================
--- tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/war/ArtifactTest.java	2009-02-06 13:21:59 UTC (rev 1426)
+++ tck/trunk/impl/src/test/java/org/jboss/webbeans/tck/impl/test/packaging/war/ArtifactTest.java	2009-02-06 14:49:37 UTC (rev 1427)
@@ -18,7 +18,7 @@
    {
       WarArtifactDescriptor war = new WarArtifactDescriptor(null, null, null);
       war.getClasses().add(Cow.class);
-      File root = war.create();
+      File root = war.getExplodedJar();
       assert root.listFiles().length == 2;
       assert root.isDirectory();
       assert root.listFiles(WEB_INF_FILTER).length == 1;
@@ -61,7 +61,7 @@
    {
       WarArtifactDescriptor war = new WarArtifactDescriptor(null, null, null);
       war.getClasses().add(Cow.class);
-      JarInputStream is = new JarInputStream(war.asJar());
+      JarInputStream is = new JarInputStream(war.getJar());
       JarEntry entry;
       List<String> fileNames = new ArrayList<String>();
       while ((entry = is.getNextJarEntry()) != null)




More information about the weld-commits mailing list