Author: ljelinko
Date: 2012-05-23 08:47:43 -0400 (Wed, 23 May 2012)
New Revision: 41289
Added:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/detector/RuntimeDuplications.java
Modified:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/META-INF/MANIFEST.MF
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/AllTestsSuite.java
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/RuntimeDetectionPreferencesDialog.java
Log:
Added test for the case when there are two identical runtimes on the search path.
Modified: trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
---
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/META-INF/MANIFEST.MF 2012-05-23
11:52:55 UTC (rev 41288)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/META-INF/MANIFEST.MF 2012-05-23
12:47:43 UTC (rev 41289)
@@ -17,5 +17,6 @@
org.jboss.tools.ui.bot.ext;bundle-version="1.0.0",
org.hamcrest;bundle-version="1.1.0",
org.jboss.tools.runtime.core,
- org.jboss.tools.runtime.ui;bundle-version="1.3.0"
+ org.jboss.tools.runtime.ui;bundle-version="1.3.0",
+ org.apache.commons.io;bundle-version="2.0.1"
Modified:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/AllTestsSuite.java
===================================================================
---
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/AllTestsSuite.java 2012-05-23
11:52:55 UTC (rev 41288)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/AllTestsSuite.java 2012-05-23
12:47:43 UTC (rev 41289)
@@ -1,5 +1,6 @@
package org.jboss.tools.runtime.as.ui.bot.test;
+import org.jboss.tools.runtime.as.ui.bot.test.detector.RuntimeDuplications;
import org.jboss.tools.runtime.as.ui.bot.test.detector.ServerWithSeam;
import org.jboss.tools.runtime.as.ui.bot.test.detector.seam.seam22.CheckSeam22;
import org.jboss.tools.runtime.as.ui.bot.test.detector.seam.seam22.DetectSeam22;
@@ -35,6 +36,7 @@
@RunWith(RequirementAwareSuite.class)
@Suite.SuiteClasses({
+ RuntimeDuplications.class,
ServerWithSeam.class,
DetectJBoss7.class,
OperateJBoss7.class,
Added:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/detector/RuntimeDuplications.java
===================================================================
---
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/detector/RuntimeDuplications.java
(rev 0)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/detector/RuntimeDuplications.java 2012-05-23
12:47:43 UTC (rev 41289)
@@ -0,0 +1,111 @@
+package org.jboss.tools.runtime.as.ui.bot.test.detector;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.is;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.commons.io.FileUtils;
+import org.jboss.tools.runtime.as.ui.bot.test.RuntimeProperties;
+import org.jboss.tools.runtime.as.ui.bot.test.detector.server.eap5.DetectEAP5;
+import
org.jboss.tools.runtime.as.ui.bot.test.dialog.preferences.RuntimeDetectionPreferencesDialog;
+import org.jboss.tools.runtime.as.ui.bot.test.dialog.preferences.SeamPreferencesDialog;
+import
org.jboss.tools.runtime.as.ui.bot.test.dialog.preferences.SearchingForRuntimesDialog;
+import
org.jboss.tools.runtime.as.ui.bot.test.dialog.preferences.ServerRuntimesPreferencesDialog;
+import org.jboss.tools.runtime.as.ui.bot.test.entity.Runtime;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests the case when the runtime path contains two identical server runtimes with Seam.
+ *
+ * @author Lucia Jelinkova
+ *
+ */
+public class RuntimeDuplications extends SWTTestExt {
+
+ private File tmpServerPath;
+
+ private File tmpServerAPath;
+
+ private File tmpServerBPath;
+
+ private RuntimeDetectionPreferencesDialog runtimeDetectionPreferences;
+
+ private SearchingForRuntimesDialog searchingForRuntimesDialog;
+
+ private SeamPreferencesDialog seamPreferences = new SeamPreferencesDialog();
+
+ private ServerRuntimesPreferencesDialog serverRuntimesPreferences = new
ServerRuntimesPreferencesDialog();
+
+ @Before
+ public void prepareServers() throws IOException{
+ File tmpDir = FileUtils.getTempDirectory();
+ tmpServerPath = new File(tmpDir, "tmpServerCopy_" +
System.currentTimeMillis());
+ tmpServerAPath = new File(tmpServerPath, "serverA");
+ tmpServerBPath = new File(tmpServerPath, "serverB");
+
+ File server = new
File(RuntimeProperties.getInstance().getRuntimePath(DetectEAP5.SERVER_ID));
+ FileUtils.copyDirectoryToDirectory(server, tmpServerAPath);
+ FileUtils.copyDirectoryToDirectory(server, tmpServerBPath);
+ }
+
+ @Test
+ public void duplicateRuntimes(){
+ searchRuntimePath();
+
+ assertFoundRuntimesNumber(4);
+ assertSeamRuntimesNumber(2);
+ assertServerRuntimesNumber(2);
+
+ searchRuntimePath();
+ assertFoundRuntimesNumber(0);
+ }
+
+ @After
+ public void deleteServers() throws IOException{
+ FileUtils.deleteDirectory(tmpServerPath);
+
+ runtimeDetectionPreferences.open();
+ runtimeDetectionPreferences.removePath(RuntimeProperties.getInstance().getRuntimePath(DetectEAP5.SERVER_ID));
+ runtimeDetectionPreferences.ok();
+
+ seamPreferences.open();
+ seamPreferences.removeAllRuntimes();
+ seamPreferences.ok();
+
+ serverRuntimesPreferences.open();
+ serverRuntimesPreferences.removeAllRuntimes();
+ serverRuntimesPreferences.ok();
+ }
+
+ private void searchRuntimePath() {
+ runtimeDetectionPreferences = new RuntimeDetectionPreferencesDialog();
+ runtimeDetectionPreferences.open();
+ runtimeDetectionPreferences.addPath(tmpServerPath.getAbsolutePath());
+ searchingForRuntimesDialog = runtimeDetectionPreferences.search();
+ }
+
+ private void assertFoundRuntimesNumber(int expected) {
+ List<Runtime> runtimes = searchingForRuntimesDialog.getRuntimes();
+ assertThat(runtimes.size(), is(expected));
+ searchingForRuntimesDialog.ok();
+ runtimeDetectionPreferences.ok();
+ }
+
+ private void assertSeamRuntimesNumber(int expected) {
+ seamPreferences.open();
+ assertThat(seamPreferences.getRuntimes().size(), is(expected));
+ seamPreferences.ok();
+ }
+
+ private void assertServerRuntimesNumber(int expected) {
+ serverRuntimesPreferences.open();
+ assertThat(serverRuntimesPreferences.getRuntimes().size(), is(expected));
+ serverRuntimesPreferences.ok();
+ }
+}
Modified:
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/RuntimeDetectionPreferencesDialog.java
===================================================================
---
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/RuntimeDetectionPreferencesDialog.java 2012-05-23
11:52:55 UTC (rev 41288)
+++
trunk/runtime/tests/org.jboss.tools.runtime.as.ui.bot.test/src/org/jboss/tools/runtime/as/ui/bot/test/dialog/preferences/RuntimeDetectionPreferencesDialog.java 2012-05-23
12:47:43 UTC (rev 41289)
@@ -9,12 +9,20 @@
import org.eclipse.swtbot.swt.finder.waits.ICondition;
import org.jboss.tools.runtime.core.model.RuntimePath;
import org.jboss.tools.runtime.ui.RuntimeUIActivator;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
import org.jboss.tools.ui.bot.ext.SWTBotFactory;
import org.jboss.tools.ui.bot.ext.condition.TaskDuration;
public class RuntimeDetectionPreferencesDialog extends PreferencesDialog{
public void open(){
+ SWTBotExt bot = SWTBotFactory.getBot();
+ try {
+ bot.shell("Preferences");
+ ok();
+ } catch (WidgetNotFoundException e){
+ // ok
+ }
open("JBoss Tools", "JBoss Tools Runtime Detection");
}
Show replies by date