Author: jjankovi
Date: 2012-05-24 04:43:30 -0400 (Thu, 24 May 2012)
New Revision: 41341
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesAllBotTests.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/BuildingArchiveNode.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/BuildingArchiveTest.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/CreatingArchiveTest.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/DeletingArchiveTest.java
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ViewIsPresentTest.java
Log:
ModifyingArchiveTest included in suite + refactoring
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesAllBotTests.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesAllBotTests.java 2012-05-24
08:42:44 UTC (rev 41340)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesAllBotTests.java 2012-05-24
08:43:30 UTC (rev 41341)
@@ -26,7 +26,7 @@
BuildingArchiveTest.class,
CreatingArchiveTest.class,
DeletingArchiveTest.class,
-// ModifyingArchiveTest.class,
+ ModifyingArchiveTest.class,
// DeployingArchiveTest.class,
})
public class ArchivesAllBotTests {
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.java 2012-05-24
08:42:44 UTC (rev 41340)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesTestBase.java 2012-05-24
08:43:30 UTC (rev 41341)
@@ -25,15 +25,18 @@
*
*/
@Require(clearProjects = true, perspective = "Java")
-// server = @Server(state = ServerState.NotRunning,
-// version = "6.0", operator = ">="))
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({ ArchivesAllBotTests.class })
public class ArchivesTestBase extends SWTTestExt {
- protected ProjectArchivesView viewForProject(String projectName) {
+ protected ProjectArchivesView openProjectArchivesView() {
ProjectArchivesView view = new ProjectArchivesView();
view.show();
+ return view;
+ }
+
+ protected ProjectArchivesView viewForProject(String projectName) {
+ ProjectArchivesView view = openProjectArchivesView();
projectExplorer.selectProject(projectName);
return view;
}
@@ -42,10 +45,25 @@
return new ProjectArchivesExplorer(projectName);
}
+ protected void assertItemExistsInView(ProjectArchivesView view, String... path) {
+ assertTrue(view.itemExists(path));
+ }
+
+ protected void assertItemExistsInExplorer(ProjectArchivesExplorer explorer, String...
path) {
+ assertTrue(explorer.itemExists(path));
+ }
+
+ protected void assertItemNotExistsInView(ProjectArchivesView view, String... path) {
+ assertFalse(view.itemExists(path));
+ }
+
+ protected void assertItemNotExistsInExplorer(ProjectArchivesExplorer explorer, String...
path) {
+ assertFalse(explorer.itemExists(path));
+ }
+
protected static void importProject(String projectName) {
String location = "/resources/prj/" + projectName;
-
importProject(projectName, location, projectName);
}
@@ -53,7 +71,6 @@
String projectLocation, String dir) {
ImportHelper.importProject(projectLocation, dir, Activator.PLUGIN_ID);
-
eclipse.addConfiguredRuntimeIntoProject(projectName,
configuredState.getServer().name);
}
@@ -61,15 +78,12 @@
protected static void importProjectWithoutRuntime(String projectName) {
String location = "/resources/prj/" + projectName;
-
importProjectWithoutRuntime(projectName, location, projectName);
}
protected static void importProjectWithoutRuntime(String projectName,
String projectLocation, String dir) {
-
ImportHelper.importProject(projectLocation, dir, Activator.PLUGIN_ID);
-
}
}
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/BuildingArchiveNode.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/BuildingArchiveNode.java 2012-05-24
08:42:44 UTC (rev 41340)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/BuildingArchiveNode.java 2012-05-24
08:43:30 UTC (rev 41341)
@@ -21,8 +21,12 @@
public class BuildingArchiveNode extends ArchivesTestBase {
private static String projectName = "pr2";
- private String archiveName = projectName + ".jar [/" + projectName +
"]";
+ private final String PATH_SUFFIX = " [/" + projectName + "]";
+ private final String ARCHIVE_NAME = projectName + ".jar";
+ private final String ARCHIVE_PATH =
+ ARCHIVE_NAME + PATH_SUFFIX;
+
@BeforeClass
public static void setup() {
importProjectWithoutRuntime(projectName);
@@ -31,7 +35,7 @@
@Test
public void testBuildingArchiveNode() {
viewForProject(projectName).
- buildArchiveNode(projectName, archiveName);
+ buildArchiveNode(projectName, ARCHIVE_PATH);
}
}
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/BuildingArchiveTest.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/BuildingArchiveTest.java 2012-05-24
08:42:44 UTC (rev 41340)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/BuildingArchiveTest.java 2012-05-24
08:43:30 UTC (rev 41341)
@@ -21,8 +21,12 @@
public class BuildingArchiveTest extends ArchivesTestBase{
private static String projectName = "pr2";
- private String archiveName = projectName + ".jar [/" + projectName +
"]";
+ private final String PATH_SUFFIX = " [/" + projectName + "]";
+ private final String ARCHIVE_NAME = projectName + ".jar";
+ private final String ARCHIVE_PATH =
+ ARCHIVE_NAME + PATH_SUFFIX;
+
@BeforeClass
public static void setup() {
importProjectWithoutRuntime(projectName);
@@ -31,13 +35,13 @@
@Test
public void testBuildingArchiveWithView() {
viewForProject(projectName)
- .buildArchiveFull(projectName, archiveName);
+ .buildArchiveFull(projectName, ARCHIVE_PATH);
}
@Test
public void testBuildingArchiveWithExplorer() {
explorerForProject(projectName)
- .buildArchiveFull(archiveName);
+ .buildArchiveFull(ARCHIVE_PATH);
}
}
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/CreatingArchiveTest.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/CreatingArchiveTest.java 2012-05-24
08:42:44 UTC (rev 41340)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/CreatingArchiveTest.java 2012-05-24
08:43:30 UTC (rev 41341)
@@ -24,47 +24,63 @@
*/
public class CreatingArchiveTest extends ArchivesTestBase {
- private static String project1 = "pr1";
+ private static String project = "pr1";
+ private final String ARCHIVE_STANDARD_1 =
+ project + "-standard.jar";
+ private final String ARCHIVE_STANDARD_2 =
+ project + "-standard-expl.jar";
+ private final String ARCHIVE_NO_COMPRESSION_1 =
+ project + "-nocompression.jar";
+ private final String ARCHIVE_NO_COMPRESSION_2 =
+ project + "-nocompression-expl.jar";
+
+ private final String PATH_SUFFIX = " [/" + project + "]";
+ private final String ARCHIVE_STANDARD_1_PATH =
+ ARCHIVE_STANDARD_1 + PATH_SUFFIX;
+ private final String ARCHIVE_STANDARD_2_PATH =
+ ARCHIVE_STANDARD_2 + PATH_SUFFIX;
+ private final String ARCHIVE_NO_COMPRESSION_1_PATH =
+ ARCHIVE_NO_COMPRESSION_1 + PATH_SUFFIX;
+ private final String ARCHIVE_NO_COMPRESSION_2_PATH =
+ ARCHIVE_NO_COMPRESSION_2 + PATH_SUFFIX;
+
+
@BeforeClass
public static void setup() {
JavaProjectEntity jpe = new JavaProjectEntity();
- jpe.setProjectName(project1);
+ jpe.setProjectName(project);
eclipse.createJavaProject(jpe);
}
@Test
public void testCreatingArchivetWithView() {
- ProjectArchivesView view = viewForProject(project1);
+ ProjectArchivesView view = viewForProject(project);
- /* creating JAR archive from project1 - standard way */
- NewJarDialog dialog = view.createNewJarArchive(project1);
- createArchive(dialog, project1 + "-standard", true);
- assertTrue(view.itemExists(project1,
- project1 + "-standard.jar [/" + project1 + "]"));
+ /* creating JAR archive from project - standard way */
+ NewJarDialog dialog = view.createNewJarArchive(project);
+ createArchive(dialog, ARCHIVE_STANDARD_1, true);
+ assertItemExistsInView(view, project, ARCHIVE_STANDARD_1_PATH);
- /* creating JAR archive from project1 - no compression way */
- dialog = view.createNewJarArchive(project1);
- createArchive(dialog, project1 + "-nocompression", false);
- assertTrue(view.itemExists(project1,
- project1 + "-nocompression.jar [/" + project1 + "]"));
+ /* creating JAR archive from project - no compression way */
+ dialog = view.createNewJarArchive(project);
+ createArchive(dialog, ARCHIVE_NO_COMPRESSION_1, false);
+ assertItemExistsInView(view, project, ARCHIVE_NO_COMPRESSION_1_PATH);
}
@Test
public void testCreatingArchiveWithExplorer() {
- ProjectArchivesExplorer explorer = explorerForProject(project1);
+ ProjectArchivesExplorer explorer = explorerForProject(project);
- /* creating JAR archive from project1 - standard way */
+ /* creating JAR archive from project - standard way */
NewJarDialog dialog = explorer.createNewJarArchive();
- createArchive(dialog, project1 + "-standard-expl", true);
- assertTrue(explorer.itemExists(
- project1 + "-standard-expl.jar [/" + project1 + "]"));
+ createArchive(dialog, ARCHIVE_STANDARD_2, true);
+ assertItemExistsInExplorer(explorer, ARCHIVE_STANDARD_2_PATH);
- /* creating JAR archive from project1 - no compression way */
+ /* creating JAR archive from project - no compression way */
dialog = explorer.createNewJarArchive();
- createArchive(dialog, project1 + "-nocompression-expl", false);
- assertTrue(explorer.itemExists(
- project1 + "-nocompression-expl.jar [/" + project1 + "]"));
+ createArchive(dialog, ARCHIVE_NO_COMPRESSION_2, false);
+ assertItemExistsInExplorer(explorer, ARCHIVE_NO_COMPRESSION_2_PATH);
}
private void createArchive(NewJarDialog dialog, String archiveName,
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/DeletingArchiveTest.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/DeletingArchiveTest.java 2012-05-24
08:42:44 UTC (rev 41340)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/DeletingArchiveTest.java 2012-05-24
08:43:30 UTC (rev 41341)
@@ -23,8 +23,15 @@
public class DeletingArchiveTest extends ArchivesTestBase {
private static String project = "pr3";
- private String pathToArchive1 = project + "a.jar [/" + project +
"]";
- private String pathToArchive2 = project + "b.jar [/" + project +
"]";
+ private final String ARCHIVE_NAME_1 =
+ project + "a.jar";
+ private final String ARCHIVE_NAME_2 =
+ project + "b.jar";
+ private final String PATH_SUFFIX = " [/" + project + "]";
+ private final String PATH_ARCHIVE_1 =
+ ARCHIVE_NAME_1 + PATH_SUFFIX;
+ private final String PATH_ARCHIVE_2 =
+ ARCHIVE_NAME_2 + PATH_SUFFIX;
@BeforeClass
public static void setup() {
@@ -34,15 +41,15 @@
@Test
public void testDeletingArchivetWithView() {
ProjectArchivesView view = viewForProject(project);
- view.deleteArchive(project, pathToArchive1);
- assertFalse(view.itemExists(project, pathToArchive1));
+ view.deleteArchive(project, PATH_ARCHIVE_1);
+ assertItemNotExistsInView(view, project, PATH_ARCHIVE_1);
}
@Test
public void testDeletingArchiveWithExplorer() {
ProjectArchivesExplorer explorer = explorerForProject(project);
- explorer.deleteArchive(pathToArchive2);
- assertFalse(explorer.itemExists(pathToArchive1));
+ explorer.deleteArchive(PATH_ARCHIVE_2);
+ assertItemNotExistsInExplorer(explorer, PATH_ARCHIVE_2);
}
}
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ViewIsPresentTest.java
===================================================================
---
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ViewIsPresentTest.java 2012-05-24
08:42:44 UTC (rev 41340)
+++
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ViewIsPresentTest.java 2012-05-24
08:43:30 UTC (rev 41341)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.archives.ui.bot.test;
-import org.jboss.tools.archives.ui.bot.test.view.ProjectArchivesView;
import org.jboss.tools.ui.bot.ext.types.IDELabel;
import org.junit.Test;
@@ -23,8 +22,12 @@
@Test
public void testArchivesViewIsPresent() {
- ProjectArchivesView view = new ProjectArchivesView();
- view.show();
+ openProjectArchivesView();
+ assertArchivesViewIsActive();
+
+ }
+
+ private void assertArchivesViewIsActive() {
assertTrue("Project Archives view is not active.",
bot.activeView().getTitle().equals(IDELabel.View.PROJECT_ARCHIVES));
}