本文整理汇总了Java中org.jboss.arquillian.container.spi.client.container.DeploymentException类的典型用法代码示例。如果您正苦于以下问题:Java DeploymentException类的具体用法?Java DeploymentException怎么用?Java DeploymentException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DeploymentException类属于org.jboss.arquillian.container.spi.client.container包,在下文中一共展示了DeploymentException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: waitForDeployments
import org.jboss.arquillian.container.spi.client.container.DeploymentException; //导入依赖的package包/类
/**
* Wait for the template resources to come up after the test container has
* been started. This allows the test container and the template resources
* to come up in parallel.
*/
public void waitForDeployments(@Observes(precedence = -100) AfterStart event, OpenShiftAdapter client, TemplateDetails details, TestClass testClass, CECubeConfiguration configuration, OpenShiftClient openshiftClient) throws Exception {
if (testClass == null) {
// nothing to do, since we're not in ClassScoped context
return;
}
if (details == null) {
log.warning(String.format("No environment for %s", testClass.getName()));
return;
}
log.info(String.format("Waiting for environment for %s", testClass.getName()));
try {
for (List<? extends OpenShiftResource> resources : details.getResources()) {
delay(client, resources);
}
} catch (Throwable t) {
logEvents(openshiftClient, configuration);
throw new DeploymentException("Error waiting for template resources to deploy: " + testClass.getName(), t);
}
}
示例2: deploy
import org.jboss.arquillian.container.spi.client.container.DeploymentException; //导入依赖的package包/类
@Override
public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
// Get all the server groups we're deploying to
final Set<String> serverGroups = getServerGroups(archive);
if (!serverGroups.isEmpty()) {
final ProtocolMetaData metaData = new ProtocolMetaData();
final ArchiveDeployer deployer = archiveDeployerInst.get();
final String uniqueName = deployer.deploy(archive, serverGroups);
final Domain domain = domainInst.get();
for (String serverGroupName : serverGroups) {
for (Server server : domain.getServersInGroup(serverGroupName)) {
metaData.addContext(new LazyHttpContext(server, uniqueName, managementClient));
}
}
return metaData;
}
throw new DeploymentException("Could not determine the server-group to deploy the archive to.");
}
示例3: testDeploy
import org.jboss.arquillian.container.spi.client.container.DeploymentException; //导入依赖的package包/类
private static void testDeploy(final ArchiveDeployer deployer, final ManagementClient client, final String containerName) throws IOException, DeploymentException {
if (!controller.isStarted(containerName)) {
controller.start(containerName);
}
final int currentDeployments = getCurrentDeploymentCount(client);
// Deploy both deployments
try {
deployer.deploy(createDeployment());
// Read each result, we should have two results for the first op and one for the second
final int newDeployments = getCurrentDeploymentCount(client);
Assert.assertTrue("Expected 1 deployments found " + (newDeployments - currentDeployments) + " for container " + containerName,
newDeployments == (1 + currentDeployments));
} finally {
deployer.undeploy("dep1");
controller.stop(containerName);
}
}
示例4: createException
import org.jboss.arquillian.container.spi.client.container.DeploymentException; //导入依赖的package包/类
/**
* Creates a deployment exception with the root cause of the exception adding any other causes as a suppressed
* exception.
*
* @param message the message for the exception
* @param cause the first cause
*
* @return a deployment exception for the error
*/
private static DeploymentException createException(final String message, final Throwable cause) {
final Set<Throwable> causes = Collections.newSetFromMap(new IdentityHashMap<>());
Throwable currentCause = cause;
Throwable rootCause = currentCause;
while (currentCause != null) {
currentCause = currentCause.getCause();
if (currentCause != null) {
causes.add(currentCause);
rootCause = currentCause;
}
}
final DeploymentException result = new DeploymentException(message, rootCause);
causes.forEach(result::addSuppressed);
return result;
}
示例5: getDeployment
import org.jboss.arquillian.container.spi.client.container.DeploymentException; //导入依赖的package包/类
@Deployment
@AddonDependencies({
@AddonDependency(name = INCOMPATIBLE, version = INCOMPATIBLE_VERSION, optional = true,
shouldThrowException = DeploymentException.class,
listener = {
TestRepositoryDeploymentListener.class,
FurnaceVersion_2_14_0_DeploymentListener.class
}, timeout = 5000
),
@AddonDependency(name = COMPATIBLE, version = COMPATIBLE_VERSION, listener = TestRepositoryDeploymentListener.class)
})
public static AddonArchive getDeployment() throws Exception
{
AddonArchive archive = ShrinkWrap.create(AddonArchive.class);
archive.addAsLocalServices(StrictModeEnabledByDefaultTest.class);
return archive;
}
示例6: undeploy
import org.jboss.arquillian.container.spi.client.container.DeploymentException; //导入依赖的package包/类
@Override
public void undeploy(Archive<?> archive) throws DeploymentException
{
undeploying = true;
AddonId addonToUndeploy = getAddonEntry(deploymentInstance.get());
AddonRegistry registry = runnable.getForge().getAddonRegistry();
System.out.println("Undeploying [" + addonToUndeploy + "] ... ");
try
{
Addon addonToStop = registry.getAddon(addonToUndeploy);
if (addonToStop.getStatus().isLoaded())
((MutableAddonRepository) addonToStop.getRepository()).disable(addonToUndeploy);
Addons.waitUntilStopped(addonToStop);
}
catch (Exception e)
{
throw new DeploymentException("Failed to undeploy " + addonToUndeploy, e);
}
finally
{
repository.undeploy(addonToUndeploy);
}
}
示例7: createDeployment
import org.jboss.arquillian.container.spi.client.container.DeploymentException; //导入依赖的package包/类
/**
* We expect this to fail with a deployment exception
* @return the base base web application archive
* @throws IOException - on resource failure
*/
@Deployment(testable=true)
@ShouldThrowException(DeploymentException.class)
public static WebArchive createDeployment() throws IOException {
URL publicKey = AppScopedTest.class.getResource("/publicKey.pem");
WebArchive webArchive = ShrinkWrap
.create(WebArchive.class, "AppScopedTest.war")
.addAsResource(publicKey, "/publicKey.pem")
.addClass(AppScopedEndpoint.class)
.addClass(TCKApplication.class)
.addAsWebInfResource("beans.xml", "beans.xml")
;
System.out.printf("WebArchive: %s\n", webArchive.toString(true));
return webArchive;
}
示例8: deploy
import org.jboss.arquillian.container.spi.client.container.DeploymentException; //导入依赖的package包/类
@Override
public synchronized ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
StartupTimeout startupTimeout = this.testClass.getAnnotation(StartupTimeout.class);
if (startupTimeout != null) {
setTimeout(startupTimeout.value());
}
this.delegateContainer = new UberjarSimpleContainer(this.containerContext.get(), this.deploymentContext.get(), this.testClass);
try {
this.delegateContainer
.setJavaVmArguments(this.getJavaVmArguments())
.requestedMavenArtifacts(this.requestedMavenArtifacts)
.start(archive);
// start wants to connect to the remote container, which isn't up until now, so
// we override start above and call it here instead
super.start();
ProtocolMetaData metaData = new ProtocolMetaData();
metaData.addContext(createDeploymentContext(archive.getId()));
return metaData;
} catch (Throwable e) {
if (e instanceof LifecycleException) {
e = e.getCause();
}
throw new DeploymentException(e.getMessage(), e);
}
}
示例9: undeploy
import org.jboss.arquillian.container.spi.client.container.DeploymentException; //导入依赖的package包/类
@Override
public synchronized void undeploy(Archive<?> archive) throws DeploymentException {
try {
this.delegateContainer.stop();
} catch (Exception e) {
throw new DeploymentException("Unable to stop process", e);
}
}
示例10: deploy
import org.jboss.arquillian.container.spi.client.container.DeploymentException; //导入依赖的package包/类
@Override
public ProtocolMetaData deploy(Archive<?> archive)
throws DeploymentException {
LiferayRemoteContainerConfiguration config =
_configurationInstance.get();
ProtocolMetaData protocolMetaData = super.deploy(archive);
protocolMetaData.addContext(
new HTTPContext(config.getHttpHost(), config.getHttpPort()));
return protocolMetaData;
}
示例11: delayDeployment
import org.jboss.arquillian.container.spi.client.container.DeploymentException; //导入依赖的package包/类
private void delayDeployment(DeploymentConfig dc, String prefix, int replicas, Operator op) throws Exception {
final Map<String, String> labels = dc.getSpec().getSelector();
try {
delay(labels, replicas, op);
} catch (Exception e) {
throw new DeploymentException(String.format("Timeout waiting for deployment %s to scale to %s pods", prefix, replicas), e);
}
}
示例12: createEnvironment
import org.jboss.arquillian.container.spi.client.container.DeploymentException; //导入依赖的package包/类
/**
* Create the environment as specified by @Template or
* arq.extension.ce-cube.openshift.template.* properties.
* <p>
* In the future, this might be handled by starting application Cube
* objects, e.g. CreateCube(application), StartCube(application)
* <p>
* Needs to fire before the containers are started.
*/
public void createEnvironment(@Observes(precedence = 10) BeforeClass event, OpenShiftAdapter client,
CECubeConfiguration configuration, OpenShiftClient openshiftClient) throws DeploymentException {
final TestClass testClass = event.getTestClass();
log.info(String.format("Creating environment for %s", testClass.getName()));
OpenShiftResourceFactory.createResources(testClass.getName(), client, null, testClass.getJavaClass(), configuration.getProperties());
processTemplateResources(testClass, client, configuration);
final CubeOpenShiftConfiguration config = (CubeOpenShiftConfiguration) configurationInstance.get();
registerRoutes(config, openshiftClient);
}
示例13: processTemplateResources
import org.jboss.arquillian.container.spi.client.container.DeploymentException; //导入依赖的package包/类
/**
* Instantiates the templates specified by @Template within @TemplateResources
*/
private void processTemplateResources(TestClass testClass, OpenShiftAdapter client, CECubeConfiguration configuration) throws DeploymentException {
List<? extends OpenShiftResource> resources;
final List<List<? extends OpenShiftResource>> RESOURCES = new ArrayList<List<? extends OpenShiftResource>>();
templates = OpenShiftResourceFactory.getTemplates(testClass.getJavaClass());
boolean sync_instantiation = OpenShiftResourceFactory.syncInstantiation(testClass.getJavaClass());
/* Instantiate templates */
for (Template template : templates) {
resources = processTemplate(template, testClass, client, configuration);
if (sync_instantiation) {
/* synchronous template instantiation */
RESOURCES.add(resources);
} else {
/* asynchronous template instantiation */
try {
delay(client, resources);
}
catch (Throwable t) {
throw new DeploymentException("Error waiting for template resources to deploy: " + testClass.getName(), t);
}
}
}
templateDetailsProducer.set(new TemplateDetails() {
@Override
public List<List<? extends OpenShiftResource>> getResources() {
return RESOURCES;
}
});
}
示例14: deploy
import org.jboss.arquillian.container.spi.client.container.DeploymentException; //导入依赖的package包/类
@Override
public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
StartupTimeout startupTimeout = this.testClass.getAnnotation(StartupTimeout.class);
if (startupTimeout != null) {
setTimeout(startupTimeout.value());
}
if (this.testClass.getAnnotation(InVM.class) != null) {
this.delegateContainer = new InVMSimpleContainer(this.testClass);
} else {
this.delegateContainer = new UberjarSimpleContainer(this.testClass);
}
try {
this.delegateContainer
.requestedMavenArtifacts(this.requestedMavenArtifacts)
.start(archive);
// start wants to connect to the remote container, which isn't up until now, so
// we override start above and call it here instead
super.start();
ProtocolMetaData metaData = new ProtocolMetaData();
metaData.addContext(createDeploymentContext(archive.getId()));
return metaData;
} catch (Exception e) {
throw new DeploymentException(e.getMessage(), e);
}
}
示例15: undeploy
import org.jboss.arquillian.container.spi.client.container.DeploymentException; //导入依赖的package包/类
@Override
public void undeploy(Archive<?> archive) throws DeploymentException {
try {
this.delegateContainer.stop();
} catch (Exception e) {
throw new DeploymentException("Unable to stop process", e);
}
}