Permalink
Browse files

AS7-4894 HA Singleton deployer for applications

  • Loading branch information...
1 parent 37ff68f commit 994b12a881a9b2ee8c2ab0229f605a0b8e003ec7 @pferraro committed Oct 25, 2012
Showing with 3,421 additions and 154 deletions.
  1. +10 −6 arquillian/common/src/main/java/org/jboss/as/arquillian/container/ArchiveDeployer.java
  2. +6 −2 arquillian/common/src/main/java/org/jboss/as/arquillian/container/CommonDeployableContainer.java
  3. +40 −0 ...iner-managed/src/main/java/org/jboss/as/arquillian/container/managed/DeployManagedDeployment.java
  4. +71 −0 ...tainer-managed/src/main/java/org/jboss/as/arquillian/container/managed/ManagedClientDeployer.java
  5. +38 −0 ...managed/src/main/java/org/jboss/as/arquillian/container/managed/ManagedClientDeployerCreator.java
  6. +96 −0 ...ged/src/main/java/org/jboss/as/arquillian/container/managed/ManagedContainerDeployController.java
  7. +5 −0 ...er-managed/src/main/java/org/jboss/as/arquillian/container/managed/ManagedContainerExtension.java
  8. +29 −0 ...an/container-managed/src/main/java/org/jboss/as/arquillian/container/managed/ManagedDeployer.java
  9. +41 −0 ...iner-managed/src/main/java/org/jboss/as/arquillian/container/managed/ManagedDeployerProvider.java
  10. +4 −0 build/build.xml
  11. +5 −0 build/pom.xml
  12. +2 −0 build/src/main/resources/configuration/domain/subsystems.xml
  13. +1 −0 build/src/main/resources/configuration/standalone/subsystems-full-ha.xml
  14. +1 −0 build/src/main/resources/configuration/standalone/subsystems-ha.xml
  15. +1 −1 build/src/main/resources/configuration/subsystems/infinispan.xml
  16. +8 −0 build/src/main/resources/configuration/subsystems/singleton-deployment.xml
  17. +10 −0 build/src/main/resources/docs/schema/jboss-as-config_1_4.xsd
  18. +48 −0 build/src/main/resources/docs/schema/jboss-as-singleton-deployment.xsd
  19. +42 −0 build/src/main/resources/modules/org/jboss/as/clustering/singleton/deployment/main/module.xml
  20. +1 −1 build/src/main/resources/modules/org/jboss/as/server/main/module.xml
  21. +1 −0 cli/src/main/java/org/jboss/as/cli/Util.java
  22. +22 −2 cli/src/main/java/org/jboss/as/cli/handlers/DeployHandler.java
  23. +2 −2 cli/src/main/resources/help/deploy.txt
  24. +52 −0 ...tering/common/src/main/java/org/jboss/as/clustering/controller/StringListAttributeMarshaller.java
  25. +39 −0 clustering/common/src/main/java/org/jboss/as/clustering/msc/BatchServiceTargetFactory.java
  26. +94 −0 clustering/common/src/main/java/org/jboss/as/clustering/msc/DelegatingBatchServiceTarget.java
  27. +178 −0 clustering/common/src/main/java/org/jboss/as/clustering/msc/DelegatingServiceBuilder.java
  28. +100 −0 clustering/common/src/main/java/org/jboss/as/clustering/msc/DelegatingServiceContainer.java
  29. +133 −0 clustering/common/src/main/java/org/jboss/as/clustering/msc/DelegatingServiceController.java
  30. +148 −0 clustering/common/src/main/java/org/jboss/as/clustering/msc/DelegatingServiceTarget.java
  31. +39 −0 clustering/common/src/main/java/org/jboss/as/clustering/msc/ServiceBuilderFactory.java
  32. +39 −0 clustering/common/src/main/java/org/jboss/as/clustering/msc/ServiceContainerFactory.java
  33. +5 −27 clustering/common/src/main/java/org/jboss/as/clustering/msc/ServiceContainerHelper.java
  34. +39 −0 clustering/common/src/main/java/org/jboss/as/clustering/msc/ServiceControllerFactory.java
  35. +39 −0 clustering/common/src/main/java/org/jboss/as/clustering/msc/ServiceTargetFactory.java
  36. +1 −8 clustering/impl/src/main/java/org/jboss/as/clustering/impl/ClusterNodeImpl.java
  37. +0 −2 clustering/jgroups/src/main/resources/jgroups-defaults.xml
  38. +1 −0 clustering/pom.xml
  39. +97 −0 clustering/singleton-deployment/pom.xml
  40. +76 −0 ...java/org/jboss/as/clustering/singleton/deployment/SingletonDeploymentUnitPhaseServiceBuilder.java
  41. +64 −0 ...on-deployment/src/main/java/org/jboss/as/clustering/singleton/deployment/subsystem/Attribute.java
  42. +87 −0 .../main/java/org/jboss/as/clustering/singleton/deployment/subsystem/DeploymentPolicyAddHandler.java
  43. +58 −0 ...in/java/org/jboss/as/clustering/singleton/deployment/subsystem/DeploymentPolicyRemoveHandler.java
  44. +75 −0 ...va/org/jboss/as/clustering/singleton/deployment/subsystem/DeploymentPolicyResourceDefinition.java
  45. +62 −0 ...eton-deployment/src/main/java/org/jboss/as/clustering/singleton/deployment/subsystem/Element.java
  46. +34 −0 ...on-deployment/src/main/java/org/jboss/as/clustering/singleton/deployment/subsystem/ModelKeys.java
  47. +64 −0 ...on-deployment/src/main/java/org/jboss/as/clustering/singleton/deployment/subsystem/Namespace.java
  48. +59 −0 ...ain/java/org/jboss/as/clustering/singleton/deployment/subsystem/SingletonDeploymentExtension.java
  49. +36 −0 .../as/clustering/singleton/deployment/subsystem/SingletonDeploymentResourceDescriptionResolver.java
  50. +51 −0 ...rg/jboss/as/clustering/singleton/deployment/subsystem/SingletonDeploymentSubsystemAddHandler.java
  51. +36 −0 .../as/clustering/singleton/deployment/subsystem/SingletonDeploymentSubsystemResourceDefinition.java
  52. +106 −0 ...jboss/as/clustering/singleton/deployment/subsystem/SingletonDeploymentSubsystemXMLReader_1_0.java
  53. +62 −0 ...org/jboss/as/clustering/singleton/deployment/subsystem/SingletonDeploymentSubsystemXMLWriter.java
  54. +23 −0 ...ering/singleton-deployment/src/main/resources/META-INF/services/org.jboss.as.controller.Extension
  55. +11 −0 ...ain/resources/org/jboss/as/clustering/singleton/deployment/subsystem/LocalDescriptions.properties
  56. +41 −0 ...java/org/jboss/as/clustering/singleton/deployment/subsystem/SingletonDeploymentSubsystemTest.java
  57. +4 −0 clustering/singleton-deployment/src/test/resources/subsystem-singleton-deployment.xml
  58. +7 −0 clustering/singleton/src/main/java/org/jboss/as/clustering/singleton/SingletonLogger.java
  59. +72 −33 clustering/singleton/src/main/java/org/jboss/as/clustering/singleton/SingletonService.java
  60. +15 −0 clustering/singleton/src/main/java/org/jboss/as/clustering/singleton/election/NamePreference.java
  61. +15 −0 ...g/singleton/src/main/java/org/jboss/as/clustering/singleton/election/SocketAddressPreference.java
  62. +1 −1 controller-client/src/main/java/org/jboss/as/controller/client/helpers/ClientConstants.java
  63. +9 −0 ...-client/src/main/java/org/jboss/as/controller/client/helpers/domain/AddDeploymentPlanBuilder.java
  64. +9 −0 ...ler-client/src/main/java/org/jboss/as/controller/client/helpers/domain/DeploymentPlanBuilder.java
  65. +6 −1 ...rc/main/java/org/jboss/as/controller/client/helpers/domain/impl/AddDeploymentPlanBuilderImpl.java
  66. +14 −9 ...client/src/main/java/org/jboss/as/controller/client/helpers/domain/impl/DeploymentActionImpl.java
  67. +6 −1 ...t/src/main/java/org/jboss/as/controller/client/helpers/domain/impl/DeploymentPlanBuilderImpl.java
  68. +9 −1 ...ent/src/main/java/org/jboss/as/controller/client/helpers/standalone/AddDeploymentPlanBuilder.java
  69. +9 −0 ...client/src/main/java/org/jboss/as/controller/client/helpers/standalone/DeploymentPlanBuilder.java
  70. +5 −1 ...lient/src/main/java/org/jboss/as/controller/client/helpers/standalone/ServerDeploymentHelper.java
  71. +5 −0 .../java/org/jboss/as/controller/client/helpers/standalone/impl/AbstractServerDeploymentManager.java
  72. +15 −9 ...nt/src/main/java/org/jboss/as/controller/client/helpers/standalone/impl/DeploymentActionImpl.java
  73. +12 −3 ...c/main/java/org/jboss/as/controller/client/helpers/standalone/impl/DeploymentPlanBuilderImpl.java
  74. +1 −0 controller/src/main/java/org/jboss/as/controller/descriptions/ModelDescriptionConstants.java
  75. +1 −0 controller/src/main/java/org/jboss/as/controller/parsing/Attribute.java
  76. +1 −1 host-controller/src/main/java/org/jboss/as/host/controller/parsing/DomainXml.java
  77. +6 −0 pom.xml
  78. +3 −0 server/src/main/java/org/jboss/as/server/ApplicationServerService.java
  79. +4 −0 server/src/main/java/org/jboss/as/server/ServerLogger.java
  80. +2 −0 server/src/main/java/org/jboss/as/server/ServerMessages.java
  81. +12 −8 server/src/main/java/org/jboss/as/server/controller/resources/DeploymentAttributes.java
  82. +6 −0 server/src/main/java/org/jboss/as/server/deployment/AbstractDeploymentUnitService.java
  83. +5 −0 server/src/main/java/org/jboss/as/server/deployment/Attachments.java
  84. +55 −0 server/src/main/java/org/jboss/as/server/deployment/DefaultDeploymentUnitPhaseServiceBuilder.java
  85. +4 −1 server/src/main/java/org/jboss/as/server/deployment/DeploymentAddHandler.java
  86. +7 −1 server/src/main/java/org/jboss/as/server/deployment/DeploymentDeployHandler.java
  87. +4 −2 server/src/main/java/org/jboss/as/server/deployment/DeploymentFullReplaceHandler.java
  88. +36 −17 server/src/main/java/org/jboss/as/server/deployment/DeploymentHandlerUtil.java
  89. +4 −1 server/src/main/java/org/jboss/as/server/deployment/DeploymentRedeployHandler.java
  90. +12 −3 server/src/main/java/org/jboss/as/server/deployment/DeploymentRemoveHandler.java
  91. +8 −2 server/src/main/java/org/jboss/as/server/deployment/DeploymentReplaceHandler.java
  92. +1 −2 server/src/main/java/org/jboss/as/server/deployment/DeploymentUnitPhaseService.java
  93. +36 −0 server/src/main/java/org/jboss/as/server/deployment/DeploymentUnitPhaseServiceBuilder.java
  94. +14 −0 server/src/main/java/org/jboss/as/server/deployment/Services.java
  95. +1 −0 server/src/main/java/org/jboss/as/server/deployment/SubDeploymentProcessor.java
  96. +9 −0 server/src/main/java/org/jboss/as/server/parsing/CommonXml.java
  97. +2 −1 server/src/main/java/org/jboss/as/server/parsing/StandaloneXml.java
  98. +122 −0 testsuite/integration/clust/src/test/java/org/jboss/as/test/clustering/ServiceListenerServlet.java
  99. +135 −0 ...suite/integration/clust/src/test/java/org/jboss/as/test/clustering/ViewChangeListenerServlet.java
  100. +266 −0 ...t/java/org/jboss/as/test/clustering/cluster/singleton/deployment/SingletonDeploymentTestCase.java
  101. +16 −3 testsuite/integration/clust/src/test/java/org/jboss/as/test/clustering/single/web/SimpleServlet.java
  102. +2 −2 ...src/test/java/org/jboss/as/test/smoke/deployment/rar/tests/redeployment/ReDeploymentTestCase.java
@@ -43,11 +43,15 @@ public ArchiveDeployer(ModelControllerClient modelControllerClient) {
}
public String deploy(Archive<?> archive) throws DeploymentException {
- return deployInternal(archive);
+ return this.deploy(archive, null);
+ }
+
+ public String deploy(Archive<?> archive, String policy) throws DeploymentException {
+ return deployInternal(archive, policy);
}
public String deploy(String name, InputStream input) throws DeploymentException {
- return deployInternal(name, input);
+ return deployInternal(name, null, input);
}
public void undeploy(String runtimeName) throws DeploymentException {
@@ -58,10 +62,10 @@ public void undeploy(String runtimeName) throws DeploymentException {
}
}
- private String deployInternal(Archive<?> archive) throws DeploymentException {
+ private String deployInternal(Archive<?> archive, String policy) throws DeploymentException {
final InputStream input = archive.as(ZipExporter.class).exportAsInputStream();
try {
- return deployInternal(archive.getName(), input);
+ return deployInternal(archive.getName(), policy, input);
} finally {
if (input != null)
try {
@@ -72,9 +76,9 @@ private String deployInternal(Archive<?> archive) throws DeploymentException {
}
}
- private String deployInternal(String name, InputStream input) throws DeploymentException {
+ private String deployInternal(String name, String policy, InputStream input) throws DeploymentException {
try {
- return deployer.deploy(name, input);
+ return deployer.deploy(name, policy, input);
} catch (Exception ex) {
Throwable rootCause = ex.getCause();
while (null != rootCause && rootCause.getCause() != null) {
@@ -139,10 +139,14 @@ protected ModelControllerClient getModelControllerClient() {
return getManagementClient().getControllerClient();
}
+ public ProtocolMetaData deploy(Archive<?> archive, String policy) throws DeploymentException {
+ String runtimeName = archiveDeployer.get().deploy(archive, policy);
+ return getManagementClient().getProtocolMetaData(runtimeName);
+ }
+
@Override
public ProtocolMetaData deploy(Archive<?> archive) throws DeploymentException {
- String runtimeName = archiveDeployer.get().deploy(archive);
- return getManagementClient().getProtocolMetaData(runtimeName);
+ return this.deploy(archive, null);
}
@Override
@@ -0,0 +1,40 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.as.arquillian.container.managed;
+
+import org.jboss.arquillian.container.spi.Container;
+import org.jboss.arquillian.container.spi.client.deployment.Deployment;
+import org.jboss.arquillian.container.spi.event.DeploymentEvent;
+import org.jboss.as.arquillian.container.CommonDeployableContainer;
+
+public class DeployManagedDeployment extends DeploymentEvent {
+ private final String policy;
+
+ public DeployManagedDeployment(Container container, Deployment deployment, String policy) {
+ super(container, deployment);
+ this.policy = policy;
+ }
+
+ @Override
+ public CommonDeployableContainer<?> getDeployableContainer() {
+ return (CommonDeployableContainer<?>) super.getDeployableContainer();
+ }
+
+ public String getDeploymentPolicy() {
+ return this.policy;
+ }
+}
@@ -0,0 +1,71 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.as.arquillian.container.managed;
+
+import org.jboss.arquillian.container.spi.Container;
+import org.jboss.arquillian.container.spi.Container.State;
+import org.jboss.arquillian.container.spi.ContainerRegistry;
+import org.jboss.arquillian.container.spi.client.deployment.Deployment;
+import org.jboss.arquillian.container.spi.client.deployment.DeploymentScenario;
+import org.jboss.arquillian.container.spi.client.deployment.DeploymentTargetDescription;
+import org.jboss.arquillian.container.spi.event.DeploymentEvent;
+import org.jboss.arquillian.container.test.impl.client.deployment.ClientDeployer;
+import org.jboss.arquillian.core.api.Event;
+import org.jboss.arquillian.core.api.Instance;
+import org.jboss.arquillian.core.api.annotation.Inject;
+
+public class ManagedClientDeployer extends ClientDeployer implements ManagedDeployer {
+ @Inject
+ private Event<DeploymentEvent> event;
+
+ @Inject
+ private Instance<ContainerRegistry> containerRegistry;
+
+ @Inject
+ private Instance<DeploymentScenario> deploymentScenario;
+
+ @Override
+ public void deploy(String name, String policy) {
+ DeploymentScenario scenario = deploymentScenario.get();
+ if (scenario == null) {
+ throw new IllegalArgumentException("No deployment scenario in context");
+ }
+ ContainerRegistry registry = containerRegistry.get();
+ if (registry == null) {
+ throw new IllegalArgumentException("No container registry in context");
+ }
+
+ Deployment deployment = scenario.deployment(new DeploymentTargetDescription(name));
+ if (deployment == null) {
+ throw new IllegalArgumentException("No deployment in context found with name " + name);
+ }
+
+ if (deployment.getDescription().managed()) {
+ throw new IllegalArgumentException("Could not deploy " + name
+ + " deployment. The deployment is controlled by Arquillian");
+ }
+
+ Container container = registry.getContainer(deployment.getDescription().getTarget());
+
+ if (!container.getState().equals(State.STARTED)) {
+ throw new IllegalArgumentException("Deployment with name " + name + " could not be deployed. Container "
+ + container.getName() + " must be started first.");
+ }
+
+ event.fire(new DeployManagedDeployment(container, deployment, policy));
+ }
+}
@@ -0,0 +1,38 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.as.arquillian.container.managed;
+
+import org.jboss.arquillian.core.api.Injector;
+import org.jboss.arquillian.core.api.Instance;
+import org.jboss.arquillian.core.api.InstanceProducer;
+import org.jboss.arquillian.core.api.annotation.ApplicationScoped;
+import org.jboss.arquillian.core.api.annotation.Inject;
+import org.jboss.arquillian.core.api.annotation.Observes;
+import org.jboss.arquillian.test.spi.event.suite.BeforeSuite;
+
+public class ManagedClientDeployerCreator {
+
+ @Inject @ApplicationScoped
+ private InstanceProducer<ManagedDeployer> deployer;
+
+ @Inject
+ private Instance<Injector> injector;
+
+ public void createClientSideDeployer(@Observes BeforeSuite event) {
+ deployer.set(injector.get().inject(new ManagedClientDeployer()));
+ }
+}
@@ -0,0 +1,96 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.as.arquillian.container.managed;
+
+import java.util.concurrent.Callable;
+
+import org.jboss.arquillian.container.spi.client.deployment.Deployment;
+import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription;
+import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData;
+import org.jboss.arquillian.container.spi.context.annotation.DeploymentScoped;
+import org.jboss.arquillian.container.spi.event.container.AfterDeploy;
+import org.jboss.arquillian.container.spi.event.container.BeforeDeploy;
+import org.jboss.arquillian.container.spi.event.container.DeployerEvent;
+import org.jboss.arquillian.core.api.Event;
+import org.jboss.arquillian.core.api.Injector;
+import org.jboss.arquillian.core.api.Instance;
+import org.jboss.arquillian.core.api.InstanceProducer;
+import org.jboss.arquillian.core.api.annotation.Inject;
+import org.jboss.arquillian.core.api.annotation.Observes;
+import org.jboss.as.arquillian.container.CommonDeployableContainer;
+
+public class ManagedContainerDeployController {
+ @Inject
+ private Instance<Injector> injector;
+
+ public void deploy(@Observes final DeployManagedDeployment event) throws Exception {
+ executeOperation(new Callable<Void>() {
+ @Inject
+ private Event<DeployerEvent> deployEvent;
+
+ @Inject
+ @DeploymentScoped
+ private InstanceProducer<DeploymentDescription> deploymentDescriptionProducer;
+
+ @Inject
+ @DeploymentScoped
+ private InstanceProducer<Deployment> deploymentProducer;
+
+ @Inject
+ @DeploymentScoped
+ private InstanceProducer<ProtocolMetaData> protocolMetadata;
+
+ @Override
+ public Void call() throws Exception {
+ CommonDeployableContainer<?> deployableContainer = event.getDeployableContainer();
+ Deployment deployment = event.getDeployment();
+ DeploymentDescription deploymentDescription = deployment.getDescription();
+ String policy = event.getDeploymentPolicy();
+ /*
+ * TODO: should the DeploymentDescription producer some how be automatically registered ? Or should we just
+ * 'know' who is the first one to create the context
+ */
+ deploymentDescriptionProducer.set(deploymentDescription);
+ deploymentProducer.set(deployment);
+
+ deployEvent.fire(new BeforeDeploy(deployableContainer, deploymentDescription));
+
+ try {
+ if (deploymentDescription.isArchiveDeployment()) {
+ protocolMetadata
+ .set(deployableContainer.deploy(deploymentDescription.getTestableArchive() != null ? deploymentDescription
+ .getTestableArchive() : deploymentDescription.getArchive(), policy));
+ } else {
+ deployableContainer.deploy(deploymentDescription.getDescriptor());
+ }
+ deployment.deployed();
+ } catch (Exception e) {
+ deployment.deployedWithError(e);
+ throw e;
+ }
+
+ deployEvent.fire(new AfterDeploy(deployableContainer, deploymentDescription));
+ return null;
+ }
+ });
+ }
+
+ private void executeOperation(Callable<Void> operation) throws Exception {
+ injector.get().inject(operation);
+ operation.call();
+ }
+}
@@ -17,6 +17,8 @@
package org.jboss.as.arquillian.container.managed;
import org.jboss.arquillian.container.spi.client.container.DeployableContainer;
+import org.jboss.arquillian.container.test.impl.enricher.resource.DeployerProvider;
+import org.jboss.arquillian.test.spi.enricher.resource.ResourceProvider;
import org.jboss.as.arquillian.container.CommonContainerExtension;
/**
@@ -32,5 +34,8 @@
public void register(ExtensionBuilder builder) {
super.register(builder);
builder.service(DeployableContainer.class, ManagedDeployableContainer.class);
+ builder.override(ResourceProvider.class, DeployerProvider.class, ManagedDeployerProvider.class);
+ builder.observer(ManagedClientDeployerCreator.class);
+ builder.observer(ManagedContainerDeployController.class);
}
}
@@ -0,0 +1,29 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.as.arquillian.container.managed;
+
+import org.jboss.arquillian.container.test.api.Deployer;
+
+public interface ManagedDeployer extends Deployer {
+ /**
+ * Deploy the named deployment using the specified policy.<br/>
+ * The operation will block until deploy is complete.
+ * @param name The name of the deployment
+ * @param policy the deployment policy.
+ */
+ void deploy(String name, String policy);
+}
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jboss.as.arquillian.container.managed;
+
+import java.lang.annotation.Annotation;
+
+import org.jboss.arquillian.container.test.api.Deployer;
+import org.jboss.arquillian.core.api.Instance;
+import org.jboss.arquillian.core.api.annotation.Inject;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.arquillian.test.spi.enricher.resource.ResourceProvider;
+
+public class ManagedDeployerProvider implements ResourceProvider {
+ @Inject
+ private Instance<ManagedDeployer> deployer;
+
+ @Override
+ public Object lookup(ArquillianResource resource, Annotation... qualifiers)
+ {
+ return deployer.get();
+ }
+
+ @Override
+ public boolean canProvide(Class<?> type) {
+ return Deployer.class.isAssignableFrom(type);
+ }
+}
Oops, something went wrong.

0 comments on commit 994b12a

Please sign in to comment.