[webbeans-commits] Webbeans SVN: r1911 - in test-harness/trunk: impl/src/main/java/org/jboss/testharness and 15 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Wed Mar 11 09:06:00 EDT 2009
Author: pete.muir at jboss.org
Date: 2009-03-11 09:06:00 -0400 (Wed, 11 Mar 2009)
New Revision: 1911
Added:
test-harness/trunk/api/src/main/java/org/jboss/testharness/api/ConfigurationBuilder.java
test-harness/trunk/api/src/main/java/org/jboss/testharness/api/ResourceDescriptor.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/PropertiesBasedConfigurationBuilder.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ResourceDescriptorImpl.java
test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/mock/MockConfigurationBuilder.java
test-harness/trunk/tests/src/test/resources/META-INF/
test-harness/trunk/tests/src/test/resources/META-INF/web-beans-tck.properties
Removed:
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/PropertiesBasedConfigurationImpl.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ResourceDescriptor.java
Modified:
test-harness/trunk/api/src/main/java/org/jboss/testharness/api/Configuration.java
test-harness/trunk/api/src/main/java/org/jboss/testharness/api/TCK.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/AbstractTest.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/ConfigurationImpl.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/TCKImpl.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactDescriptor.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactGenerator.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EarArtifactDescriptor.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EjbJarArtifactDescriptor.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/jsr299/JSR299ArtifactDescriptor.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/jsr299/TCKArtifactDescriptor.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/war/WarArtifactDescriptor.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/runner/TestRunner.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/DeploymentProperties.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/Reflections.java
test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/ear/EarArtifactTest.java
test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/packages/ArtifactTest.java
test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/subpackages/SubpackagesArtifactTest.java
test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/tck/TCKArtifactTest.java
test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/war/WarArtifactTest.java
Log:
more configuration, pass in configuration builder, identical property values merged
Modified: test-harness/trunk/api/src/main/java/org/jboss/testharness/api/Configuration.java
===================================================================
--- test-harness/trunk/api/src/main/java/org/jboss/testharness/api/Configuration.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/api/src/main/java/org/jboss/testharness/api/Configuration.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -1,5 +1,7 @@
package org.jboss.testharness.api;
+import java.util.List;
+
import org.jboss.testharness.spi.Containers;
import org.jboss.testharness.spi.StandaloneContainers;
@@ -21,12 +23,13 @@
public interface Configuration
{
- public static final String OUTPUT_DIRECTORY_PROPERTY_NAME = "org.jboss.jsr299.tck.outputDirectory";
- public static final String STANDALONE_PROPERTY_NAME = "org.jboss.jsr299.tck.standalone";
- public static final String RUN_INTEGRATION_TESTS_PROPERTY_NAME = "org.jboss.jsr299.tck.runIntegrationTests";
- public static final String CONNECT_TIMEOUT_PROPERTY_NAME = "org.jboss.jsr299.tck.connectTimeout";
- public static final String LIBRARY_DIRECTORY_PROPERTY_NAME = "org.jboss.jsr299.tck.libraryDirectory";
- public static final String HOST_PROPERTY_NAME = "org.jboss.jsr299.tck.host";
+ public static final String OUTPUT_DIRECTORY_PROPERTY_NAME = "org.jboss.testharness.outputDirectory";
+ public static final String STANDALONE_PROPERTY_NAME = "org.jboss.testharness.standalone";
+ public static final String RUN_INTEGRATION_TESTS_PROPERTY_NAME = "org.jboss.testharness.runIntegrationTests";
+ public static final String CONNECT_TIMEOUT_PROPERTY_NAME = "org.jboss.testharness.connectTimeout";
+ public static final String LIBRARY_DIRECTORY_PROPERTY_NAME = "org.jboss.testharness.libraryDirectory";
+ public static final String HOST_PROPERTY_NAME = "org.jboss.testharness.host";
+ public static final String TEST_PACKAGE_PROPERTY_NAME = "org.jboss.testharness.testPackage";
public static final String DEFAULT_OUTPUT_DIRECTORY = System.getProperty("java.io.tmpdir") + "/jsr-299-tck/";
public static final boolean DEFAULT_STANDALONE = true;
@@ -117,4 +120,14 @@
public void setHost(String host);
+ public List<String> getExtraPackages();
+
+ public List<ResourceDescriptor> getExtraResources();
+
+ public List<String> getExtraDeploymentProperties();
+
+ public String getTestPackage();
+
+ public void setTestPackage(String packageName);
+
}
\ No newline at end of file
Added: test-harness/trunk/api/src/main/java/org/jboss/testharness/api/ConfigurationBuilder.java
===================================================================
--- test-harness/trunk/api/src/main/java/org/jboss/testharness/api/ConfigurationBuilder.java (rev 0)
+++ test-harness/trunk/api/src/main/java/org/jboss/testharness/api/ConfigurationBuilder.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -0,0 +1,13 @@
+package org.jboss.testharness.api;
+
+
+public interface ConfigurationBuilder
+{
+
+ public static final String PROPERTY_NAME = ConfigurationBuilder.class.getName();
+
+ public ConfigurationBuilder init();
+
+ public Configuration getConfiguration();
+
+}
\ No newline at end of file
Property changes on: test-harness/trunk/api/src/main/java/org/jboss/testharness/api/ConfigurationBuilder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: test-harness/trunk/api/src/main/java/org/jboss/testharness/api/ResourceDescriptor.java (from rev 1903, test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ResourceDescriptor.java)
===================================================================
--- test-harness/trunk/api/src/main/java/org/jboss/testharness/api/ResourceDescriptor.java (rev 0)
+++ test-harness/trunk/api/src/main/java/org/jboss/testharness/api/ResourceDescriptor.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -0,0 +1,12 @@
+package org.jboss.testharness.api;
+
+import java.net.URL;
+
+public interface ResourceDescriptor
+{
+
+ public String getName();
+
+ public URL getSource();
+
+}
\ No newline at end of file
Modified: test-harness/trunk/api/src/main/java/org/jboss/testharness/api/TCK.java
===================================================================
--- test-harness/trunk/api/src/main/java/org/jboss/testharness/api/TCK.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/api/src/main/java/org/jboss/testharness/api/TCK.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -31,7 +31,7 @@
TCK tCK;
try
{
- tCK = (TCK) Class.forName("org.jboss.jsr299.tck.impl.TCKImpl").newInstance();
+ tCK = (TCK) Class.forName("org.jboss.testharness.impl.TCKImpl").newInstance();
}
catch (InstantiationException e)
{
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/AbstractTest.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/AbstractTest.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/AbstractTest.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -10,7 +10,6 @@
import org.jboss.testharness.api.DeploymentException;
import org.jboss.testharness.api.TestResult;
import org.jboss.testharness.api.TestResult.Status;
-import org.jboss.testharness.impl.ConfigurationImpl;
import org.jboss.testharness.impl.packaging.ArtifactGenerator;
import org.jboss.testharness.impl.packaging.jsr299.JSR299ArtifactDescriptor;
import org.jboss.testharness.impl.packaging.jsr299.TCKArtifactDescriptor;
@@ -164,7 +163,7 @@
}
}
- @BeforeSuite(alwaysRun=true)
+ @BeforeSuite(alwaysRun=true, groups="scaffold")
public void beforeSuite(ITestContext context) throws Exception
{
if (isSuiteDeployingTestsToContainer())
@@ -179,7 +178,7 @@
}
- @AfterSuite(alwaysRun=true)
+ @AfterSuite(alwaysRun=true, groups="scaffold")
public void afterSuite() throws Exception
{
if (isSuiteDeployingTestsToContainer())
@@ -192,7 +191,7 @@
}
}
- @BeforeClass(alwaysRun=true)
+ @BeforeClass(alwaysRun=true, groups="scaffold")
public void beforeClass() throws Throwable
{
generateArtifact();
@@ -200,7 +199,7 @@
}
- @AfterClass(alwaysRun=true)
+ @AfterClass(alwaysRun=true, groups="scaffold")
public void afterClass() throws Exception
{
undeployArtifact();
@@ -208,9 +207,19 @@
this.deploymentException = null;
skipTest = false;
}
+
+ public void beforeMethod()
+ {
+
+ }
+
+ public void afterMethod()
+ {
+
+ }
- public void run(IHookCallBack callback, ITestResult testResult)
+ public final void run(IHookCallBack callback, ITestResult testResult)
{
if (artifact == null && !isInContainer())
{
@@ -222,11 +231,19 @@
}
else if ((!isDeployToContainerNeeded() || artifact.isRunLocally()) && !skipTest)
{
- callback.runTestMethod(testResult);
- if (!getCurrentConfiguration().isStandalone() && !isInContainer() && !artifact.isRunLocally())
- {
- log.warn("Running testcase locally " + testResult.getMethod());
- }
+ try
+ {
+ beforeMethod();
+ callback.runTestMethod(testResult);
+ }
+ finally
+ {
+ afterMethod();
+ if (!getCurrentConfiguration().isStandalone() && !isInContainer() && !artifact.isRunLocally())
+ {
+ log.warn("Running testcase locally " + testResult.getMethod());
+ }
+ }
}
else if (!skipTest)
{
@@ -246,10 +263,7 @@
}
}
- protected static Configuration getCurrentConfiguration()
- {
- return ConfigurationImpl.get();
- }
+ protected abstract Configuration getCurrentConfiguration();
protected String getContextPath()
{
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/ConfigurationImpl.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/ConfigurationImpl.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/ConfigurationImpl.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -1,7 +1,13 @@
package org.jboss.testharness.impl;
+import java.util.ArrayList;
+import java.util.List;
+
import org.jboss.testharness.api.Configuration;
+import org.jboss.testharness.api.ConfigurationBuilder;
+import org.jboss.testharness.api.ResourceDescriptor;
import org.jboss.testharness.api.TestLauncher;
+import org.jboss.testharness.impl.util.DeploymentProperties;
import org.jboss.testharness.spi.Containers;
import org.jboss.testharness.spi.StandaloneContainers;
@@ -9,15 +15,24 @@
{
private static Configuration current;
+
+ static
+ {
+ DeploymentProperties properties = new DeploymentProperties();
+ current = properties.getInstanceValue(ConfigurationBuilder.PROPERTY_NAME, ConfigurationBuilder.class, true).init().getConfiguration();
+ }
+
+ public static <T extends Configuration> T get(Class<T> expectedType)
+ {
+ return expectedType.cast(current);
+ }
+
public static Configuration get()
{
- if (ConfigurationImpl.current == null)
- {
- ConfigurationImpl.current = new PropertiesBasedConfigurationImpl().loadSPIImplementation();
- }
- return ConfigurationImpl.current;
+ return get(Configuration.class);
}
+
private String outputDirectory;
private boolean standalone;
private boolean runIntegrationTests;
@@ -27,9 +42,16 @@
private Containers containers;
private StandaloneContainers standaloneContainers;
private String host;
+ private List<String> extraPackages;
+ private List<ResourceDescriptor> extraResources;
+ private List<String> extraDeploymentProperties;
+ private String testPackage;
protected ConfigurationImpl()
{
+ this.extraPackages = new ArrayList<String>();
+ this.extraResources = new ArrayList<ResourceDescriptor>();
+ this.extraDeploymentProperties = new ArrayList<String>();
}
public ConfigurationImpl(Configuration configuration)
@@ -43,6 +65,8 @@
this.containers = configuration.getContainers();
this.standaloneContainers = configuration.getStandaloneContainers();
this.host = configuration.getHost();
+ this.extraPackages = configuration.getExtraPackages();
+ this.extraResources = configuration.getExtraResources();
}
public String getOutputDirectory()
@@ -145,6 +169,31 @@
this.testLauncher = testLauncher;
}
+ public List<String> getExtraPackages()
+ {
+ return extraPackages;
+ }
+
+ public List<ResourceDescriptor> getExtraResources()
+ {
+ return extraResources;
+ }
+
+ public List<String> getExtraDeploymentProperties()
+ {
+ return extraDeploymentProperties;
+ }
+
+ public String getTestPackage()
+ {
+ return testPackage;
+ }
+
+ public void setTestPackage(String testPackage)
+ {
+ this.testPackage = testPackage;
+ }
+
@Override
public String toString()
{
Copied: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/PropertiesBasedConfigurationBuilder.java (from rev 1903, test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/PropertiesBasedConfigurationImpl.java)
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/PropertiesBasedConfigurationBuilder.java (rev 0)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/PropertiesBasedConfigurationBuilder.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -0,0 +1,80 @@
+package org.jboss.testharness.impl;
+
+import static org.jboss.testharness.api.Configuration.CONNECT_TIMEOUT_PROPERTY_NAME;
+import static org.jboss.testharness.api.Configuration.DEFAULT_CONNECT_DELAY;
+import static org.jboss.testharness.api.Configuration.DEFAULT_HOST;
+import static org.jboss.testharness.api.Configuration.DEFAULT_LIBRARY_DIRECTORY;
+import static org.jboss.testharness.api.Configuration.DEFAULT_OUTPUT_DIRECTORY;
+import static org.jboss.testharness.api.Configuration.DEFAULT_RUN_INTEGRATION_TESTS;
+import static org.jboss.testharness.api.Configuration.DEFAULT_STANDALONE;
+import static org.jboss.testharness.api.Configuration.HOST_PROPERTY_NAME;
+import static org.jboss.testharness.api.Configuration.LIBRARY_DIRECTORY_PROPERTY_NAME;
+import static org.jboss.testharness.api.Configuration.OUTPUT_DIRECTORY_PROPERTY_NAME;
+import static org.jboss.testharness.api.Configuration.RUN_INTEGRATION_TESTS_PROPERTY_NAME;
+import static org.jboss.testharness.api.Configuration.STANDALONE_PROPERTY_NAME;
+import static org.jboss.testharness.api.Configuration.TEST_PACKAGE_PROPERTY_NAME;
+
+import org.jboss.testharness.api.Configurable;
+import org.jboss.testharness.api.Configuration;
+import org.jboss.testharness.api.ConfigurationBuilder;
+import org.jboss.testharness.api.TestLauncher;
+import org.jboss.testharness.impl.util.DeploymentProperties;
+import org.jboss.testharness.spi.Containers;
+import org.jboss.testharness.spi.StandaloneContainers;
+
+public abstract class PropertiesBasedConfigurationBuilder<T extends Configuration> implements ConfigurationBuilder
+{
+
+ private final DeploymentProperties deploymentProperties;
+ private final T configuration;
+
+ public PropertiesBasedConfigurationBuilder(T configuration)
+ {
+ this.deploymentProperties = new DeploymentProperties();
+ this.configuration = configuration;
+
+ configuration.setOutputDirectory(deploymentProperties.getStringValue(OUTPUT_DIRECTORY_PROPERTY_NAME, DEFAULT_OUTPUT_DIRECTORY, false));
+ configuration.setStandalone(deploymentProperties.getBooleanValue(STANDALONE_PROPERTY_NAME, DEFAULT_STANDALONE, false));
+ configuration.setRunIntegrationTests(deploymentProperties.getBooleanValue(RUN_INTEGRATION_TESTS_PROPERTY_NAME, DEFAULT_RUN_INTEGRATION_TESTS, false));
+ configuration.setConnectTimeout(deploymentProperties.getIntValue(CONNECT_TIMEOUT_PROPERTY_NAME, DEFAULT_CONNECT_DELAY, false));
+ configuration.setLibraryDirectory(deploymentProperties.getStringValue(LIBRARY_DIRECTORY_PROPERTY_NAME, DEFAULT_LIBRARY_DIRECTORY, false));
+ configuration.setHost(deploymentProperties.getStringValue(HOST_PROPERTY_NAME, DEFAULT_HOST, false));
+ configuration.setTestPackage(deploymentProperties.getStringValue(TEST_PACKAGE_PROPERTY_NAME, null, false));
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.testharness.impl.ConfigurationBuilder#loadSPIImplementation()
+ */
+ public ConfigurationBuilder init()
+ {
+ configuration.setInContainerTestLauncher(getInstanceValue(TestLauncher.PROPERTY_NAME, TestLauncher.class, configuration.isRunIntegrationTests() || !configuration.isStandalone()));
+ configuration.setContainers(getInstanceValue(Containers.PROPERTY_NAME, Containers.class, !configuration.isStandalone() || configuration.isRunIntegrationTests()));
+ configuration.setStandaloneContainers(getInstanceValue(StandaloneContainers.PROPERTY_NAME, StandaloneContainers.class, configuration.isStandalone()));
+
+ return this;
+ }
+
+ protected <T> T getInstanceValue(String propertyName, Class<T> expectedType, boolean required)
+ {
+ T instance = deploymentProperties.getInstanceValue(propertyName, expectedType, required);
+ if (instance instanceof Configurable)
+ {
+ ((Configurable) instance).setConfiguration(configuration);
+ }
+ return instance;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.testharness.impl.ConfigurationBuilder#getConfiguration()
+ */
+ public T getConfiguration()
+ {
+ return configuration;
+ }
+
+ protected DeploymentProperties getDeploymentProperties()
+ {
+ return deploymentProperties;
+ }
+
+}
Deleted: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/PropertiesBasedConfigurationImpl.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/PropertiesBasedConfigurationImpl.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/PropertiesBasedConfigurationImpl.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -1,45 +0,0 @@
-package org.jboss.testharness.impl;
-
-import org.jboss.testharness.api.Configurable;
-import org.jboss.testharness.api.TestLauncher;
-import org.jboss.testharness.impl.util.DeploymentProperties;
-import org.jboss.testharness.spi.Containers;
-import org.jboss.testharness.spi.StandaloneContainers;
-
-public class PropertiesBasedConfigurationImpl extends ConfigurationImpl
-{
-
- private final DeploymentProperties deploymentProperties;
-
- public PropertiesBasedConfigurationImpl()
- {
- this.deploymentProperties = new DeploymentProperties();
-
- setOutputDirectory(deploymentProperties.getStringValue(OUTPUT_DIRECTORY_PROPERTY_NAME, DEFAULT_OUTPUT_DIRECTORY, false));
- setStandalone(deploymentProperties.getBooleanValue(STANDALONE_PROPERTY_NAME, DEFAULT_STANDALONE, false));
- setRunIntegrationTests(deploymentProperties.getBooleanValue(RUN_INTEGRATION_TESTS_PROPERTY_NAME, DEFAULT_RUN_INTEGRATION_TESTS, false));
- setConnectTimeout(deploymentProperties.getIntValue(CONNECT_TIMEOUT_PROPERTY_NAME, DEFAULT_CONNECT_DELAY, false));
- setLibraryDirectory(deploymentProperties.getStringValue(LIBRARY_DIRECTORY_PROPERTY_NAME, DEFAULT_LIBRARY_DIRECTORY, false));
- setHost(deploymentProperties.getStringValue(HOST_PROPERTY_NAME, DEFAULT_HOST, false));
- }
-
- public PropertiesBasedConfigurationImpl loadSPIImplementation()
- {
- setInContainerTestLauncher(getInstanceValue(TestLauncher.PROPERTY_NAME, TestLauncher.class, isRunIntegrationTests() || !isStandalone()));
- setContainers(getInstanceValue(Containers.PROPERTY_NAME, Containers.class, !isStandalone() || isRunIntegrationTests()));
- setStandaloneContainers(getInstanceValue(StandaloneContainers.PROPERTY_NAME, StandaloneContainers.class, isStandalone()));
-
- return this;
- }
-
- private <T> T getInstanceValue(String propertyName, Class<T> expectedType, boolean required)
- {
- T instance = deploymentProperties.getInstanceValue(propertyName, expectedType, required);
- if (instance instanceof Configurable)
- {
- ((Configurable) instance).setConfiguration(this);
- }
- return instance;
- }
-
-}
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/TCKImpl.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/TCKImpl.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/TCKImpl.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -1,71 +1,21 @@
package org.jboss.testharness.impl;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.xml.parsers.ParserConfigurationException;
-
import org.apache.log4j.Logger;
import org.jboss.testharness.api.Configuration;
import org.jboss.testharness.api.TCK;
import org.jboss.testharness.impl.packaging.ArtifactGenerator;
-import org.testng.TestNG;
-import org.testng.xml.Parser;
-import org.testng.xml.XmlSuite;
-import org.xml.sax.SAXException;
public class TCKImpl extends TCK
{
private static Logger log = Logger.getLogger(TCKImpl.class);
-
- protected void runUnitTests()
- {
- TestNG testNG = new TestNG();
- addUnitTests(testNG);
- if (getConfiguration().getOutputDirectory() != null)
- {
- testNG.setOutputDirectory(getConfiguration().getOutputDirectory());
- }
- testNG.run();
- }
-
- private static void addUnitTests(TestNG testNG)
- {
- InputStream is = TCKImpl.class.getResourceAsStream("/tck-unit-tests.xml");
- if (is == null)
- {
- throw new IllegalStateException("Unable to load testng.xml");
- }
- List<XmlSuite> suites = new ArrayList<XmlSuite>();
- try
- {
- suites.addAll(new Parser(is).parse());
-
- }
- catch (ParserConfigurationException e)
- {
- throw new IllegalStateException("Unable to load testng.xml", e);
- }
- catch (SAXException e)
- {
- throw new IllegalStateException("Unable to load testng.xml", e);
- }
- catch (IOException e)
- {
- throw new IllegalStateException("Unable to load testng.xml", e);
- }
- testNG.setXmlSuites(suites);
- }
@Override
public void dumpArtifacts()
{
- Configuration configuration = new PropertiesBasedConfigurationImpl();
+ Configuration configuration = getConfiguration();
configuration.setStandalone(false);
- new ArtifactGenerator(configuration).dumpArtifacts();
+ new ArtifactGenerator(configuration).dumpArtifacts(configuration.getTestPackage());
}
@Override
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactDescriptor.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactDescriptor.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactDescriptor.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -30,6 +30,8 @@
import java.util.zip.ZipFile;
import org.apache.log4j.Logger;
+import org.jboss.testharness.api.ResourceDescriptor;
+import org.jboss.testharness.impl.ConfigurationImpl;
import org.jboss.testharness.impl.util.Files;
public class ArtifactDescriptor
@@ -245,6 +247,16 @@
this.libraries = new HashSet<ResourceDescriptor>();
}
+ public ArtifactDescriptor initialize()
+ {
+ for (String packageName : ConfigurationImpl.get().getExtraPackages())
+ {
+ addPackage(packageName, false);
+ }
+ getResources().addAll(ConfigurationImpl.get().getExtraResources());
+ return this;
+ }
+
public InputStream getJarAsStream() throws IOException
{
if (jar == null)
@@ -296,15 +308,15 @@
{
copyClass(clazz, getClassesRoot(root));
}
- for (ResourceDescriptor resourceDescriptor : resources)
+ for (ResourceDescriptor resourceDescriptorImpl : resources)
{
- copyResource(resourceDescriptor, root);
+ copyResource(resourceDescriptorImpl, root);
}
if (isLibrariesSupported())
{
- for (ResourceDescriptor resourceDescriptor : libraries)
+ for (ResourceDescriptor resourceDescriptorImpl : libraries)
{
- copyResource(resourceDescriptor, getLibraryRoot(root));
+ copyResource(resourceDescriptorImpl, getLibraryRoot(root));
}
}
this.explodedJar = root;
@@ -315,29 +327,29 @@
copyClass(clazz.getName(), root);
}
- private static void copyResource(ResourceDescriptor resourceDescriptor, File root) throws IOException
+ private static void copyResource(ResourceDescriptor resourceDescriptorImpl, File root) throws IOException
{
String directoryName;
String fileName;
- if (resourceDescriptor.getName().lastIndexOf("/") > 0)
+ if (resourceDescriptorImpl.getName().lastIndexOf("/") > 0)
{
- directoryName = resourceDescriptor.getName().substring(0, resourceDescriptor.getName().lastIndexOf("/"));
- fileName = resourceDescriptor.getName().substring(resourceDescriptor.getName().lastIndexOf("/") + 1);
+ directoryName = resourceDescriptorImpl.getName().substring(0, resourceDescriptorImpl.getName().lastIndexOf("/"));
+ fileName = resourceDescriptorImpl.getName().substring(resourceDescriptorImpl.getName().lastIndexOf("/") + 1);
}
else
{
directoryName = "";
- fileName = resourceDescriptor.getName();
+ fileName = resourceDescriptorImpl.getName();
}
if (isEmpty(fileName))
{
- throw new IllegalArgumentException("Unable to determine source file name of " + resourceDescriptor);
+ throw new IllegalArgumentException("Unable to determine source file name of " + resourceDescriptorImpl);
}
File directory = makeDirectoryStructure(root, directoryName);
File file = new File(directory, fileName);
file.createNewFile();
file.deleteOnExit();
- Files.copy(resourceDescriptor.getSource().openStream(), file);
+ Files.copy(resourceDescriptorImpl.getSource().openStream(), file);
}
private static void copyClass(String className, File root) throws IOException
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactGenerator.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactGenerator.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ArtifactGenerator.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -15,8 +15,8 @@
import java.util.Set;
import org.apache.log4j.Logger;
-import org.jboss.testharness.AbstractTest;
import org.jboss.testharness.api.Configuration;
+import org.jboss.testharness.api.ResourceDescriptor;
import org.jboss.testharness.impl.packaging.ear.EarArtifactDescriptor;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
import org.jboss.testharness.impl.packaging.jsr299.JSR299ArtifactDescriptor;
@@ -131,7 +131,7 @@
{
try
{
- this.extraLibraries.add(new ResourceDescriptor(file.getName(), file.toURI().toURL()));
+ this.extraLibraries.add(new ResourceDescriptorImpl(file.getName(), file.toURI().toURL()));
}
catch (IOException e)
{
@@ -162,12 +162,12 @@
private Collection<ResourceDescriptor> asResourceDescriptors(Resource[] resources)
{
- List<ResourceDescriptor> resourceDescriptors = new ArrayList<ResourceDescriptor>();
+ List<ResourceDescriptor> resourceDescriptorImpls = new ArrayList<ResourceDescriptor>();
for (Resource resource : resources)
{
- resourceDescriptors.add(new ResourceDescriptor(resource.destination(), asAbsolutePath(resource.source())));
+ resourceDescriptorImpls.add(new ResourceDescriptorImpl(resource.destination(), asAbsolutePath(resource.source())));
}
- return resourceDescriptors;
+ return resourceDescriptorImpls;
}
private String asAbsolutePath(String path)
@@ -187,15 +187,15 @@
TCKArtifactDescriptor artifact;
if (!standalone && packagingType.equals(WAR))
{
- artifact = new WarArtifactDescriptor(declaringClass, beansXml);
+ artifact = new WarArtifactDescriptor(declaringClass, beansXml).initialize();
}
else if (!standalone && packagingType.equals(EAR))
{
- artifact = new EarArtifactDescriptor(declaringClass, beansXml);
+ artifact = new EarArtifactDescriptor(declaringClass, beansXml).initialize();
}
else
{
- artifact = new JSR299ArtifactDescriptor(declaringClass, beansXml);
+ artifact = new JSR299ArtifactDescriptor(declaringClass, beansXml).initialize();
}
if (addDeclaringPackage)
@@ -237,9 +237,9 @@
return artifacts;
}
- public void dumpArtifacts()
+ public void dumpArtifacts(String basePackageName)
{
- List<ArtifactDescriptor> artifacts = createArtifacts(AbstractTest.class.getPackage().getName());
+ List<ArtifactDescriptor> artifacts = createArtifacts(basePackageName);
File file = new File(configuration.getOutputDirectory());
if (!file.exists())
{
Deleted: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ResourceDescriptor.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ResourceDescriptor.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ResourceDescriptor.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -1,83 +0,0 @@
-package org.jboss.testharness.impl.packaging;
-
-import static org.jboss.testharness.impl.util.Reflections.loadResource;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import org.jboss.testharness.impl.util.Files;
-
-public class ResourceDescriptor
-{
-
- private final String name;
- private final URL source;
-
- public ResourceDescriptor(String name, InputStream source) throws IOException
- {
- this.name = name;
- File file = File.createTempFile(ResourceDescriptor.class.getName(), null);
- file.deleteOnExit();
- Files.copy(source, file);
- this.source = file.toURI().toURL();
- }
-
- public ResourceDescriptor(String name, URL source)
- {
- this.name = name;
- this.source = source;
- }
-
- public ResourceDescriptor(String name, String source)
- {
- this.name = name;
- if (name == null)
- {
- throw new IllegalArgumentException("Unable to have a null resource");
- }
- this.source = loadResource(source);
- if (this.source == null)
- {
- throw new IllegalArgumentException("Unable to load file for " + source);
- }
- }
-
- public String getName()
- {
- return name;
- }
-
- public URL getSource()
- {
- return source;
- }
-
- @Override
- public boolean equals(Object obj)
- {
- if (obj instanceof ResourceDescriptor)
- {
- ResourceDescriptor that = (ResourceDescriptor) obj;
- return this.getName().equals(that.getName());
- }
- else
- {
- return false;
- }
- }
-
- @Override
- public int hashCode()
- {
- return name.hashCode();
- }
-
- @Override
- public String toString()
- {
- return name + " (" + source.toString() + ")";
- }
-
-}
Copied: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ResourceDescriptorImpl.java (from rev 1903, test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ResourceDescriptor.java)
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ResourceDescriptorImpl.java (rev 0)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ResourceDescriptorImpl.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -0,0 +1,90 @@
+package org.jboss.testharness.impl.packaging;
+
+import static org.jboss.testharness.impl.util.Reflections.loadResource;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.jboss.testharness.api.ResourceDescriptor;
+import org.jboss.testharness.impl.util.Files;
+
+public class ResourceDescriptorImpl implements ResourceDescriptor
+{
+
+ private final String name;
+ private final URL source;
+
+ public ResourceDescriptorImpl(String name, InputStream source) throws IOException
+ {
+ this.name = name;
+ File file = File.createTempFile(ResourceDescriptorImpl.class.getName(), null);
+ file.deleteOnExit();
+ Files.copy(source, file);
+ this.source = file.toURI().toURL();
+ }
+
+ public ResourceDescriptorImpl(String name, URL source)
+ {
+ this.name = name;
+ this.source = source;
+ }
+
+ public ResourceDescriptorImpl(String name, String source)
+ {
+ this.name = name;
+ if (name == null)
+ {
+ throw new IllegalArgumentException("Unable to have a null resource");
+ }
+ this.source = loadResource(source);
+ if (this.source == null)
+ {
+ throw new IllegalArgumentException("Unable to load file for " + source);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.testharness.impl.packaging.ResourceDescriptor#getName()
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.testharness.impl.packaging.ResourceDescriptor#getSource()
+ */
+ public URL getSource()
+ {
+ return source;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj instanceof ResourceDescriptorImpl)
+ {
+ ResourceDescriptor that = (ResourceDescriptor) obj;
+ return this.getName().equals(that.getName());
+ }
+ else
+ {
+ return false;
+ }
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return name.hashCode();
+ }
+
+ @Override
+ public String toString()
+ {
+ return name + " (" + source.toString() + ")";
+ }
+
+}
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EarArtifactDescriptor.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EarArtifactDescriptor.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EarArtifactDescriptor.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -9,7 +9,8 @@
import java.util.Set;
import org.apache.log4j.Logger;
-import org.jboss.testharness.impl.packaging.ResourceDescriptor;
+import org.jboss.testharness.api.ResourceDescriptor;
+import org.jboss.testharness.impl.packaging.ResourceDescriptorImpl;
import org.jboss.testharness.impl.packaging.jsr299.JSR299ArtifactDescriptor;
import org.jboss.testharness.impl.packaging.war.WarArtifactDescriptor;
@@ -26,7 +27,7 @@
public EarArtifactDescriptor(Class<?> declaringClass, String beansXmlSourceFileName)
{
super(declaringClass, null);
- this.ejbJar = new EjbJarArtifactDescriptor(declaringClass, beansXmlSourceFileName);
+ this.ejbJar = new EjbJarArtifactDescriptor(declaringClass, beansXmlSourceFileName).initialize();
this.war = new WarArtifactDescriptor(declaringClass, null)
{
@@ -42,12 +43,19 @@
return false;
}
- };
+ }.initialize();
+
+ }
+
+ @Override
+ public EarArtifactDescriptor initialize()
+ {
+ super.initialize();
InputStream applicationXml = null;
try
{
- applicationXml = getApplicationXml(declaringClass);
- getResources().add(new ResourceDescriptor(APPLICATION_XML_DESTINATION, applicationXml));
+ applicationXml = getApplicationXml(getDeclaringClass());
+ getResources().add(new ResourceDescriptorImpl(APPLICATION_XML_DESTINATION, applicationXml));
}
catch (IOException e)
{
@@ -67,6 +75,7 @@
}
}
}
+ return this;
}
@Override
@@ -123,11 +132,11 @@
if (resource.getName().startsWith("war"))
{
getResources().remove(resource);
- war.getResources().add(new ResourceDescriptor(resource.getName().substring(3), resource.getSource()));
+ war.getResources().add(new ResourceDescriptorImpl(resource.getName().substring(3), resource.getSource()));
}
}
- getResources().add(new ResourceDescriptor(war.getDefaultName(), war.getJar()));
- getResources().add(new ResourceDescriptor(ejbJar.getDefaultName(), ejbJar.getJar()));
+ getResources().add(new ResourceDescriptorImpl(war.getDefaultName(), war.getJar()));
+ getResources().add(new ResourceDescriptorImpl(ejbJar.getDefaultName(), ejbJar.getJar()));
super.create();
}
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EjbJarArtifactDescriptor.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EjbJarArtifactDescriptor.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/ear/EjbJarArtifactDescriptor.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -3,7 +3,7 @@
import java.net.URL;
-import org.jboss.testharness.impl.packaging.ResourceDescriptor;
+import org.jboss.testharness.impl.packaging.ResourceDescriptorImpl;
import org.jboss.testharness.impl.packaging.jsr299.JSR299ArtifactDescriptor;
public class EjbJarArtifactDescriptor extends JSR299ArtifactDescriptor
@@ -16,12 +16,19 @@
public EjbJarArtifactDescriptor(Class<?> declaringClass, String beansXmlSourceFileName)
{
super(declaringClass, beansXmlSourceFileName);
+ }
+
+ @Override
+ public EjbJarArtifactDescriptor initialize()
+ {
+ super.initialize();
URL ejbJarXml = loadResource(CUSTOM_EJB_JAR_XML_FILE_NAME);
if (ejbJarXml == null)
{
ejbJarXml = loadResource(STANDARD_EJB_JAR_XML_FILE_NAME);
}
- getResources().add(new ResourceDescriptor(EJB_JAR_XML_DESTINATION, ejbJarXml));
+ getResources().add(new ResourceDescriptorImpl(EJB_JAR_XML_DESTINATION, ejbJarXml));
+ return this;
}
@Override
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/jsr299/JSR299ArtifactDescriptor.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/jsr299/JSR299ArtifactDescriptor.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/jsr299/JSR299ArtifactDescriptor.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -2,7 +2,8 @@
import static org.jboss.testharness.impl.util.Strings.isEmpty;
-import org.jboss.testharness.impl.packaging.ResourceDescriptor;
+import org.jboss.testharness.api.ResourceDescriptor;
+import org.jboss.testharness.impl.packaging.ResourceDescriptorImpl;
public class JSR299ArtifactDescriptor extends TCKArtifactDescriptor
{
@@ -25,9 +26,18 @@
{
beansXmlSourceFileName = STANDARD_BEANS_XML_FILE_NAME;
}
- this.beansXml = new ResourceDescriptor(getBeansDestination(), beansXmlSourceFileName);
+ this.beansXml = new ResourceDescriptorImpl(getBeansDestination(), beansXmlSourceFileName);
+ }
+ }
+ @Override
+ public JSR299ArtifactDescriptor initialize()
+ {
+ super.initialize();
+ if (beansXml != null)
+ {
getResources().add(beansXml);
}
+ return this;
}
public String getBeansDestination()
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/jsr299/TCKArtifactDescriptor.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/jsr299/TCKArtifactDescriptor.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/jsr299/TCKArtifactDescriptor.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -8,8 +8,9 @@
import java.io.Writer;
import org.apache.log4j.Logger;
+import org.jboss.testharness.impl.ConfigurationImpl;
import org.jboss.testharness.impl.packaging.ArtifactDescriptor;
-import org.jboss.testharness.impl.packaging.ResourceDescriptor;
+import org.jboss.testharness.impl.packaging.ResourceDescriptorImpl;
import org.jboss.testharness.impl.util.DeploymentProperties;
public class TCKArtifactDescriptor extends ArtifactDescriptor
@@ -23,16 +24,23 @@
public TCKArtifactDescriptor(Class<?> declaringClass)
{
super(declaringClass);
+
+ }
+
+ @Override
+ public TCKArtifactDescriptor initialize()
+ {
+ super.initialize();
if (isLibrariesSupported())
{
- getLibraries().add(new ResourceDescriptor("testng.jar", "/lib/testng-jdk15.jar"));
- getLibraries().add(new ResourceDescriptor("jboss-test-harness-api.jar", "/lib/jboss-test-harness-api.jar"));
- getLibraries().add(new ResourceDescriptor("jboss-test-harness.jar", "/lib/jboss-test-harness.jar"));
+ getLibraries().add(new ResourceDescriptorImpl("testng.jar", "/lib/testng-jdk15.jar"));
+ getLibraries().add(new ResourceDescriptorImpl("jboss-test-harness-api.jar", "/lib/jboss-test-harness-api.jar"));
+ getLibraries().add(new ResourceDescriptorImpl("jboss-test-harness.jar", "/lib/jboss-test-harness.jar"));
InputStream deploymentProperties = null;
try
{
- deploymentProperties = getDeploymentProperties(declaringClass);
- getResources().add(new ResourceDescriptor(getClassesRoot() + DeploymentProperties.RESOURCE_BUNDLE, deploymentProperties));
+ deploymentProperties = getDeploymentProperties(getDeclaringClass());
+ getResources().add(new ResourceDescriptorImpl(getClassesRoot() + DeploymentProperties.RESOURCE_BUNDLE, deploymentProperties));
}
catch (IOException e)
{
@@ -53,6 +61,7 @@
}
}
}
+ return this;
}
private static InputStream getDeploymentProperties(Class<?> declaringClass) throws IOException
@@ -61,7 +70,11 @@
try
{
Writer writer = new PrintWriter(os);
- writer.write("className=" + declaringClass.getName());
+ writer.write("className=" + declaringClass.getName() + "\n");
+ for (String line : ConfigurationImpl.get().getExtraDeploymentProperties())
+ {
+ writer.write(line + "\n");
+ }
writer.flush();
return new ByteArrayInputStream(os.toByteArray());
}
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/war/WarArtifactDescriptor.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/war/WarArtifactDescriptor.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/war/WarArtifactDescriptor.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -3,7 +3,7 @@
import java.net.URL;
-import org.jboss.testharness.impl.packaging.ResourceDescriptor;
+import org.jboss.testharness.impl.packaging.ResourceDescriptorImpl;
import org.jboss.testharness.impl.packaging.jsr299.JSR299ArtifactDescriptor;
public class WarArtifactDescriptor extends JSR299ArtifactDescriptor
@@ -16,12 +16,19 @@
public WarArtifactDescriptor(Class<?> declaringClass, String beansXmlSourceFileName)
{
super(declaringClass, beansXmlSourceFileName);
+ }
+
+ @Override
+ public WarArtifactDescriptor initialize()
+ {
+ super.initialize();
URL webXml = loadResource(CUSTOM_WEB_XML_FILE_NAME);
if (webXml == null)
{
webXml = loadResource(STANDARD_WEB_XML_FILE_NAME);
}
- getResources().add(new ResourceDescriptor(WEB_XML_DESTINATION, webXml));
+ getResources().add(new ResourceDescriptorImpl(WEB_XML_DESTINATION, webXml));
+ return this;
}
@Override
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/runner/TestRunner.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/runner/TestRunner.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/runner/TestRunner.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -1,7 +1,9 @@
package org.jboss.testharness.impl.runner;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.jboss.testharness.AbstractTest;
import org.jboss.testharness.impl.testng.RemoveExpectedExceptionsAnnotationTransformer;
@@ -16,7 +18,7 @@
public class TestRunner
{
- private List<String> classNames;
+ private Set<String> classNames;
private List<String> methodNames;
private ITestContext context;
private List<ITestResult> testResults;
@@ -25,11 +27,11 @@
public TestRunner()
{
methodNames = new ArrayList<String>();
- classNames = new ArrayList<String>();
+ classNames = new HashSet<String>();
}
- public List<String> getClassNames()
+ public Set<String> getClassNames()
{
return classNames;
}
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/DeploymentProperties.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/DeploymentProperties.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/DeploymentProperties.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -3,9 +3,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
-import java.util.ArrayList;
import java.util.HashSet;
-import java.util.List;
import java.util.Properties;
import java.util.Set;
@@ -46,9 +44,9 @@
* @return A list of possible values. An empty list is returned if there are
* no matches.
*/
- public List<String> getPropertyValues(String key)
+ public Set<String> getPropertyValues(String key)
{
- List<String> values = new ArrayList<String>();
+ Set<String> values = new HashSet<String>();
addPropertiesFromSystem(key, values);
addPropertiesFromResourceBundle(key, values);
return values;
@@ -60,7 +58,7 @@
* @param key The key to match
* @param values The currently found values
*/
- private void addPropertiesFromSystem(String key, List<String> values)
+ private void addPropertiesFromSystem(String key, Set<String> values)
{
addProperty(key, System.getProperty(key), values);
}
@@ -71,7 +69,7 @@
* @param key The key to match
* @param values The currently found values
*/
- private void addPropertiesFromResourceBundle(String key, List<String> values)
+ private void addPropertiesFromResourceBundle(String key, Set<String> values)
{
try
{
@@ -107,7 +105,7 @@
* @param value The value of the property
* @param values The currently found values
*/
- private void addProperty(String key, String value, List<String> values)
+ private void addProperty(String key, String value, Set<String> values)
{
if (value != null)
{
@@ -207,7 +205,7 @@
public String getStringValue(String propertyName, String _default, boolean required)
{
- List<String> values = getPropertyValues(propertyName);
+ Set<String> values = getPropertyValues(propertyName);
if (values.size() == 0)
{
if (required)
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/Reflections.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/Reflections.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/Reflections.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -2,13 +2,8 @@
import java.io.IOException;
import java.io.InputStream;
-import java.lang.annotation.Annotation;
import java.net.URL;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Enumeration;
-import java.util.List;
-import java.util.Set;
import org.jboss.testharness.impl.packaging.ArtifactDescriptor;
@@ -20,30 +15,6 @@
*/
public class Reflections
{
- /**
- * Checks if all annotations are in a given set of annotations
- *
- * @param annotations The annotation set
- * @param annotationTypes The annotations to match
- * @return True if match, false otherwise
- */
- public static boolean annotationSetMatches(Set<Annotation> annotations, Class<? extends Annotation>... annotationTypes)
- {
- List<Class<? extends Annotation>> annotationTypeList = new ArrayList<Class<? extends Annotation>>();
- annotationTypeList.addAll(Arrays.asList(annotationTypes));
- for (Annotation annotation : annotations)
- {
- if (annotationTypeList.contains(annotation.annotationType()))
- {
- annotationTypeList.remove(annotation.annotationType());
- }
- else
- {
- return false;
- }
- }
- return annotationTypeList.size() == 0;
- }
public static InputStream loadResourceAsStream(String name)
{
Added: test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/mock/MockConfigurationBuilder.java
===================================================================
--- test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/mock/MockConfigurationBuilder.java (rev 0)
+++ test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/mock/MockConfigurationBuilder.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -0,0 +1,21 @@
+package org.jboss.testharness.test.impl.mock;
+
+import org.jboss.testharness.api.Configuration;
+import org.jboss.testharness.api.ConfigurationBuilder;
+
+public class MockConfigurationBuilder implements ConfigurationBuilder
+{
+
+ private Configuration configuration = new MockConfiguration();
+
+ public Configuration getConfiguration()
+ {
+ return configuration;
+ }
+
+ public ConfigurationBuilder init()
+ {
+ return this;
+ }
+
+}
Property changes on: test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/mock/MockConfigurationBuilder.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/ear/EarArtifactTest.java
===================================================================
--- test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/ear/EarArtifactTest.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/ear/EarArtifactTest.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -19,7 +19,7 @@
@Test
public void testDefaultEar() throws Exception
{
- EarArtifactDescriptor ear = new EarArtifactDescriptor(DummyTest.class, null);
+ EarArtifactDescriptor ear = new EarArtifactDescriptor(DummyTest.class, null).initialize();
ear.getClasses().add(Cow.class);
File root = ear.getExplodedJar();
assert root.isDirectory();
@@ -117,7 +117,7 @@
@Test
public void testJarProduction() throws Exception
{
- EarArtifactDescriptor ear = new EarArtifactDescriptor(DummyTest.class, null);
+ EarArtifactDescriptor ear = new EarArtifactDescriptor(DummyTest.class, null).initialize();
ear.getClasses().add(Cow.class);
JarInputStream is = new JarInputStream(ear.getJarAsStream());
JarEntry entry;
Modified: test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/packages/ArtifactTest.java
===================================================================
--- test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/packages/ArtifactTest.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/packages/ArtifactTest.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -13,7 +13,7 @@
@Test
public void testAllClassesInPackage() throws Exception
{
- ArtifactDescriptor artifactDescriptor = new ArtifactDescriptor(null);
+ ArtifactDescriptor artifactDescriptor = new ArtifactDescriptor(null).initialize();
artifactDescriptor.addPackage(ArtifactTest.class.getPackage());
File root = artifactDescriptor.getExplodedJar();
File currentPackage = getCurrentPackageAsFile(root);
Modified: test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/subpackages/SubpackagesArtifactTest.java
===================================================================
--- test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/subpackages/SubpackagesArtifactTest.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/subpackages/SubpackagesArtifactTest.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -13,7 +13,7 @@
@Test
public void testAllClassesInPackageAndNotSubPackages() throws Exception
{
- ArtifactDescriptor artifactDescriptor = new ArtifactDescriptor(null);
+ ArtifactDescriptor artifactDescriptor = new ArtifactDescriptor(null).initialize();
artifactDescriptor.addPackage(SubpackagesArtifactTest.class.getPackage());
File root = artifactDescriptor.getExplodedJar();
File currentPackage = getCurrentPackageAsFile(root);
Modified: test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/tck/TCKArtifactTest.java
===================================================================
--- test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/tck/TCKArtifactTest.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/tck/TCKArtifactTest.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -18,7 +18,7 @@
@Test
public void testTCKSupportJar() throws Exception
{
- ArtifactDescriptor artifactDescriptor = new WarArtifactDescriptor(DummyTest.class, null);
+ ArtifactDescriptor artifactDescriptor = new WarArtifactDescriptor(DummyTest.class, null).initialize();
File root = artifactDescriptor.getExplodedJar();
File tckSupportJar = new File(root, "WEB-INF/lib/jboss-test-harness.jar");
assert tckSupportJar.exists();
Modified: test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/war/WarArtifactTest.java
===================================================================
--- test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/war/WarArtifactTest.java 2009-03-11 12:12:32 UTC (rev 1910)
+++ test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/war/WarArtifactTest.java 2009-03-11 13:06:00 UTC (rev 1911)
@@ -18,7 +18,7 @@
@Test
public void testDefaultWar() throws Exception
{
- WarArtifactDescriptor war = new WarArtifactDescriptor(DummyTest.class, null);
+ WarArtifactDescriptor war = new WarArtifactDescriptor(DummyTest.class, null).initialize();
war.getClasses().add(Cow.class);
File root = war.getExplodedJar();
assert root.listFiles().length == 1;
@@ -73,7 +73,7 @@
@Test
public void testJarProduction() throws Exception
{
- WarArtifactDescriptor war = new WarArtifactDescriptor(DummyTest.class, null);
+ WarArtifactDescriptor war = new WarArtifactDescriptor(DummyTest.class, null).initialize();
war.getClasses().add(Cow.class);
JarInputStream is = new JarInputStream(war.getJarAsStream());
JarEntry entry;
Added: test-harness/trunk/tests/src/test/resources/META-INF/web-beans-tck.properties
===================================================================
--- test-harness/trunk/tests/src/test/resources/META-INF/web-beans-tck.properties (rev 0)
+++ test-harness/trunk/tests/src/test/resources/META-INF/web-beans-tck.properties 2009-03-11 13:06:00 UTC (rev 1911)
@@ -0,0 +1 @@
+org.jboss.testharness.api.ConfigurationBuilder=org.jboss.testharness.test.impl.mock.MockConfigurationBuilder
\ No newline at end of file
Property changes on: test-harness/trunk/tests/src/test/resources/META-INF/web-beans-tck.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
More information about the weld-commits
mailing list