[webbeans-commits] Webbeans SVN: r1977 - in ri/trunk: jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas and 2 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Fri Mar 13 12:02:30 EDT 2009
Author: pete.muir at jboss.org
Date: 2009-03-13 12:02:30 -0400 (Fri, 13 Mar 2009)
New Revision: 1977
Removed:
ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java
ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ProfileServiceContainersImpl.java
ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/util/
Modified:
ri/trunk/jboss-tck-runner/pom.xml
ri/trunk/jboss-tck-runner/src/main/resources/META-INF/web-beans-tck.properties
ri/trunk/version-matrix/pom.xml
Log:
switch to using jboss 5 deployment from harness
Modified: ri/trunk/jboss-tck-runner/pom.xml
===================================================================
--- ri/trunk/jboss-tck-runner/pom.xml 2009-03-13 16:02:18 UTC (rev 1976)
+++ ri/trunk/jboss-tck-runner/pom.xml 2009-03-13 16:02:30 UTC (rev 1977)
@@ -38,42 +38,12 @@
<artifactId>jsr299-tck-impl</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>
+ <groupId>org.jboss.test-harness</groupId>
+ <artifactId>jboss-test-harness-jboss-as-5</artifactId>
</dependency>
+
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-client</artifactId>
- <type>pom</type>
- <scope>runtime</scope>
- </dependency>
-
</dependencies>
<build>
Deleted: ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java
===================================================================
--- ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java 2009-03-13 16:02:18 UTC (rev 1976)
+++ ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/AbstractContainersImpl.java 2009-03-13 16:02:30 UTC (rev 1977)
@@ -1,288 +0,0 @@
-package org.jboss.webbeans.tck.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.spi.Containers;
-import org.jboss.webbeans.tck.integration.jbossas.util.DeploymentProperties;
-
-/**
- *
- * @author jeffgenender
- * @author Pete Muir
- *
- */
-public abstract class AbstractContainersImpl implements Configurable, Containers
-{
-
- 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(AbstractContainersImpl.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 AbstractContainersImpl()
- {
- this.properties = new DeploymentProperties();
- }
-
- protected static void copy(InputStream inputStream, File file) throws IOException
- {
- OutputStream os = new FileOutputStream(file);
- try
- {
- byte[] buf = new byte[1024];
- int i = 0;
- while ((i = inputStream.read(buf)) != -1)
- {
- os.write(buf, 0, i);
- }
- }
- finally
- {
- os.close();
- }
- }
-
- public void setConfiguration(Configuration configuration)
- {
- this.configuration = configuration;
- }
-
- protected boolean isJBossUp()
- {
- // 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("Successfully connected to JBoss AS at " + jbossHttpUrl);
- return true;
- }
-
- public void setup() throws IOException
- {
- String jbossAsPath = properties.getStringValue(JBOSS_AS_DIR_PROPERTY_NAME, "../jboss-as", false);
- if (jbossAsPath != 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);
- }
- }
- }
- 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 in " + jbossHome + " at URL " + 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();
- }
-
- protected void restartJboss() throws IOException
- {
- 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");
- }
- }
-
- 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");
- log.info("Shut down JBoss AS");
- }
-
- 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
Deleted: ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ProfileServiceContainersImpl.java
===================================================================
--- ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ProfileServiceContainersImpl.java 2009-03-13 16:02:18 UTC (rev 1976)
+++ ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ProfileServiceContainersImpl.java 2009-03-13 16:02:30 UTC (rev 1977)
@@ -1,219 +0,0 @@
-package org.jboss.webbeans.tck.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 AbstractContainersImpl
-{
-
- 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 + "/_WebBeansBootstrap"))
- {
- 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();
- }
-
-}
Modified: ri/trunk/jboss-tck-runner/src/main/resources/META-INF/web-beans-tck.properties
===================================================================
--- ri/trunk/jboss-tck-runner/src/main/resources/META-INF/web-beans-tck.properties 2009-03-13 16:02:18 UTC (rev 1976)
+++ ri/trunk/jboss-tck-runner/src/main/resources/META-INF/web-beans-tck.properties 2009-03-13 16:02:30 UTC (rev 1977)
@@ -1,4 +1 @@
-org.jboss.testharness.spi.Containers=org.jboss.webbeans.tck.integration.jbossas.ProfileServiceContainersImpl
-org.jboss.testharness.api.TestLauncher=org.jboss.testharness.impl.runner.servlet.ServletTestLauncher
-org.jboss.testharness.connectDelay=1500
-org.jboss.testharness.connectRetries=8
\ No newline at end of file
+org.jboss.testharness.api.TestLauncher=org.jboss.testharness.impl.runner.servlet.ServletTestLauncher
\ No newline at end of file
Modified: ri/trunk/version-matrix/pom.xml
===================================================================
--- ri/trunk/version-matrix/pom.xml 2009-03-13 16:02:18 UTC (rev 1976)
+++ ri/trunk/version-matrix/pom.xml 2009-03-13 16:02:30 UTC (rev 1977)
@@ -243,6 +243,12 @@
<version>1.0.0-SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.jboss.test-harness</groupId>
+ <artifactId>jboss-test-harness-jboss-as-5</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ </dependency>
+
<!-- <dependency>-->
<!-- <groupId>org.jboss.naming</groupId>-->
<!-- <artifactId>jnp-client</artifactId>-->
More information about the weld-commits
mailing list