Author: adietish
Date: 2011-04-12 13:48:37 -0400 (Tue, 12 Apr 2011)
New Revision: 30524
Added:
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/StandaloneDeployerIntegrationTest.java
Removed:
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/as/demos/war/runner/StandaloneDeployerIntegrationTest.java
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/StandaloneDeploymentIntegrationTest.java
Log:
Deleted:
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/as/demos/war/runner/StandaloneDeployerIntegrationTest.java
===================================================================
---
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/as/demos/war/runner/StandaloneDeployerIntegrationTest.java 2011-04-12
17:31:57 UTC (rev 30523)
+++
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/as/demos/war/runner/StandaloneDeployerIntegrationTest.java 2011-04-12
17:48:37 UTC (rev 30524)
@@ -1,103 +0,0 @@
-/*
- * 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.as.demos.war.runner;
-
-import static org.jboss.as.protocol.StreamUtils.safeClose;
-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.as7.deployment.StandaloneDeployer;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-/**
- *
- * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
- * @version $Revision: 1.1 $
- */
-public class StandaloneDeployerIntegrationTest {
-
- 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 WEB_PORT = 8080;
-
- @Test
- public void canDeployUsingDeploymentUtils() throws Exception {
- StandaloneDeployer utils = null;
- try {
- utils = new StandaloneDeployer();
- File warFile = getWarFile("minimalistic.war");
- utils.addWarFileDeployment(warFile);
- utils.deploy();
-
- String response = getServerResponse(new URL(
- MessageFormat.format("http://{0}:{1}/{2}",
- HOST, String.valueOf(WEB_PORT), "minimalistic")));
- assertTrue(response.indexOf("minimalistic") >= 0);
-
- } finally {
- utils.undeploy();
- safeClose(utils);
- }
- }
-
- 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();
- }
-}
Copied:
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/StandaloneDeployerIntegrationTest.java
(from rev 30522,
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/as/demos/war/runner/StandaloneDeployerIntegrationTest.java)
===================================================================
---
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/StandaloneDeployerIntegrationTest.java
(rev 0)
+++
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/StandaloneDeployerIntegrationTest.java 2011-04-12
17:48:37 UTC (rev 30524)
@@ -0,0 +1,103 @@
+/*
+ * 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.as7.deployment.tests;
+
+import static org.jboss.as.protocol.StreamUtils.safeClose;
+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.as7.deployment.StandaloneDeployer;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+
+/**
+ *
+ * @author <a href="kabir.khan(a)jboss.com">Kabir Khan</a>
+ * @version $Revision: 1.1 $
+ */
+public class StandaloneDeployerIntegrationTest {
+
+ 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 WEB_PORT = 8080;
+
+ @Test
+ public void canDeployUsingDeploymentUtils() throws Exception {
+ StandaloneDeployer utils = null;
+ try {
+ utils = new StandaloneDeployer();
+ File warFile = getWarFile("minimalistic.war");
+ utils.addWarDeployment(warFile);
+ utils.deploy();
+
+ String response = getServerResponse(new URL(
+ MessageFormat.format("http://{0}:{1}/{2}",
+ HOST, String.valueOf(WEB_PORT), "minimalistic")));
+ assertTrue(response.indexOf("minimalistic") >= 0);
+
+ } finally {
+ utils.undeploy();
+ safeClose(utils);
+ }
+ }
+
+ 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();
+ }
+}
Property changes on:
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/StandaloneDeployerIntegrationTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/StandaloneDeploymentIntegrationTest.java
===================================================================
---
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/StandaloneDeploymentIntegrationTest.java 2011-04-12
17:31:57 UTC (rev 30523)
+++
workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/StandaloneDeploymentIntegrationTest.java 2011-04-12
17:48:37 UTC (rev 30524)
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat Inc..
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- *
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat Incorporated - initial API and implementation
- *******************************************************************************/
-package org.jboss.ide.eclipse.as7.deployment.tests;
-
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.fail;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.net.ConnectException;
-import java.net.HttpURLConnection;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.text.MessageFormat;
-import java.util.List;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Platform;
-import org.jboss.ide.eclipse.as7.deployment.Deployable;
-import org.jboss.ide.eclipse.as7.deployment.DeploymentException;
-import org.jboss.ide.eclipse.as7.deployment.Session;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-/**
- * @author André Dietisheim
- */
-public class StandaloneDeploymentIntegrationTest {
-
- 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;
- private Session session;
-
- @Before
- public void setUp() throws UnknownHostException, IOException {
- assertAs7IsRunning();
- this.session = new Session(HOST, MGMT_PORT);
- }
-
- public void tearDown() {
- session.close();
- }
-
- private void assertAs7IsRunning() throws UnknownHostException, IOException {
- try {
- Socket socket = new Socket();
- socket.connect(new InetSocketAddress(HOST, MGMT_PORT));
- socket.close();
- } catch (ConnectException e) {
- fail("JBoss as7 seems not to run on " + HOST + ", test cannot access
it's management API on port "
- + MGMT_PORT);
- }
- }
-
- @Ignore
- @Test
- public void canDeploy() throws DeploymentException, URISyntaxException, IOException {
- File file = getWarFile("minimalistic.war");
- session.newStandaloneDeployment().add(file).deploy();
- }
-
- @Ignore
- @Test
- public void returnsDeployables() throws DeploymentException, URISyntaxException,
IOException {
- String warName = "minimalistic.war";
- File file = getWarFile(warName);
- List<Deployable> deployables =
session.newStandaloneDeployment().add(file).deploy();
- assertEquals(1, deployables.size());
- assertEquals(warName, deployables.get(0).getName());
- }
-
- @Test
- public void canGetDeploymentStatus() throws DeploymentException, URISyntaxException,
IOException {
- File file = getWarFile("minimalistic.war");
- List<Deployable> deployables =
session.newStandaloneDeployment().add(file).deploy();
- Deployable deployable = deployables.get(0);
- assertNotNull(deployable.getStatus());
- }
-
- @Test
- public void isDeployed() throws DeploymentException, URISyntaxException, IOException {
- String warName = "minimalistic.war";
- File file = getWarFile(warName);
- Session session = new Session(HOST, MGMT_PORT);
- List<Deployable> deployables =
session.newStandaloneDeployment().add(file).deploy();
- Deployable deployable = deployables.get(0);
- deployable.getStatus(); // wait for deployment to have finished
- String response = getServerResponse(new URL(
- MessageFormat.format("http://{0}:{1}/{2}",
- HOST,
- String.valueOf(WEB_PORT),
- getWebappname(deployable.getName()))));
- assertTrue(response.indexOf("minimalistic") >= 0);
- }
-
- /**
- * cuts off the .war suffix
- * @param deployableName
- * @return
- */
- private String getWebappname(String deployableName) {
- int suffixIndex = deployableName.indexOf('.');
- if (suffixIndex < 0) {
- return deployableName;
- }
- return deployableName.substring(0, suffixIndex);
- }
-
- 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(BufferedInputStream in) throws IOException {
- StringWriter writer = new StringWriter();
- for (int data = -1; ((data = in.read()) != -1);) {
- writer.write(data);
- }
- return writer.toString();
- }
-}