Author: adietish
Date: 2011-06-14 16:48:14 -0400 (Tue, 14 Jun 2011)
New Revision: 32099
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/JBossManagementServiceTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/utils/
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/utils/AS7ManagerTestUtils.java
Removed:
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerTestUtils.java
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/JBossManagementServiceIntegrationTest.java
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/management/as7/
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/pom.xml
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7IntegrationTestSuite.java
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerIntegrationTest.java
Log:
[JBIDE-9137]
Property changes on: trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests
___________________________________________________________________
Added: svn:ignore
+ target
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/pom.xml
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/pom.xml 2011-06-14
20:47:22 UTC (rev 32098)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/pom.xml 2011-06-14
20:48:14 UTC (rev 32099)
@@ -17,8 +17,11 @@
<groupId>org.sonatype.tycho</groupId>
<artifactId>maven-osgi-test-plugin</artifactId>
<configuration>
+ <includes>
+ <include>**/*Test*.class</include>
+ </includes>
<excludes>
- <exclude>**/IntegrationTestSuite*.class</exclude>
+ <exclude>**/*IntegrationTest*.class</exclude>
</excludes>
</configuration>
</plugin>
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7IntegrationTestSuite.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7IntegrationTestSuite.java 2011-06-14
20:47:22 UTC (rev 32098)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7IntegrationTestSuite.java 2011-06-14
20:48:14 UTC (rev 32099)
@@ -19,7 +19,7 @@
@RunWith(Suite.class)
@Suite.SuiteClasses({
AS7ManagerIntegrationTest.class
- , JBossManagementServiceIntegrationTest.class
+ , JBossManagementServiceTest.class
})
public class AS7IntegrationTestSuite {
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerIntegrationTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerIntegrationTest.java 2011-06-14
20:47:22 UTC (rev 32098)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerIntegrationTest.java 2011-06-14
20:48:14 UTC (rev 32099)
@@ -26,6 +26,7 @@
import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7DeploymentState;
import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ServerState;
+import org.jboss.ide.eclipse.as.internal.management.as7.tests.utils.AS7ManagerTestUtils;
import org.jboss.ide.eclipse.as.management.as7.deployment.AS7Manager;
import org.junit.After;
import org.junit.Before;
Deleted:
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerTestUtils.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerTestUtils.java 2011-06-14
20:47:22 UTC (rev 32098)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerTestUtils.java 2011-06-14
20:48:14 UTC (rev 32099)
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.internal.management.as7.tests;
-
-import java.io.BufferedInputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.net.ConnectException;
-import java.net.HttpURLConnection;
-import java.net.Socket;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.UnknownHostException;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Platform;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
-import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
-import org.jboss.ide.eclipse.as.management.as7.deployment.AS7Manager;
-import org.osgi.framework.Bundle;
-
-/**
- * @author André Dietisheim
- */
-public class AS7ManagerTestUtils {
-
- 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 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 RESPONSE_TIMEOUT = 10 * 1024;
- private static final long WAIT_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 waitForRespose(String name, String host, int port) throws
IOException {
- waitForResponseCode(200, name, host, port);
- return getResponse(name, host, port);
- }
-
- public static void quietlyUndeploy(File file, AS7Manager manager) {
- quietlyUndeploy(file.getName(), manager);
- }
-
- public static void quietlyUndeploy(String name, AS7Manager manager) {
- try {
- // DetypedDeployer.undeploy(name, AS7ManagerTestUtils.HOST,
- // AS7ManagerTestUtils.MGMT_PORT);
- waitUntilFinished(manager.undeploy(name));
- } catch (Exception e) {
- // ignore
- }
- }
-
- public static void quietlyRemove(String name, AS7Manager manager) {
- try {
- // DetypedDeployer.remove(name, AS7ManagerTestUtils.HOST,
- // AS7ManagerTestUtils.MGMT_PORT);
- waitUntilFinished(manager.remove(name));
- } catch (Exception e) {
- // ignore
- }
- }
-
- public static void waitUntilFinished(IJBoss7DeploymentResult result) throws
JBoss7ManangerException {
- result.getStatus(); // wait for operation to finish
- }
-
- public static String getResponse(String name, String host, int port) throws IOException
{
- URL url = new URL("http://" + host + ":" + port + "/" +
name);
- HttpURLConnection connection = connect(url);
- return toString(new BufferedInputStream(connection.getInputStream()));
- }
-
- public static HttpURLConnection waitForResponseCode(int code, String name, String host,
int port)
- throws IOException {
- URL url = new URL("http://" + host + ":" + port + "/" +
name);
- long until = System.currentTimeMillis() + WAIT_TIMEOUT;
- while (System.currentTimeMillis() < until) {
- HttpURLConnection connection = connect(url);
- try {
- if (connection.getResponseCode() == code) {
- return connection;
- }
- } catch (FileNotFoundException e) {
- if (code == 404) {
- return connection;
- }
- throw e;
- }
- }
- throw new RuntimeException("wait on url " + url + " for response code
" + code + " timed out.");
- }
-
- private static HttpURLConnection connect(URL url) throws IOException {
- HttpURLConnection connection = (HttpURLConnection) url.openConnection();
- connection.setUseCaches(false);
- connection.setDoInput(true);
- connection.setAllowUserInteraction(false);
- connection.setConnectTimeout(RESPONSE_TIMEOUT);
- connection.setInstanceFollowRedirects(true);
- connection.setDoOutput(false);
- return connection;
- }
-
- 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();
- }
-
- public static boolean isListening(String host, int port) throws UnknownHostException,
IOException {
- Socket socket = null;
- try {
- socket = new Socket(host, port);
- return socket.isConnected();
- } catch (ConnectException e) {
- return false;
- } finally {
- if (socket != null) {
- socket.close();
- }
- }
- }
-}
\ No newline at end of file
Deleted:
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/JBossManagementServiceIntegrationTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/JBossManagementServiceIntegrationTest.java 2011-06-14
20:47:22 UTC (rev 32098)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/JBossManagementServiceIntegrationTest.java 2011-06-14
20:48:14 UTC (rev 32099)
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is 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, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.internal.management.as7.tests;
-
-import static org.junit.Assert.assertNotNull;
-
-import java.net.UnknownHostException;
-
-import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.BundleException;
-import org.osgi.framework.ServiceReference;
-
-/**
- *
- * @author André Dietisheim
- */
-public class JBossManagementServiceIntegrationTest {
-
- private static final String DS_BUNDLEID = "org.eclipse.equinox.ds";
-
- @Before
- public void setUp() throws UnknownHostException {
- }
-
- @After
- public void tearDown() {
- }
-
- @Test
- public void serviceIsReachable() throws BundleException {
- ensureDSIsRunning();
- BundleContext context = Activator.getContext();
- ServiceReference<IJBoss7ManagerService> reference =
- context.getServiceReference(IJBoss7ManagerService.class);
- assertNotNull(reference);
- IJBoss7ManagerService service = context.getService(reference);
- assertNotNull(service);
- }
-
- private void ensureDSIsRunning() throws BundleException {
- BundleContext context = Activator.getContext();
- assertNotNull("bundle of this test is not active", context);
- Bundle bundle = getDSBundle();
- assertNotNull(
- DS_BUNDLEID + " not installed. You have to install the declarative services
daemon so that "
- + IJBoss7ManagerService.class + " service is registered"
- , bundle);
- if (bundle.getState() != Bundle.ACTIVE) {
- bundle.start();
- }
- }
-
- private Bundle getDSBundle() {
- Bundle dsBundle = null;
- for (Bundle bundle : Activator.getContext().getBundles()) {
- if (DS_BUNDLEID.equals(bundle.getSymbolicName())) {
- dsBundle = bundle;
- break;
- }
- }
- return dsBundle;
- }
-}
Copied:
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/JBossManagementServiceTest.java
(from rev 32096,
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/JBossManagementServiceIntegrationTest.java)
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/JBossManagementServiceTest.java
(rev 0)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/JBossManagementServiceTest.java 2011-06-14
20:48:14 UTC (rev 32099)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.internal.management.as7.tests;
+
+import static org.junit.Assert.assertNotNull;
+
+import java.net.UnknownHostException;
+
+import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.ServiceReference;
+
+/**
+ *
+ * @author André Dietisheim
+ */
+public class JBossManagementServiceTest {
+
+ private static final String DS_BUNDLEID = "org.eclipse.equinox.ds";
+
+ @Before
+ public void setUp() throws UnknownHostException {
+ }
+
+ @After
+ public void tearDown() {
+ }
+
+ @Test
+ public void serviceIsReachable() throws BundleException {
+ ensureDSIsRunning();
+ BundleContext context = Activator.getContext();
+ ServiceReference<IJBoss7ManagerService> reference =
+ context.getServiceReference(IJBoss7ManagerService.class);
+ assertNotNull(reference);
+ IJBoss7ManagerService service = context.getService(reference);
+ assertNotNull(service);
+ }
+
+ private void ensureDSIsRunning() throws BundleException {
+ BundleContext context = Activator.getContext();
+ assertNotNull("bundle of this test is not active", context);
+ Bundle bundle = getDSBundle();
+ assertNotNull(
+ DS_BUNDLEID + " not installed. You have to install the declarative services
daemon so that "
+ + IJBoss7ManagerService.class + " service is registered"
+ , bundle);
+ if (bundle.getState() != Bundle.ACTIVE) {
+ bundle.start();
+ }
+ }
+
+ private Bundle getDSBundle() {
+ Bundle dsBundle = null;
+ for (Bundle bundle : Activator.getContext().getBundles()) {
+ if (DS_BUNDLEID.equals(bundle.getSymbolicName())) {
+ dsBundle = bundle;
+ break;
+ }
+ }
+ return dsBundle;
+ }
+}
Property changes on:
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/JBossManagementServiceTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/utils/AS7ManagerTestUtils.java
(from rev 32096,
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/AS7ManagerTestUtils.java)
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/utils/AS7ManagerTestUtils.java
(rev 0)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/utils/AS7ManagerTestUtils.java 2011-06-14
20:48:14 UTC (rev 32099)
@@ -0,0 +1,151 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.internal.management.as7.tests.utils;
+
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.net.ConnectException;
+import java.net.HttpURLConnection;
+import java.net.Socket;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.UnknownHostException;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
+import org.jboss.ide.eclipse.as.management.as7.deployment.AS7Manager;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author André Dietisheim
+ */
+public class AS7ManagerTestUtils {
+
+ 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 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 RESPONSE_TIMEOUT = 10 * 1024;
+ private static final long WAIT_TIMEOUT = 10 * 1024;
+
+ private AS7ManagerTestUtils() {
+ // inhibit instantiation
+ }
+
+ 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 waitForRespose(String name, String host, int port) throws
IOException {
+ waitForResponseCode(200, name, host, port);
+ return getResponse(name, host, port);
+ }
+
+ public static void quietlyUndeploy(File file, AS7Manager manager) {
+ quietlyUndeploy(file.getName(), manager);
+ }
+
+ public static void quietlyUndeploy(String name, AS7Manager manager) {
+ try {
+ // DetypedDeployer.undeploy(name, AS7ManagerTestUtils.HOST,
+ // AS7ManagerTestUtils.MGMT_PORT);
+ waitUntilFinished(manager.undeploy(name));
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ public static void quietlyRemove(String name, AS7Manager manager) {
+ try {
+ // DetypedDeployer.remove(name, AS7ManagerTestUtils.HOST,
+ // AS7ManagerTestUtils.MGMT_PORT);
+ waitUntilFinished(manager.remove(name));
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ public static void waitUntilFinished(IJBoss7DeploymentResult result) throws
JBoss7ManangerException {
+ result.getStatus(); // wait for operation to finish
+ }
+
+ public static String getResponse(String name, String host, int port) throws IOException
{
+ URL url = new URL("http://" + host + ":" + port + "/" +
name);
+ HttpURLConnection connection = connect(url);
+ return toString(new BufferedInputStream(connection.getInputStream()));
+ }
+
+ public static HttpURLConnection waitForResponseCode(int code, String name, String host,
int port)
+ throws IOException {
+ URL url = new URL("http://" + host + ":" + port + "/" +
name);
+ long until = System.currentTimeMillis() + WAIT_TIMEOUT;
+ while (System.currentTimeMillis() < until) {
+ HttpURLConnection connection = connect(url);
+ try {
+ if (connection.getResponseCode() == code) {
+ return connection;
+ }
+ } catch (FileNotFoundException e) {
+ if (code == 404) {
+ return connection;
+ }
+ throw e;
+ }
+ }
+ throw new RuntimeException("wait on url " + url + " for response code
" + code + " timed out.");
+ }
+
+ private static HttpURLConnection connect(URL url) throws IOException {
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setUseCaches(false);
+ connection.setDoInput(true);
+ connection.setAllowUserInteraction(false);
+ connection.setConnectTimeout(RESPONSE_TIMEOUT);
+ connection.setInstanceFollowRedirects(true);
+ connection.setDoOutput(false);
+ return connection;
+ }
+
+ 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();
+ }
+
+ public static boolean isListening(String host, int port) throws UnknownHostException,
IOException {
+ Socket socket = null;
+ try {
+ socket = new Socket(host, port);
+ return socket.isConnected();
+ } catch (ConnectException e) {
+ return false;
+ } finally {
+ if (socket != null) {
+ socket.close();
+ }
+ }
+ }
+}
\ No newline at end of file
Property changes on:
trunk/as/tests/org.jboss.ide.eclipse.as.management.as7.tests/src/org/jboss/ide/eclipse/as/internal/management/as7/tests/utils/AS7ManagerTestUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain