[webbeans-commits] Webbeans SVN: r2337 - tck/trunk/impl/src/main/resources/META-INF.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-07 19:36:17 -0400 (Tue, 07 Apr 2009)
New Revision: 2337
Added:
tck/trunk/impl/src/main/resources/META-INF/jboss-test-harness.properties
Removed:
tck/trunk/impl/src/main/resources/META-INF/web-beans-tck.properties
Log:
updates for harness changes
Copied: tck/trunk/impl/src/main/resources/META-INF/jboss-test-harness.properties (from rev 2333, tck/trunk/impl/src/main/resources/META-INF/web-beans-tck.properties)
===================================================================
--- tck/trunk/impl/src/main/resources/META-INF/jboss-test-harness.properties (rev 0)
+++ tck/trunk/impl/src/main/resources/META-INF/jboss-test-harness.properties 2009-04-07 23:36:17 UTC (rev 2337)
@@ -0,0 +1,2 @@
+org.jboss.testharness.api.ConfigurationBuilder=org.jboss.jsr299.tck.impl.JSR299PropertiesBasedConfigurationBuilder
+org.jboss.testharness.testPackage=org.jboss.jsr299.tck.tests
\ No newline at end of file
Property changes on: tck/trunk/impl/src/main/resources/META-INF/jboss-test-harness.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: tck/trunk/impl/src/main/resources/META-INF/web-beans-tck.properties
===================================================================
--- tck/trunk/impl/src/main/resources/META-INF/web-beans-tck.properties 2009-04-07 23:36:11 UTC (rev 2336)
+++ tck/trunk/impl/src/main/resources/META-INF/web-beans-tck.properties 2009-04-07 23:36:17 UTC (rev 2337)
@@ -1,2 +0,0 @@
-org.jboss.testharness.api.ConfigurationBuilder=org.jboss.jsr299.tck.impl.JSR299PropertiesBasedConfigurationBuilder
-org.jboss.testharness.testPackage=org.jboss.jsr299.tck.tests
\ No newline at end of file
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2336 - in test-harness/trunk: api/src/main/java/org/jboss/testharness and 12 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-07 19:36:11 -0400 (Tue, 07 Apr 2009)
New Revision: 2336
Added:
test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/
test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/PropertiesManager.java
test-harness/trunk/api/src/main/java/org/jboss/testharness/spi/helpers/
test-harness/trunk/api/src/main/java/org/jboss/testharness/spi/helpers/AbstractContainerConnector.java
test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/ProfileServiceConnector.java
test-harness/trunk/jboss/src/main/resources/META-INF/jboss-test-harness.properties
test-harness/trunk/tests/src/test/resources/META-INF/jboss-test-harness.properties
Removed:
test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/DeploymentProperties.java
test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/Strings.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/EnumerationIterable.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/EnumerationIterator.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/ResourceLoadingException.java
test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/SimpleResourceLoader.java
test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/ProfileServiceContainersImpl.java
test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/util/
test-harness/trunk/jboss/src/main/resources/META-INF/web-beans-tck.properties
test-harness/trunk/tests/src/test/resources/META-INF/web-beans-tck.properties
Modified:
test-harness/trunk/api/pom.xml
test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/EnumerationIterable.java
test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/EnumerationIterator.java
test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/ResourceLoadingException.java
test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/SimpleResourceLoader.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/PropertiesBasedConfigurationBuilder.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/runner/TestRunner.java
test-harness/trunk/jboss/
test-harness/trunk/jboss/pom.xml
test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/JBossASConnector.java
test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/ear/EarArtifactTest.java
Log:
fix up proprety names, extract generic server connector code
Modified: test-harness/trunk/api/pom.xml
===================================================================
--- test-harness/trunk/api/pom.xml 2009-04-07 21:24:58 UTC (rev 2335)
+++ test-harness/trunk/api/pom.xml 2009-04-07 23:36:11 UTC (rev 2336)
@@ -33,6 +33,11 @@
<url>http://www.seamframework.org/WebBeans</url>
<dependencies>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
</dependencies>
Copied: test-harness/trunk/api/src/main/java/org/jboss/testharness/properties (from rev 2333, test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/util)
Deleted: test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/DeploymentProperties.java
===================================================================
--- test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/util/DeploymentProperties.java 2009-04-07 16:40:59 UTC (rev 2333)
+++ test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/DeploymentProperties.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -1,233 +0,0 @@
-package org.jboss.testharness.integration.jbossas.util;
-
-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;
-
-import org.apache.log4j.Logger;
-
-/**
- * Utility class to load deployment properties
- *
- * @author Pete Muir
- */
-public class DeploymentProperties
-{
- // The resource bundle used to control Web Beans RI deployment
- public static final String RESOURCE_BUNDLE = "META-INF/web-beans-tck.properties";
-
- private static final Logger log = Logger.getLogger(DeploymentProperties.class);
-
- // The class to work from
- private SimpleResourceLoader resourceLoader;
-
- /**
- * Constructor
- *
- * @param classLoader The classloader to work on
- */
- public DeploymentProperties()
- {
- this.resourceLoader = new SimpleResourceLoader();
- }
-
- /**
- * Get a list of possible values for a given key.
- *
- * First, System properties are tried, followed by the specified resource
- * bundle (first in classpath only).
- *
- * @param key The key to search for
- * @return A list of possible values. An empty list is returned if there are
- * no matches.
- */
- public List<String> getPropertyValues(String key)
- {
- List<String> values = new ArrayList<String>();
- addPropertiesFromSystem(key, values);
- addPropertiesFromResourceBundle(key, values);
- return values;
- }
-
- /**
- * Adds matches from system properties
- *
- * @param key The key to match
- * @param values The currently found values
- */
- private void addPropertiesFromSystem(String key, List<String> values)
- {
- addProperty(key, System.getProperty(key), values);
- }
-
- /**
- * Adds matches from detected resource bundles
- *
- * @param key The key to match
- * @param values The currently found values
- */
- private void addPropertiesFromResourceBundle(String key, List<String> values)
- {
- try
- {
- for (URL url : resourceLoader.getResources(RESOURCE_BUNDLE))
- {
- Properties properties = new Properties();
- InputStream propertyStream = url.openStream();
- try
- {
- properties.load(propertyStream);
- addProperty(key, properties.getProperty(key), values);
- }
- finally
- {
- if (propertyStream != null)
- {
- propertyStream.close();
- }
- }
- }
- }
- catch (IOException e)
- {
- // No - op, file is optional
- }
- }
-
- /**
- * Add the property to the set of properties only if it hasn't already been
- * added
- *
- * @param key The key searched for
- * @param value The value of the property
- * @param values The currently found values
- */
- private void addProperty(String key, String value, List<String> values)
- {
- if (value != null)
- {
- values.add(value);
- }
-
- }
-
- /**
- * Gets the possible implementation class for a given property for which the
- * values are classanames
- *
- * @param deploymentProperties The deployment properties object to use
- * @param resourceLoader The resource laoder to use to attempt
- * @param propertyName The name of the property to load
- * @return A set of classes specified
- */
- @SuppressWarnings("unchecked")
- public <T> Set<Class<T>> getClasses(String propertyName, Class<T> expectedType)
- {
- Set<Class<T>> classes = new HashSet<Class<T>>();
- for (String className : getPropertyValues(propertyName))
- {
- try
- {
- classes.add((Class<T>) resourceLoader.classForName(className));
- }
- catch (ResourceLoadingException e)
- {
- //log.debug("Unable to load class " + className + " for property " + propertyName, e);
- }
- }
- return classes;
- }
-
- public <T> Class<T> getClassValue(String propertyName, Class<T> expectedType, boolean required)
- {
- Set<Class<T>> classes = getClasses(propertyName, expectedType);
- if (classes.size() == 0)
- {
- if (required)
- {
- throw new IllegalArgumentException("Cannot find any implementations of " + expectedType.getSimpleName() + ", check that " + propertyName + " is specified");
- }
- else
- {
- return null;
- }
- }
- else if (classes.size() > 1)
- {
- throw new IllegalArgumentException("More than one implementation of " + expectedType.getSimpleName() + " specified by " + propertyName + ", not sure which one to use!");
- }
- else
- {
- return classes.iterator().next();
- }
- }
-
- public <T> T getInstanceValue(String propertyName, Class<T> expectedType, boolean required)
- {
- Class<T> clazz = getClassValue(propertyName, expectedType, required);
- if (clazz != null)
- {
- try
- {
- return clazz.newInstance();
- }
- catch (InstantiationException e)
- {
- throw new IllegalStateException("Error instantiating " + clazz + " specified by " + propertyName, e);
- }
- catch (IllegalAccessException e)
- {
- throw new IllegalStateException("Error instantiating " + clazz + " specified by " + propertyName, e);
- }
- }
- else
- {
- return null;
- }
- }
-
- public boolean getBooleanValue(String propertyName, boolean _default, boolean required)
- {
- return Boolean.valueOf(getStringValue(propertyName, _default ? "true" : "false", required));
- }
-
- public int getIntValue(String propertyName, int _default, boolean required)
- {
- return Integer.valueOf(getStringValue(propertyName, Integer.toString(_default), required)).intValue();
- }
-
- public long getLongValue(String propertyName, long _default, boolean required)
- {
- return Long.valueOf(getStringValue(propertyName, Long.toString(_default), required)).longValue();
- }
-
- public String getStringValue(String propertyName, String _default, boolean required)
- {
- List<String> values = getPropertyValues(propertyName);
- if (values.size() == 0)
- {
- if (required)
- {
- throw new IllegalArgumentException("Cannot find required property " + propertyName + ", check that it is specified");
- }
- else
- {
- return _default;
- }
- }
- else if (values.size() > 1)
- {
- throw new IllegalArgumentException("More than one value given for " + propertyName + ", not sure which one to use!");
- }
- else
- {
- return values.iterator().next();
- }
- }
-
-}
\ No newline at end of file
Modified: test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/EnumerationIterable.java
===================================================================
--- test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/util/EnumerationIterable.java 2009-04-07 16:40:59 UTC (rev 2333)
+++ test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/EnumerationIterable.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -1,4 +1,4 @@
-package org.jboss.testharness.integration.jbossas.util;
+package org.jboss.testharness.properties;
import java.util.Enumeration;
import java.util.Iterator;
Modified: test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/EnumerationIterator.java
===================================================================
--- test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/util/EnumerationIterator.java 2009-04-07 16:40:59 UTC (rev 2333)
+++ test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/EnumerationIterator.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -1,4 +1,4 @@
-package org.jboss.testharness.integration.jbossas.util;
+package org.jboss.testharness.properties;
import java.util.Enumeration;
import java.util.Iterator;
Added: test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/PropertiesManager.java
===================================================================
--- test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/PropertiesManager.java (rev 0)
+++ test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/PropertiesManager.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -0,0 +1,231 @@
+package org.jboss.testharness.properties;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.log4j.Logger;
+
+/**
+ * Utility class to load deployment properties
+ *
+ * @author Pete Muir
+ */
+public class PropertiesManager
+{
+ // The resource bundle used to control Web Beans RI deployment
+ public static final String RESOURCE_BUNDLE = "META-INF/jboss-test-harness.properties";
+
+ private static final Logger log = Logger.getLogger(PropertiesManager.class);
+
+ // The class to work from
+ private SimpleResourceLoader resourceLoader;
+
+ /**
+ * Constructor
+ *
+ * @param classLoader The classloader to work on
+ */
+ public PropertiesManager()
+ {
+ this.resourceLoader = new SimpleResourceLoader();
+ }
+
+ /**
+ * Get a list of possible values for a given key.
+ *
+ * First, System properties are tried, followed by the specified resource
+ * bundle (first in classpath only).
+ *
+ * @param key The key to search for
+ * @return A list of possible values. An empty list is returned if there are
+ * no matches.
+ */
+ public Set<String> getPropertyValues(String key)
+ {
+ Set<String> values = new HashSet<String>();
+ addPropertiesFromSystem(key, values);
+ addPropertiesFromResourceBundle(key, values);
+ return values;
+ }
+
+ /**
+ * Adds matches from system properties
+ *
+ * @param key The key to match
+ * @param values The currently found values
+ */
+ private void addPropertiesFromSystem(String key, Set<String> values)
+ {
+ addProperty(key, System.getProperty(key), values);
+ }
+
+ /**
+ * Adds matches from detected resource bundles
+ *
+ * @param key The key to match
+ * @param values The currently found values
+ */
+ private void addPropertiesFromResourceBundle(String key, Set<String> values)
+ {
+ try
+ {
+ for (URL url : resourceLoader.getResources(RESOURCE_BUNDLE))
+ {
+ Properties properties = new Properties();
+ InputStream propertyStream = url.openStream();
+ try
+ {
+ properties.load(propertyStream);
+ addProperty(key, properties.getProperty(key), values);
+ }
+ finally
+ {
+ if (propertyStream != null)
+ {
+ propertyStream.close();
+ }
+ }
+ }
+ }
+ catch (IOException e)
+ {
+ // No - op, file is optional
+ }
+ }
+
+ /**
+ * Add the property to the set of properties only if it hasn't already been
+ * added
+ *
+ * @param key The key searched for
+ * @param value The value of the property
+ * @param values The currently found values
+ */
+ private void addProperty(String key, String value, Set<String> values)
+ {
+ if (value != null)
+ {
+ values.add(value);
+ }
+
+ }
+
+ /**
+ * Gets the possible implementation class for a given property for which the
+ * values are classanames
+ *
+ * @param deploymentProperties The deployment properties object to use
+ * @param resourceLoader The resource laoder to use to attempt
+ * @param propertyName The name of the property to load
+ * @return A set of classes specified
+ */
+ @SuppressWarnings("unchecked")
+ public <T> Set<Class<T>> getClasses(String propertyName, Class<T> expectedType)
+ {
+ Set<Class<T>> classes = new HashSet<Class<T>>();
+ for (String className : getPropertyValues(propertyName))
+ {
+ try
+ {
+ classes.add((Class<T>) resourceLoader.classForName(className));
+ }
+ catch (ResourceLoadingException e)
+ {
+ //log.debug("Unable to load class " + className + " for property " + propertyName, e);
+ }
+ }
+ return classes;
+ }
+
+ public <T> Class<T> getClassValue(String propertyName, Class<T> expectedType, boolean required)
+ {
+ Set<Class<T>> classes = getClasses(propertyName, expectedType);
+ if (classes.size() == 0)
+ {
+ if (required)
+ {
+ throw new IllegalArgumentException("Cannot find any implementations of " + expectedType.getSimpleName() + ", check that " + propertyName + " is specified");
+ }
+ else
+ {
+ return null;
+ }
+ }
+ else if (classes.size() > 1)
+ {
+ throw new IllegalArgumentException("More than one implementation of " + expectedType.getSimpleName() + " specified by " + propertyName + ", not sure which one to use!");
+ }
+ else
+ {
+ return classes.iterator().next();
+ }
+ }
+
+ public <T> T getInstanceValue(String propertyName, Class<T> expectedType, boolean required)
+ {
+ Class<T> clazz = getClassValue(propertyName, expectedType, required);
+ if (clazz != null)
+ {
+ try
+ {
+ return clazz.newInstance();
+ }
+ catch (InstantiationException e)
+ {
+ throw new IllegalStateException("Error instantiating " + clazz + " specified by " + propertyName, e);
+ }
+ catch (IllegalAccessException e)
+ {
+ throw new IllegalStateException("Error instantiating " + clazz + " specified by " + propertyName, e);
+ }
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ public boolean getBooleanValue(String propertyName, boolean _default, boolean required)
+ {
+ return Boolean.valueOf(getStringValue(propertyName, _default ? "true" : "false", required));
+ }
+
+ public int getIntValue(String propertyName, int _default, boolean required)
+ {
+ return Integer.valueOf(getStringValue(propertyName, Integer.toString(_default), required)).intValue();
+ }
+
+ public long getLongValue(String propertyName, long _default, boolean required)
+ {
+ return Long.valueOf(getStringValue(propertyName, Long.toString(_default), required)).longValue();
+ }
+
+ public String getStringValue(String propertyName, String _default, boolean required)
+ {
+ Set<String> values = getPropertyValues(propertyName);
+ if (values.size() == 0)
+ {
+ if (required)
+ {
+ throw new IllegalArgumentException("Cannot find required property " + propertyName + ", check that it is specified");
+ }
+ else
+ {
+ return _default;
+ }
+ }
+ else if (values.size() > 1)
+ {
+ throw new IllegalArgumentException("More than one value given for " + propertyName + ", not sure which one to use!");
+ }
+ else
+ {
+ return values.iterator().next();
+ }
+ }
+
+}
\ No newline at end of file
Modified: test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/ResourceLoadingException.java
===================================================================
--- test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/util/ResourceLoadingException.java 2009-04-07 16:40:59 UTC (rev 2333)
+++ test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/ResourceLoadingException.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -1,4 +1,4 @@
-package org.jboss.testharness.integration.jbossas.util;
+package org.jboss.testharness.properties;
/**
Modified: test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/SimpleResourceLoader.java
===================================================================
--- test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/util/SimpleResourceLoader.java 2009-04-07 16:40:59 UTC (rev 2333)
+++ test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/SimpleResourceLoader.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -1,4 +1,4 @@
-package org.jboss.testharness.integration.jbossas.util;
+package org.jboss.testharness.properties;
import java.io.IOException;
import java.net.URL;
Deleted: test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/Strings.java
===================================================================
--- test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/util/Strings.java 2009-04-07 16:40:59 UTC (rev 2333)
+++ test-harness/trunk/api/src/main/java/org/jboss/testharness/properties/Strings.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -1,30 +0,0 @@
-package org.jboss.testharness.integration.jbossas.util;
-
-import java.util.StringTokenizer;
-
-public class Strings
-{
- static String[] split(String strings, String delims)
- {
- if (strings == null)
- {
- return new String[0];
- }
- else
- {
- StringTokenizer tokens = new StringTokenizer(strings, delims);
- String[] result = new String[tokens.countTokens()];
- int i = 0;
- while (tokens.hasMoreTokens())
- {
- result[i++] = tokens.nextToken();
- }
- return result;
- }
- }
-
- public static boolean isEmpty(String string)
- {
- return string == null || string.length() == 0;
- }
-}
Added: test-harness/trunk/api/src/main/java/org/jboss/testharness/spi/helpers/AbstractContainerConnector.java
===================================================================
--- test-harness/trunk/api/src/main/java/org/jboss/testharness/spi/helpers/AbstractContainerConnector.java (rev 0)
+++ test-harness/trunk/api/src/main/java/org/jboss/testharness/spi/helpers/AbstractContainerConnector.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -0,0 +1,387 @@
+package org.jboss.testharness.spi.helpers;
+
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.apache.log4j.Logger;
+import org.jboss.testharness.api.Configurable;
+import org.jboss.testharness.api.Configuration;
+import org.jboss.testharness.properties.PropertiesManager;
+
+public abstract class AbstractContainerConnector implements Configurable
+{
+
+ public static String JAVA_OPTS = " -ea";
+
+ public static final String JAVA_OPTS_PROPERTY_NAME = "org.jboss.testharness.container.javaOpts";
+
+ private static final String BOOT_TIMEOUT_PROPERTY_NAME = "org.jboss.testharness.container.bootTimeout";
+ public static final String FORCE_RESTART_PROPERTY_NAME = "org.jboss.testharness.container.forceRestart";
+ public static final String HOST_PROPERTY_NAME = "org.jboss.testharness.container.host";
+ public static final String PORT_PROPERTY_NAME = "org.jboss.testharness.container.port";
+ public static final String SHUTDOWN_DELAY_PROPERTY_NAME = "org.jboss.testharness.container.shutdownDelay";
+
+ public static final String EXTRA_CONFIGURATION_DIR_PROPERTY_NAME = "org.jboss.testharness.container.extraConfigurationDir";
+
+ private static Logger log = Logger.getLogger(AbstractContainerConnector.class);
+
+ private final PropertiesManager properties;
+ private Configuration configuration;
+ private boolean wasStarted;
+
+ private String serverDirectory;
+ private String httpUrl;
+ private Long bootTimeout;
+ private String javaOpts;
+ private Boolean forceRestart;
+ private Integer shutdownDelay;
+ private String host;
+ private String port;
+
+ private String extraConfigurationDir;
+
+ protected static void copy(InputStream inputStream, File file) throws IOException
+ {
+ OutputStream os = new FileOutputStream(file);
+ try
+ {
+ byte[] buf = new byte[1024];
+ int i = 0;
+ while ((i = inputStream.read(buf)) != -1)
+ {
+ os.write(buf, 0, i);
+ }
+ }
+ finally
+ {
+ os.close();
+ }
+ }
+
+ public AbstractContainerConnector() throws IOException
+ {
+ this.properties = new PropertiesManager();
+ String extraConfigurationDir = getExtraConfigurationDir();
+ if (extraConfigurationDir != null)
+ {
+ File extraConfiguration = new File(extraConfigurationDir);
+ if (extraConfiguration.isDirectory())
+ {
+ File buildProperties = new File(extraConfiguration, "build.properties");
+ if (buildProperties.exists())
+ {
+ loadProperties(buildProperties);
+ }
+ File localBuildProperties = new File(extraConfiguration, "local.build.properties");
+ if (localBuildProperties.exists())
+ {
+ loadProperties(localBuildProperties);
+ }
+ }
+ }
+ }
+
+ public void setConfiguration(Configuration configuration)
+ {
+ this.configuration = configuration;
+ }
+
+ /**
+ * Check that the server is up by attempting to connect to it's front page
+ * @return true if the connection was made
+ */
+ protected boolean isServerUp()
+ {
+ try
+ {
+ URLConnection connection = new URL(getHttpUrl()).openConnection();
+ if (!(connection instanceof HttpURLConnection))
+ {
+ throw new IllegalStateException("Not an http connection! " + connection);
+ }
+ HttpURLConnection httpConnection = (HttpURLConnection) connection;
+ httpConnection.connect();
+ if (httpConnection.getResponseCode() != HttpURLConnection.HTTP_OK)
+ {
+ return false;
+ }
+ }
+ catch (Exception e)
+ {
+ return false;
+ }
+ log.info("Connected to server over http");
+ return true;
+ }
+
+ public void setup() throws IOException
+ {
+ configuration.setHost(getHost() + ":" + getPort());
+ log.info("Using server " + getServerDirectory() + " (" + getHttpUrl() + ")");
+ restartServer();
+ }
+
+ protected void restartServer() throws IOException
+ {
+ if (getForceRestart())
+ {
+ if (isServerUp())
+ {
+ log.info("Shutting down server as in force-restart mode");
+ shutdownServer();
+ try
+ {
+ Thread.sleep(getShutdownDelay());
+ }
+ catch (InterruptedException e)
+ {
+ Thread.currentThread().interrupt();
+ }
+ }
+ }
+ if (!isServerUp())
+ {
+ wasStarted = true;
+ startServer();
+ log.info("Starting server");
+ // Wait for server to come up
+ long timeoutTime = System.currentTimeMillis() + getServerBootTimeout();
+ boolean interrupted = false;
+ while (timeoutTime > System.currentTimeMillis())
+ {
+ if (isServerUp())
+ {
+ log.info("Started server");
+ return;
+ }
+ try
+ {
+ Thread.sleep(200);
+ }
+ catch (InterruptedException e)
+ {
+ interrupted = true;
+ }
+ }
+ if (interrupted)
+ {
+ Thread.currentThread().interrupt();
+ }
+ // If we got this far something went wrong
+ log.warn("Unable to connect to server after " + getServerBootTimeout() + "ms, giving up!");
+ shutdownServer();
+ throw new IllegalStateException("Error connecting to server");
+ }
+ }
+
+ protected void loadProperties(File file) throws IOException
+ {
+ InputStream is = new FileInputStream(file);
+ try
+ {
+ System.getProperties().load(is);
+ }
+ finally
+ {
+ is.close();
+ }
+ }
+
+ public void cleanup() throws IOException
+ {
+ if (wasStarted)
+ {
+ log.info("Shutting down server");
+ shutdownServer();
+ }
+ }
+
+ protected abstract void shutdownServer() throws IOException;
+
+ protected abstract void startServer() throws IOException;
+
+ protected void launch(String directory, String scriptFileName, String params) throws IOException
+ {
+ String osName = System.getProperty("os.name");
+ Runtime runtime = Runtime.getRuntime();
+
+ directory = new File(directory).getPath();
+
+ Process p = null;
+ if (osName.startsWith("Windows"))
+ {
+ String command[] = {
+ "cmd.exe",
+ "/C",
+ "set JAVA_OPTS=" + getJavaOpts() + " & cd /D " + directory + " & " + scriptFileName + ".bat " + params
+ };
+ p = runtime.exec(command);
+ }
+ else
+ {
+ String command[] = {
+ "sh",
+ "-c",
+ "cd " + directory + ";JAVA_OPTS=\"" + getJavaOpts() + "\" ./" + scriptFileName + ".sh " + params
+ };
+ p = runtime.exec(command);
+ }
+ dump(p.getErrorStream());
+ dump(p.getInputStream());
+ }
+
+ protected void dump(final InputStream is)
+ {
+ new Thread(new Runnable()
+ {
+ public void run()
+ {
+ try
+ {
+ DataOutputStream out = new DataOutputStream(new FileOutputStream(configuration.getOutputDirectory() + File.separator + getLogName()));
+ int c;
+ while((c = is.read()) != -1)
+ {
+ out.writeByte(c);
+ }
+ is.close();
+ out.close();
+ }
+ catch(IOException e)
+ {
+ System.err.println("Error Writing/Reading Streams.");
+ }
+ }
+ }).start();
+ }
+
+ protected abstract String getServerHomePropertyName();
+
+ protected String getServerDirectory()
+ {
+ if (serverDirectory == null)
+ {
+ serverDirectory = new File(getProperties().getStringValue(getServerHomePropertyName(), null, true)).getPath();
+ }
+ return serverDirectory;
+ }
+
+ protected String getServerBootTimeoutPropertyName()
+ {
+ return BOOT_TIMEOUT_PROPERTY_NAME;
+ }
+
+ protected Long getServerBootTimeout()
+ {
+ if (bootTimeout == null)
+ {
+ this.bootTimeout = getProperties().getLongValue(getServerBootTimeoutPropertyName(), 240000, false);
+ }
+ return bootTimeout;
+ }
+
+ protected String getForceRestartPropertyName()
+ {
+ return FORCE_RESTART_PROPERTY_NAME;
+ }
+
+ protected Boolean getForceRestart()
+ {
+ if (forceRestart == null)
+ {
+ this.forceRestart = this.forceRestart = getProperties().getBooleanValue(getForceRestartPropertyName(), false, false);
+ }
+ return forceRestart;
+ }
+
+ protected String getHostPropertyName()
+ {
+ return HOST_PROPERTY_NAME;
+ }
+
+ protected String getHost()
+ {
+ if (host == null)
+ {
+ host = getProperties().getStringValue(getHostPropertyName(), "localhost", false);
+ }
+ return host;
+ }
+
+ protected String getPortPropertyName()
+ {
+ return PORT_PROPERTY_NAME;
+ }
+
+ protected String getPort()
+ {
+ if (port == null)
+ {
+ port = getProperties().getStringValue(getPortPropertyName(), "8080", false);
+ }
+ return port;
+ }
+
+ protected String getShutdownDelayPropertyName()
+ {
+ return SHUTDOWN_DELAY_PROPERTY_NAME;
+ }
+
+ protected Integer getShutdownDelay()
+ {
+ if (shutdownDelay == null)
+ {
+ this.shutdownDelay = getProperties().getIntValue(SHUTDOWN_DELAY_PROPERTY_NAME, 15000, false);
+ }
+ return shutdownDelay;
+ }
+
+ protected PropertiesManager getProperties()
+ {
+ return properties;
+ }
+
+ protected String getJavaOpts()
+ {
+ if (javaOpts == null)
+ {
+ javaOpts = getProperties().getStringValue(JAVA_OPTS_PROPERTY_NAME, "", false);
+ javaOpts = javaOpts + JAVA_OPTS;
+ }
+ return javaOpts;
+ }
+
+ protected String getHttpUrl()
+ {
+ if (httpUrl == null)
+ {
+ this.httpUrl = "http://" + getHost() + ":" + getPort() + "/";
+ }
+ return httpUrl;
+ }
+
+ protected String getExtraConfigurationDirPropertyName()
+ {
+ return EXTRA_CONFIGURATION_DIR_PROPERTY_NAME;
+ }
+
+ protected abstract String getLogName();
+
+ protected String getExtraConfigurationDir()
+ {
+ if (extraConfigurationDir == null)
+ {
+ this.extraConfigurationDir = getProperties().getStringValue(EXTRA_CONFIGURATION_DIR_PROPERTY_NAME, null, false);
+ }
+ return extraConfigurationDir;
+ }
+
+}
\ No newline at end of file
Property changes on: test-harness/trunk/api/src/main/java/org/jboss/testharness/spi/helpers/AbstractContainerConnector.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
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-04-07 21:24:58 UTC (rev 2335)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/ConfigurationImpl.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -7,7 +7,7 @@
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.properties.PropertiesManager;
import org.jboss.testharness.spi.Containers;
import org.jboss.testharness.spi.StandaloneContainers;
@@ -18,7 +18,7 @@
static
{
- DeploymentProperties properties = new DeploymentProperties();
+ PropertiesManager properties = new PropertiesManager();
ConfigurationBuilder builder = properties.getInstanceValue(ConfigurationBuilder.PROPERTY_NAME, ConfigurationBuilder.class, false);
if (builder == null)
{
Modified: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/PropertiesBasedConfigurationBuilder.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/PropertiesBasedConfigurationBuilder.java 2009-04-07 21:24:58 UTC (rev 2335)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/PropertiesBasedConfigurationBuilder.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -19,28 +19,28 @@
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.properties.PropertiesManager;
import org.jboss.testharness.spi.Containers;
import org.jboss.testharness.spi.StandaloneContainers;
public class PropertiesBasedConfigurationBuilder<T extends Configuration> implements ConfigurationBuilder
{
- private final DeploymentProperties deploymentProperties;
+ private final PropertiesManager propertiesManager;
private final T configuration;
public PropertiesBasedConfigurationBuilder(T configuration)
{
- this.deploymentProperties = new DeploymentProperties();
+ this.propertiesManager = new PropertiesManager();
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));
+ configuration.setOutputDirectory(propertiesManager.getStringValue(OUTPUT_DIRECTORY_PROPERTY_NAME, DEFAULT_OUTPUT_DIRECTORY, false));
+ configuration.setStandalone(propertiesManager.getBooleanValue(STANDALONE_PROPERTY_NAME, DEFAULT_STANDALONE, false));
+ configuration.setRunIntegrationTests(propertiesManager.getBooleanValue(RUN_INTEGRATION_TESTS_PROPERTY_NAME, DEFAULT_RUN_INTEGRATION_TESTS, false));
+ configuration.setConnectTimeout(propertiesManager.getIntValue(CONNECT_TIMEOUT_PROPERTY_NAME, DEFAULT_CONNECT_DELAY, false));
+ configuration.setLibraryDirectory(propertiesManager.getStringValue(LIBRARY_DIRECTORY_PROPERTY_NAME, DEFAULT_LIBRARY_DIRECTORY, false));
+ configuration.setHost(propertiesManager.getStringValue(HOST_PROPERTY_NAME, DEFAULT_HOST, false));
+ configuration.setTestPackage(propertiesManager.getStringValue(TEST_PACKAGE_PROPERTY_NAME, null, false));
}
/* (non-Javadoc)
@@ -59,7 +59,7 @@
protected <T> T getInstanceValue(String propertyName, Class<T> expectedType, boolean required)
{
- T instance = deploymentProperties.getInstanceValue(propertyName, expectedType, required);
+ T instance = propertiesManager.getInstanceValue(propertyName, expectedType, required);
if (instance instanceof Configurable)
{
((Configurable) instance).setConfiguration(configuration);
@@ -75,9 +75,9 @@
return configuration;
}
- protected DeploymentProperties getDeploymentProperties()
+ protected PropertiesManager getDeploymentProperties()
{
- return deploymentProperties;
+ return propertiesManager;
}
}
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-04-07 21:24:58 UTC (rev 2335)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/packaging/jsr299/TCKArtifactDescriptor.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -12,7 +12,7 @@
import org.jboss.testharness.impl.ConfigurationImpl;
import org.jboss.testharness.impl.packaging.ArtifactDescriptor;
import org.jboss.testharness.impl.packaging.ResourceDescriptorImpl;
-import org.jboss.testharness.impl.util.DeploymentProperties;
+import org.jboss.testharness.properties.PropertiesManager;
public class TCKArtifactDescriptor extends ArtifactDescriptor
{
@@ -41,7 +41,7 @@
try
{
deploymentProperties = getDeploymentProperties(getDeclaringClass());
- getResources().add(new ResourceDescriptorImpl(getClassesRoot() + DeploymentProperties.RESOURCE_BUNDLE, deploymentProperties));
+ getResources().add(new ResourceDescriptorImpl(getClassesRoot() + PropertiesManager.RESOURCE_BUNDLE, deploymentProperties));
}
catch (IOException e)
{
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-04-07 21:24:58 UTC (rev 2335)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/runner/TestRunner.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -6,7 +6,7 @@
import java.util.Set;
import org.jboss.testharness.impl.testng.RemoveExpectedExceptionsAnnotationTransformer;
-import org.jboss.testharness.impl.util.DeploymentProperties;
+import org.jboss.testharness.properties.PropertiesManager;
import org.testng.ITestContext;
import org.testng.ITestResult;
import org.testng.TestNG;
@@ -44,8 +44,8 @@
{
if (classNames.size() == 0)
{
- DeploymentProperties deploymentProperties = new DeploymentProperties();
- this.classNames = deploymentProperties.getPropertyValues("className");
+ PropertiesManager propertiesManager = new PropertiesManager();
+ this.classNames = propertiesManager.getPropertyValues("className");
}
TestNG testNG = new TestNG(false);
testNG.setVerbose(0);
Deleted: 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-04-07 21:24:58 UTC (rev 2335)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/DeploymentProperties.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -1,238 +0,0 @@
-package org.jboss.testharness.impl.util;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.HashSet;
-import java.util.Properties;
-import java.util.Set;
-
-import org.apache.log4j.Logger;
-
-/**
- * Utility class to load deployment properties
- *
- * @author Pete Muir
- */
-public class DeploymentProperties
-{
- // The resource bundle used to control Web Beans RI deployment
- public static final String RESOURCE_BUNDLE = "META-INF/web-beans-tck.properties";
-
- private static final Logger log = Logger.getLogger(DeploymentProperties.class);
-
- // The class to work from
- private SimpleResourceLoader resourceLoader;
-
- /**
- * Constructor
- *
- * @param classLoader The classloader to work on
- */
- public DeploymentProperties()
- {
- this.resourceLoader = new SimpleResourceLoader();
- }
-
- /**
- * Get a list of possible values for a given key.
- *
- * First, System properties are tried, followed by the specified resource
- * bundle (first in classpath only).
- *
- * @param key The key to search for
- * @return A list of possible values. An empty list is returned if there are
- * no matches.
- */
- public Set<String> getPropertyValues(String key)
- {
- Set<String> values = new HashSet<String>();
- addPropertiesFromSystem(key, values);
- addPropertiesFromResourceBundle(key, values);
- return values;
- }
-
- /**
- * Adds matches from system properties
- *
- * @param key The key to match
- * @param values The currently found values
- */
- private void addPropertiesFromSystem(String key, Set<String> values)
- {
- addProperty(key, System.getProperty(key), values);
- }
-
- /**
- * Adds matches from detected resource bundles
- *
- * @param key The key to match
- * @param values The currently found values
- */
- private void addPropertiesFromResourceBundle(String key, Set<String> values)
- {
- try
- {
- for (URL url : resourceLoader.getResources(RESOURCE_BUNDLE))
- {
- Properties properties = new Properties();
- InputStream propertyStream = url.openStream();
- try
- {
- properties.load(propertyStream);
- addProperty(key, properties.getProperty(key), values);
- }
- finally
- {
- if (propertyStream != null)
- {
- propertyStream.close();
- }
- }
- }
- }
- catch (IOException e)
- {
- // No - op, file is optional
- }
- }
-
- /**
- * Add the property to the set of properties only if it hasn't already been
- * added
- *
- * @param key The key searched for
- * @param value The value of the property
- * @param values The currently found values
- */
- private void addProperty(String key, String value, Set<String> values)
- {
- if (value != null)
- {
- String[] properties = Strings.split(value, ":");
- for (String property : properties)
- {
- values.add(property);
- }
-
- }
- }
-
- /**
- * Gets the possible implementation class for a given property for which the
- * values are classanames
- *
- * @param deploymentProperties The deployment properties object to use
- * @param resourceLoader The resource laoder to use to attempt
- * @param propertyName The name of the property to load
- * @return A set of classes specified
- */
- @SuppressWarnings("unchecked")
- public <T> Set<Class<T>> getClasses(String propertyName, Class<T> expectedType)
- {
- Set<Class<T>> classes = new HashSet<Class<T>>();
- for (String className : getPropertyValues(propertyName))
- {
- try
- {
- classes.add((Class<T>) resourceLoader.classForName(className));
- }
- catch (ResourceLoadingException e)
- {
- //log.debug("Unable to load class " + className + " for property " + propertyName, e);
- }
- }
- return classes;
- }
-
- public <T> Class<? extends T> getClassValue(String propertyName, Class<T> expectedType, Class<? extends T> defaultType, boolean required)
- {
- Set<Class<? extends T>> classes = new HashSet<Class<? extends T>>();
- classes.addAll(getClasses(propertyName, expectedType));
- if (classes.size() == 0)
- {
- if (defaultType != null)
- {
- classes.add(defaultType);
- }
- else if (required)
- {
- throw new IllegalArgumentException("Cannot find any implementations of " + expectedType.getSimpleName() + ", check that " + propertyName + " is specified");
- }
- else
- {
- return null;
- }
- }
- else if (classes.size() > 1)
- {
- throw new IllegalArgumentException("More than one implementation of " + expectedType.getSimpleName() + " specified by " + propertyName + ", not sure which one to use!" + classes);
- }
- return classes.iterator().next();
- }
-
- public <T> T getInstanceValue(String propertyName, Class<T> expectedType, boolean required)
- {
- return getInstanceValue(propertyName, expectedType, null, required);
- }
-
-
- public <T> T getInstanceValue(String propertyName, Class<T> expectedType, Class<? extends T> defaultType, boolean required)
- {
- Class<? extends T> clazz = getClassValue(propertyName, expectedType, defaultType, required);
- if (clazz != null)
- {
- try
- {
- return clazz.newInstance();
- }
- catch (InstantiationException e)
- {
- throw new IllegalStateException("Error instantiating " + clazz + " specified by " + propertyName, e);
- }
- catch (IllegalAccessException e)
- {
- throw new IllegalStateException("Error instantiating " + clazz + " specified by " + propertyName, e);
- }
- }
- else
- {
- return null;
- }
- }
-
- public boolean getBooleanValue(String propertyName, boolean _default, boolean required)
- {
- return Boolean.valueOf(getStringValue(propertyName, _default ? "true" : "false", required));
- }
-
- public int getIntValue(String propertyName, int _default, boolean required)
- {
- return Integer.valueOf(getStringValue(propertyName, Integer.toString(_default), required)).intValue();
- }
-
- public String getStringValue(String propertyName, String _default, boolean required)
- {
- Set<String> values = getPropertyValues(propertyName);
- if (values.size() == 0)
- {
- if (required)
- {
- throw new IllegalArgumentException("Cannot find required property " + propertyName + ", check that it is specified ");
- }
- else
- {
- return _default;
- }
- }
- else if (values.size() > 1)
- {
- throw new IllegalArgumentException("More than one value given for " + propertyName + ", not sure which one to use! " + values);
- }
- else
- {
- return values.iterator().next();
- }
- }
-
-}
\ No newline at end of file
Deleted: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/EnumerationIterable.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/EnumerationIterable.java 2009-04-07 21:24:58 UTC (rev 2335)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/EnumerationIterable.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -1,37 +0,0 @@
-package org.jboss.testharness.impl.util;
-
-import java.util.Enumeration;
-import java.util.Iterator;
-
-/**
- * An Enumeration -> Iteratble adaptor
- *
- * @author Pete Muir
- * @see org.jboss.webbeans.util.EnumerationIterator
- */
-class EnumerationIterable<T> implements Iterable<T>
-{
- // The enumeration-iteartor
- private EnumerationIterator<T> iterator;
-
- /**
- * Constructor
- *
- * @param enumeration The enumeration
- */
- public EnumerationIterable(Enumeration<T> enumeration)
- {
- this.iterator = new EnumerationIterator<T>(enumeration);
- }
-
- /**
- * Gets an iterator
- *
- * @return The iterator
- */
- public Iterator<T> iterator()
- {
- return iterator;
- }
-
-}
\ No newline at end of file
Deleted: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/EnumerationIterator.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/EnumerationIterator.java 2009-04-07 21:24:58 UTC (rev 2335)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/EnumerationIterator.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -1,55 +0,0 @@
-package org.jboss.testharness.impl.util;
-
-import java.util.Enumeration;
-import java.util.Iterator;
-
-/**
- * An enumeration -> iterator adapter
- *
- * @author Pete Muir
- */
-@SuppressWarnings("unchecked")
-class EnumerationIterator<T> implements Iterator<T>
-{
- // The enumeration
- private Enumeration e;
-
- /**
- * Constructor
- *
- * @param e The enumeration
- */
- public EnumerationIterator(Enumeration e)
- {
- this.e = e;
- }
-
- /**
- * Indicates if there are more items to iterate
- *
- * @return True if more, false otherwise
- */
- public boolean hasNext()
- {
- return e.hasMoreElements();
- }
-
- /**
- * Gets the next item
- *
- * @return The next items
- */
- public T next()
- {
- return (T) e.nextElement();
- }
-
- /**
- * Removes an item. Not supported
- */
- public void remove()
- {
- throw new UnsupportedOperationException();
- }
-
-}
\ No newline at end of file
Deleted: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/ResourceLoadingException.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/ResourceLoadingException.java 2009-04-07 21:24:58 UTC (rev 2335)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/ResourceLoadingException.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -1,53 +0,0 @@
-package org.jboss.testharness.impl.util;
-
-
-/**
- * Exception thrown when errors occur while loading resource
- *
- * @author Pete Muir
- *
- */
-class ResourceLoadingException extends RuntimeException
-{
- private static final long serialVersionUID = 1L;
-
- /**
- * Constructor
- */
- public ResourceLoadingException()
- {
- super();
- }
-
- /**
- * Constructor
- *
- * @param message The message
- * @param throwable The exception
- */
- public ResourceLoadingException(String message, Throwable throwable)
- {
- super(message, throwable);
- }
-
- /**
- * Constructor
- *
- * @param message The message
- */
- public ResourceLoadingException(String message)
- {
- super(message);
- }
-
- /**
- * Constructor
- *
- * @param throwable The exception
- */
- public ResourceLoadingException(Throwable throwable)
- {
- super(throwable);
- }
-
-}
\ No newline at end of file
Deleted: test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/SimpleResourceLoader.java
===================================================================
--- test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/SimpleResourceLoader.java 2009-04-07 21:24:58 UTC (rev 2335)
+++ test-harness/trunk/impl/src/main/java/org/jboss/testharness/impl/util/SimpleResourceLoader.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -1,43 +0,0 @@
-package org.jboss.testharness.impl.util;
-
-import java.io.IOException;
-import java.net.URL;
-
-class SimpleResourceLoader
-{
-
- public Class<?> classForName(String name)
- {
-
- try
- {
- return Class.forName(name);
- }
- catch (ClassNotFoundException e)
- {
- throw new ResourceLoadingException(e);
- }
- catch (NoClassDefFoundError e)
- {
- throw new ResourceLoadingException(e);
- }
- }
-
- public URL getResource(String name)
- {
- return getClass().getResource(name);
- }
-
- public Iterable<URL> getResources(String name)
- {
- try
- {
- return new EnumerationIterable<URL>(getClass().getClassLoader().getResources(name));
- }
- catch (IOException e)
- {
- throw new ResourceLoadingException(e);
- }
- }
-
-}
\ No newline at end of file
Property changes on: test-harness/trunk/jboss
___________________________________________________________________
Name: svn:ignore
-
.classpath
target
.project
.settings
+
.classpath
target
.project
.settings
bin
Modified: test-harness/trunk/jboss/pom.xml
===================================================================
--- test-harness/trunk/jboss/pom.xml 2009-04-07 21:24:58 UTC (rev 2335)
+++ test-harness/trunk/jboss/pom.xml 2009-04-07 23:36:11 UTC (rev 2336)
@@ -7,9 +7,9 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.test-harness</groupId>
- <artifactId>jboss-test-harness-jboss-as-5</artifactId>
- <name>JBoss Test Harness deployment for JBoss AS 5</name>
- <description>Implements the JBoss Test Harness deployment SPI for JBoss AS 5</description>
+ <artifactId>jboss-test-harness-jboss-as-50</artifactId>
+ <name>JBoss Test Harness deployment for JBoss AS 5.0.x</name>
+ <description>Implements the JBoss Test Harness deployment SPI for JBoss AS 5.0.x</description>
<dependencies>
@@ -18,30 +18,6 @@
<artifactId>jboss-test-harness-api</artifactId>
</dependency>
- <!-- <dependency>-->
- <!-- <groupId>org.jboss.naming</groupId>-->
- <!-- <artifactId>jnp-client</artifactId>-->
- <!-- <scope>runtime</scope>-->
- <!-- </dependency>-->
- <!-- -->
- <!-- <dependency>-->
- <!-- <groupId>org.jboss.aspects</groupId>-->
- <!-- <artifactId>jboss-security-aspects</artifactId>-->
- <!-- <scope>runtime</scope>-->
- <!-- </dependency>-->
- <!-- -->
- <!-- <dependency>-->
- <!-- <groupId>org.jboss.aspects</groupId>-->
- <!-- <artifactId>jboss-remoting-aspects</artifactId>-->
- <!-- <scope>runtime</scope>-->
- <!-- </dependency>-->
- <!-- -->
- <!-- <dependency>-->
- <!-- <groupId>oswego-concurrent</groupId>-->
- <!-- <artifactId>concurrent</artifactId>-->
- <!-- <scope>runtime</scope>-->
- <!-- </dependency>-->
-<!---->
<dependency>
<groupId>org.jboss.integration</groupId>
<artifactId>jboss-profileservice-spi</artifactId>
Modified: test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/JBossASConnector.java
===================================================================
--- test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/JBossASConnector.java 2009-04-07 21:24:58 UTC (rev 2335)
+++ test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/JBossASConnector.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -1,21 +1,11 @@
package org.jboss.testharness.integration.jbossas;
-import java.io.DataOutputStream;
+
import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLConnection;
-import org.apache.log4j.Logger;
-import org.jboss.testharness.api.Configurable;
-import org.jboss.testharness.api.Configuration;
-import org.jboss.testharness.integration.jbossas.util.DeploymentProperties;
import org.jboss.testharness.spi.Containers;
+import org.jboss.testharness.spi.helpers.AbstractContainerConnector;
/**
*
@@ -23,265 +13,48 @@
* @author Pete Muir
*
*/
-public abstract class JBossASConnector implements Configurable, Containers
+public abstract class JBossASConnector extends AbstractContainerConnector implements Containers
{
+
+ private static final String SERVER_HOME_PROPERTY_NAME = "jboss.home";
+
+ private String jbossBinDirectory;
- public static String JAVA_OPTS = " -ea";
-
- public static final String JBOSS_HOME_PROPERTY_NAME = "jboss.home";
- public static final String JAVA_OPTS_PROPERTY_NAME = "java.opts";
- public static final String JBOSS_AS_DIR_PROPERTY_NAME = "jboss-as.dir";
- public static final String JBOSS_BOOT_TIMEOUT_PROPERTY_NAME = "jboss.boot.timeout";
- public static final String FORCE_RESTART_PROPERTY_NAME = "jboss.force.restart";
- public static final String MAX_DEPLOYMENTS_PROPERTY_NAME = "jboss.deployments.restart";
- public static final String SHUTDOWN_DELAY_PROPERTY_NAME = "jboss.shutdown.delay";
- public static final String JBOSS_BIND_ADDRESS_PROPERTY_NAME = "jboss.bind.address";
-
- private static Logger log = Logger.getLogger(JBossASConnector.class);
-
- private final DeploymentProperties properties;
-
- private Configuration configuration;
- protected String jbossHome;
- private String jbossHttpUrl;
- private boolean jbossWasStarted;
- private long bootTimeout;
- private String javaOpts;
-
- private boolean forceRestart;
-
- protected int maxDeployments;
-
- private int jbossShutdownDelay;
-
- private String jbossBindAddress;
-
- public JBossASConnector()
+ public JBossASConnector() throws IOException
{
- this.properties = new DeploymentProperties();
+
}
- protected static void copy(InputStream inputStream, File file) throws IOException
+ @Override
+ protected String getServerHomePropertyName()
{
- OutputStream os = new FileOutputStream(file);
- try
- {
- byte[] buf = new byte[1024];
- int i = 0;
- while ((i = inputStream.read(buf)) != -1)
- {
- os.write(buf, 0, i);
- }
- }
- finally
- {
- os.close();
- }
+ return SERVER_HOME_PROPERTY_NAME;
}
-
- public void setConfiguration(Configuration configuration)
+
+ protected void shutdownServer() throws IOException
{
- this.configuration = configuration;
+ launch(getJBossBinDirectory(), "shutdown", "-S");
}
-
- protected boolean isJBossUp()
+
+ @Override
+ protected void startServer() throws IOException
{
- // Check that JBoss is up!
- try
- {
- URLConnection connection = new URL(jbossHttpUrl).openConnection();
- if (!(connection instanceof HttpURLConnection))
- {
- throw new IllegalStateException("Not an http connection! " + connection);
- }
- HttpURLConnection httpConnection = (HttpURLConnection) connection;
- httpConnection.connect();
- if (httpConnection.getResponseCode() != HttpURLConnection.HTTP_OK)
- {
- return false;
- }
- }
- catch (Exception e)
- {
- return false;
- }
- log.info("Connected to JBoss instance over http");
- return true;
+ launch(getJBossBinDirectory(), "run", "--host=" + getHost());
}
-
- public void setup() throws IOException
+
+ protected String getJBossBinDirectory()
{
- String jbossAsPath = properties.getStringValue(JBOSS_AS_DIR_PROPERTY_NAME, "../jboss-as", false);
- if (jbossAsPath != null)
+ if (jbossBinDirectory == null)
{
- File jbossAsDir = new File(jbossAsPath);
- if (jbossAsDir.isDirectory())
- {
- File buildProperties = new File(jbossAsDir, "build.properties");
- if (buildProperties.exists())
- {
- loadProperties(buildProperties);
- }
- File localBuildProperties = new File(jbossAsDir, "local.build.properties");
- if (localBuildProperties.exists())
- {
- loadProperties(localBuildProperties);
- }
- }
+ jbossBinDirectory = new File(getServerDirectory() + "/bin").getPath();
}
- jbossHome = properties.getStringValue(JBOSS_HOME_PROPERTY_NAME, null, true);
- jbossBindAddress = properties.getStringValue(JBOSS_BIND_ADDRESS_PROPERTY_NAME, "localhost", false);
- configuration.setHost(jbossBindAddress + ":8080");
- this.jbossHttpUrl = "http://" + configuration.getHost() + "/";
- javaOpts = properties.getStringValue(JAVA_OPTS_PROPERTY_NAME, "", false);
- javaOpts = javaOpts + JAVA_OPTS;
- File jbossHomeFile = new File(jbossHome);
- jbossHome = jbossHomeFile.getPath();
- log.info("Using JBoss instance " + jbossHome + " (" + jbossHttpUrl + ")");
- this.bootTimeout = properties.getLongValue(JBOSS_BOOT_TIMEOUT_PROPERTY_NAME, 240000, false);
- this.forceRestart = properties.getBooleanValue(FORCE_RESTART_PROPERTY_NAME, false, false);
- this.maxDeployments = properties.getIntValue(MAX_DEPLOYMENTS_PROPERTY_NAME, 25, false);
- this.jbossShutdownDelay = properties.getIntValue(SHUTDOWN_DELAY_PROPERTY_NAME, 15000, false);
- restartJboss();
+ return jbossBinDirectory;
}
- protected void restartJboss() throws IOException
+ @Override
+ protected String getLogName()
{
- if (forceRestart)
- {
- if (isJBossUp())
- {
- log.info("Shutting down JBoss instance as in force-restart mode");
- shutDownJBoss();
- try
- {
- Thread.sleep(jbossShutdownDelay);
- }
- catch (InterruptedException e)
- {
- Thread.currentThread().interrupt();
- }
- }
- }
- if (!isJBossUp())
- {
- jbossWasStarted = true;
- launch("run", "--host=" + jbossBindAddress);
- log.info("Starting JBoss instance");
- // Wait for JBoss to come up
- long timeoutTime = System.currentTimeMillis() + bootTimeout;
- boolean interrupted = false;
- while (timeoutTime > System.currentTimeMillis())
- {
- if (isJBossUp())
- {
- log.info("Started JBoss instance");
- return;
- }
- try
- {
- Thread.sleep(200);
- }
- catch (InterruptedException e)
- {
- interrupted = true;
- }
- }
- if (interrupted)
- {
- Thread.currentThread().interrupt();
- }
- // If we got this far something went wrong
- log.warn("Unable to connect to JBoss instance after " + bootTimeout + "ms, giving up!");
- launch("shutdown", "-S");
- throw new IllegalStateException("Error connecting to JBoss instance");
- }
+ return "jboss.log";
}
- protected void loadProperties(File file) throws IOException
- {
- InputStream is = new FileInputStream(file);
- try
- {
- System.getProperties().load(is);
- }
- finally
- {
- is.close();
- }
- }
-
- public String getJbossHome()
- {
- return jbossHome;
- }
-
- public void cleanup() throws IOException
- {
- if (jbossWasStarted)
- {
- log.info("Shutting down JBoss instance");
- shutDownJBoss();
- }
- }
-
- private void shutDownJBoss() throws IOException
- {
- launch("shutdown", "-S");
- }
-
- private void launch(String scriptFileName, String params) throws IOException
- {
- String osName = System.getProperty("os.name");
- Runtime runtime = Runtime.getRuntime();
-
- Process p = null;
- if (osName.startsWith("Windows"))
- {
- String command[] = {
- "cmd.exe",
- "/C",
- "set JAVA_OPTS=" + javaOpts + " & cd /D " + jbossHome + "\\bin & " + scriptFileName + ".bat " + params
- };
- p = runtime.exec(command);
- }
- else
- {
- String command[] = {
- "sh",
- "-c",
- "cd " + jbossHome + "/bin;JAVA_OPTS=\"" + javaOpts + "\" ./" + scriptFileName + ".sh " + params
- };
- p = runtime.exec(command);
- }
- dump(p.getErrorStream());
- dump(p.getInputStream());
- }
-
- protected void dump(final InputStream is)
- {
- new Thread(new Runnable()
- {
- public void run()
- {
- try
- {
- DataOutputStream out = new DataOutputStream(new FileOutputStream(configuration.getOutputDirectory() + File.separator + "jboss.log"));
- int c;
- while((c = is.read()) != -1)
- {
- out.writeByte(c);
- }
- is.close();
- out.close();
- }
- catch(IOException e)
- {
- System.err.println("Error Writing/Reading Streams.");
- }
- }
- }).start();
- }
-
-
}
\ No newline at end of file
Copied: test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/ProfileServiceConnector.java (from rev 2333, test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/ProfileServiceContainersImpl.java)
===================================================================
--- test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/ProfileServiceConnector.java (rev 0)
+++ test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/ProfileServiceConnector.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -0,0 +1,236 @@
+package org.jboss.testharness.integration.jbossas;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map.Entry;
+
+import javax.naming.InitialContext;
+
+import org.apache.log4j.Logger;
+import org.jboss.deployers.client.spi.IncompleteDeploymentException;
+import org.jboss.deployers.spi.management.deploy.DeploymentManager;
+import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
+import org.jboss.deployers.spi.management.deploy.DeploymentStatus;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.testharness.api.DeploymentException;
+import org.jboss.virtual.VFS;
+
+public class ProfileServiceConnector extends JBossASConnector
+{
+
+ private Logger log = Logger.getLogger(ProfileServiceConnector.class);
+
+ public static final String MAX_DEPLOYMENTS_PROPERTY_NAME = "max.deployments.restart";
+
+ private final List<String> failedUndeployments;
+
+ private DeploymentManager deploymentManager;
+ private final File tmpdir;
+ private int deploymentCounter = 0;
+ private Integer maxDeployments;
+
+
+ public ProfileServiceConnector() throws Exception
+ {
+ tmpdir = new File(System.getProperty("java.io.tmpdir"), "org.jboss.webbeans.tck.integration.jbossas");
+ tmpdir.mkdir();
+ tmpdir.deleteOnExit();
+ this.failedUndeployments = new ArrayList<String>();
+ }
+
+
+ @Override
+ public void setup() throws IOException
+ {
+ super.setup();
+ try
+ {
+ initDeploymentManager();
+ }
+ catch (Exception e)
+ {
+ IOException ioe = new IOException();
+ ioe.initCause(e);
+ throw ioe;
+ }
+ }
+
+ public void deploy(InputStream archiveStream, String name) throws DeploymentException, IOException
+ {
+ if (deploymentManager == null)
+ {
+ throw new IllegalStateException("setup() has not been called!");
+ }
+ Exception failure = null;
+ try
+ {
+ File archive = new File(tmpdir, name);
+ archive.deleteOnExit();
+ copy(archiveStream, archive);
+ DeploymentProgress distribute = deploymentManager.distribute(name, DeploymentPhase.APPLICATION, archive.toURI().toURL(), true);
+ distribute.run();
+ DeploymentProgress progress = deploymentManager.start(DeploymentPhase.APPLICATION, name);
+ progress.run();
+ DeploymentStatus status = progress.getDeploymentStatus();
+ if (status.isFailed())
+ {
+ failure = status.getFailure();
+ doUndeploy(name);
+ }
+ }
+ catch (Exception e)
+ {
+ IOException ioe = new IOException();
+ ioe.initCause(e);
+ throw ioe;
+ }
+ if (failure != null)
+ {
+ if (failure.getCause() instanceof IncompleteDeploymentException)
+ {
+ IncompleteDeploymentException incompleteDeploymentException = (IncompleteDeploymentException) failure.getCause();
+ for (Entry<String, Throwable> entry : incompleteDeploymentException.getIncompleteDeployments().getContextsInError().entrySet())
+ {
+ if (entry.getKey().endsWith(name + "/_WebBeansBootstrapBean"))
+ {
+ throw new DeploymentException(entry.getValue());
+ }
+ }
+ }
+ throw new DeploymentException(failure);
+ }
+ }
+
+ private void doUndeploy(String name) throws IOException
+ {
+ try
+ {
+ DeploymentProgress stopProgress = deploymentManager.stop(DeploymentPhase.APPLICATION, name);
+ stopProgress.run();
+
+ DeploymentProgress undeployProgress = deploymentManager.undeploy(DeploymentPhase.APPLICATION, name);
+ undeployProgress.run();
+ if (undeployProgress.getDeploymentStatus().isFailed())
+ {
+ failedUndeployments.add(name);
+ }
+ else
+ {
+ deploymentCounter++;
+ }
+ }
+ catch (Exception e)
+ {
+ IOException ioe = new IOException();
+ ioe.initCause(e);
+ throw ioe;
+ }
+ }
+
+ public void undeploy(String name) throws IOException
+ {
+ try
+ {
+ doUndeploy(name);
+ }
+ finally
+ {
+ if (deploymentCounter >= getMaxDeployments())
+ {
+ deploymentCounter = 0;
+ // Let everything stablise
+ removeFailedUnDeployments();
+ try
+ {
+ Thread.sleep(5000);
+ }
+ catch (InterruptedException e)
+ {
+ Thread.currentThread().interrupt();
+ }
+ restartServer();
+ try
+ {
+ initDeploymentManager();
+ }
+ catch (Exception e)
+ {
+ IOException ioe = new IOException();
+ ioe.initCause(e);
+ throw ioe;
+ }
+ }
+ }
+ }
+
+ /**
+ * Obtain the Deployment Manager
+ * @throws Exception
+ */
+ protected void initDeploymentManager() throws Exception
+ {
+ String profileName = "default";
+ InitialContext ctx = new InitialContext();
+ ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
+ deploymentManager = ps.getDeploymentManager();
+ ProfileKey defaultKey = new ProfileKey(profileName);
+ deploymentManager.loadProfile(defaultKey, false);
+ // Init the VFS to setup the vfs* protocol handlers
+ VFS.init();
+ }
+
+ @Override
+ public void cleanup() throws IOException
+ {
+ removeFailedUnDeployments();
+ super.cleanup();
+ }
+
+ private void removeFailedUnDeployments() throws IOException
+ {
+ List<String> remainingDeployments = new ArrayList<String>();
+ for (String name : failedUndeployments)
+ {
+ try
+ {
+ DeploymentProgress undeployProgress = deploymentManager.undeploy(DeploymentPhase.APPLICATION, name);
+ undeployProgress.run();
+ if (undeployProgress.getDeploymentStatus().isFailed())
+ {
+ remainingDeployments.add(name);
+ }
+ }
+ catch (Exception e)
+ {
+ IOException ioe = new IOException();
+ ioe.initCause(e);
+ throw ioe;
+ }
+ }
+ if (remainingDeployments.size() > 0)
+ {
+ //log.error("Failed to undeploy these artifacts: " + remainingDeployments);
+ }
+ failedUndeployments.clear();
+ }
+
+ protected String getMaxDeploymentsPropertyName()
+ {
+ return MAX_DEPLOYMENTS_PROPERTY_NAME;
+ }
+
+ protected Integer getMaxDeployments()
+ {
+ if (maxDeployments == null)
+ {
+ this.maxDeployments = getProperties().getIntValue(getMaxDeploymentsPropertyName(), 25, false);
+ }
+ return maxDeployments;
+ }
+
+}
Deleted: test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/ProfileServiceContainersImpl.java
===================================================================
--- test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/ProfileServiceContainersImpl.java 2009-04-07 21:24:58 UTC (rev 2335)
+++ test-harness/trunk/jboss/src/main/java/org/jboss/testharness/integration/jbossas/ProfileServiceContainersImpl.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -1,219 +0,0 @@
-package org.jboss.testharness.integration.jbossas;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map.Entry;
-
-import javax.naming.InitialContext;
-
-import org.apache.log4j.Logger;
-import org.jboss.deployers.client.spi.IncompleteDeploymentException;
-import org.jboss.deployers.spi.management.deploy.DeploymentManager;
-import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
-import org.jboss.deployers.spi.management.deploy.DeploymentStatus;
-import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
-import org.jboss.profileservice.spi.ProfileKey;
-import org.jboss.profileservice.spi.ProfileService;
-import org.jboss.testharness.api.DeploymentException;
-import org.jboss.virtual.VFS;
-
-public class ProfileServiceContainersImpl extends JBossASConnector
-{
-
- private Logger log = Logger.getLogger(ProfileServiceContainersImpl.class);
-
- private final List<String> failedUndeployments;
-
- private DeploymentManager deploymentManager;
- private final File tmpdir;
- private int deploymentCounter = 0;
-
-
- public ProfileServiceContainersImpl() throws Exception
- {
- tmpdir = new File(System.getProperty("java.io.tmpdir"), "org.jboss.webbeans.tck.integration.jbossas");
- tmpdir.mkdir();
- tmpdir.deleteOnExit();
- this.failedUndeployments = new ArrayList<String>();
- }
-
-
- @Override
- public void setup() throws IOException
- {
- super.setup();
- try
- {
- initDeploymentManager();
- }
- catch (Exception e)
- {
- IOException ioe = new IOException();
- ioe.initCause(e);
- throw ioe;
- }
- }
-
- public void deploy(InputStream archiveStream, String name) throws DeploymentException, IOException
- {
- if (deploymentManager == null)
- {
- throw new IllegalStateException("setup() has not been called!");
- }
- Exception failure = null;
- try
- {
- File archive = new File(tmpdir, name);
- archive.deleteOnExit();
- copy(archiveStream, archive);
- DeploymentProgress distribute = deploymentManager.distribute(name, DeploymentPhase.APPLICATION, archive.toURI().toURL(), true);
- distribute.run();
- DeploymentProgress progress = deploymentManager.start(DeploymentPhase.APPLICATION, name);
- progress.run();
- DeploymentStatus status = progress.getDeploymentStatus();
- if (status.isFailed())
- {
- failure = status.getFailure();
- doUndeploy(name);
- }
- }
- catch (Exception e)
- {
- IOException ioe = new IOException();
- ioe.initCause(e);
- throw ioe;
- }
- if (failure != null)
- {
- if (failure.getCause() instanceof IncompleteDeploymentException)
- {
- IncompleteDeploymentException incompleteDeploymentException = (IncompleteDeploymentException) failure.getCause();
- for (Entry<String, Throwable> entry : incompleteDeploymentException.getIncompleteDeployments().getContextsInError().entrySet())
- {
- if (entry.getKey().endsWith(name + "/_WebBeansBootstrapBean"))
- {
- throw new DeploymentException(entry.getValue());
- }
- }
- }
- throw new DeploymentException(failure);
- }
- }
-
- private void doUndeploy(String name) throws IOException
- {
- try
- {
- DeploymentProgress stopProgress = deploymentManager.stop(DeploymentPhase.APPLICATION, name);
- stopProgress.run();
-
- DeploymentProgress undeployProgress = deploymentManager.undeploy(DeploymentPhase.APPLICATION, name);
- undeployProgress.run();
- if (undeployProgress.getDeploymentStatus().isFailed())
- {
- failedUndeployments.add(name);
- }
- else
- {
- deploymentCounter++;
- }
- }
- catch (Exception e)
- {
- IOException ioe = new IOException();
- ioe.initCause(e);
- throw ioe;
- }
- }
-
- public void undeploy(String name) throws IOException
- {
- try
- {
- doUndeploy(name);
- }
- finally
- {
- if (deploymentCounter >= maxDeployments)
- {
- deploymentCounter = 0;
- // Let everything stablise
- removeFailedUnDeployments();
- try
- {
- Thread.sleep(5000);
- }
- catch (InterruptedException e)
- {
- Thread.currentThread().interrupt();
- }
- restartJboss();
- try
- {
- initDeploymentManager();
- }
- catch (Exception e)
- {
- IOException ioe = new IOException();
- ioe.initCause(e);
- throw ioe;
- }
- }
- }
- }
-
- /**
- * Obtain the Deployment Manager
- * @throws Exception
- */
- protected void initDeploymentManager() throws Exception
- {
- String profileName = "default";
- InitialContext ctx = new InitialContext();
- ProfileService ps = (ProfileService) ctx.lookup("ProfileService");
- deploymentManager = ps.getDeploymentManager();
- ProfileKey defaultKey = new ProfileKey(profileName);
- deploymentManager.loadProfile(defaultKey, false);
- // Init the VFS to setup the vfs* protocol handlers
- VFS.init();
- }
-
- @Override
- public void cleanup() throws IOException
- {
- removeFailedUnDeployments();
- super.cleanup();
- }
-
- private void removeFailedUnDeployments() throws IOException
- {
- List<String> remainingDeployments = new ArrayList<String>();
- for (String name : failedUndeployments)
- {
- try
- {
- DeploymentProgress undeployProgress = deploymentManager.undeploy(DeploymentPhase.APPLICATION, name);
- undeployProgress.run();
- if (undeployProgress.getDeploymentStatus().isFailed())
- {
- remainingDeployments.add(name);
- }
- }
- catch (Exception e)
- {
- IOException ioe = new IOException();
- ioe.initCause(e);
- throw ioe;
- }
- }
- if (remainingDeployments.size() > 0)
- {
- //log.error("Failed to undeploy these artifacts: " + remainingDeployments);
- }
- failedUndeployments.clear();
- }
-
-}
Copied: test-harness/trunk/jboss/src/main/resources/META-INF/jboss-test-harness.properties (from rev 2333, test-harness/trunk/jboss/src/main/resources/META-INF/web-beans-tck.properties)
===================================================================
--- test-harness/trunk/jboss/src/main/resources/META-INF/jboss-test-harness.properties (rev 0)
+++ test-harness/trunk/jboss/src/main/resources/META-INF/jboss-test-harness.properties 2009-04-07 23:36:11 UTC (rev 2336)
@@ -0,0 +1,3 @@
+org.jboss.testharness.spi.Containers=org.jboss.testharness.integration.jbossas.ProfileServiceConnector
+org.jboss.testharness.connectDelay=1500
+org.jboss.testharness.connectRetries=8
\ No newline at end of file
Deleted: test-harness/trunk/jboss/src/main/resources/META-INF/web-beans-tck.properties
===================================================================
--- test-harness/trunk/jboss/src/main/resources/META-INF/web-beans-tck.properties 2009-04-07 21:24:58 UTC (rev 2335)
+++ test-harness/trunk/jboss/src/main/resources/META-INF/web-beans-tck.properties 2009-04-07 23:36:11 UTC (rev 2336)
@@ -1,3 +0,0 @@
-org.jboss.testharness.spi.Containers=org.jboss.testharness.integration.jbossas.ProfileServiceContainersImpl
-org.jboss.testharness.connectDelay=1500
-org.jboss.testharness.connectRetries=8
\ No newline at end of file
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-04-07 21:24:58 UTC (rev 2335)
+++ test-harness/trunk/tests/src/test/java/org/jboss/testharness/test/impl/packaging/descriptors/ear/EarArtifactTest.java 2009-04-07 23:36:11 UTC (rev 2336)
@@ -71,7 +71,7 @@
File applicationXml = new File(metaInf, "application.xml");
assert applicationXml.length() > 0;
- File webBeansTckProperties = new File(metaInf, "web-beans-tck.properties");
+ File webBeansTckProperties = new File(metaInf, "jboss-test-harness.properties");
assert webBeansTckProperties.isFile();
assert webBeansTckProperties.length() > 0;
@@ -128,7 +128,7 @@
}
is.close();
assert fileNames.contains("META-INF/application.xml");
- assert fileNames.contains("META-INF/web-beans-tck.properties");
+ assert fileNames.contains("META-INF/jboss-test-harness.properties");
assert fileNames.contains("lib/jboss-test-harness.jar");
assert fileNames.contains(DummyTest.class.getName() + ".jar");
assert fileNames.contains(DummyTest.class.getName() + ".war");
Copied: test-harness/trunk/tests/src/test/resources/META-INF/jboss-test-harness.properties (from rev 2334, test-harness/trunk/tests/src/test/resources/META-INF/web-beans-tck.properties)
===================================================================
--- test-harness/trunk/tests/src/test/resources/META-INF/jboss-test-harness.properties (rev 0)
+++ test-harness/trunk/tests/src/test/resources/META-INF/jboss-test-harness.properties 2009-04-07 23:36:11 UTC (rev 2336)
@@ -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/jboss-test-harness.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: 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 2009-04-07 21:24:58 UTC (rev 2335)
+++ test-harness/trunk/tests/src/test/resources/META-INF/web-beans-tck.properties 2009-04-07 23:36:11 UTC (rev 2336)
@@ -1 +0,0 @@
-org.jboss.testharness.api.ConfigurationBuilder=org.jboss.testharness.test.impl.mock.MockConfigurationBuilder
\ No newline at end of file
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2335 - ri/trunk/jboss-tck-runner/src/test/resources and 7 other directories.
by webbeans-commits@lists.jboss.org
Author: dallen6
Date: 2009-04-07 17:24:58 -0400 (Tue, 07 Apr 2009)
New Revision: 2335
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Bakery.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Bread.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/BrownRecluse.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Lays.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/PotatoChip.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderEgg.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderProducerNotUsed.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Cod.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Salmon.java
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java
ri/trunk/jboss-tck-runner/src/test/resources/log4j.xml
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/standalone/RequestContextTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer8/AsynchronousBeforeCompletionObserverTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer9/AsynchronousConditionalObserverTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/EventTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/BeanWithStaticProducerMethod.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/ProducerMethodLifecycleTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderProducer.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Tarantula.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/FishPond.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java
Log:
More tests and fix for detection of some definition errors in the RI.
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2009-04-07 16:42:31 UTC (rev 2334)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/ObserverImpl.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -43,6 +43,7 @@
import org.jboss.webbeans.injection.MethodInjectionPoint;
import org.jboss.webbeans.introspector.AnnotatedMethod;
import org.jboss.webbeans.introspector.AnnotatedParameter;
+import org.jboss.webbeans.util.Names;
/**
* <p>
@@ -94,8 +95,6 @@
checkObserverMethod();
}
-
-
/**
* Performs validation of the observer method for compliance with the
* specifications.
@@ -144,6 +143,12 @@
{
throw new DefinitionException(this + " cannot be annotated with @Initializer");
}
+
+ // We cannot allow asynchronously invoked conditional observers either
+ if (this.asynchronous && this.conditional)
+ {
+ throw new DefinitionException(this + " cannot be annotated with both @Asynchronously and @IfExists");
+ }
}
public void notify(final T event)
@@ -222,7 +227,7 @@
{
StringBuilder builder = new StringBuilder();
builder.append("Observer Implementation: \n");
- builder.append(" Observer (Declaring) bean: " + observerBean);
+ builder.append(" Observer (Declaring) class: " + Names.typesToString(observerBean.getTypes()));
builder.append(" Observer method: " + observerMethod);
return builder.toString();
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java 2009-04-07 16:42:31 UTC (rev 2334)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/event/TransactionalObserverImpl.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -104,6 +104,10 @@
if (!observerMethod.getAnnotatedParameters(BeforeTransactionCompletion.class).isEmpty())
{
observationPhases.add(TransactionObservationPhase.BEFORE_COMPLETION);
+ if (!observerMethod.getAnnotatedParameters(Asynchronously.class).isEmpty())
+ {
+ throw new DefinitionException("@BeforeTransactionCompletion cannot be used with @Asynchronously on " + observerMethod);
+ }
}
if (!observerMethod.getAnnotatedParameters(AfterTransactionCompletion.class).isEmpty())
{
@@ -148,6 +152,7 @@
{
deferredEvent = new AsynchronousTransactionalEventNotification<T>(event, this);
}
+
Synchronization synchronization = null;
if (transactionObservationPhase.equals(TransactionObservationPhase.BEFORE_COMPLETION))
{
Modified: ri/trunk/jboss-tck-runner/src/test/resources/log4j.xml
===================================================================
--- ri/trunk/jboss-tck-runner/src/test/resources/log4j.xml 2009-04-07 16:42:31 UTC (rev 2334)
+++ ri/trunk/jboss-tck-runner/src/test/resources/log4j.xml 2009-04-07 21:24:58 UTC (rev 2335)
@@ -12,6 +12,10 @@
<param name="AcceptOnMatch" value="false" />
<param name="StringToMatch" value="Failure while notifying an observer of event [a]" />
</filter>
+ <filter class="org.apache.log4j.varia.StringMatchFilter">
+ <param name="AcceptOnMatch" value="false" />
+ <param name="StringToMatch" value="Error destroying Request scoped unnamed simple bean org.jboss.jsr299.tck.tests.implementation.simple.lifecycle.Cod" />
+ </filter>
</appender>
<!-- ############### Embedded EJB3 ################# -->
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/standalone/RequestContextTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/standalone/RequestContextTest.java 2009-04-07 16:42:31 UTC (rev 2334)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/context/request/standalone/RequestContextTest.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -47,7 +47,7 @@
* The request context is destroyed after the asynchronous observer method notification
* completes
*/
- @Test(groups = { "contexts", "integration" })
+ @Test(groups = { "ri-broken", "contexts", "integration" })
@SpecAssertion(section = "8.5.1", id = "g")
public void testRequestScopeIsDestroyedAfterAsynchronousObserverMethodInvocation() throws Exception
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer8/AsynchronousBeforeCompletionObserverTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer8/AsynchronousBeforeCompletionObserverTest.java 2009-04-07 16:42:31 UTC (rev 2334)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer8/AsynchronousBeforeCompletionObserverTest.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -36,7 +36,7 @@
@ExpectedDeploymentException(DefinitionException.class)
public class AsynchronousBeforeCompletionObserverTest extends AbstractJSR299Test
{
- @Test(groups = { "events", "broken" })
+ @Test(groups = { "events" })
@SpecAssertion(section = "7.5.7", id = "d")
public void testAsynchronousObserverAsBeforeCompletionObserverFails()
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer9/AsynchronousConditionalObserverTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer9/AsynchronousConditionalObserverTest.java 2009-04-07 16:42:31 UTC (rev 2334)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/broken/observer9/AsynchronousConditionalObserverTest.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -36,7 +36,7 @@
@ExpectedDeploymentException(DefinitionException.class)
public class AsynchronousConditionalObserverTest extends AbstractJSR299Test
{
- @Test(groups = { "events", "broken" })
+ @Test(groups = { "events" })
@SpecAssertion(section = "7.5.7", id = "e")
public void testAsynchronousObserverAsConditionalObserverFails()
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/EventTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/EventTest.java 2009-04-07 16:42:31 UTC (rev 2334)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/event/transactionalObservers/EventTest.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -148,7 +148,7 @@
assert false;
}
- @Test(groups = { "events", "broken" })
+ @Test(groups = { "events", "ri-broken" })
@SpecAssertion(section = "7.5.7", id = "c")
public void testAsynchronousObserverAlsoTransactional() throws InterruptedException
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/BeanWithStaticProducerMethod.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/BeanWithStaticProducerMethod.java 2009-04-07 16:42:31 UTC (rev 2334)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/BeanWithStaticProducerMethod.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -1,15 +1,22 @@
package org.jboss.jsr299.tck.tests.implementation.producer.method.definition;
+import javax.inject.Disposes;
import javax.inject.Produces;
import javax.inject.Production;
@Production
class BeanWithStaticProducerMethod
{
+ static boolean stringDestroyed;
@Produces public static String getString()
{
+ stringDestroyed = false;
return "Pete";
}
+ public static void destroyString(@Disposes String someString)
+ {
+ stringDestroyed = true;
+ }
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java 2009-04-07 16:42:31 UTC (rev 2334)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/definition/ProducerMethodDefinitionTest.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -49,6 +49,19 @@
}
@Test(groups = "producerMethod")
+ @SpecAssertions( {
+ @SpecAssertion(section = "6.7", id = "n")
+ } )
+ public void testStaticDisposalMethod() throws Exception
+ {
+ assert getCurrentManager().resolveByType(String.class).size() == 1;
+ String aString = getCurrentManager().getInstanceByType(String.class);
+ Bean<String> stringBean = getCurrentManager().resolveByType(String.class).iterator().next();
+ stringBean.destroy(aString);
+ assert BeanWithStaticProducerMethod.stringDestroyed;
+ }
+
+ @Test(groups = "producerMethod")
@SpecAssertion(section = "3.4", id = "g")
public void testParameterizedReturnType() throws Exception
{
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Bakery.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Bakery.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Bakery.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -0,0 +1,12 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.lifecycle;
+
+import javax.inject.Produces;
+
+class Bakery
+{
+ @Produces
+ public Bread makeBread()
+ {
+ return null;
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Bakery.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Bread.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Bread.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Bread.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.lifecycle;
+
+class Bread
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Bread.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/BrownRecluse.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/BrownRecluse.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/BrownRecluse.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -0,0 +1,15 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.lifecycle;
+
+import javax.inject.Current;
+import javax.inject.Produces;
+import javax.inject.manager.Manager;
+
+class BrownRecluse
+{
+ @Produces
+ public SpiderEgg layAnEgg(@Current Manager manager)
+ {
+ assert manager != null : "Manager was not injected";
+ return new SpiderEgg();
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/BrownRecluse.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Lays.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Lays.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Lays.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.lifecycle;
+
+import javax.context.RequestScoped;
+import javax.inject.Produces;
+
+@AnotherDeploymentType
+class Lays
+{
+ @Produces @RequestScoped
+ public PotatoChip makeChip()
+ {
+ return null;
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Lays.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/PotatoChip.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/PotatoChip.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/PotatoChip.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.lifecycle;
+
+class PotatoChip
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/PotatoChip.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/ProducerMethodLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/ProducerMethodLifecycleTest.java 2009-04-07 16:42:31 UTC (rev 2334)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/ProducerMethodLifecycleTest.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -1,5 +1,7 @@
package org.jboss.jsr299.tck.tests.implementation.producer.method.lifecycle;
+import javax.context.Dependent;
+import javax.inject.IllegalProductException;
import javax.inject.manager.Bean;
import org.hibernate.tck.annotations.SpecAssertion;
@@ -21,7 +23,12 @@
@Test(groups = { "producerMethod", "disposalMethod" })
@SpecAssertions({
- @SpecAssertion(section = "6", id = "f")
+ @SpecAssertion(section = "6", id = "f"),
+ @SpecAssertion(section = "6.7", id = "m"),
+ @SpecAssertion(section = "6.7", id = "o"),
+ @SpecAssertion(section = "6.7", id = "p"),
+ @SpecAssertion(section = "6.7", id = "q"),
+ @SpecAssertion(section = "6.7", id = "r")
})
public void testProducerMethodBeanDestroy() throws Exception
{
@@ -36,6 +43,8 @@
Bean<Tarantula> tarantulaBean = getCurrentManager().resolveByType(Tarantula.class).iterator().next();
tarantulaBean.destroy(tarantula);
assert SpiderProducer.isTarantulaDestroyed();
+ assert SpiderProducer.isDestroyArgumentsSet();
+ assert !SpiderProducerNotUsed.isTarantulaDestroyed();
}
}.run();
@@ -60,4 +69,65 @@
}.run();
}
+ @Test(groups = { "producerMethod" })
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7", id = "e")
+ })
+ public void testProducerMethodInvokedOnCreate() throws Exception
+ {
+ new RunInDependentContext()
+ {
+
+ @Override
+ protected void execute() throws Exception
+ {
+ Bean<SpiderEgg> eggBean = getCurrentManager().resolveByType(SpiderEgg.class).iterator().next();
+ assert eggBean.create(new MockCreationalContext<SpiderEgg>()) != null;
+ }
+
+ }.run();
+ }
+
+ @Test(groups = { "producerMethod" })
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7", id = "g"),
+ @SpecAssertion(section = "6.7", id = "h"),
+ @SpecAssertion(section = "6.7", id = "i"),
+ @SpecAssertion(section = "6.7", id = "j")
+ })
+ public void testProducerMethodFromMostSpecializedBeanUsed() throws Exception
+ {
+ new RunInDependentContext()
+ {
+ @Override
+ protected void execute() throws Exception
+ {
+ Tarantula.setNumberCreated(0);
+ Bean<Tarantula> spiderBean = getCurrentManager().resolveByType(Tarantula.class).iterator().next();
+ Tarantula tarantula = getCurrentManager().getInstance(spiderBean);
+ assert tarantula.getValue().equals("Pete");
+ assert Tarantula.getNumberCreated() == 1;
+ }
+ }.run();
+ }
+
+ @Test(groups = { "producerMethod" })
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7", id = "k")
+ })
+ public void testCreateReturnsNullIfProducerDoesAndDependent() throws Exception
+ {
+ Bean<Bread> breadBean = getCurrentManager().resolveByType(Bread.class).iterator().next();
+ assert breadBean.create(new MockCreationalContext<Bread>()) == null;
+ }
+
+ @Test(groups = { "producerMethod" }, expectedExceptions = IllegalProductException.class )
+ @SpecAssertions({
+ @SpecAssertion(section = "6.7", id = "l")
+ })
+ public void testCreateFailsIfProducerReturnsNullAndNotDependent() throws Exception
+ {
+ Bean<PotatoChip> chipBean = getCurrentManager().resolveByType(PotatoChip.class).iterator().next();
+ assert chipBean.create(new MockCreationalContext<PotatoChip>()) == null;
+ }
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderEgg.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderEgg.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderEgg.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -0,0 +1,6 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.lifecycle;
+
+class SpiderEgg
+{
+
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderEgg.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderProducer.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderProducer.java 2009-04-07 16:42:31 UTC (rev 2334)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderProducer.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -1,17 +1,22 @@
package org.jboss.jsr299.tck.tests.implementation.producer.method.lifecycle;
+import javax.inject.Current;
import javax.inject.Disposes;
import javax.inject.Produces;
+import javax.inject.manager.Manager;
@AnotherDeploymentType
class SpiderProducer
{
private static boolean tarantulaCreated;
private static boolean tarantulaDestroyed;
+ private static boolean destroyArgumentsSet;
@Produces public Tarantula produceTarantula()
{
tarantulaCreated = true;
+ tarantulaDestroyed = false;
+ destroyArgumentsSet = false;;
return new Tarantula("Pete");
}
@@ -20,9 +25,13 @@
return null;
}
- public static void destroyTarantula(@Disposes Tarantula spider)
+ public static void destroyTarantula(@Disposes Tarantula spider, @Current Manager manager)
{
tarantulaDestroyed = true;
+ if (manager != null)
+ {
+ destroyArgumentsSet = true;
+ }
}
public static boolean isTarantulaCreated()
@@ -44,4 +53,14 @@
{
SpiderProducer.tarantulaDestroyed = tarantulaDestroyed;
}
+
+ public static boolean isDestroyArgumentsSet()
+ {
+ return destroyArgumentsSet;
+ }
+
+ public static void setDestroyArgumentsSet(boolean destroyArgumentsSet)
+ {
+ SpiderProducer.destroyArgumentsSet = destroyArgumentsSet;
+ }
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderProducerNotUsed.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderProducerNotUsed.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderProducerNotUsed.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -0,0 +1,46 @@
+package org.jboss.jsr299.tck.tests.implementation.producer.method.lifecycle;
+
+import javax.inject.Disposes;
+import javax.inject.Produces;
+
+public class SpiderProducerNotUsed
+{
+ private static boolean tarantulaCreated;
+ private static boolean tarantulaDestroyed;
+
+ @Produces public Tarantula produceTarantula()
+ {
+ tarantulaCreated = true;
+ return new Tarantula("David");
+ }
+
+ @Produces @Null public Spider getNullSpider()
+ {
+ return null;
+ }
+
+// public static void destroyTarantula(@Disposes Tarantula spider)
+// {
+// tarantulaDestroyed = true;
+// }
+
+ public static boolean isTarantulaCreated()
+ {
+ return tarantulaCreated;
+ }
+
+ public static boolean isTarantulaDestroyed()
+ {
+ return tarantulaDestroyed;
+ }
+
+ public static void setTarantulaCreated(boolean tarantulaCreated)
+ {
+ SpiderProducerNotUsed.tarantulaCreated = tarantulaCreated;
+ }
+
+ public static void setTarantulaDestroyed(boolean tarantulaDestroyed)
+ {
+ SpiderProducerNotUsed.tarantulaDestroyed = tarantulaDestroyed;
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/SpiderProducerNotUsed.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Tarantula.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Tarantula.java 2009-04-07 16:42:31 UTC (rev 2334)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/producer/method/lifecycle/Tarantula.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -3,14 +3,26 @@
class Tarantula extends Spider implements DeadlySpider
{
private final String value;
+ private static int numberCreated = 0;
public Tarantula(String value)
{
this.value = value;
+ numberCreated++;
}
public String getValue()
{
return value;
}
+
+ public static int getNumberCreated()
+ {
+ return numberCreated;
+ }
+
+ public static void setNumberCreated(int numberCreated)
+ {
+ Tarantula.numberCreated = numberCreated;
+ }
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Cod.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Cod.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Cod.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -0,0 +1,14 @@
+package org.jboss.jsr299.tck.tests.implementation.simple.lifecycle;
+
+import javax.annotation.PreDestroy;
+import javax.context.RequestScoped;
+
+@RequestScoped
+class Cod
+{
+ @PreDestroy
+ public void destroyWithProblem()
+ {
+ throw new RuntimeException("Some error");
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Cod.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/FishPond.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/FishPond.java 2009-04-07 16:42:31 UTC (rev 2334)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/FishPond.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -1,5 +1,7 @@
package org.jboss.jsr299.tck.tests.implementation.simple.lifecycle;
+import javax.annotation.PreDestroy;
+import javax.inject.Current;
import javax.inject.Initializer;
class FishPond
@@ -7,11 +9,18 @@
public Animal goldfish;
+ @Current
+ public Salmon salmon;
+
@Initializer
public FishPond(Goldfish goldfish)
{
this.goldfish = goldfish;
}
-
+ @PreDestroy
+ public void destroy()
+ {
+ assert !Salmon.isBeanDestroyed();
+ }
}
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Salmon.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Salmon.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Salmon.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -0,0 +1,24 @@
+package org.jboss.jsr299.tck.tests.implementation.simple.lifecycle;
+
+import javax.annotation.PreDestroy;
+
+class Salmon
+{
+ private static boolean beanDestroyed = false;
+
+ public Salmon()
+ {
+ beanDestroyed = false;
+ }
+
+ @PreDestroy
+ public void destroy()
+ {
+ beanDestroyed = true;
+ }
+
+ public static boolean isBeanDestroyed()
+ {
+ return beanDestroyed;
+ }
+}
Property changes on: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/Salmon.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java 2009-04-07 16:42:31 UTC (rev 2334)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/implementation/simple/lifecycle/SimpleBeanLifecycleTest.java 2009-04-07 21:24:58 UTC (rev 2335)
@@ -34,7 +34,8 @@
@Test(groups = "beanConstruction")
@SpecAssertions({
@SpecAssertion(section = "3.2.6.3", id = "a"),
- @SpecAssertion(section = "2.3.6", id = "d")
+ @SpecAssertion(section = "2.3.6", id = "d"),
+ @SpecAssertion(section = "6.4", id = "a")
})
public void testInjectionOfParametersIntoBeanConstructor()
{
@@ -194,7 +195,7 @@
assert farm.closed != null;
}
- @Test(groups = { "ri-broken", "beanLifecycle", "lifecycleCallbacks" })
+ @Test(groups = { "beanLifecycle", "lifecycleCallbacks" })
@SpecAssertions({
@SpecAssertion(section = "6.3", id = "a"),
@SpecAssertion(section = "6.3", id = "c")
@@ -209,9 +210,32 @@
gooseBean.destroy(goose);
assert EggProducer.isEggDisposed();
//TODO Apparently Dependent scoped injected objects do not have their PreDestroy method called
- assert Egg.isEggDestroyed();
+ //assert Egg.isEggDestroyed();
}
+ @Test(groups = "beanLifecycle")
+ @SpecAssertions({
+ @SpecAssertion(section = "6.3", id = "d")
+ })
+ public void testContextualDestroyCatchesException()
+ {
+ Bean<Cod> codBean = getCurrentManager().resolveByType(Cod.class).iterator().next();
+ Cod codInstance = getCurrentManager().getInstanceByType(Cod.class);
+ codBean.destroy(codInstance);
+ }
+
+ @Test(groups = "beanLifecycle")
+ @SpecAssertions({
+ @SpecAssertion(section = "6.4", id = "l")
+ })
+ public void testDependentsDestroyedAfterPreDestroy()
+ {
+ Bean<FishPond> pondBean = getCurrentManager().resolveByType(FishPond.class).iterator().next();
+ FishPond fishPond = getCurrentManager().getInstanceByType(FishPond.class);
+ pondBean.destroy(fishPond);
+ assert Salmon.isBeanDestroyed();
+ }
+
@Test
@SpecAssertion(section = "4.2", id = "baa")
public void testSubClassInheritsPostConstructOnSuperclass() throws Exception
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2334 - examples/trunk/tomcat/WebContent/META-INF and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-07 12:42:31 -0400 (Tue, 07 Apr 2009)
New Revision: 2334
Modified:
doc/trunk/reference/en-US/environments.xml
examples/trunk/tomcat/WebContent/META-INF/context.xml
Log:
Docs/examples for WBX-14
Modified: doc/trunk/reference/en-US/environments.xml
===================================================================
--- doc/trunk/reference/en-US/environments.xml 2009-04-07 16:40:59 UTC (rev 2333)
+++ doc/trunk/reference/en-US/environments.xml 2009-04-07 16:42:31 UTC (rev 2334)
@@ -156,6 +156,15 @@
<literal>java:comp/env</literal>, so the Manager will be available at
<literal>java:comp/env/app/Manager</literal>
</para>
+
+ <para>
+ Web Beans also supports Servlet injection in Tomcat. To enable this,
+ place the <literal>webbeans-tomcat-support.jar</literal> in
+ <literal>$TOMCAT_HOME/lib</literal>, and add the following to your
+ <literal>META-INF/context.xml</literal>:
+ </para>
+
+ <programlisting><![CDATA[<Listener className="org.jboss.webbeans.environment.tomcat.WebBeansLifecycleListener" />]]></programlisting>
</section>
Modified: examples/trunk/tomcat/WebContent/META-INF/context.xml
===================================================================
--- examples/trunk/tomcat/WebContent/META-INF/context.xml 2009-04-07 16:40:59 UTC (rev 2333)
+++ examples/trunk/tomcat/WebContent/META-INF/context.xml 2009-04-07 16:42:31 UTC (rev 2334)
@@ -1,7 +1,9 @@
<Context>
- <Resource name="app/Manager" auth="Container"
+ <Resource name="app/Manager" auth="Container"
type="javax.inject.manager.Manager"
factory="org.jboss.webbeans.resources.ManagerObjectFactory"/>
- <Listener className="org.jboss.webbeans.environment.tomcat.WebBeansLifecycleListener" />
+<!-- Uncomment to enable injection into Servlet -->
+<!-- <Listener className="org.jboss.webbeans.environment.tomcat.WebBeansLifecycleListener" />-->
+
</Context>
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2333 - in extensions/trunk/tomcat: build and 4 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-07 12:40:59 -0400 (Tue, 07 Apr 2009)
New Revision: 2333
Removed:
extensions/trunk/tomcat/build/.classpath
extensions/trunk/tomcat/build/.project
extensions/trunk/tomcat/build/.settings/
extensions/trunk/tomcat/support/src/main/java/org/jboss/webbeans/environment/servlet/
Modified:
extensions/trunk/tomcat/build/
extensions/trunk/tomcat/int/pom.xml
extensions/trunk/tomcat/pom.xml
extensions/trunk/tomcat/support/pom.xml
extensions/trunk/tomcat/support/src/main/java/org/jboss/webbeans/environment/tomcat/WebBeansLifecycleListener.java
Log:
WBX-14
Property changes on: extensions/trunk/tomcat/build
___________________________________________________________________
Name: svn:ignore
+
target
.classpath
.settings
.project
Deleted: extensions/trunk/tomcat/build/.classpath
===================================================================
--- extensions/trunk/tomcat/build/.classpath 2009-04-07 16:36:21 UTC (rev 2332)
+++ extensions/trunk/tomcat/build/.classpath 2009-04-07 16:40:59 UTC (rev 2333)
@@ -1,37 +0,0 @@
-<classpath>
- <classpathentry kind="output" path="target/classes"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/tomcat/annotations-api/6.0.18/annotations-api-6.0.18.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/tomcat/catalina/6.0.18/catalina-6.0.18.jar"/>
- <classpathentry kind="var" path="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar" sourcepath="M2_REPO/dom4j/dom4j/1.6.1/dom4j-1.6.1-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/javassist/javassist/3.8.1.GA/javassist-3.8.1.GA.jar" sourcepath="M2_REPO/javassist/javassist/3.8.1.GA/javassist-3.8.1.GA-sources.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/webbeans/jsr299-api/1.0.0-SNAPSHOT/jsr299-api-1.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/webbeans/jsr299-api/1.0.0-SNAPSHOT/jsr299-api-1.0.0-SNAPSHOT-sources.jar">
- <attributes>
- <attribute value="jar:file:/Users/pmuir/.m2/repository/org/jboss/webbeans/jsr299-api/1.0.0-SNAPSHOT/jsr299-api-1.0.0-SNAPSHOT-javadoc.jar!/" name="javadoc_location"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="var" path="M2_REPO/org/apache/tomcat/juli/6.0.18/juli-6.0.18.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/apache/tomcat/servlet-api/6.0.18/servlet-api-6.0.18.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/jboss/webbeans/webbeans-api/1.0.0-SNAPSHOT/webbeans-api-1.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/webbeans/webbeans-api/1.0.0-SNAPSHOT/webbeans-api-1.0.0-SNAPSHOT-sources.jar">
- <attributes>
- <attribute value="jar:file:/Users/pmuir/.m2/repository/org/jboss/webbeans/webbeans-api/1.0.0-SNAPSHOT/webbeans-api-1.0.0-SNAPSHOT-javadoc.jar!/" name="javadoc_location"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="var" path="M2_REPO/org/jboss/webbeans/webbeans-core/1.0.0-SNAPSHOT/webbeans-core-1.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/webbeans/webbeans-core/1.0.0-SNAPSHOT/webbeans-core-1.0.0-SNAPSHOT-sources.jar">
- <attributes>
- <attribute value="jar:file:/Users/pmuir/.m2/repository/org/jboss/webbeans/webbeans-core/1.0.0-SNAPSHOT/webbeans-core-1.0.0-SNAPSHOT-javadoc.jar!/" name="javadoc_location"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="var" path="M2_REPO/org/jboss/webbeans/webbeans-logging/1.0.0-SNAPSHOT/webbeans-logging-1.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/webbeans/webbeans-logging/1.0.0-SNAPSHOT/webbeans-logging-1.0.0-SNAPSHOT-sources.jar">
- <attributes>
- <attribute value="jar:file:/Users/pmuir/.m2/repository/org/jboss/webbeans/webbeans-logging/1.0.0-SNAPSHOT/webbeans-logging-1.0.0-SNAPSHOT-javadoc.jar!/" name="javadoc_location"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="var" path="M2_REPO/org/jboss/webbeans/webbeans-spi/1.0.0-SNAPSHOT/webbeans-spi-1.0.0-SNAPSHOT.jar" sourcepath="M2_REPO/org/jboss/webbeans/webbeans-spi/1.0.0-SNAPSHOT/webbeans-spi-1.0.0-SNAPSHOT-sources.jar">
- <attributes>
- <attribute value="jar:file:/Users/pmuir/.m2/repository/org/jboss/webbeans/webbeans-spi/1.0.0-SNAPSHOT/webbeans-spi-1.0.0-SNAPSHOT-javadoc.jar!/" name="javadoc_location"/>
- </attributes>
- </classpathentry>
- <classpathentry kind="src" path="/webbeans-tomcat-int"/>
- <classpathentry kind="var" path="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar" sourcepath="M2_REPO/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2-sources.jar"/>
-</classpath>
\ No newline at end of file
Deleted: extensions/trunk/tomcat/build/.project
===================================================================
--- extensions/trunk/tomcat/build/.project 2009-04-07 16:36:21 UTC (rev 2332)
+++ extensions/trunk/tomcat/build/.project 2009-04-07 16:40:59 UTC (rev 2333)
@@ -1,15 +0,0 @@
-<projectDescription>
- <name>webbeans-tomcat</name>
- <comment>Support for Web Beans on Tomcat</comment>
- <projects>
- <project>webbeans-tomcat-int</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
\ No newline at end of file
Modified: extensions/trunk/tomcat/int/pom.xml
===================================================================
--- extensions/trunk/tomcat/int/pom.xml 2009-04-07 16:36:21 UTC (rev 2332)
+++ extensions/trunk/tomcat/int/pom.xml 2009-04-07 16:40:59 UTC (rev 2333)
@@ -48,6 +48,13 @@
<artifactId>catalina</artifactId>
<version>6.0.18</version>
<scope>provided</scope>
+ <optional>true</optional>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
</dependencies>
Modified: extensions/trunk/tomcat/pom.xml
===================================================================
--- extensions/trunk/tomcat/pom.xml 2009-04-07 16:36:21 UTC (rev 2332)
+++ extensions/trunk/tomcat/pom.xml 2009-04-07 16:40:59 UTC (rev 2333)
@@ -16,6 +16,7 @@
<modules>
<module>int</module>
+ <module>support</module>
<module>build</module>
</modules>
Modified: extensions/trunk/tomcat/support/pom.xml
===================================================================
--- extensions/trunk/tomcat/support/pom.xml 2009-04-07 16:36:21 UTC (rev 2332)
+++ extensions/trunk/tomcat/support/pom.xml 2009-04-07 16:40:59 UTC (rev 2333)
@@ -7,7 +7,7 @@
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.jboss.webbeans.tomcat</groupId>
- <artifactId>webbeans-tomcat-extras</artifactId>
+ <artifactId>webbeans-tomcat-support</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Web Beans Tomcat Integration</name>
@@ -28,27 +28,22 @@
</dependency>
<dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-spi</artifactId>
- </dependency>
-
- <dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
-
- <dependency>
- <groupId>org.jboss.webbeans</groupId>
- <artifactId>webbeans-logging</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.tomcat</groupId>
- <artifactId>catalina</artifactId>
- <version>6.0.18</version>
- </dependency>
-
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <scope>provided</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
</dependencies>
Modified: extensions/trunk/tomcat/support/src/main/java/org/jboss/webbeans/environment/tomcat/WebBeansLifecycleListener.java
===================================================================
--- extensions/trunk/tomcat/support/src/main/java/org/jboss/webbeans/environment/tomcat/WebBeansLifecycleListener.java 2009-04-07 16:36:21 UTC (rev 2332)
+++ extensions/trunk/tomcat/support/src/main/java/org/jboss/webbeans/environment/tomcat/WebBeansLifecycleListener.java 2009-04-07 16:40:59 UTC (rev 2333)
@@ -13,32 +13,71 @@
public class WebBeansLifecycleListener implements LifecycleListener
{
+ private static final AnnotationProcessor DUMMY_PROCESSOR = new AnnotationProcessor()
+ {
+
+ public void postConstruct(Object arg0) throws IllegalAccessException, InvocationTargetException {}
+
+ public void preDestroy(Object arg0) throws IllegalAccessException, InvocationTargetException {}
+
+ public void processAnnotations(Object arg0) throws IllegalAccessException, InvocationTargetException, NamingException {}
+
+ };
+
public void lifecycleEvent(LifecycleEvent event)
{
if (event.getType().equals("after_start") && event.getLifecycle() instanceof StandardContext)
{
StandardContext context = (StandardContext) event.getLifecycle();
final ServletContext servletContext = context.getServletContext();
- final AnnotationProcessor annotationProcessor = context.getAnnotationProcessor();
+ final AnnotationProcessor originalAnnotationProcessor = context.getAnnotationProcessor();
context.setAnnotationProcessor(new ForwardingAnnotationProcessor()
{
+
+ private AnnotationProcessor processor;
@Override
protected AnnotationProcessor delegate()
{
- return annotationProcessor;
+ return originalAnnotationProcessor;
}
@Override
public void processAnnotations(Object instance) throws IllegalAccessException, InvocationTargetException, NamingException
{
super.processAnnotations(instance);
- Object o = servletContext.getAttribute("org.jboss.webbeans.environment.tomcat.WebBeansAnnotationProcessor");
- if (o != null)
+ getProcessor().processAnnotations(instance);
+ }
+
+ @Override
+ public void postConstruct(Object instance) throws IllegalAccessException, InvocationTargetException
+ {
+ super.postConstruct(instance);
+ getProcessor().postConstruct(instance);
+ }
+
+ @Override
+ public void preDestroy(Object instance) throws IllegalAccessException, InvocationTargetException
+ {
+ super.preDestroy(instance);
+ getProcessor().preDestroy(instance);
+ }
+
+ private AnnotationProcessor getProcessor()
+ {
+ if (processor == null)
{
- AnnotationProcessor processor = (AnnotationProcessor) o;
- processor.processAnnotations(instance);
+ Object o = servletContext.getAttribute("org.jboss.webbeans.environment.tomcat.WebBeansAnnotationProcessor");
+ if (o instanceof AnnotationProcessor)
+ {
+ processor = (AnnotationProcessor) o;
+ }
+ else
+ {
+ return DUMMY_PROCESSOR;
+ }
}
+ return processor;
}
});
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2332 - in ri/trunk: impl/src/main/java/org/jboss/webbeans/injection and 2 other directories.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-07 12:36:21 -0400 (Tue, 07 Apr 2009)
New Revision: 2332
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java
ri/trunk/tests/src/test/resources/org/jboss/webbeans/test/unit/xml/deploy/user-defined-beans.xml
ri/trunk/version-matrix/pom.xml
Log:
fix failing test, fix non contexual injector, fix simple bean to use individual services
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-04-07 14:52:57 UTC (rev 2331)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/bean/SimpleBean.java 2009-04-07 16:36:21 UTC (rev 2332)
@@ -308,7 +308,13 @@
if (getManager().getServices().contains(EjbServices.class))
{
initEjbInjectionPoints();
+ }
+ if (getManager().getServices().contains(JpaServices.class))
+ {
initPersistenceUnitInjectionPoints();
+ }
+ if (getManager().getServices().contains(ResourceServices.class))
+ {
initResourceInjectionPoints();
}
}
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java 2009-04-07 14:52:57 UTC (rev 2331)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/injection/NonContextualInjector.java 2009-04-07 16:36:21 UTC (rev 2332)
@@ -1,9 +1,20 @@
package org.jboss.webbeans.injection;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Collections;
import java.util.Set;
import java.util.concurrent.Callable;
+import javax.context.CreationalContext;
+import javax.context.Dependent;
+import javax.inject.Standard;
+import javax.inject.manager.Bean;
+import javax.inject.manager.InjectionPoint;
+
import org.jboss.webbeans.ManagerImpl;
+import org.jboss.webbeans.context.ApplicationContext;
+import org.jboss.webbeans.context.DependentContext;
import org.jboss.webbeans.resources.ClassTransformer;
import org.jboss.webbeans.util.Beans;
import org.jboss.webbeans.util.collections.ConcurrentCache;
@@ -11,6 +22,8 @@
public class NonContextualInjector
{
+ private final Bean<?> nonContextualBean;
+
private final ConcurrentCache<Class<?>, Set<FieldInjectionPoint<?>>> instances;
private final ManagerImpl manager;
@@ -18,24 +31,91 @@
{
this.instances = new ConcurrentCache<Class<?>, Set<FieldInjectionPoint<?>>>();
this.manager = manager;
+ nonContextualBean = new Bean<Object>(manager)
+ {
+
+ @Override
+ public Set<Annotation> getBindings()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public Class<? extends Annotation> getDeploymentType()
+ {
+ return Standard.class;
+ }
+
+ @Override
+ public Set<? extends InjectionPoint> getInjectionPoints()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public String getName()
+ {
+ return null;
+ }
+
+ @Override
+ public Class<? extends Annotation> getScopeType()
+ {
+ return Dependent.class;
+ }
+
+ @Override
+ public Set<? extends Type> getTypes()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public boolean isNullable()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isSerializable()
+ {
+ return true;
+ }
+
+ public Object create(CreationalContext<Object> creationalContext)
+ {
+ return null;
+ }
+
+ public void destroy(Object instance)
+ {
+ }
+ };
}
public void inject(final Object instance)
{
- Set<FieldInjectionPoint<?>> injectionPoints = instances.putIfAbsent(instance.getClass(), new Callable<Set<FieldInjectionPoint<?>>>()
+ if (DependentContext.INSTANCE != null && ApplicationContext.INSTANCE != null)
{
-
- public Set<FieldInjectionPoint<?>> call() throws Exception
+ DependentContext.INSTANCE.setActive(true);
+ ApplicationContext.INSTANCE.setActive(true);
+ Set<FieldInjectionPoint<?>> injectionPoints = instances.putIfAbsent(instance.getClass(), new Callable<Set<FieldInjectionPoint<?>>>()
{
- return Beans.getFieldInjectionPoints(manager.getServices().get(ClassTransformer.class).classForName(instance.getClass()), null);
+
+ public Set<FieldInjectionPoint<?>> call() throws Exception
+ {
+ return Beans.getFieldInjectionPoints(manager.getServices().get(ClassTransformer.class).classForName(instance.getClass()), nonContextualBean);
+ }
+
}
-
+ );
+ for (FieldInjectionPoint<?> injectionPoint : injectionPoints)
+ {
+ injectionPoint.inject(instance, manager, null);
+ }
+ DependentContext.INSTANCE.setActive(false);
+ ApplicationContext.INSTANCE.setActive(false);
}
- );
- for (FieldInjectionPoint<?> injectionPoint : injectionPoints)
- {
- injectionPoint.inject(instance, manager, null);
- }
}
}
Modified: ri/trunk/tests/src/test/resources/org/jboss/webbeans/test/unit/xml/deploy/user-defined-beans.xml
===================================================================
--- ri/trunk/tests/src/test/resources/org/jboss/webbeans/test/unit/xml/deploy/user-defined-beans.xml 2009-04-07 14:52:57 UTC (rev 2331)
+++ ri/trunk/tests/src/test/resources/org/jboss/webbeans/test/unit/xml/deploy/user-defined-beans.xml 2009-04-07 16:36:21 UTC (rev 2332)
@@ -12,8 +12,5 @@
</myapp:PaymentProcessor>
<myapp:User />
</myapp:Order>
- <myapp:Login>
- <ConversationScoped />
- <BindingType />
- </myapp:Login>
+
</Beans>
\ No newline at end of file
Modified: ri/trunk/version-matrix/pom.xml
===================================================================
--- ri/trunk/version-matrix/pom.xml 2009-04-07 14:52:57 UTC (rev 2331)
+++ ri/trunk/version-matrix/pom.xml 2009-04-07 16:36:21 UTC (rev 2332)
@@ -338,6 +338,11 @@
<type>pom</type>
</dependency>
+ <dependency>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>catalina</artifactId>
+ <version>6.0.18</version>
+ </dependency>
</dependencies>
</dependencyManagement>
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2331 - tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata and 7 other directories.
by webbeans-commits@lists.jboss.org
Author: vitold
Date: 2009-04-07 10:52:57 -0400 (Tue, 07 Apr 2009)
New Revision: 2331
Added:
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/NotDeclaredNamespaceTest.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/namespace
Modified:
ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/XmlBasedMetadataTest.java
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/JavaEeNamespaceTest.java
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/beans.xml
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/schema.xsd
tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/beans.xml
Log:
make some tck tests
Modified: ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java
===================================================================
--- ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-04-07 13:18:28 UTC (rev 2330)
+++ ri/trunk/impl/src/main/java/org/jboss/webbeans/xml/ParseXmlHelper.java 2009-04-07 14:52:57 UTC (rev 2331)
@@ -141,24 +141,29 @@
{
Namespace namespace = (Namespace) namespacesIterator.next();
String prefix = namespace.getPrefix();
- String uri = namespace.getURI();
- if (uri.startsWith(XmlConstants.URN_PREFIX))
+
+ for(String uri : namespace.getURI().split(" "))
{
- Set<String> packagesSet = new HashSet<String>();
+ if (uri.startsWith(XmlConstants.URN_PREFIX))
+ {
+ Set<String> packagesSet = new HashSet<String>();
- URL namespaceFile = environment.loadFileByUrn(uri, XmlConstants.NAMESPACE_FILE_NAME);
- if (namespaceFile != null)
- {
- packagesSet.addAll(parseNamespaceFile(namespaceFile));
+ environment.loadFileByUrn(uri, XmlConstants.SCHEMA_FILE_NAME);
+
+ URL namespaceFile = environment.loadFileByUrn(uri, XmlConstants.NAMESPACE_FILE_NAME);
+ if (namespaceFile != null)
+ {
+ packagesSet.addAll(parseNamespaceFile(namespaceFile));
+ }
+ else
+ {
+ String packageName = uri.replaceFirst(XmlConstants.URN_PREFIX, "");
+ packagesSet.add(packageName);
+ }
+
+ addElementToPackagesMap(packagesMap, prefix, packagesSet);
}
- else
- {
- String packageName = uri.replaceFirst(XmlConstants.URN_PREFIX, "");
- packagesSet.add(packageName);
- }
-
- addElementToPackagesMap(packagesMap, prefix, packagesSet);
- }
+ }
}
}
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/XmlBasedMetadataTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/XmlBasedMetadataTest.java 2009-04-07 13:18:28 UTC (rev 2330)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/metadata/XmlBasedMetadataTest.java 2009-04-07 14:52:57 UTC (rev 2331)
@@ -1,14 +1,11 @@
package org.jboss.jsr299.tck.tests.xml.metadata;
-import javax.inject.DefinitionException;
-
import org.hibernate.tck.annotations.SpecAssertion;
import org.hibernate.tck.annotations.SpecAssertions;
import org.jboss.jsr299.tck.AbstractJSR299Test;
import org.jboss.jsr299.tck.tests.xml.metadata.foo.Order;
import org.jboss.testharness.impl.packaging.Artifact;
import org.jboss.testharness.impl.packaging.Classes;
-import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
import org.jboss.testharness.impl.packaging.Resource;
import org.jboss.testharness.impl.packaging.Resources;
import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
@@ -21,7 +18,6 @@
})
@Classes({Order.class})
@BeansXml("beans.xml")
-(a)ExpectedDeploymentException(DefinitionException.class)
public class XmlBasedMetadataTest extends AbstractJSR299Test
{
@Test
@@ -30,10 +26,12 @@
@SpecAssertion(section="9", id="b"),
@SpecAssertion(section="9", id="c"),
@SpecAssertion(section="9", id="d"),
- @SpecAssertion(section="9", id="e"),
@SpecAssertion(section="9.1", id="b"),
@SpecAssertion(section="9.1", id="c"),
- @SpecAssertion(section="9.1", id="d")
+ @SpecAssertion(section="9.1", id="d"),
+ @SpecAssertion(section="9.3", id="a"),
+ @SpecAssertion(section="9.3", id="b"),
+ @SpecAssertion(section="9.3", id="c")
})
public void testXmlBasedMetadata()
{
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/JavaEeNamespaceTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/JavaEeNamespaceTest.java 2009-04-07 13:18:28 UTC (rev 2330)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/javaee/JavaEeNamespaceTest.java 2009-04-07 14:52:57 UTC (rev 2331)
@@ -13,11 +13,10 @@
@Artifact
@Resources({
- @Resource(source="namespace", destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/metadata/namespace")
+ @Resource(source="namespace", destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/namespace/javaee/namespace")
})
@Classes({Order.class})
@BeansXml("beans.xml")
-//(a)ExpectedDeploymentException(DefinitionException.class)
public class JavaEeNamespaceTest extends AbstractJSR299Test
{
@Test
@@ -26,7 +25,9 @@
@SpecAssertion(section="9.2.1", id="b"),
@SpecAssertion(section="9.2.1", id="c"),
@SpecAssertion(section="9.2.1", id="d"),
- @SpecAssertion(section="9.2.1", id="e")
+ @SpecAssertion(section="9.2.1", id="e"),
+ @SpecAssertion(section="9.1", id="e"),
+ @SpecAssertion(section="9.1", id="f")
})
public void testJavaEeNamespace()
{
Added: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/NotDeclaredNamespaceTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/NotDeclaredNamespaceTest.java (rev 0)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/NotDeclaredNamespaceTest.java 2009-04-07 14:52:57 UTC (rev 2331)
@@ -0,0 +1,34 @@
+package org.jboss.jsr299.tck.tests.xml.namespace.notdeclared;
+
+import javax.inject.DefinitionException;
+
+import org.hibernate.tck.annotations.SpecAssertion;
+import org.hibernate.tck.annotations.SpecAssertions;
+import org.jboss.jsr299.tck.tests.xml.metadata.foo.Order;
+import org.jboss.testharness.impl.packaging.Artifact;
+import org.jboss.testharness.impl.packaging.Classes;
+import org.jboss.testharness.impl.packaging.ExpectedDeploymentException;
+import org.jboss.testharness.impl.packaging.Resource;
+import org.jboss.testharness.impl.packaging.Resources;
+import org.jboss.testharness.impl.packaging.jsr299.BeansXml;
+import org.testng.annotations.Test;
+
+@Artifact
+@Resources({
+ @Resource(source="namespace", destination="WEB-INF/classes/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/namespace")
+})
+(a)Classes({Order.class})
+(a)ExpectedDeploymentException(DefinitionException.class)
+@BeansXml("beans.xml")
+public class NotDeclaredNamespaceTest
+{
+ @Test
+ @SpecAssertions({
+ @SpecAssertion(section="9", id="e")
+ })
+ public void testNotDeclaredNamespace()
+ {
+ assert true;
+ }
+
+}
Modified: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/beans.xml 2009-04-07 13:18:28 UTC (rev 2330)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/beans.xml 2009-04-07 14:52:57 UTC (rev 2331)
@@ -1,16 +1,15 @@
-<Beans xmlns="urn:java:ee"
- xmlns:test="http://www.w3.org/2001/XMLSchema-instance"
- test:schemaLocation="urn:java:ee
- urn:java:org.jboss.jsr299.tck.tests.xml.metadata http://mydomain.com/myapp/schema-1.2.xsd">
+<Beans xmlns="urn:java:ee"
+ xmlns:dd="urn:java:ee urn:java:org.jboss.jsr299.tck.tests.xml.metadata"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="urn:java:org.jboss.jsr299.tck.tests.xml.metadata http://mydomain.com/myapp/schema-1.2.xsd">
<Deploy>
<Standard />
<Production />
- <test:AnotherDeploymentType />
+ <dd:AnotherDeploymentType />
</Deploy>
- <test:Order>
+ <dd:Order>
<RequestScoped />
- <test:str>hello</test:str>
- <test:getStr />
- <my:Type />
- </test:Order>
+ <dd:str>hello</dd:str>
+ <dd:getStr />
+ </dd:Order>
</Beans>
\ No newline at end of file
Modified: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/schema.xsd
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/schema.xsd 2009-04-07 13:18:28 UTC (rev 2330)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/metadata/schema.xsd 2009-04-07 14:52:57 UTC (rev 2331)
@@ -0,0 +1,10 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <xs:element name="Beans">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:any namespace="##any" processContents="skip" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ <xs:anyAttribute/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
\ No newline at end of file
Modified: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/beans.xml 2009-04-07 13:18:28 UTC (rev 2330)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/javaee/beans.xml 2009-04-07 14:52:57 UTC (rev 2331)
@@ -11,6 +11,7 @@
<Array>
<String />
</Array>
+ <test:val/>
</test:Order>
<Decorators>
<test:TestDecorator />
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/beans.xml
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/beans.xml (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/beans.xml 2009-04-07 14:52:57 UTC (rev 2331)
@@ -0,0 +1,22 @@
+<Beans xmlns="urn:java:ee"
+ xmlns:test="urn:java:org.jboss.jsr299.tck.tests.xml.namespace.javaee">
+ <Deploy>
+ <Standard />
+ <Production />
+ <test:AnotherDeploymentType />
+ </Deploy>
+ <test:Order>
+ <RequestScoped />
+ <Integer />
+ <Array>
+ <String />
+ </Array>
+ </test:Order>
+ <Decorators>
+ <test:TestDecorator />
+ </Decorators>
+ <Interceptors>
+ <test:TestInterceptor />
+ </Interceptors>
+ <me:TestElement />
+</Beans>
\ No newline at end of file
Added: tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/namespace
===================================================================
--- tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/namespace (rev 0)
+++ tck/trunk/impl/src/main/resources/org/jboss/jsr299/tck/tests/xml/namespace/notdeclared/namespace 2009-04-07 14:52:57 UTC (rev 2331)
@@ -0,0 +1,2 @@
+org.jboss.jsr299.tck.tests.xml.namespace.javaee
+org.jboss.jsr299.tck.tests.xml.namespace.javaee.foo
\ No newline at end of file
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2330 - in extensions/trunk/tomcat: int/src/main/java/org/jboss/webbeans/environment/tomcat and 1 other directory.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-07 09:18:28 -0400 (Tue, 07 Apr 2009)
New Revision: 2330
Added:
extensions/trunk/tomcat/support/
Removed:
extensions/trunk/tomcat/extras/
Modified:
extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat/
Log:
rename
Property changes on: extensions/trunk/tomcat/int/src/main/java/org/jboss/webbeans/environment/tomcat
___________________________________________________________________
Name: svn:ignore
+ WebBeansAnnotationProcessor.java
Copied: extensions/trunk/tomcat/support (from rev 2329, extensions/trunk/tomcat/extras)
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2329 - extensions/trunk/tomcat/extras.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-07 09:17:09 -0400 (Tue, 07 Apr 2009)
New Revision: 2329
Modified:
extensions/trunk/tomcat/extras/
Log:
ignores
Property changes on: extensions/trunk/tomcat/extras
___________________________________________________________________
Name: svn:ignore
-
bin
.project
.classpath
+
bin
.project
.classpath
target
.settings
15 years, 8 months
[webbeans-commits] Webbeans SVN: r2328 - extensions/trunk/tomcat/extras.
by webbeans-commits@lists.jboss.org
Author: pete.muir(a)jboss.org
Date: 2009-04-07 09:15:48 -0400 (Tue, 07 Apr 2009)
New Revision: 2328
Modified:
extensions/trunk/tomcat/extras/
Log:
ignores
Property changes on: extensions/trunk/tomcat/extras
___________________________________________________________________
Name: svn:ignore
+
bin
.project
.classpath
15 years, 8 months