[jbosstools-commits] JBoss Tools SVN: r30674 - in trunk/as/org.jboss.ide.eclipse.as.management.as7.tests: .settings and 14 other directories.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Wed Apr 20 09:13:41 EDT 2011
Author: adietish
Date: 2011-04-20 09:13:41 -0400 (Wed, 20 Apr 2011)
New Revision: 30674
Added:
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/.classpath
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/.project
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/.settings/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/.settings/org.eclipse.jdt.core.prefs
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/META-INF/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/META-INF/MANIFEST.MF
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/build.properties
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/Activator.java
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DeployerTestUtils.java
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DeploymentManagerIntegratonTest.java
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/TypedDeployerIntegrationTest.java
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/gwt-helloworld.war
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic.war
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/META-INF/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/META-INF/MANIFEST.MF
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/WEB-INF/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/WEB-INF/classes/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/WEB-INF/lib/
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/WEB-INF/web.xml
trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/index.html
Log:
[JBIDE-8690] moved from workspace to trunk, added tests
Added: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/.classpath
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/.classpath (rev 0)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/.classpath 2011-04-20 13:13:41 UTC (rev 30674)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="wars"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/.classpath
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/.project
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/.project (rev 0)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/.project 2011-04-20 13:13:41 UTC (rev 30674)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.ide.eclipse.as.management.as7.tests</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/.project
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/.settings/org.eclipse.jdt.core.prefs (rev 0)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/.settings/org.eclipse.jdt.core.prefs 2011-04-20 13:13:41 UTC (rev 30674)
@@ -0,0 +1,8 @@
+#Thu Apr 07 10:43:42 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/META-INF/MANIFEST.MF (rev 0)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/META-INF/MANIFEST.MF 2011-04-20 13:13:41 UTC (rev 30674)
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Tests
+Bundle-SymbolicName: org.jboss.ide.eclipse.as.management.as7.tests
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.jboss.ide.eclipse.as.management.as7;bundle-version="1.0.0",
+ org.junit;bundle-version="[4.8.1,5.0.0)",
+ org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.hamcrest;bundle-version="1.1.0"
+Bundle-ClassPath: .,
+ wars/
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/build.properties
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/build.properties (rev 0)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/build.properties 2011-04-20 13:13:41 UTC (rev 30674)
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ wars/
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/build.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/Activator.java
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/Activator.java (rev 0)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/Activator.java 2011-04-20 13:13:41 UTC (rev 30674)
@@ -0,0 +1,30 @@
+package org.jboss.ide.eclipse.as.management.as7.tests;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+}
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/Activator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DeployerTestUtils.java
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DeployerTestUtils.java (rev 0)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DeployerTestUtils.java 2011-04-20 13:13:41 UTC (rev 30674)
@@ -0,0 +1,86 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.tests;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.net.HttpURLConnection;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author André Dietisheim
+ */
+public class DeployerTestUtils {
+
+ public static final String GWT_HELLOWORLD_WAR = "gwt-helloworld.war";
+ public static final String MINIMALISTIC_WAR = "minimalistic.war";
+
+ public static final String HOST = "localhost";
+ public static final int MGMT_PORT = 9999;
+ public static final int WEB_PORT = 8080;
+
+ private static final String WAR_FOLDER = "/wars/";
+ private static final String BUNDLE_ID = "org.jboss.ide.eclipse.as.management.as7.tests";
+
+ private static final int WEBAPP_RESPONSE_TIMEOUT = 10 * 1024;
+
+ public static File getWarFile(String name) throws URISyntaxException, IOException {
+ Bundle bundle = Platform.getBundle(BUNDLE_ID);
+ URL entryUrl = bundle.getEntry(WAR_FOLDER + name);
+ return new File(FileLocator.resolve(entryUrl).toURI());
+ }
+
+ public static String getWebappResponse(String name, String host, int port) throws IOException {
+ return getServerResponse(new URL(
+ MessageFormat.format(
+ "http://{0}:{1}/{2}", host, String.valueOf(port), name)));
+ }
+
+ public static String getServerResponse(URL url) throws IOException {
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setUseCaches(false);
+ connection.setDoInput(true);
+ connection.setAllowUserInteraction(false);
+ connection.setConnectTimeout(WEBAPP_RESPONSE_TIMEOUT);
+ connection.setInstanceFollowRedirects(true);
+ connection.setDoOutput(false);
+ BufferedInputStream in = new BufferedInputStream(connection.getInputStream());
+ return toString(in);
+ }
+
+ public static String toString(InputStream in) throws IOException {
+ StringWriter writer = new StringWriter();
+ for (int data = -1; ((data = in.read()) != -1);) {
+ writer.write(data);
+ }
+ return writer.toString();
+ }
+}
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DeployerTestUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DeploymentManagerIntegratonTest.java
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DeploymentManagerIntegratonTest.java (rev 0)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DeploymentManagerIntegratonTest.java 2011-04-20 13:13:41 UTC (rev 30674)
@@ -0,0 +1,126 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.tests;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.net.HttpURLConnection;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.ide.eclipse.as.management.as7.deployment.DeployerException;
+import org.jboss.ide.eclipse.as.management.as7.deployment.DeploymentManager;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+
+/**
+ *
+ * @author André Dietisheim
+ */
+public class DeploymentManagerIntegratonTest {
+
+ private static final String WAR_FOLDER = "/wars/";
+ private static final String BUNDLE_ID = "org.jboss.ide.eclipse.as7.deployment.tests";
+
+ private static final int WEBAPP_RESPONSE_TIMEOUT = 10 * 1024;
+
+ private static final String HOST = "localhost";
+ private static final int MGMT_PORT = 9999;
+ private static final int WEB_PORT = 8080;
+
+ @Test
+ public void canDeploy() throws Exception {
+ DeploymentManager deployer = null;
+ File warFile = getWarFile("minimalistic.war");
+ try {
+ deployer = new DeploymentManager(HOST, MGMT_PORT);
+ deployer.deploy(warFile).execute();
+
+ String response = getServerResponse(new URL(
+ MessageFormat.format(
+ "http://{0}:{1}/{2}", HOST, String.valueOf(WEB_PORT), "minimalistic")));
+ assertTrue(response.indexOf("minimalistic") >= 0);
+
+ } finally {
+ quietlyUndeploy(warFile, deployer);
+ }
+ }
+
+ @Test(expected = DeployerException.class)
+ public void cannotDeployWarTwice() throws Exception {
+ DeploymentManager deployer = null;
+ File warFile = getWarFile("minimalistic.war");
+ try {
+ deployer = new DeploymentManager(HOST, MGMT_PORT);
+ deployer.deploy(warFile).execute();
+ deployer.deploy(warFile).execute();
+ } finally {
+ quietlyUndeploy(warFile, deployer);
+ }
+ }
+
+ private File getWarFile(String name) throws URISyntaxException, IOException {
+ Bundle bundle = Platform.getBundle(BUNDLE_ID);
+ URL entryUrl = bundle.getEntry(WAR_FOLDER + name);
+ return new File(FileLocator.resolve(entryUrl).toURI());
+ }
+
+ private String getServerResponse(URL url) throws IOException {
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setUseCaches(false);
+ connection.setDoInput(true);
+ connection.setAllowUserInteraction(false);
+ connection.setConnectTimeout(WEBAPP_RESPONSE_TIMEOUT);
+ connection.setInstanceFollowRedirects(true);
+ connection.setDoOutput(false);
+ BufferedInputStream in = new BufferedInputStream(connection.getInputStream());
+ return toString(in);
+ }
+
+ private String toString(InputStream in) throws IOException {
+ StringWriter writer = new StringWriter();
+ for (int data = -1; ((data = in.read()) != -1);) {
+ writer.write(data);
+ }
+ return writer.toString();
+ }
+
+ private void quietlyUndeploy(File file, DeploymentManager deployer) {
+ try {
+ if (deployer != null) {
+ deployer.undeploy(file).execute();
+ deployer.dispose();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ // ignore
+ }
+ }
+}
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DeploymentManagerIntegratonTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java (rev 0)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java 2011-04-20 13:13:41 UTC (rev 30674)
@@ -0,0 +1,111 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.tests;
+
+import static org.hamcrest.Matchers.hasItems;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.util.List;
+
+import org.jboss.ide.eclipse.as.management.as7.deployment.DeployerException;
+import org.jboss.ide.eclipse.as.management.as7.deployment.DetypedDeployer;
+import org.junit.Test;
+
+/**
+ * @author André Dietisheim
+ */
+public class DetypedDeployerIntegrationTest {
+
+ @Test
+ public void canDeploy() throws Exception {
+ File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
+ try {
+ DetypedDeployer.deploy(warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+
+ String response = DeployerTestUtils.getWebappResponse("minimalistic", DeployerTestUtils.HOST, DeployerTestUtils.WEB_PORT);
+ assertTrue(response.indexOf("minimalistic") >= 0);
+
+ } finally {
+ quietlyUndeploy(warFile);
+ }
+ }
+
+ @Test(expected = DeployerException.class)
+ public void cannotDeployWarTwice() throws Exception {
+ File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
+ try {
+ DetypedDeployer.deploy(warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+ DetypedDeployer.deploy(warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+ } finally {
+ quietlyUndeploy(warFile);
+ }
+ }
+
+ @Test
+ public void canReplaceWar() throws Exception {
+ File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
+ File warFile2 = DeployerTestUtils.getWarFile(DeployerTestUtils.GWT_HELLOWORLD_WAR);
+ String name = warFile.getName();
+ try {
+ DetypedDeployer.deploy(name, warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+ DetypedDeployer.replace(name, warFile2, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+ String response = DeployerTestUtils.getWebappResponse(
+ "minimalistic", DeployerTestUtils.HOST, DeployerTestUtils.WEB_PORT);
+ assertTrue(response.indexOf("GWT") >= 0);
+ } finally {
+ quietlyUndeploy(warFile);
+ }
+ }
+
+ @Test(expected = DeployerException.class)
+ public void cannotUndeployNondeployed() throws DeployerException {
+ DetypedDeployer.undeploy("inexistant", DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+ }
+
+ @Test
+ public void canQueryDeploymentdeployedState() throws Exception {
+ File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
+ File warFile2 = DeployerTestUtils.getWarFile(DeployerTestUtils.GWT_HELLOWORLD_WAR);
+ try {
+ DetypedDeployer.deploy(warFile, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+ DetypedDeployer.deploy(warFile2, DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+ List<String> deployments = DetypedDeployer.getDeployments(DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+ assertThat(deployments.size(), is(2));
+ assertThat(deployments, hasItems(DeployerTestUtils.MINIMALISTIC_WAR, DeployerTestUtils.GWT_HELLOWORLD_WAR));
+ } finally {
+ quietlyUndeploy(warFile);
+ quietlyUndeploy(warFile2);
+ }
+ }
+
+ private void quietlyUndeploy(File file) {
+ try {
+ DetypedDeployer.undeploy(file.getName(), DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+ } catch (Exception e) {
+ e.printStackTrace();
+ // ignore
+ }
+ }
+}
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/DetypedDeployerIntegrationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/TypedDeployerIntegrationTest.java
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/TypedDeployerIntegrationTest.java (rev 0)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/TypedDeployerIntegrationTest.java 2011-04-20 13:13:41 UTC (rev 30674)
@@ -0,0 +1,129 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat, Inc., and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ide.eclipse.as.management.as7.tests;
+
+import static org.junit.Assert.assertTrue;
+
+import java.io.File;
+import java.net.UnknownHostException;
+import java.util.concurrent.ExecutionException;
+
+import org.jboss.ide.eclipse.as.management.as7.deployment.DeployerException;
+import org.jboss.ide.eclipse.as.management.as7.deployment.TypedDeployer;
+import org.jboss.ide.eclipse.as.management.as7.deployment.TypedDeployer.DeploymentResult;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ *
+ * @author André Dietisheim
+ */
+public class TypedDeployerIntegrationTest {
+
+ private TypedDeployer deployer;
+
+ @Before
+ public void setUp() throws UnknownHostException {
+ this.deployer = new TypedDeployer(DeployerTestUtils.HOST, DeployerTestUtils.MGMT_PORT);
+ }
+
+ @After
+ public void tearDown() {
+ deployer.dispose();
+ }
+
+ @Test
+ public void canDeploy() throws Exception {
+ File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
+ try {
+ waitUntilFinished(deployer.deploy(warFile));
+
+ String response = DeployerTestUtils.getWebappResponse(
+ "minimalistic", DeployerTestUtils.HOST, DeployerTestUtils.WEB_PORT);
+ assertTrue(response.indexOf("minimalistic") >= 0);
+
+ } finally {
+ quietlyUndeploy(warFile);
+ }
+ }
+
+ @Test
+ public void deployedWarHasDeployedStatus() throws Exception {
+ File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
+ try {
+ waitUntilFinished(deployer.deploy(warFile));
+
+ String response = DeployerTestUtils.getWebappResponse(
+ "minimalistic", DeployerTestUtils.HOST, DeployerTestUtils.WEB_PORT);
+ assertTrue(response.indexOf("minimalistic") >= 0);
+
+ } finally {
+ quietlyUndeploy(warFile);
+ }
+ }
+
+ @Test(expected = DeployerException.class)
+ public void cannotDeployWarTwice() throws Exception {
+ File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
+ try {
+ waitUntilFinished(deployer.deploy(warFile));
+ waitUntilFinished(deployer.deploy(warFile));
+ } finally {
+ quietlyUndeploy(warFile);
+ }
+ }
+
+ @Test(expected = DeployerException.class)
+ public void cannotUndeployNondeployed() throws DeployerException, InterruptedException, ExecutionException {
+ waitUntilFinished(deployer.undeploy("inexistant"));
+ }
+
+ @Test
+ public void canReplaceWar() throws Exception {
+ File warFile = DeployerTestUtils.getWarFile(DeployerTestUtils.MINIMALISTIC_WAR);
+ File warFile2 = DeployerTestUtils.getWarFile(DeployerTestUtils.GWT_HELLOWORLD_WAR);
+ String name = warFile.getName();
+ try {
+ waitUntilFinished(deployer.deploy(name, warFile));
+ waitUntilFinished(deployer.replace(name, warFile2));
+ String response = DeployerTestUtils.getWebappResponse(
+ "minimalistic", DeployerTestUtils.HOST, DeployerTestUtils.WEB_PORT);
+ assertTrue(response.indexOf("GWT") >= 0);
+ } finally {
+ quietlyUndeploy(warFile);
+ }
+ }
+
+ private void quietlyUndeploy(File file) {
+ try {
+ waitUntilFinished(deployer.undeploy(file.getName()));
+ } catch (Exception e) {
+ e.printStackTrace();
+ // ignore
+ }
+ }
+
+ private void waitUntilFinished(DeploymentResult result) throws DeployerException {
+ result.getStatus(); // wait for operation to finish
+ }
+}
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/tests/TypedDeployerIntegrationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/gwt-helloworld.war
===================================================================
(Binary files differ)
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/gwt-helloworld.war
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/META-INF/MANIFEST.MF
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/META-INF/MANIFEST.MF (rev 0)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/META-INF/MANIFEST.MF 2011-04-20 13:13:41 UTC (rev 30674)
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path:
+
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/WEB-INF/web.xml
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/WEB-INF/web.xml (rev 0)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/WEB-INF/web.xml 2011-04-20 13:13:41 UTC (rev 30674)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
+ <display-name>minimalistic</display-name>
+ <welcome-file-list>
+ <welcome-file>index.html</welcome-file>
+ <welcome-file>index.htm</welcome-file>
+ <welcome-file>index.jsp</welcome-file>
+ <welcome-file>default.html</welcome-file>
+ <welcome-file>default.htm</welcome-file>
+ <welcome-file>default.jsp</welcome-file>
+ </welcome-file-list>
+</web-app>
\ No newline at end of file
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/WEB-INF/web.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/index.html
===================================================================
--- trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/index.html (rev 0)
+++ trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/index.html 2011-04-20 13:13:41 UTC (rev 30674)
@@ -0,0 +1,10 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<title>minimalistic</title>
+</head>
+<body>
+this is really minimalistic
+</body>
+</html>
\ No newline at end of file
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic/index.html
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic.war
===================================================================
(Binary files differ)
Property changes on: trunk/as/org.jboss.ide.eclipse.as.management.as7.tests/wars/minimalistic.war
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
More information about the jbosstools-commits
mailing list