[jbosstools-commits] JBoss Tools SVN: r30458 - workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Sat Apr 9 09:15:17 EDT 2011


Author: adietish
Date: 2011-04-09 09:15:17 -0400 (Sat, 09 Apr 2011)
New Revision: 30458

Added:
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderIntegrationTest.java
Removed:
   workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderTest.java
Log:
[JBIDE-8690] added tests for deployed artifacts (name, status)

Copied: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderIntegrationTest.java (from rev 30455, workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderTest.java)
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderIntegrationTest.java	                        (rev 0)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderIntegrationTest.java	2011-04-09 13:15:17 UTC (rev 30458)
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * 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.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.ConnectException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.UnknownHostException;
+import java.util.List;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.ide.eclipse.as7.deployment.DeploymentBuilder;
+import org.jboss.ide.eclipse.as7.deployment.DeploymentBuilder.Deployable;
+import org.jboss.ide.eclipse.as7.deployment.DeploymentBuilderException;
+import org.junit.Before;
+import org.junit.Test;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author André Dietisheim
+ */
+public class DeploymentBuilderIntegrationTest {
+
+	private static final String WAR_FOLDER = "wars/";
+
+	private static final String BUNDLE_ID = "org.jboss.ide.eclipse.as7.deployment.tests";
+
+	private static final String HOST = "localhost";
+	private static final int PORT = 9999;
+
+	@Before
+	public void setUp() throws UnknownHostException, IOException {
+		assertAs7IsRunning();
+	}
+
+	private void assertAs7IsRunning() throws UnknownHostException, IOException {
+		try {
+			Socket socket = new Socket();
+			socket.connect(new InetSocketAddress(HOST, PORT));
+			socket.close();
+		} catch (ConnectException e) {
+			fail("JBoss as7 seems not to run on " + HOST + ", test cannot access it's management API on port " + PORT);
+		}
+	}
+
+	@Test
+	public void canDeploy() throws DeploymentBuilderException, URISyntaxException, IOException {
+		File file = getWarFile("minimalistic.war");
+		new DeploymentBuilder(HOST, PORT).add(file).deploy();
+	}
+
+	@Test
+	public void getMatchingDeployables() throws DeploymentBuilderException, URISyntaxException, IOException {
+		String warName = "minimalistic.war";
+		File file = getWarFile(warName );
+		List<Deployable> deployables = new DeploymentBuilder(HOST, PORT).add(file).deploy();
+		assertEquals(1, deployables.size());
+		assertEquals(warName, deployables.get(0).getName());
+	}
+
+	@Test
+	public void canGetDeploymentStatus() throws DeploymentBuilderException, URISyntaxException, IOException {
+		File file = getWarFile("minimalistic.war");
+		List<Deployable> deployables = new DeploymentBuilder(HOST, PORT).add(file).deploy();
+		Deployable deployable = deployables.get(0);
+		assertNotNull(deployable.getStatus());
+	}
+
+	
+	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());
+	}
+}


Property changes on: workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderIntegrationTest.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/DeploymentBuilderTest.java
===================================================================
--- workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderTest.java	2011-04-09 12:52:44 UTC (rev 30457)
+++ workspace/adietish/org.jboss.ide.eclipse.as7.deployment.tests/src/org/jboss/ide/eclipse/as7/deployment/tests/DeploymentBuilderTest.java	2011-04-09 13:15:17 UTC (rev 30458)
@@ -1,67 +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 java.io.File;
-import java.io.IOException;
-import java.net.InetSocketAddress;
-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.as7.deployment.DeploymentBuilder;
-import org.jboss.ide.eclipse.as7.deployment.DeploymentBuilderException;
-import org.junit.Before;
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-
-import static junit.framework.Assert.assertTrue;
-
-/**
- * @author André Dietisheim
- */
-public class DeploymentBuilderTest {
-
-    private static final String WAR_FOLDER = "wars/";
-
-    private static final String BUNDLE_ID = "org.jboss.ide.eclipse.as7.deployment.tests";
-
-    private static final String HOST = "localhost";
-    private static final int PORT = 9999;
-
-    @Before
-    public void setUp() throws UnknownHostException, IOException {
-        assertAs7IsRunning();
-    }
-
-    private void assertAs7IsRunning() throws UnknownHostException, IOException {
-        Socket socket = new Socket();
-        socket.connect(new InetSocketAddress(HOST, PORT));
-        assertTrue(socket.isConnected());
-        socket.close();
-    }
-
-    @Test
-    public void canDeploy() throws DeploymentBuilderException, URISyntaxException, IOException {
-        File file = getWarFile("minimalistic.war");
-        new DeploymentBuilder(HOST, PORT).add(file).deploy();
-    }
-
-    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());
-
-    }
-}



More information about the jbosstools-commits mailing list