Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://anonsvn.jboss.org/repos/weld/ri/trunk@1541 1c488680-804c-0410-94cd-c6b725194a0e
- Loading branch information
Showing
2 changed files
with
107 additions
and
1 deletion.
There are no files selected for viewing
106 changes: 106 additions & 0 deletions
106
...rc/main/java/org/jboss/webbeans/tck/integration/jbossas/ProfileServiceContainersImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
jboss-tck-runner/src/main/resources/META-INF/web-beans-tck.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |