[jbosstools-commits] JBoss Tools SVN: r41878 - trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Tue Jun 12 03:41:54 EDT 2012
Author: jjankovi
Date: 2012-06-12 03:41:54 -0400 (Tue, 12 Jun 2012)
New Revision: 41878
Added:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/UserLibrariesFilesetTest.java
Modified:
trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesAllBotTests.java
Log:
UserLibrariesFilesetTest implemented and added into test suite
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-06-12 07:40:38 UTC (rev 41877)
+++ trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/ArchivesAllBotTests.java 2012-06-12 07:41:54 UTC (rev 41878)
@@ -24,6 +24,7 @@
VariousProjectsArchiving.class,
ArchiveViewReSwitchingTest.class,
FolderTest.class,
+ UserLibrariesFilesetTest.class,
BuildingArchiveNode.class,
BuildingProjectTest.class,
BuildingArchiveTest.class,
Added: trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/UserLibrariesFilesetTest.java
===================================================================
--- trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/UserLibrariesFilesetTest.java (rev 0)
+++ trunk/archives/tests/org.jboss.tools.archives.ui.bot.test/src/org/jboss/tools/archives/ui/bot/test/UserLibrariesFilesetTest.java 2012-06-12 07:41:54 UTC (rev 41878)
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2012 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.tools.archives.ui.bot.test;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.jboss.tools.archives.ui.bot.test.dialog.UserLibrariesFilesetDialog;
+import org.jboss.tools.archives.ui.bot.test.explorer.ProjectArchivesExplorer;
+import org.jboss.tools.archives.ui.bot.test.view.ProjectArchivesView;
+import org.jboss.tools.ui.bot.ext.gen.IPreference;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ *
+ * @author jjankovi
+ *
+ */
+public class UserLibrariesFilesetTest extends ArchivesTestBase {
+
+ private static String projectName = "pr2";
+
+ private final String PATH_SUFFIX = " [/" + projectName + "]";
+ private final String ARCHIVE_NAME = projectName + ".jar";
+ private final String ARCHIVE_PATH =
+ ARCHIVE_NAME + PATH_SUFFIX;
+
+ private final static String USER_LIBRARY_1 = "myLibrary1";
+ private final static String USER_LIBRARY_2 = "myLibrary2";
+
+ @BeforeClass
+ public static void setup() {
+ importProjectWithoutRuntime(projectName);
+ createUserLibrary(USER_LIBRARY_1);
+ createUserLibrary(USER_LIBRARY_2);
+ }
+
+ @Test
+ public void testCreatingUserLibraryFileSetInView() {
+
+ /* prepare view for testing */
+ ProjectArchivesView view = viewForProject(projectName);
+
+ /* create folder */
+ createUserLibraryFileset(view.createUserLibraryFileset(projectName, ARCHIVE_PATH), USER_LIBRARY_1);
+
+ /* test if folder was created */
+ assertItemExistsInView(view, projectName, ARCHIVE_PATH, USER_LIBRARY_1);
+ }
+ @Ignore // not implemented in tools yet
+ @Test
+ public void testCreatingUserLibraryFileSetInExplorer() {
+ /* prepare view for testing */
+ ProjectArchivesExplorer explorer = explorerForProject(projectName);
+
+ /* create folder */
+ createUserLibraryFileset(explorer.createUserLibraryFileset(ARCHIVE_PATH), USER_LIBRARY_2);
+
+ /* test if folder was created */
+ assertItemExistsInExplorer(explorer, ARCHIVE_PATH, USER_LIBRARY_2);
+ }
+
+ private void createUserLibraryFileset(
+ UserLibrariesFilesetDialog dialog, String userLibrary) {
+ dialog.selectUserLibrary(userLibrary).finish();
+ }
+
+ private static void createUserLibrary(String userLibrary) {
+ SWTBot bot = getUserLibraryPreferencePage();
+ bot.button(IDELabel.Button.NEW).click();
+ SWTBotShell shell = bot.shell("New User Library");
+ shell.bot().text().setText(userLibrary);
+ shell.bot().button(IDELabel.Button.OK).click();
+ bot.button(IDELabel.Button.OK).click();
+ util.waitForNonIgnoredJobs();
+ }
+
+ private static SWTBot getUserLibraryPreferencePage() {
+ IPreference page = new IPreference() {
+
+ @Override
+ public String getName() {
+ return "User Libraries";
+ }
+
+ @Override
+ public List<String> getGroupPath() {
+ List<String> path = new ArrayList<String>();
+ path.add("Java");
+ path.add("Build Path");
+ return path;
+ }
+ };
+ return open.preferenceOpen(page);
+ }
+
+}
More information about the jbosstools-commits
mailing list