diff --git a/pom.xml b/pom.xml index 6731949a..1ba660dc 100644 --- a/pom.xml +++ b/pom.xml @@ -265,5 +265,8 @@ tomcat-managed-parent tomcat-managed-common tomcat-managed-10 + tomcat-remote-parent + tomcat-remote-common + tomcat-remote-10 diff --git a/tomcat-common/src/test/java/org/jboss/arquillian/container/tomcat/test/TestDeploymentFactory.java b/tomcat-common/src/test/java/org/jboss/arquillian/container/tomcat/test/TestDeploymentFactory.java index 74819864..898ccaa3 100644 --- a/tomcat-common/src/test/java/org/jboss/arquillian/container/tomcat/test/TestDeploymentFactory.java +++ b/tomcat-common/src/test/java/org/jboss/arquillian/container/tomcat/test/TestDeploymentFactory.java @@ -27,7 +27,7 @@ public final class TestDeploymentFactory { public static final String TEST_WELCOME_FILE = "index.jsp"; - public static final String SERVLET_5 = "5.0"; + public static final String SERVLET_5_0 = "5.0"; public static final String ROOT_CONTEXT = "ROOT"; diff --git a/tomcat-embedded-10/src/test/java/org/jboss/arquillian/container/tomcat/embedded/Tomcat10EmbeddedClientIT.java b/tomcat-embedded-10/src/test/java/org/jboss/arquillian/container/tomcat/embedded/Tomcat10EmbeddedClientIT.java index 9dd4c36d..54fe3f55 100755 --- a/tomcat-embedded-10/src/test/java/org/jboss/arquillian/container/tomcat/embedded/Tomcat10EmbeddedClientIT.java +++ b/tomcat-embedded-10/src/test/java/org/jboss/arquillian/container/tomcat/embedded/Tomcat10EmbeddedClientIT.java @@ -17,7 +17,7 @@ package org.jboss.arquillian.container.tomcat.embedded; import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.ROOT_CONTEXT; -import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.SERVLET_5; +import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.SERVLET_5_0; import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.TEST_CONTEXT; import org.jboss.arquillian.container.test.api.Deployment; @@ -39,12 +39,12 @@ public class Tomcat10EmbeddedClientIT extends TomcatClientITBase { @Deployment(name = ROOT_CONTEXT, testable = false) public static WebArchive createRootDeployment() { - return TEST_DEPLOYMENT_FACTORY.createWebAppClientDeployment(ROOT_CONTEXT, SERVLET_5); + return TEST_DEPLOYMENT_FACTORY.createWebAppClientDeployment(ROOT_CONTEXT, SERVLET_5_0); } @Deployment(name = TEST_CONTEXT, testable = false) public static WebArchive createTestDeployment() { - return TEST_DEPLOYMENT_FACTORY.createWebAppClientDeployment(TEST_CONTEXT, SERVLET_5); + return TEST_DEPLOYMENT_FACTORY.createWebAppClientDeployment(TEST_CONTEXT, SERVLET_5_0); } } diff --git a/tomcat-embedded-10/src/test/java/org/jboss/arquillian/container/tomcat/embedded/Tomcat10EmbeddedInContainerIT.java b/tomcat-embedded-10/src/test/java/org/jboss/arquillian/container/tomcat/embedded/Tomcat10EmbeddedInContainerIT.java index d3bc7112..fc21e909 100644 --- a/tomcat-embedded-10/src/test/java/org/jboss/arquillian/container/tomcat/embedded/Tomcat10EmbeddedInContainerIT.java +++ b/tomcat-embedded-10/src/test/java/org/jboss/arquillian/container/tomcat/embedded/Tomcat10EmbeddedInContainerIT.java @@ -17,7 +17,7 @@ package org.jboss.arquillian.container.tomcat.embedded; import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.ROOT_CONTEXT; -import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.SERVLET_5; +import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.SERVLET_5_0; import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.TEST_CONTEXT; import org.jboss.arquillian.container.test.api.Deployment; @@ -35,12 +35,12 @@ public class Tomcat10EmbeddedInContainerIT extends TomcatInContainerITBase { @Deployment(name = ROOT_CONTEXT) public static WebArchive createRootDeployment() { - return TEST_DEPLOYMENT_FACTORY.createWebAppInContainerDeployment(ROOT_CONTEXT, SERVLET_5); + return TEST_DEPLOYMENT_FACTORY.createWebAppInContainerDeployment(ROOT_CONTEXT, SERVLET_5_0); } @Deployment(name = TEST_CONTEXT) public static WebArchive createTestDeployment() { - return TEST_DEPLOYMENT_FACTORY.createWebAppInContainerDeployment(TEST_CONTEXT, SERVLET_5); + return TEST_DEPLOYMENT_FACTORY.createWebAppInContainerDeployment(TEST_CONTEXT, SERVLET_5_0); } } diff --git a/tomcat-managed-10/src/test/java/org/jboss/arquillian/container/tomcat/managed/Tomcat10ManagedClientIT.java b/tomcat-managed-10/src/test/java/org/jboss/arquillian/container/tomcat/managed/Tomcat10ManagedClientIT.java index 61c0694b..975d4db5 100755 --- a/tomcat-managed-10/src/test/java/org/jboss/arquillian/container/tomcat/managed/Tomcat10ManagedClientIT.java +++ b/tomcat-managed-10/src/test/java/org/jboss/arquillian/container/tomcat/managed/Tomcat10ManagedClientIT.java @@ -17,7 +17,7 @@ package org.jboss.arquillian.container.tomcat.managed; import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.ROOT_CONTEXT; -import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.SERVLET_5; +import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.SERVLET_5_0; import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.TEST_CONTEXT; import org.jboss.arquillian.container.test.api.Deployment; @@ -40,12 +40,12 @@ public class Tomcat10ManagedClientIT extends TomcatClientITBase { @Deployment(name = ROOT_CONTEXT, testable = false) public static WebArchive createRootDeployment() { - return TEST_DEPLOYMENT_FACTORY.createWebAppClientDeployment(ROOT_CONTEXT, SERVLET_5); + return TEST_DEPLOYMENT_FACTORY.createWebAppClientDeployment(ROOT_CONTEXT, SERVLET_5_0); } @Deployment(name = TEST_CONTEXT, testable = false) public static WebArchive createTestDeployment() { - return TEST_DEPLOYMENT_FACTORY.createWebAppClientDeployment(TEST_CONTEXT, SERVLET_5); + return TEST_DEPLOYMENT_FACTORY.createWebAppClientDeployment(TEST_CONTEXT, SERVLET_5_0); } } diff --git a/tomcat-managed-10/src/test/java/org/jboss/arquillian/container/tomcat/managed/Tomcat10ManagedInContainerIT.java b/tomcat-managed-10/src/test/java/org/jboss/arquillian/container/tomcat/managed/Tomcat10ManagedInContainerIT.java index c500139e..abaf06bc 100755 --- a/tomcat-managed-10/src/test/java/org/jboss/arquillian/container/tomcat/managed/Tomcat10ManagedInContainerIT.java +++ b/tomcat-managed-10/src/test/java/org/jboss/arquillian/container/tomcat/managed/Tomcat10ManagedInContainerIT.java @@ -17,7 +17,7 @@ package org.jboss.arquillian.container.tomcat.managed; import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.ROOT_CONTEXT; -import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.SERVLET_5; +import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.SERVLET_5_0; import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.TEST_CONTEXT; import org.jboss.arquillian.container.test.api.Deployment; @@ -38,12 +38,12 @@ public class Tomcat10ManagedInContainerIT extends TomcatInContainerITBase { @Deployment(name = ROOT_CONTEXT) public static WebArchive createRootDeployment() { - return TEST_DEPLOYMENT_FACTORY.createWebAppInContainerDeployment(ROOT_CONTEXT, SERVLET_5); + return TEST_DEPLOYMENT_FACTORY.createWebAppInContainerDeployment(ROOT_CONTEXT, SERVLET_5_0); } @Deployment(name = TEST_CONTEXT) public static WebArchive createTestDeployment() { - return TEST_DEPLOYMENT_FACTORY.createWebAppInContainerDeployment(TEST_CONTEXT, SERVLET_5); + return TEST_DEPLOYMENT_FACTORY.createWebAppInContainerDeployment(TEST_CONTEXT, SERVLET_5_0); } } diff --git a/tomcat-remote-10/pom.xml b/tomcat-remote-10/pom.xml new file mode 100755 index 00000000..314a3e2d --- /dev/null +++ b/tomcat-remote-10/pom.xml @@ -0,0 +1,37 @@ + + + + 4.0.0 + + + org.jboss.arquillian.container + arquillian-tomcat-remote-parent + 1.2.1-SNAPSHOT + ../tomcat-remote-parent/pom.xml + + + arquillian-tomcat-remote-10 + Arquillian Tomcat Remote 10.x Container + + + 10 + ${tomcat.major.version}.1.19 + + + + + + org.codehaus.cargo + cargo-maven2-plugin + + + tomcat${tomcat.major.version}x + + https://archive.apache.org/dist/tomcat/tomcat-${tomcat.major.version}/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip + + + + + + + diff --git a/tomcat-remote-10/src/main/java/org/jboss/arquillian/container/tomcat/remote/Tomcat10RemoteContainer.java b/tomcat-remote-10/src/main/java/org/jboss/arquillian/container/tomcat/remote/Tomcat10RemoteContainer.java new file mode 100755 index 00000000..8eda058a --- /dev/null +++ b/tomcat-remote-10/src/main/java/org/jboss/arquillian/container/tomcat/remote/Tomcat10RemoteContainer.java @@ -0,0 +1,35 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2014, 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.arquillian.container.tomcat.remote; + +import org.jboss.arquillian.container.spi.client.container.DeployableContainer; +import org.jboss.arquillian.container.spi.client.protocol.ProtocolDescription; +import org.jboss.arquillian.container.tomcat.Tomcat7ManagerCommandSpec; + +/** + * Arquillian {@link DeployableContainer} implementation for a remote Tomcat server; responsible for both deployment + * operations. + * + * @author Karel Piwko + * @author Ondrej Zizka + */ +public class Tomcat10RemoteContainer extends TomcatRemoteContainer { + + public Tomcat10RemoteContainer() { + super(new ProtocolDescription("Servlet 5.0"), new Tomcat7ManagerCommandSpec()); + } +} diff --git a/tomcat-remote-10/src/main/java/org/jboss/arquillian/container/tomcat/remote/Tomcat10RemoteExtension.java b/tomcat-remote-10/src/main/java/org/jboss/arquillian/container/tomcat/remote/Tomcat10RemoteExtension.java new file mode 100644 index 00000000..cb0bda11 --- /dev/null +++ b/tomcat-remote-10/src/main/java/org/jboss/arquillian/container/tomcat/remote/Tomcat10RemoteExtension.java @@ -0,0 +1,32 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2011 Red Hat Inc. and/or its affiliates and other contributors + * as indicated by the @authors tag. All rights reserved. + * 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.arquillian.container.tomcat.remote; + +import org.jboss.arquillian.container.spi.client.container.DeployableContainer; +import org.jboss.arquillian.core.spi.LoadableExtension; + +/** + * @author Aslak Knutsen + */ +public class Tomcat10RemoteExtension implements LoadableExtension { + + @Override + public void register(final ExtensionBuilder builder) { + builder.service(DeployableContainer.class, Tomcat10RemoteContainer.class); + } +} diff --git a/tomcat-remote-10/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension b/tomcat-remote-10/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension new file mode 100755 index 00000000..72dda104 --- /dev/null +++ b/tomcat-remote-10/src/main/resources/META-INF/services/org.jboss.arquillian.core.spi.LoadableExtension @@ -0,0 +1 @@ +org.jboss.arquillian.container.tomcat.remote.Tomcat10RemoteExtension diff --git a/tomcat-remote-10/src/test/java/org/jboss/arquillian/container/tomcat/remote/Tomcat10RemoteClientIT.java b/tomcat-remote-10/src/test/java/org/jboss/arquillian/container/tomcat/remote/Tomcat10RemoteClientIT.java new file mode 100755 index 00000000..54b41e39 --- /dev/null +++ b/tomcat-remote-10/src/test/java/org/jboss/arquillian/container/tomcat/remote/Tomcat10RemoteClientIT.java @@ -0,0 +1,45 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, 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.arquillian.container.tomcat.remote; + +import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.*; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.tomcat.test.TomcatClientITBase; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.runner.RunWith; + +/** + * Tests that Tomcat deployments into the Tomcat server work through the Arquillian lifecycle + * + * @author Jean Deruelle + * @author Dan Allen + */ +@RunWith(Arquillian.class) +public class Tomcat10RemoteClientIT extends TomcatClientITBase { + + @Deployment(name = ROOT_CONTEXT, testable = false) + public static WebArchive createRootDeployment() { + return TEST_DEPLOYMENT_FACTORY.createWebAppClientDeployment(ROOT_CONTEXT, SERVLET_5_0); + } + + @Deployment(name = TEST_CONTEXT, testable = false) + public static WebArchive createTestDeployment() { + return TEST_DEPLOYMENT_FACTORY.createWebAppClientDeployment(TEST_CONTEXT, SERVLET_5_0); + } +} diff --git a/tomcat-remote-10/src/test/java/org/jboss/arquillian/container/tomcat/remote/Tomcat10RemoteInContainerIT.java b/tomcat-remote-10/src/test/java/org/jboss/arquillian/container/tomcat/remote/Tomcat10RemoteInContainerIT.java new file mode 100644 index 00000000..296c6959 --- /dev/null +++ b/tomcat-remote-10/src/test/java/org/jboss/arquillian/container/tomcat/remote/Tomcat10RemoteInContainerIT.java @@ -0,0 +1,44 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2010, 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.arquillian.container.tomcat.remote; + +import static org.jboss.arquillian.container.tomcat.test.TestDeploymentFactory.*; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.tomcat.test.TomcatInContainerITBase; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.shrinkwrap.api.spec.WebArchive; +import org.junit.runner.RunWith; + +/** + * Tests that Tomcat deployments into the Tomcat server work through the Arquillian lifecycle + * + * @author Dan Allen + */ +@RunWith(Arquillian.class) +public class Tomcat10RemoteInContainerIT extends TomcatInContainerITBase { + + @Deployment(name = ROOT_CONTEXT) + public static WebArchive createRootDeployment() { + return TEST_DEPLOYMENT_FACTORY.createWebAppInContainerDeployment(ROOT_CONTEXT, SERVLET_5_0); + } + + @Deployment(name = TEST_CONTEXT) + public static WebArchive createTestDeployment() { + return TEST_DEPLOYMENT_FACTORY.createWebAppInContainerDeployment(TEST_CONTEXT, SERVLET_5_0); + } +} diff --git a/tomcat-remote-10/src/test/resources/arquillian.xml b/tomcat-remote-10/src/test/resources/arquillian.xml new file mode 100755 index 00000000..4eb47cd5 --- /dev/null +++ b/tomcat-remote-10/src/test/resources/arquillian.xml @@ -0,0 +1,13 @@ + + + + + + ${test.jmx.port} + ${test.http.port} + ${test.manager.username} + ${test.manager.password} + + + \ No newline at end of file diff --git a/tomcat-remote-10/src/test/resources/tomcat-users.xml b/tomcat-remote-10/src/test/resources/tomcat-users.xml new file mode 100644 index 00000000..79183836 --- /dev/null +++ b/tomcat-remote-10/src/test/resources/tomcat-users.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/tomcat-remote-common/pom.xml b/tomcat-remote-common/pom.xml new file mode 100644 index 00000000..e4ccd340 --- /dev/null +++ b/tomcat-remote-common/pom.xml @@ -0,0 +1,52 @@ + + + + 4.0.0 + + + org.jboss.arquillian.container + arquillian-parent-tomcat + 1.2.1-SNAPSHOT + + + arquillian-tomcat-remote-common + Arquillian Tomcat Remote Container Common + + + + + + + org.jboss.arquillian.container + arquillian-tomcat-common + ${project.version} + + + + + + org.jboss.arquillian.container + arquillian-tomcat-common + ${project.version} + test-jar + test + + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + test-jar + + + + + + + diff --git a/tomcat-remote-common/src/main/java/org/jboss/arquillian/container/tomcat/remote/TomcatRemoteConfiguration.java b/tomcat-remote-common/src/main/java/org/jboss/arquillian/container/tomcat/remote/TomcatRemoteConfiguration.java new file mode 100755 index 00000000..9ec0cb4c --- /dev/null +++ b/tomcat-remote-common/src/main/java/org/jboss/arquillian/container/tomcat/remote/TomcatRemoteConfiguration.java @@ -0,0 +1,35 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2009, 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.arquillian.container.tomcat.remote; + +import org.jboss.arquillian.container.spi.ConfigurationException; +import org.jboss.arquillian.container.tomcat.TomcatConfiguration; + +/** + * Arquillian Tomcat Container Configuration + * + * @author Karel Piwko + * @author Ondrej Zizka + */ +public class TomcatRemoteConfiguration extends TomcatConfiguration { + + @Override + public void validate() throws ConfigurationException { + super.validate(); + } + +} diff --git a/tomcat-remote-common/src/main/java/org/jboss/arquillian/container/tomcat/remote/TomcatRemoteContainer.java b/tomcat-remote-common/src/main/java/org/jboss/arquillian/container/tomcat/remote/TomcatRemoteContainer.java new file mode 100755 index 00000000..0d5851dd --- /dev/null +++ b/tomcat-remote-common/src/main/java/org/jboss/arquillian/container/tomcat/remote/TomcatRemoteContainer.java @@ -0,0 +1,127 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2014, 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.arquillian.container.tomcat.remote; + +import java.io.IOException; +import java.net.URL; + +import org.jboss.arquillian.container.spi.client.container.DeployableContainer; +import org.jboss.arquillian.container.spi.client.container.DeploymentException; +import org.jboss.arquillian.container.spi.client.container.LifecycleException; +import org.jboss.arquillian.container.spi.client.deployment.Validate; +import org.jboss.arquillian.container.spi.client.protocol.ProtocolDescription; +import org.jboss.arquillian.container.spi.client.protocol.metadata.ProtocolMetaData; +import org.jboss.arquillian.container.tomcat.ProtocolMetadataParser; +import org.jboss.arquillian.container.tomcat.ShrinkWrapUtil; +import org.jboss.arquillian.container.tomcat.TomcatManager; +import org.jboss.arquillian.container.tomcat.TomcatManagerCommandSpec; +import org.jboss.shrinkwrap.api.Archive; +import org.jboss.shrinkwrap.descriptor.api.Descriptor; + +/** + * Arquillian {@link DeployableContainer} implementation for a remote Tomcat server; responsible for both deployment + * operations. + * + * @author Karel Piwko + * @author Ondrej Zizka + */ +abstract class TomcatRemoteContainer implements DeployableContainer { + + private final ProtocolDescription protocolDescription; + + private final TomcatManagerCommandSpec tomcatManagerCommandSpec; + + private TomcatRemoteConfiguration configuration; + + private TomcatManager manager; + + TomcatRemoteContainer(final ProtocolDescription protocolDescription, final TomcatManagerCommandSpec tomcatManagerCommandSpec) { + this.protocolDescription = protocolDescription; + this.tomcatManagerCommandSpec = tomcatManagerCommandSpec; + } + + @Override + public Class getConfigurationClass() { + return TomcatRemoteConfiguration.class; + } + + @Override + public ProtocolDescription getDefaultProtocol() { + + return protocolDescription; + } + + @Override + public void setup(final TomcatRemoteConfiguration configuration) { + this.configuration = configuration; + this.manager = new TomcatManager<>(configuration, tomcatManagerCommandSpec); + } + + @Override + public void start() throws LifecycleException { + // no-op + } + + @Override + public void stop() throws LifecycleException { + // no-op + } + + @Override + public void deploy(final Descriptor descriptor) throws DeploymentException { + throw new UnsupportedOperationException("Not implemented"); + } + + @Override + public void undeploy(final Descriptor descriptor) throws DeploymentException { + throw new UnsupportedOperationException("Not implemented"); + } + + /** + * Deploys to remote Tomcat using its /manager web-app's org.apache.catalina.manager.ManagerServlet. + * + * @throws DeploymentException if unable to deploy an archive. + */ + @Override + public ProtocolMetaData deploy(final Archive archive) throws DeploymentException { + Validate.notNull(archive, "Archive must not be null"); + + final String archiveName = manager.normalizeArchiveName(archive.getName()); + final URL archiveURL = ShrinkWrapUtil.toURL(archive); + try { + manager.deploy("/" + archiveName, archiveURL); + } catch (final IOException e) { + throw new DeploymentException("Unable to deploy an archive " + archive.getName(), e); + } + + final ProtocolMetadataParser parser = new ProtocolMetadataParser<>(configuration); + + return parser.retrieveContextServletInfo(archiveName); + } + + @Override + public void undeploy(final Archive archive) throws DeploymentException { + Validate.notNull(archive, "Archive must not be null"); + + final String archiveName = manager.normalizeArchiveName(archive.getName()); + try { + manager.undeploy("/" + archiveName); + } catch (final IOException e) { + throw new DeploymentException("Unable to undeploy an archive " + archive.getName(), e); + } + } +} diff --git a/tomcat-remote-parent/pom.xml b/tomcat-remote-parent/pom.xml new file mode 100644 index 00000000..b5407686 --- /dev/null +++ b/tomcat-remote-parent/pom.xml @@ -0,0 +1,89 @@ + + + + 4.0.0 + + + org.jboss.arquillian.container + arquillian-tomcat-container-parent + 1.2.1-SNAPSHOT + ../tomcat-container-parent/pom.xml + + + arquillian-tomcat-remote-parent + pom + Arquillian Tomcat Remote Container Parent + + + + + + + org.jboss.arquillian.container + arquillian-tomcat-remote-common + ${project.version} + + + + + + org.jboss.arquillian.container + arquillian-tomcat-remote-common + ${project.version} + test-jar + test + + + + + + + + + org.codehaus.cargo + cargo-maven2-plugin + + + start-container + pre-integration-test + + start + + + + + 127.0.0.1 + ${test.jmx.port} + false + false + + + + + ${test.http.port} + ${test.ajp.port} + ${test.rmi.port} + + + + ${project.build.testOutputDirectory}/tomcat-users.xml + conf + + + + + + + stop-container + post-integration-test + + stop + + + + + + + + +