[webbeans-commits] Webbeans SVN: r1541 - ri/trunk/jboss-tck-runner/src/main/resources/META-INF and 1 other directories.
webbeans-commits at lists.jboss.org
webbeans-commits at lists.jboss.org
Mon Feb 16 12:36:45 EST 2009
Author: pete.muir at jboss.org
Date: 2009-02-16 12:36:45 -0500 (Mon, 16 Feb 2009)
New Revision: 1541
Added:
ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ProfileServiceContainersImpl.java
Modified:
ri/trunk/jboss-tck-runner/src/main/resources/META-INF/web-beans-tck.properties
tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractDeclarativeTest.java
Log:
Use profileservice to deploy tests
Added: 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 (rev 0)
+++ ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ProfileServiceContainersImpl.java 2009-02-16 17:36:45 UTC (rev 1541)
@@ -0,0 +1,106 @@
+package org.jboss.webbeans.tck.integration.jbossas;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.naming.InitialContext;
+
+import org.apache.log4j.Logger;
+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.jsr299.tck.api.DeploymentException;
+import org.jboss.managed.api.ManagedDeployment.DeploymentPhase;
+import org.jboss.profileservice.spi.ProfileKey;
+import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.test.JBossTestServices;
+import org.jboss.virtual.VFS;
+
+public class ProfileServiceContainersImpl extends AbstractContainersImpl
+{
+
+ private Logger log = Logger.getLogger(ProfileServiceContainersImpl.class);
+
+ private DeploymentManager deploymentManager;
+ private JBossTestServices testServices;
+ private final File tmpdir;
+
+
+ public ProfileServiceContainersImpl() throws Exception
+ {
+ this.testServices = new JBossTestServices(JBossTestServicesContainersImpl.class);
+ this.testServices.setUpLogging();
+ this.testServices.init();
+ tmpdir = new File(System.getProperty("java.io.tmpdir"), "org.jboss.webbeans.tck.integration.jbossas");
+ tmpdir.mkdir();
+ tmpdir.deleteOnExit();
+ }
+
+
+ @Override
+ public void setup() throws IOException
+ {
+ super.setup();
+
+ }
+
+ public void deploy(InputStream archiveStream, String name) throws DeploymentException, IOException
+ {
+ 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();
+ undeploy(name);
+ }
+ }
+ catch (Exception e)
+ {
+ throw new IOException(e);
+ }
+ if (failure != null)
+ {
+ throw new DeploymentException(failure);
+ }
+ }
+
+ public void undeploy(String name) throws DeploymentException, IOException
+ {
+ try
+ {
+ deploymentManager.stop(DeploymentPhase.APPLICATION, name).run();
+ deploymentManager.undeploy(DeploymentPhase.APPLICATION, name).run();
+ }
+ catch (Exception e)
+ {
+ throw new IOException(e);
+ }
+ }
+
+ /**
+ * Obtain the Deployment Manager
+ * @throws Exception
+ */
+ protected void initDeploymentManager() throws Exception
+ {
+ String profileName = "default";
+ InitialContext ctx = testServices.getInitialContext();
+ 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();
+ }
+
+}
Property changes on: ri/trunk/jboss-tck-runner/src/main/java/org/jboss/webbeans/tck/integration/jbossas/ProfileServiceContainersImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: ri/trunk/jboss-tck-runner/src/main/resources/META-INF/web-beans-tck.properties
===================================================================
--- ri/trunk/jboss-tck-runner/src/main/resources/META-INF/web-beans-tck.properties 2009-02-16 17:22:31 UTC (rev 1540)
+++ ri/trunk/jboss-tck-runner/src/main/resources/META-INF/web-beans-tck.properties 2009-02-16 17:36:45 UTC (rev 1541)
@@ -1,4 +1,4 @@
-org.jboss.jsr299.tck.spi.Containers=org.jboss.webbeans.tck.integration.jbossas.JBossTestServicesContainersImpl
+org.jboss.jsr299.tck.spi.Containers=org.jboss.webbeans.tck.integration.jbossas.ProfileServiceContainersImpl
org.jboss.jsr299.tck.api.TestLauncher=org.jboss.jsr299.tck.impl.runner.servlet.ServletTestLauncher
org.jboss.jsr299.tck.connectDelay=1500
org.jboss.jsr299.tck.connectRetries=8
\ No newline at end of file
Modified: tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractDeclarativeTest.java
===================================================================
--- tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractDeclarativeTest.java 2009-02-16 17:22:31 UTC (rev 1540)
+++ tck/trunk/impl/src/main/java/org/jboss/jsr299/tck/AbstractDeclarativeTest.java 2009-02-16 17:36:45 UTC (rev 1541)
@@ -162,7 +162,10 @@
@AfterSuite(alwaysRun=true)
public void afterSuite() throws Exception
{
- log.info("Ran " + numberOfTestsRunInContainer + " tests in the container");
+ if (!isInContainer())
+ {
+ log.info("Ran " + numberOfTestsRunInContainer + " tests in the container");
+ }
if (isSuiteDeployingTestsToContainer())
{
getCurrentConfiguration().getContainers().cleanup();
More information about the weld-commits
mailing list