summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Chouinard2013-04-04 19:21:15 (EDT)
committerFrancois Chouinard2013-05-27 14:58:57 (EDT)
commit69d24a7a976a4c78aaaeb2e189fe156366a38c80 (patch)
treebe5cff2d08e74f8df19318d7b3feed99eeb3797a
parent5f037de7ee2ab6ce6c014b9232f1e72c03db695d (diff)
downloadorg.eclipse.mylyn.reviews.r4e-69d24a7a976a4c78aaaeb2e189fe156366a38c80.zip
org.eclipse.mylyn.reviews.r4e-69d24a7a976a4c78aaaeb2e189fe156366a38c80.tar.gz
org.eclipse.mylyn.reviews.r4e-69d24a7a976a4c78aaaeb2e189fe156366a38c80.tar.bz2
R4E UI JUnits improvement2 (part 2)
We still have stability problems with the automated UI tests where some of them fail occasionally. This patch: - De-'singleton'izes TestUtils and R4UITestMain so we avoid potential simultaneous changes in the test workspace and in the shared repository - Introduces R4ETestCase to minimize the code impacts of the de-'singleton'ization on the actual tests (which have to extend R4ETestCase) - Ensures that the workspace projects have a unique name per test suite - Ensures that the shared drive is also unique per test suite - Moved the share drive(s) from /tmp to the workspace so it is guaranteed to be cleaned up event if a test case bombed with an exception. - Remove the now obsolete R4ETestSetup class Change-Id: I12a24e70924d65becfcaa012b41143eeaf98d977 Signed-off-by: Francois Chouinard <fchouinard@gmail.com>
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4ETestCase.java72
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4ETestSetup.java123
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4EUIAllTests.java3
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/RuleSetTests.java36
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/CloneAnomaliesCommentsTests.java75
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/CompareReviewItemsTests.java101
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/DuplicateAnomalyTests.java86
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PostponedAnomaliesTests.java154
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PreferencesTests.java64
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/ReviewWithStrangeCharTest.java56
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/UpgradeVersionTests.java72
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/UserReviewedTests.java166
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestMain.java24
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityBasicTests.java192
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityInformalTests.java222
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanitySetupTests.java107
-rw-r--r--org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/utils/TestUtils.java282
17 files changed, 929 insertions, 906 deletions
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4ETestCase.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4ETestCase.java
new file mode 100644
index 0000000..9e13532
--- /dev/null
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4ETestCase.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Ericsson Research Canada
+ *
+ * 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
+ *
+ * Description:
+ *
+ * This class implements the common setup for R4E JUnit UI Test suite
+ *
+ * Contributors:
+ * Sebastien Dubois - Created for Mylyn Review R4E project
+ *
+ ******************************************************************************/
+
+package org.eclipse.mylyn.reviews.r4e.ui.tests;
+
+import junit.framework.TestCase;
+
+import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
+
+public class R4ETestCase extends TestCase {
+
+ // ------------------------------------------------------------------------
+ // Attributes
+ // ------------------------------------------------------------------------
+
+ protected R4EUITestMain fTestMain = null;
+
+ protected TestUtils fTestUtils = null;
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ protected R4ETestCase(String suite) {
+ super(suite);
+ }
+
+ // ------------------------------------------------------------------------
+ // TestCase
+ // ------------------------------------------------------------------------
+
+ /**
+ * Sets up the R4E test environment.
+ */
+ @Override
+ protected void setUp() throws Exception {
+ // Setup the test proxy
+ fTestMain = new R4EUITestMain();
+
+ // Initialize the suite's TestUtils
+ fTestUtils = TestUtils.get(getClass().getSimpleName());
+ fTestUtils.setupTestEnvironment();
+ fTestUtils.setDefaultUser(fTestMain);
+ fTestUtils.startNavigatorView();
+ }
+
+ /**
+ * Tears down R4E test setup.
+ */
+ @Override
+ protected void tearDown() throws Exception {
+ fTestMain = null;
+ fTestUtils.stopNavigatorView();
+ fTestUtils.cleanupTestEnvironment();
+ }
+
+}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4ETestSetup.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4ETestSetup.java
deleted file mode 100644
index 6190404..0000000
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4ETestSetup.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2012 Ericsson Research Canada
- *
- * 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
- *
- * Description:
- *
- * This class implements the common setup for R4E JUnit UI Test suite
- *
- * Contributors:
- * Sebastien Dubois - Created for Mylyn Review R4E project
- *
- ******************************************************************************/
-
-package org.eclipse.mylyn.reviews.r4e.ui.tests;
-
-import java.io.IOException;
-import java.net.URISyntaxException;
-
-import junit.extensions.TestSetup;
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
-import org.osgi.framework.Bundle;
-
-public class R4ETestSetup extends TestSetup {
-
- public R4ETestSetup(Test suite) {
- super(suite);
- }
-
- /**
- * Sets up the R4E test environment.
- */
- @Override
- protected void setUp() throws Exception {
-
- try {
- TestUtils.setupTestEnvironment();
- TestUtils.setDefaultUser();
- TestUtils.startNavigatorView();
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- Bundle bundle = Platform.getBundle(R4EUITestPlugin.PLUGIN_ID);
- Platform.getLog(bundle).log(
- new Status(IStatus.ERROR, R4EUITestPlugin.PLUGIN_ID, IStatus.OK, "Exception: " + e.toString(), e));
- try {
- TestUtils.cleanupTestEnvironment();
- } catch (CoreException e1) {
- bundle = Platform.getBundle(R4EUITestPlugin.PLUGIN_ID);
- Platform.getLog(bundle).log(
- new Status(IStatus.ERROR, R4EUITestPlugin.PLUGIN_ID, IStatus.OK, "Exception: " + e.toString(),
- e));
- } catch (IOException e1) {
- bundle = Platform.getBundle(R4EUITestPlugin.PLUGIN_ID);
- Platform.getLog(bundle).log(
- new Status(IStatus.ERROR, R4EUITestPlugin.PLUGIN_ID, IStatus.OK, "Exception: " + e.toString(),
- e));
- }
- } catch (IOException e) {
- Bundle bundle = Platform.getBundle(R4EUITestPlugin.PLUGIN_ID);
- Platform.getLog(bundle).log(
- new Status(IStatus.ERROR, R4EUITestPlugin.PLUGIN_ID, IStatus.OK, "Exception: " + e.toString(), e));
- try {
- TestUtils.cleanupTestEnvironment();
- } catch (CoreException e1) {
- bundle = Platform.getBundle(R4EUITestPlugin.PLUGIN_ID);
- Platform.getLog(bundle).log(
- new Status(IStatus.ERROR, R4EUITestPlugin.PLUGIN_ID, IStatus.OK, "Exception: " + e.toString(),
- e));
- } catch (IOException e1) {
- bundle = Platform.getBundle(R4EUITestPlugin.PLUGIN_ID);
- Platform.getLog(bundle).log(
- new Status(IStatus.ERROR, R4EUITestPlugin.PLUGIN_ID, IStatus.OK, "Exception: " + e.toString(),
- e));
- }
- } catch (URISyntaxException e) {
- Bundle bundle = Platform.getBundle(R4EUITestPlugin.PLUGIN_ID);
- Platform.getLog(bundle).log(
- new Status(IStatus.ERROR, R4EUITestPlugin.PLUGIN_ID, IStatus.OK, "Exception: " + e.toString(), e));
- try {
- TestUtils.cleanupTestEnvironment();
- } catch (CoreException e1) {
- bundle = Platform.getBundle(R4EUITestPlugin.PLUGIN_ID);
- Platform.getLog(bundle).log(
- new Status(IStatus.ERROR, R4EUITestPlugin.PLUGIN_ID, IStatus.OK, "Exception: " + e.toString(),
- e));
- } catch (IOException e1) {
- bundle = Platform.getBundle(R4EUITestPlugin.PLUGIN_ID);
- Platform.getLog(bundle).log(
- new Status(IStatus.ERROR, R4EUITestPlugin.PLUGIN_ID, IStatus.OK, "Exception: " + e.toString(),
- e));
- }
- }
- }
-
- /**
- * Tears down R4E test setup.
- */
- @Override
- protected void tearDown() throws Exception {
- try {
- TestUtils.stopNavigatorView();
- TestUtils.cleanupTestEnvironment();
- } catch (CoreException e) {
- Bundle bundle = Platform.getBundle(R4EUITestPlugin.PLUGIN_ID);
- Platform.getLog(bundle).log(
- new Status(IStatus.ERROR, R4EUITestPlugin.PLUGIN_ID, IStatus.OK, "Exception: " + e.toString(), e));
- } catch (IOException e) {
- Bundle bundle = Platform.getBundle(R4EUITestPlugin.PLUGIN_ID);
- Platform.getLog(bundle).log(
- new Status(IStatus.ERROR, R4EUITestPlugin.PLUGIN_ID, IStatus.OK, "Exception: " + e.toString(), e));
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4EUIAllTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4EUIAllTests.java
index e698eac..286cb4d 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4EUIAllTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/R4EUIAllTests.java
@@ -82,7 +82,8 @@ public class R4EUIAllTests extends TestSuite {
//suite.addTestSuite(RuleTests.class);
//suite.addTestSuite(PostponedElementsTests.class);
- return new R4ETestSetup(suite);
+// return new R4ETestSetup(suite);
+ return suite;
}
/**
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/RuleSetTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/RuleSetTests.java
index 8279aad..5221f88 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/RuleSetTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/RuleSetTests.java
@@ -14,7 +14,6 @@ package org.eclipse.mylyn.reviews.r4e.ui.tests;
import java.util.concurrent.ExecutionException;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.commands.NotEnabledException;
@@ -24,10 +23,8 @@ import org.eclipse.core.runtime.Path;
import org.eclipse.mylyn.reviews.r4e.core.model.serial.impl.OutOfSyncException;
import org.eclipse.mylyn.reviews.r4e.core.model.serial.impl.ResourceHandlingException;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIRuleSet;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
import org.eclipse.mylyn.reviews.r4e.ui.tests.sanity.SanitySetupTests;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
import org.junit.After;
import org.junit.Before;
@@ -35,7 +32,7 @@ import org.junit.Before;
* @author Sebastien Dubois
*/
@SuppressWarnings({ "restriction", "nls" })
-public class RuleSetTests extends TestCase {
+public class RuleSetTests extends R4ETestCase {
// ------------------------------------------------------------------------
// Constants
@@ -52,6 +49,24 @@ public class RuleSetTests extends TestCase {
private R4EUIRuleSet fRuleSet;
// ------------------------------------------------------------------------
+ // Constants
+ // ------------------------------------------------------------------------
+
+ private static final String TEST_SUITE_ID = "RuleSetTests";
+
+ // ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ public RuleSetTests(String suite) {
+ super(suite);
+ }
+
+ public RuleSetTests() {
+ super(TEST_SUITE_ID);
+ }
+
+ // ------------------------------------------------------------------------
// Methods
// ------------------------------------------------------------------------
@@ -61,7 +76,7 @@ public class RuleSetTests extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(SanitySetupTests.class);
- return new R4ETestSetup(suite);
+ return suite;
}
/**
@@ -70,7 +85,8 @@ public class RuleSetTests extends TestCase {
@Before
@Override
public void setUp() throws Exception {
- TestUtils.startNavigatorView();
+ super.setUp();
+ fTestUtils.startNavigatorView();
}
/**
@@ -80,7 +96,8 @@ public class RuleSetTests extends TestCase {
@Override
public void tearDown() throws Exception {
fRuleSet = null;
- TestUtils.stopNavigatorView();
+ fTestUtils.stopNavigatorView();
+ super.tearDown();
}
/**
@@ -101,14 +118,13 @@ public class RuleSetTests extends TestCase {
//Create a Rule Set
r4eAssert.setTest("Create a Rule Set");
- R4EUITestMain proxy = R4EUITestMain.getInstance();
- fRuleSet = proxy.getRuleSetProxy().createRuleSet(TestUtils.FSharedFolder, RULE_SET_TEST_NAME,
+ fRuleSet = fTestMain.getRuleSetProxy().createRuleSet(fTestUtils.FSharedFolder, RULE_SET_TEST_NAME,
RULE_SET_TEST_VERSION);
r4eAssert.assertNotNull(fRuleSet);
r4eAssert.assertEquals(RULE_SET_TEST_VERSION, fRuleSet.getRuleSet().getVersion());
- r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString(), fRuleSet.getRuleSet().getFolder());
+ r4eAssert.assertEquals(new Path(fTestUtils.FSharedFolder).toPortableString(), fRuleSet.getRuleSet().getFolder());
r4eAssert.assertEquals(RULE_SET_TEST_NAME, fRuleSet.getRuleSet().getName());
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/CloneAnomaliesCommentsTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/CloneAnomaliesCommentsTests.java
index 23bd3b9..8651e0c 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/CloneAnomaliesCommentsTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/CloneAnomaliesCommentsTests.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.List;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.runtime.CoreException;
@@ -46,8 +45,7 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewItem;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUISelection;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUITextPosition;
import org.eclipse.mylyn.reviews.r4e.ui.internal.navigator.ReviewNavigatorActionGroup;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestCase;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
@@ -55,7 +53,7 @@ import org.junit.After;
import org.junit.Before;
@SuppressWarnings({ "restriction", "nls" })
-public class CloneAnomaliesCommentsTests extends TestCase {
+public class CloneAnomaliesCommentsTests extends R4ETestCase {
// ------------------------------------------------------------------------
// Constants
@@ -85,8 +83,6 @@ public class CloneAnomaliesCommentsTests extends TestCase {
// Member variables
// ------------------------------------------------------------------------
- private R4EUITestMain fProxy = null;
-
private R4EUIReviewGroup fGroup = null;
private String fGroupName = null;
@@ -123,6 +119,20 @@ public class CloneAnomaliesCommentsTests extends TestCase {
private R4EUIAnomalyBasic fClonedAnomaly4 = null;
// ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ private static final String TEST_SUITE_ID = "CloneAnomaliesCommentsTests";
+
+ public CloneAnomaliesCommentsTests(String suite) {
+ super(suite);
+ }
+
+ public CloneAnomaliesCommentsTests() {
+ super(TEST_SUITE_ID);
+ }
+
+ // ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
@@ -134,7 +144,7 @@ public class CloneAnomaliesCommentsTests extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(CloneAnomaliesCommentsTests.class);
- return new R4ETestSetup(suite);
+ return suite;
}
/**
@@ -146,13 +156,13 @@ public class CloneAnomaliesCommentsTests extends TestCase {
@Before
@Override
public void setUp() throws Exception {
- fProxy = R4EUITestMain.getInstance();
+ super.setUp();
createReviewGroups();
createReview();
createReviewItem();
createParticipants(fReview);
if (((ReviewNavigatorActionGroup) R4EUIModelController.getNavigatorView().getActionSet()).isHideDeltasFilterSet()) {
- fProxy.getCommandProxy().toggleHideDeltasFilter();
+ fTestMain.getCommandProxy().toggleHideDeltasFilter();
}
createAnomalies();
createComments();
@@ -166,7 +176,7 @@ public class CloneAnomaliesCommentsTests extends TestCase {
@After
@Override
public void tearDown() throws Exception {
- fProxy = null;
+ fTestMain = null;
}
// ------------------------------------------------------------------------
@@ -212,14 +222,14 @@ public class CloneAnomaliesCommentsTests extends TestCase {
}
}
if (null == fGroup) {
- fGroup = fProxy.getReviewGroupProxy().createReviewGroup(
- TestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME,
+ fGroup = fTestMain.getReviewGroupProxy().createReviewGroup(
+ fTestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME,
TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
r4eAssert.assertNotNull(fGroup);
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName());
- r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertEquals(new Path(fTestUtils.FSharedFolder).toPortableString() + "/"
+ TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getFolder());
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup()
.getDescription());
@@ -255,12 +265,12 @@ public class CloneAnomaliesCommentsTests extends TestCase {
}
}
if (!fGroup.isOpen()) {
- fProxy.getCommandProxy().openElement(fGroup);
+ fTestMain.getCommandProxy().openElement(fGroup);
}
r4eAssert.assertTrue(fGroup.isOpen());
r4eAssert.setTest("Create Review");
- fReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
+ fReview = fTestMain.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
REVIEW_TEST_NAME, REVIEW_TEST_DESCRIPTION, TestConstants.REVIEW_TEST_DUE_DATE,
TestConstants.REVIEW_TEST_PROJECT, TestConstants.REVIEW_TEST_COMPONENTS,
TestConstants.REVIEW_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_TEST_OBJECTIVES,
@@ -291,7 +301,7 @@ public class CloneAnomaliesCommentsTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createReviewItem");
r4eAssert.setTest("Create Commit Item");
- fItem = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
+ fItem = fTestMain.getItemProxy().createCommitItem(fTestUtils.FJavaIProject, 0);
r4eAssert.assertNotNull(fItem);
r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem.getItem().getAddedById());
r4eAssert.assertEquals("The.committer@some.com", fItem.getItem().getAuthorRep());
@@ -381,7 +391,7 @@ public class CloneAnomaliesCommentsTests extends TestCase {
}
r4eAssert.setTest("Create Manual Tree Item");
- fItem2 = fProxy.getItemProxy().createManualTreeItem(TestUtils.FJavaFile3);
+ fItem2 = fTestMain.getItemProxy().createManualTreeItem(fTestUtils.FJavaFile3);
r4eAssert.assertNotNull(fItem2);
r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem2.getItem().getAddedById());
r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
@@ -413,7 +423,7 @@ public class CloneAnomaliesCommentsTests extends TestCase {
// R4EUIConstants.SELECTION_ANNOTATION_ID));
r4eAssert.setTest("Create Manual Text Item");
- fItem3 = fProxy.getItemProxy().createManualTextItem(TestUtils.FJavaFile4, 50, 20);
+ fItem3 = fTestMain.getItemProxy().createManualTextItem(fTestUtils.FJavaFile4, 50, 20);
r4eAssert.assertNotNull(fItem3);
r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem3.getItem().getAddedById());
r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
@@ -461,7 +471,7 @@ public class CloneAnomaliesCommentsTests extends TestCase {
participant.setId(TestConstants.PARTICIPANT_TEST_ID);
participant.setEmail(TestConstants.PARTICIPANT_TEST_EMAIL);
participants.add(participant);
- R4EUIParticipant uiParticipant = fProxy.getParticipantProxy().createParticipant(
+ R4EUIParticipant uiParticipant = fTestMain.getParticipantProxy().createParticipant(
aReview.getParticipantContainer(), participants);
r4eAssert.assertNotNull(uiParticipant);
r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, uiParticipant.getParticipant().getId());
@@ -484,7 +494,7 @@ public class CloneAnomaliesCommentsTests extends TestCase {
.getContentsContainerElement()
.getContentsList()
.get(0);
- fAnomaly1 = fProxy.getAnomalyProxy().createLinkedAnomaly(content1, ANOMALY1_TEST_TITLE,
+ fAnomaly1 = fTestMain.getAnomalyProxy().createLinkedAnomaly(content1, ANOMALY1_TEST_TITLE,
ANOMALY1_TEST_DESCRIPTION, TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
TestConstants.ANOMALY_TEST_RANK_MAJOR, TestConstants.ANOMALY_TEST_DUE_DATE,
TestConstants.PARTICIPANT_ASSIGN_TO, null);
@@ -510,7 +520,7 @@ public class CloneAnomaliesCommentsTests extends TestCase {
.getContentsContainerElement()
.getContentsList()
.get(1);
- fAnomaly2 = fProxy.getAnomalyProxy().createLinkedAnomaly(content2, ANOMALY2_TEST_TITLE,
+ fAnomaly2 = fTestMain.getAnomalyProxy().createLinkedAnomaly(content2, ANOMALY2_TEST_TITLE,
ANOMALY2_TEST_DESCRIPTION, TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
TestConstants.ANOMALY_TEST_RANK_MAJOR, TestConstants.ANOMALY_TEST_DUE_DATE,
TestConstants.PARTICIPANT_ASSIGN_TO, null);
@@ -542,22 +552,22 @@ public class CloneAnomaliesCommentsTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createComments");
r4eAssert.setTest("Anomaly 1 Comment 1");
- fAnomaly1Comment1 = fProxy.getCommentProxy().createComment(fAnomaly1, ANOMALY1_COMMENT1_TEST);
+ fAnomaly1Comment1 = fTestMain.getCommentProxy().createComment(fAnomaly1, ANOMALY1_COMMENT1_TEST);
r4eAssert.assertNotNull(fAnomaly1Comment1);
r4eAssert.assertEquals(ANOMALY1_COMMENT1_TEST, fAnomaly1Comment1.getComment().getDescription());
r4eAssert.setTest("Anomaly 1 Comment 2");
- fAnomaly1Comment2 = fProxy.getCommentProxy().createComment(fAnomaly1, ANOMALY1_COMMENT2_TEST);
+ fAnomaly1Comment2 = fTestMain.getCommentProxy().createComment(fAnomaly1, ANOMALY1_COMMENT2_TEST);
r4eAssert.assertNotNull(fAnomaly1Comment2);
r4eAssert.assertEquals(ANOMALY1_COMMENT2_TEST, fAnomaly1Comment2.getComment().getDescription());
r4eAssert.setTest("Anomaly 2 Comment 1");
- fAnomaly2Comment1 = fProxy.getCommentProxy().createComment(fAnomaly2, ANOMALY2_COMMENT1_TEST);
+ fAnomaly2Comment1 = fTestMain.getCommentProxy().createComment(fAnomaly2, ANOMALY2_COMMENT1_TEST);
r4eAssert.assertNotNull(fAnomaly2Comment1);
r4eAssert.assertEquals(ANOMALY2_COMMENT1_TEST, fAnomaly2Comment1.getComment().getDescription());
r4eAssert.setTest("Anomaly 2 Comment 2");
- fAnomaly2Comment2 = fProxy.getCommentProxy().createComment(fAnomaly2, ANOMALY2_COMMENT2_TEST);
+ fAnomaly2Comment2 = fTestMain.getCommentProxy().createComment(fAnomaly2, ANOMALY2_COMMENT2_TEST);
r4eAssert.assertNotNull(fAnomaly2Comment2);
r4eAssert.assertEquals(ANOMALY2_COMMENT2_TEST, fAnomaly2Comment2.getComment().getDescription());
}
@@ -575,8 +585,9 @@ public class CloneAnomaliesCommentsTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("cloneAnomaliesFromEditor");
r4eAssert.setTest("Clone Anomaly");
- fClonedAnomaly1 = fProxy.getAnomalyProxy().cloneEditorAnomaly(fItem.getFileContexts().get(fAnomalyFileIndex),
- 20, 50, fAnomaly1, TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_TEST_ID);
+ fClonedAnomaly1 = fTestMain.getAnomalyProxy().cloneEditorAnomaly(
+ fItem.getFileContexts().get(fAnomalyFileIndex), 20, 50, fAnomaly1, TestConstants.ANOMALY_TEST_DUE_DATE,
+ TestConstants.PARTICIPANT_TEST_ID);
r4eAssert.assertNotNull(fClonedAnomaly1);
r4eAssert.assertEquals(fAnomaly1.getAnomaly().getTitle(), fClonedAnomaly1.getAnomaly().getTitle());
@@ -609,7 +620,7 @@ public class CloneAnomaliesCommentsTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("cloneAnomaliesFromExternal");
r4eAssert.setTest("Clone Anomaly");
- fClonedAnomaly2 = fProxy.getAnomalyProxy().cloneExternalAnomaly(TestUtils.FJavaFile3, fAnomaly2,
+ fClonedAnomaly2 = fTestMain.getAnomalyProxy().cloneExternalAnomaly(fTestUtils.FJavaFile3, fAnomaly2,
TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_TEST_ID);
r4eAssert.assertNotNull(fClonedAnomaly2);
@@ -686,14 +697,14 @@ public class CloneAnomaliesCommentsTests extends TestCase {
r4eAssert.setTest("Copy Elements");
List<IR4EUIModelElement> elementsCopied = new ArrayList<IR4EUIModelElement>();
elementsCopied.add(fAnomaly1);
- fProxy.getCommandProxy().copyElements(elementsCopied);
+ fTestMain.getCommandProxy().copyElements(elementsCopied);
R4EUISelection targetContent = (R4EUISelection) fItem3.getFileContexts()
.get(0)
.getContentsContainerElement()
.getChildren()[0];
r4eAssert.setTest("Paste Elements");
- List<IR4EUIModelElement> elementsPasted = fProxy.getCommandProxy().pasteElements(targetContent);
+ List<IR4EUIModelElement> elementsPasted = fTestMain.getCommandProxy().pasteElements(targetContent);
fClonedAnomaly4 = (R4EUIAnomalyBasic) elementsPasted.get(0);
r4eAssert.assertNotNull(fClonedAnomaly4);
r4eAssert.assertEquals(fAnomaly1.getAnomaly().getTitle(), fClonedAnomaly4.getAnomaly().getTitle());
@@ -758,11 +769,11 @@ public class CloneAnomaliesCommentsTests extends TestCase {
List<IR4EUIModelElement> elementsCopied = new ArrayList<IR4EUIModelElement>();
elementsCopied.add(fAnomaly2Comment1);
elementsCopied.add(fAnomaly2Comment2);
- fProxy.getCommandProxy().copyElements(elementsCopied);
+ fTestMain.getCommandProxy().copyElements(elementsCopied);
r4eAssert.setTest("Paste Elements");
@SuppressWarnings("unused")
- List<IR4EUIModelElement> elementsPasted = fProxy.getCommandProxy().pasteElements(fClonedAnomaly1);
+ List<IR4EUIModelElement> elementsPasted = fTestMain.getCommandProxy().pasteElements(fClonedAnomaly1);
//NOTE: For some reason, only the second comment is selected after the paste, so we use another way of verifying the results
r4eAssert.assertNotNull(fClonedAnomaly1.getChildren()[0]);
r4eAssert.assertEquals(fAnomaly2Comment1.getComment().getDescription(),
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/CompareReviewItemsTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/CompareReviewItemsTests.java
index 3e8d95d..0f75b15 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/CompareReviewItemsTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/CompareReviewItemsTests.java
@@ -24,7 +24,6 @@ import java.util.ArrayList;
import java.util.List;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.runtime.CoreException;
@@ -45,8 +44,7 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewGroup;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewItem;
import org.eclipse.mylyn.reviews.r4e.ui.internal.navigator.ReviewNavigatorActionGroup;
import org.eclipse.mylyn.reviews.r4e.ui.internal.utils.R4EUIConstants;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestCase;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
@@ -54,7 +52,7 @@ import org.junit.After;
import org.junit.Before;
@SuppressWarnings("restriction")
-public class CompareReviewItemsTests extends TestCase {
+public class CompareReviewItemsTests extends R4ETestCase {
// ------------------------------------------------------------------------
// Constants
@@ -70,8 +68,6 @@ public class CompareReviewItemsTests extends TestCase {
// Member variables
// ------------------------------------------------------------------------
- private R4EUITestMain fProxy = null;
-
private R4EUIReviewGroup fGroup = null;
private String fGroupName = null;
@@ -89,33 +85,39 @@ public class CompareReviewItemsTests extends TestCase {
private R4EUIAnomalyBasic fCompareEditorAnomaly = null;
// ------------------------------------------------------------------------
- // Methods
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ private static final String TEST_SUITE_ID = "CompareReviewItemsTests";
+
+ public CompareReviewItemsTests(String suite) {
+ super(suite);
+ }
+
+ public CompareReviewItemsTests() {
+ super(TEST_SUITE_ID);
+ }
+
+ // ------------------------------------------------------------------------
+ // Life cycle
// ------------------------------------------------------------------------
/**
- * Method suite - Sets up the global test environment, if not already done at the suite level.
- *
- * @return Test
+ * @return Test the test suite
*/
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(CompareReviewItemsTests.class);
- return new R4ETestSetup(suite);
+ return suite;
}
- /**
- * Method setUp - Sets up the fixture, for example, open a network connection. This method is called before a test
- * is executed.
- *
- * @throws java.lang.Exception
- */
@Override
@Before
public void setUp() throws Exception {
- fProxy = R4EUITestMain.getInstance();
+ super.setUp();
createReviewGroup();
if (((ReviewNavigatorActionGroup) R4EUIModelController.getNavigatorView().getActionSet()).isHideDeltasFilterSet()) {
- fProxy.getCommandProxy().toggleHideDeltasFilter();
+ fTestMain.getCommandProxy().toggleHideDeltasFilter();
}
createReview();
createReviewItems();
@@ -123,15 +125,10 @@ public class CompareReviewItemsTests extends TestCase {
createCompareEditorAnomalies();
}
- /**
- * Method tearDown
- *
- * @throws java.lang.Exception
- */
@Override
@After
public void tearDown() throws Exception {
- fProxy = null;
+ super.tearDown();
}
/**
@@ -139,12 +136,17 @@ public class CompareReviewItemsTests extends TestCase {
*
* @throws CoreException
*/
+ @org.junit.Test
public void testCompareReviewItems() throws CoreException, IOException, URISyntaxException {
TestUtils.waitForJobs();
commitNewReviewItemVersion();
compareReviewItemsVersions();
}
+ // ------------------------------------------------------------------------
+ // Helper functions
+ // ------------------------------------------------------------------------
+
/**
* Method createReviewGroup
*/
@@ -165,14 +167,14 @@ public class CompareReviewItemsTests extends TestCase {
}
}
if (null == fGroup) {
- fGroup = fProxy.getReviewGroupProxy().createReviewGroup(
- TestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME,
+ fGroup = fTestMain.getReviewGroupProxy().createReviewGroup(
+ fTestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME,
TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
r4eAssert.assertNotNull(fGroup);
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName());
- r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertEquals(new Path(fTestUtils.FSharedFolder).toPortableString() + "/"
+ TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getFolder());
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup()
.getDescription());
@@ -209,12 +211,12 @@ public class CompareReviewItemsTests extends TestCase {
r4eAssert.setTest("Open Review Group");
if (!fGroup.isOpen()) {
- fProxy.getCommandProxy().openElement(fGroup);
+ fTestMain.getCommandProxy().openElement(fGroup);
}
r4eAssert.assertTrue(fGroup.isOpen());
r4eAssert.setTest("Create Review");
- fReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
+ fReview = fTestMain.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
TestConstants.REVIEW_TEST_NAME_INF_COMPARE, TestConstants.REVIEW_TEST_DESCRIPTION,
TestConstants.REVIEW_TEST_DUE_DATE, TestConstants.REVIEW_TEST_PROJECT,
TestConstants.REVIEW_TEST_COMPONENTS, TestConstants.REVIEW_TEST_ENTRY_CRITERIA,
@@ -246,11 +248,11 @@ public class CompareReviewItemsTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createReviewItems");
r4eAssert.setTest("Create Commit Item");
- fItem = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
+ fItem = fTestMain.getItemProxy().createCommitItem(fTestUtils.FJavaIProject, 0);
//close and re-open, so the validation takes de-serialized information
String itemName = fItem.getName();
- fProxy.getCommandProxy().closeElement(fReview);
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(itemName)) {
fItem = (R4EUIReviewItem) elem;
@@ -261,7 +263,7 @@ public class CompareReviewItemsTests extends TestCase {
r4eAssert.assertNotNull(fItem);
r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem.getItem().getAddedById());
r4eAssert.assertEquals("The.committer@some.com", fItem.getItem().getAuthorRep());
- r4eAssert.assertEquals("third Java Commit", fItem.getItem().getDescription());
+ r4eAssert.assertEquals("second Java Commit", fItem.getItem().getDescription());
r4eAssert.assertEquals(4, fItem.getChildren().length);
for (int i = 0; i < fItem.getChildren().length; i++) {
if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE1_PROJ_NAME)) {
@@ -318,9 +320,9 @@ public class CompareReviewItemsTests extends TestCase {
.get(2)
.getTarget()
.getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
- // ((R4EUIFileContext) fItem.getChildren()[i]).getContentsContainerElement().getChildren(), true,
- // R4EUIConstants.DELTA_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotations(
+ ((R4EUIFileContext) fItem.getChildren()[i]).getContentsContainerElement().getChildren(), true,
+ R4EUIConstants.DELTA_ANNOTATION_ID));
} else if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE4_PROJ_NAME)) {
r4eAssert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem.getItem()
@@ -361,7 +363,8 @@ public class CompareReviewItemsTests extends TestCase {
participant.setId(TestConstants.PARTICIPANT_TEST_ID);
participant.setEmail(TestConstants.PARTICIPANT_TEST_EMAIL);
participants.add(participant);
- fParticipant = fProxy.getParticipantProxy().createParticipant(fReview.getParticipantContainer(), participants);
+ fParticipant = fTestMain.getParticipantProxy().createParticipant(fReview.getParticipantContainer(),
+ participants);
r4eAssert.assertNotNull(fParticipant);
r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, fParticipant.getParticipant().getId());
r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_EMAIL, fParticipant.getParticipant().getEmail());
@@ -377,7 +380,7 @@ public class CompareReviewItemsTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createCompareEditorAnomalies");
r4eAssert.setTest("Create Compare Editor Anomaly");
- fCompareEditorAnomaly = fProxy.getAnomalyProxy().createCompareEditorAnomaly(
+ fCompareEditorAnomaly = fTestMain.getAnomalyProxy().createCompareEditorAnomaly(
fItem.getFileContexts().get(fAnomalyFileIndex), 20, 50,
TestConstants.COMPARE_EDITOR_ANOMALY_TEST_TITLE, TestConstants.COMPARE_EDITOR_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_ERRONEOUS, TestConstants.ANOMALY_TEST_RANK_MINOR,
@@ -400,10 +403,14 @@ public class CompareReviewItemsTests extends TestCase {
r4eAssert.assertEquals(50, ((R4ETextPosition) ((R4ETextContent) fCompareEditorAnomaly.getAnomaly()
.getLocation()
.get(0)).getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
- // R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
+ R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
+ // ------------------------------------------------------------------------
+ // Tests
+ // ------------------------------------------------------------------------
+
/**
* Method commitNewReviewItemVersion
*/
@@ -413,13 +420,13 @@ public class CompareReviewItemsTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("commitNewReviewItemVersion");
r4eAssert.setTest("Commit New Review Item Version");
- TestUtils.FJavaFile1 = TestUtils.changeContentOfFile(TestUtils.FJavaFile1, JAVA_FILE12_EXT_MOD_PATH);
- TestUtils.commitFiles(TestUtils.FJavaIProject, TestUtils.FJavaRepository, "second Java Commit", true);
+ fTestUtils.FJavaFile1 = fTestUtils.changeContentOfFile(fTestUtils.FJavaFile1, JAVA_FILE12_EXT_MOD_PATH);
+ fTestUtils.commitFiles(fTestUtils.FJavaIProject, fTestUtils.FJavaRepository, "second Java Commit", true);
- fItem2 = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
+ fItem2 = fTestMain.getItemProxy().createCommitItem(fTestUtils.FJavaIProject, 0);
//close and re-open, so the validation takes de-serialized information
- fProxy.getCommandProxy().closeElement(fReview);
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(REVIEW_ITEM_COMMIT_1)) {
@@ -479,7 +486,7 @@ public class CompareReviewItemsTests extends TestCase {
.get(fAnomalyFileIndex)
.getAnomalyContainerElement()
.getChildren()[0];
- fProxy.getItemProxy().openCompareReviewItems(fItem, fItem2, fCompareEditorAnomaly,
+ fTestMain.getItemProxy().openCompareReviewItems(fItem, fItem2, fCompareEditorAnomaly,
R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID);
}
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/DuplicateAnomalyTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/DuplicateAnomalyTests.java
index da48116..9aaa6d9 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/DuplicateAnomalyTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/DuplicateAnomalyTests.java
@@ -25,7 +25,6 @@ import java.util.ArrayList;
import java.util.Collection;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.runtime.CoreException;
@@ -44,8 +43,7 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewGroup;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewItem;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUITextPosition;
import org.eclipse.mylyn.reviews.r4e.ui.internal.navigator.ReviewNavigatorActionGroup;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestCase;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
@@ -57,7 +55,7 @@ import org.junit.Before;
* @version $Revision: 1.0 $
*/
@SuppressWarnings({ "restriction", "nls" })
-public class DuplicateAnomalyTests extends TestCase {
+public class DuplicateAnomalyTests extends R4ETestCase {
// ------------------------------------------------------------------------
// Constant
@@ -71,8 +69,6 @@ public class DuplicateAnomalyTests extends TestCase {
// Member variables
// ------------------------------------------------------------------------
- private R4EUITestMain fProxy = null;
-
private R4EUIReviewGroup fGroup = null;
@SuppressWarnings("unused")
@@ -98,46 +94,47 @@ public class DuplicateAnomalyTests extends TestCase {
private R4EUIAnomalyBasic fExternalAnomaly = null;
// ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ private static final String TEST_SUITE_ID = "DuplicateAnomalyTests";
+
+ public DuplicateAnomalyTests(String suite) {
+ super(suite);
+ }
+
+ public DuplicateAnomalyTests() {
+ super(TEST_SUITE_ID);
+ }
+
+ // ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
/**
- * Method suite - Sets up the global test environment, if not already done at the suite level.
- *
- * @return Test
+ * @return Test the test suite
*/
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(DuplicateAnomalyTests.class);
- return new R4ETestSetup(suite);
+ return suite;
}
- /**
- * Method setUp - Sets up the fixture, for example, open a network connection. This method is called before a test
- * is executed.
- *
- * @throws java.lang.Exception
- */
@Before
@Override
public void setUp() throws Exception {
- fProxy = R4EUITestMain.getInstance();
+ super.setUp();
createReviewGroups();
if (((ReviewNavigatorActionGroup) R4EUIModelController.getNavigatorView().getActionSet()).isHideDeltasFilterSet()) {
- fProxy.getCommandProxy().toggleHideDeltasFilter();
+ fTestMain.getCommandProxy().toggleHideDeltasFilter();
}
createReviews();
}
- /**
- * Method tearDown
- *
- * @throws java.lang.Exception
- */
@After
@Override
public void tearDown() throws Exception {
- fProxy = null;
+ super.tearDown();
}
// ------------------------------------------------------------------------
@@ -149,6 +146,7 @@ public class DuplicateAnomalyTests extends TestCase {
*
* @throws CoreException
*/
+ @org.junit.Test
public void testDuplicationAnomalyInAReviews() throws CoreException {
TestUtils.waitForJobs();
createReviewItems();
@@ -181,14 +179,14 @@ public class DuplicateAnomalyTests extends TestCase {
}
}
if (null == fGroup) {
- fGroup = fProxy.getReviewGroupProxy().createReviewGroup(
- TestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME,
+ fGroup = fTestMain.getReviewGroupProxy().createReviewGroup(
+ fTestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME,
TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
r4eAssert.assertNotNull(fGroup);
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName());
- r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertEquals(new Path(fTestUtils.FSharedFolder).toPortableString() + "/"
+ TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getFolder());
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup()
.getDescription());
@@ -218,12 +216,12 @@ public class DuplicateAnomalyTests extends TestCase {
r4eAssert.setTest("Open Review Group");
if (!fGroup.isOpen()) {
- fProxy.getCommandProxy().openElement(fGroup);
+ fTestMain.getCommandProxy().openElement(fGroup);
}
r4eAssert.assertTrue(fGroup.isOpen());
r4eAssert.setTest("Create Review");
- fReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
+ fReview = fTestMain.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
TestConstants.REVIEW_DUPLICATE_NAME_INF, TestConstants.REVIEW_TEST_DESCRIPTION,
TestConstants.REVIEW_TEST_DUE_DATE, TestConstants.REVIEW_TEST_PROJECT,
TestConstants.REVIEW_TEST_COMPONENTS, TestConstants.REVIEW_TEST_ENTRY_CRITERIA,
@@ -256,16 +254,16 @@ public class DuplicateAnomalyTests extends TestCase {
* @throws IOException
* @throws URISyntaxException
*/
- private static void amendInitialCommit() throws CoreException, IOException, URISyntaxException {
+ private void amendInitialCommit() throws CoreException, IOException, URISyntaxException {
//Update files ( Modify File 3 since last commit)
- TestUtils.FJavaFile3 = TestUtils.changeContentOfFile(TestUtils.FJavaFile3, TestUtils.JAVA_FILE3_EXT_MOD_PATH);
+ fTestUtils.FJavaFile3 = fTestUtils.changeContentOfFile(fTestUtils.FJavaFile3, TestUtils.JAVA_FILE3_EXT_MOD_PATH);
//Commit modifications
Collection<String> commitFileList = new ArrayList<String>();
- commitFileList.add(TestUtils.FJavaFile3.getProjectRelativePath().toOSString());
+ commitFileList.add(fTestUtils.FJavaFile3.getProjectRelativePath().toOSString());
- TestUtils.commitAmendFiles(TestUtils.FJavaIProject, TestUtils.FJavaRepository, FTHIRD_COMMIT, commitFileList);
+ fTestUtils.commitAmendFiles(fTestUtils.FJavaIProject, fTestUtils.FJavaRepository, FTHIRD_COMMIT, commitFileList);
}
/**
@@ -277,11 +275,11 @@ public class DuplicateAnomalyTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createReviewItems");
r4eAssert.setTest("Create Commit Item 1");
- fItem = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
+ fItem = fTestMain.getItemProxy().createCommitItem(fTestUtils.FJavaIProject, 0);
//close and re-open, so the validation takes de-serialized information
String itemName = fItem.getName();
- fProxy.getCommandProxy().closeElement(fReview);
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(itemName)) {
fItem = (R4EUIReviewItem) elem;
@@ -374,7 +372,7 @@ public class DuplicateAnomalyTests extends TestCase {
}
r4eAssert.setTest("Create Manual Tree Item 1");
- fItem2 = fProxy.getItemProxy().createManualTreeItem(TestUtils.FJavaFile3);
+ fItem2 = fTestMain.getItemProxy().createManualTreeItem(fTestUtils.FJavaFile3);
r4eAssert.assertNotNull(fItem2);
r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem2.getItem().getAddedById());
r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
@@ -403,7 +401,7 @@ public class DuplicateAnomalyTests extends TestCase {
.getLocation()).getLength());
r4eAssert.setTest("Create Manual Text Item 1");
- fItem3 = fProxy.getItemProxy().createManualTextItem(TestUtils.FJavaFile4, 50, 20);
+ fItem3 = fTestMain.getItemProxy().createManualTextItem(fTestUtils.FJavaFile4, 50, 20);
r4eAssert.assertNotNull(fItem3);
r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem3.getItem().getAddedById());
r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
@@ -440,7 +438,7 @@ public class DuplicateAnomalyTests extends TestCase {
}
r4eAssert.setTest("Create Commit Item 2");
- fItem4 = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
+ fItem4 = fTestMain.getItemProxy().createCommitItem(fTestUtils.FJavaIProject, 0);
//Validate the last Commit
/************************************************************** */
@@ -623,7 +621,7 @@ public class DuplicateAnomalyTests extends TestCase {
//Same file, so the anomaly should only show in the last commit
r4eAssert.setTest("Create Linked Anomaly 1");
content = fItem.getFileContexts().get(i).getContentsContainerElement().getContentsList().get(0);
- fLinkedAnomaly1 = fProxy.getAnomalyProxy().createLinkedAnomaly(content,
+ fLinkedAnomaly1 = fTestMain.getAnomalyProxy().createLinkedAnomaly(content,
TestConstants.LINKED_ANOMALY_TEST_TITLE, TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, TestConstants.ANOMALY_TEST_RANK_MAJOR,
TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null);
@@ -648,7 +646,7 @@ public class DuplicateAnomalyTests extends TestCase {
r4eAssert.setTest("Create Linked Anomaly 2");
if (fItem.getFileContexts().get(i).getContentsContainerElement().getContentsList().size() >= 3) {
content = fItem.getFileContexts().get(i).getContentsContainerElement().getContentsList().get(2);
- fLinkedAnomaly2 = fProxy.getAnomalyProxy().createLinkedAnomaly(content,
+ fLinkedAnomaly2 = fTestMain.getAnomalyProxy().createLinkedAnomaly(content,
TestConstants.LINKED_ANOMALY_TEST_TITLE, TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, TestConstants.ANOMALY_TEST_RANK_MAJOR,
TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null);
@@ -727,7 +725,7 @@ public class DuplicateAnomalyTests extends TestCase {
// Create an external anomaly from the last commit
r4eAssert.setTest("Create External Anomaly");
- fExternalAnomaly = fProxy.getAnomalyProxy().createExternalAnomaly(TestUtils.FJavaFile3,
+ fExternalAnomaly = fTestMain.getAnomalyProxy().createExternalAnomaly(fTestUtils.FJavaFile3,
TestConstants.EXTERNAL_ANOMALY_TEST_TITLE, TestConstants.EXTERNAL_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_QUESTION, TestConstants.ANOMALY_TEST_RANK_MINOR,
TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null);
@@ -763,8 +761,8 @@ public class DuplicateAnomalyTests extends TestCase {
r4eAssert.setTest("Verify Anomaly");
String comit1 = fItem.getName();
String commit2 = fItem4.getName();
- fProxy.getCommandProxy().closeElement(fReview);
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(comit1)) {
fItem = (R4EUIReviewItem) elem;
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PostponedAnomaliesTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PostponedAnomaliesTests.java
index 752b4f9..8a7a743 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PostponedAnomaliesTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PostponedAnomaliesTests.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.List;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.runtime.CoreException;
@@ -48,8 +47,7 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewItem;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUITextPosition;
import org.eclipse.mylyn.reviews.r4e.ui.internal.navigator.ReviewNavigatorActionGroup;
import org.eclipse.mylyn.reviews.r4e.ui.internal.utils.R4EUIConstants;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestCase;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
@@ -57,7 +55,7 @@ import org.junit.After;
import org.junit.Before;
@SuppressWarnings({ "restriction", "nls" })
-public class PostponedAnomaliesTests extends TestCase {
+public class PostponedAnomaliesTests extends R4ETestCase {
// ------------------------------------------------------------------------
// Constants
@@ -91,8 +89,6 @@ public class PostponedAnomaliesTests extends TestCase {
// Member variables
// ------------------------------------------------------------------------
- private R4EUITestMain fProxy = null;
-
private R4EUIReviewGroup fGroup = null;
private String fGroupName = null;
@@ -142,50 +138,51 @@ public class PostponedAnomaliesTests extends TestCase {
private String fOriginalGlobalAnomalyTitle = null;
// ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ private static final String TEST_SUITE_ID = "PostponedAnomaliesTests";
+
+ public PostponedAnomaliesTests(String suite) {
+ super(suite);
+ }
+
+ public PostponedAnomaliesTests() {
+ super(TEST_SUITE_ID);
+ }
+
+ // ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
/**
- * Method suite - Sets up the global test environment, if not already done at the suite level.
- *
- * @return Test
+ * @return Test the test suite
*/
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(PostponedAnomaliesTests.class);
- return new R4ETestSetup(suite);
+ return suite;
}
- /**
- * Method setUp - Sets up the fixture, for example, open a network connection. This method is called before a test
- * is executed.
- *
- * @throws java.lang.Exception
- */
@Before
@Override
public void setUp() throws Exception {
- fProxy = R4EUITestMain.getInstance();
- fProxy.getPreferencesProxy().setGlobalPostponedImport(true);
+ super.setUp();
+ fTestMain.getPreferencesProxy().setGlobalPostponedImport(true);
createReviewGroups();
createOriginalReview();
createOriginalReviewItem();
createParticipants(fOriginalReview);
if (((ReviewNavigatorActionGroup) R4EUIModelController.getNavigatorView().getActionSet()).isHideDeltasFilterSet()) {
- fProxy.getCommandProxy().toggleHideDeltasFilter();
+ fTestMain.getCommandProxy().toggleHideDeltasFilter();
}
createOriginalPostponedAnomalies();
}
- /**
- * Method tearDown
- *
- * @throws java.lang.Exception
- */
@After
@Override
public void tearDown() throws Exception {
- fProxy = null;
+ super.tearDown();
}
// ------------------------------------------------------------------------
@@ -197,6 +194,7 @@ public class PostponedAnomaliesTests extends TestCase {
*
* @throws CoreException
*/
+ @org.junit.Test
public void testPostponedAnomalies() throws CoreException {
TestUtils.waitForJobs();
@@ -242,14 +240,14 @@ public class PostponedAnomaliesTests extends TestCase {
}
}
if (null == fGroup) {
- fGroup = fProxy.getReviewGroupProxy().createReviewGroup(
- TestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME,
+ fGroup = fTestMain.getReviewGroupProxy().createReviewGroup(
+ fTestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME,
TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
r4eAssert.assertNotNull(fGroup);
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName());
- r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertEquals(new Path(fTestUtils.FSharedFolder).toPortableString() + "/"
+ TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getFolder());
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup()
.getDescription());
@@ -285,13 +283,13 @@ public class PostponedAnomaliesTests extends TestCase {
}
}
if (!fGroup.isOpen()) {
- fProxy.getCommandProxy().openElement(fGroup);
+ fTestMain.getCommandProxy().openElement(fGroup);
}
r4eAssert.assertTrue(fGroup.isOpen());
// Create Review Group
r4eAssert.setTest("Create Review Group");
- fOriginalReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
+ fOriginalReview = fTestMain.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
ORIGINAL_REVIEW_TEST_NAME, ORIGINAL_REVIEW_TEST_DESCRIPTION, TestConstants.REVIEW_TEST_DUE_DATE,
TestConstants.REVIEW_TEST_PROJECT, TestConstants.REVIEW_TEST_COMPONENTS,
TestConstants.REVIEW_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_TEST_OBJECTIVES,
@@ -324,7 +322,7 @@ public class PostponedAnomaliesTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createOriginalReviewItem");
r4eAssert.setTest("Create Commit Item");
- fOriginalItem = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
+ fOriginalItem = fTestMain.getItemProxy().createCommitItem(fTestUtils.FJavaIProject, 0);
r4eAssert.assertNotNull(fOriginalItem);
r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fOriginalItem.getItem().getAddedById());
r4eAssert.assertEquals("The.committer@some.com", fOriginalItem.getItem().getAuthorRep());
@@ -416,7 +414,7 @@ public class PostponedAnomaliesTests extends TestCase {
}
r4eAssert.setTest("Create Manual Tree Item");
- fOriginalItem2 = fProxy.getItemProxy().createManualTreeItem(TestUtils.FJavaFile3);
+ fOriginalItem2 = fTestMain.getItemProxy().createManualTreeItem(fTestUtils.FJavaFile3);
r4eAssert.assertNotNull(fOriginalItem2);
r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fOriginalItem2.getItem().getAddedById());
r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fOriginalItem2.getItem()
@@ -445,7 +443,7 @@ public class PostponedAnomaliesTests extends TestCase {
.getLocation()).getLength());
r4eAssert.setTest("Create Manual Text Item");
- fOriginalItem3 = fProxy.getItemProxy().createManualTextItem(TestUtils.FJavaFile4, 50, 20);
+ fOriginalItem3 = fTestMain.getItemProxy().createManualTextItem(fTestUtils.FJavaFile4, 50, 20);
r4eAssert.assertNotNull(fOriginalItem3);
r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fOriginalItem3.getItem().getAddedById());
r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fOriginalItem3.getItem()
@@ -492,7 +490,7 @@ public class PostponedAnomaliesTests extends TestCase {
participant.setId(TestConstants.PARTICIPANT_TEST_ID);
participant.setEmail(TestConstants.PARTICIPANT_TEST_EMAIL);
participants.add(participant);
- R4EUIParticipant uiParticipant = fProxy.getParticipantProxy().createParticipant(
+ R4EUIParticipant uiParticipant = fTestMain.getParticipantProxy().createParticipant(
aReview.getParticipantContainer(), participants);
r4eAssert.assertNotNull(uiParticipant);
r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, uiParticipant.getParticipant().getId());
@@ -519,7 +517,7 @@ public class PostponedAnomaliesTests extends TestCase {
.getContentsContainerElement()
.getContentsList()
.get(0);
- fOriginalAnomaly1 = fProxy.getAnomalyProxy().createLinkedAnomaly(content1, ORIGINAL_ANOMALY1_TEST_TITLE,
+ fOriginalAnomaly1 = fTestMain.getAnomalyProxy().createLinkedAnomaly(content1, ORIGINAL_ANOMALY1_TEST_TITLE,
ORIGINAL_ANOMALY1_TEST_DESCRIPTION, TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
TestConstants.ANOMALY_TEST_RANK_MAJOR, TestConstants.ANOMALY_TEST_DUE_DATE,
TestConstants.PARTICIPANT_ASSIGN_TO, null);
@@ -538,7 +536,7 @@ public class PostponedAnomaliesTests extends TestCase {
r4eAssert.assertEquals(
((R4EUITextPosition) content1.getPosition()).getLength(),
((R4ETextPosition) ((R4ETextContent) fOriginalAnomaly1.getAnomaly().getLocation().get(0)).getLocation()).getLength());
- fProxy.getAnomalyProxy().progressAnomaly(fOriginalAnomaly1, TestConstants.ANOMALY_STATE_POSTPONED);
+ fTestMain.getAnomalyProxy().progressAnomaly(fOriginalAnomaly1, TestConstants.ANOMALY_STATE_POSTPONED);
r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalAnomaly1.getAnomaly().getState());
fOriginalAnomaly1Title = fOriginalAnomaly1.getAnomaly().getTitle();
@@ -549,7 +547,7 @@ public class PostponedAnomaliesTests extends TestCase {
.getContentsContainerElement()
.getContentsList()
.get(1);
- fOriginalAnomaly2 = fProxy.getAnomalyProxy().createLinkedAnomaly(content2, ORIGINAL_ANOMALY2_TEST_TITLE,
+ fOriginalAnomaly2 = fTestMain.getAnomalyProxy().createLinkedAnomaly(content2, ORIGINAL_ANOMALY2_TEST_TITLE,
ORIGINAL_ANOMALY2_TEST_DESCRIPTION, TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
TestConstants.ANOMALY_TEST_RANK_MAJOR, TestConstants.ANOMALY_TEST_DUE_DATE,
TestConstants.PARTICIPANT_ASSIGN_TO, null);
@@ -568,7 +566,7 @@ public class PostponedAnomaliesTests extends TestCase {
r4eAssert.assertEquals(
((R4EUITextPosition) content2.getPosition()).getLength(),
((R4ETextPosition) ((R4ETextContent) fOriginalAnomaly2.getAnomaly().getLocation().get(0)).getLocation()).getLength());
- fProxy.getAnomalyProxy().progressAnomaly(fOriginalAnomaly2, TestConstants.ANOMALY_STATE_POSTPONED);
+ fTestMain.getAnomalyProxy().progressAnomaly(fOriginalAnomaly2, TestConstants.ANOMALY_STATE_POSTPONED);
r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalAnomaly2.getAnomaly().getState());
fOriginalAnomaly2Title = fOriginalAnomaly2.getAnomaly().getTitle();
}
@@ -586,7 +584,7 @@ public class PostponedAnomaliesTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createTargetReview");
r4eAssert.setTest("Create Review");
- fTargetReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
+ fTargetReview = fTestMain.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
TARGET_REVIEW_TEST_NAME, TARGET_REVIEW_TEST_DESCRIPTION, TestConstants.REVIEW_TEST_DUE_DATE,
TestConstants.REVIEW_TEST_PROJECT, TestConstants.REVIEW_TEST_COMPONENTS,
TestConstants.REVIEW_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_TEST_OBJECTIVES,
@@ -623,7 +621,7 @@ public class PostponedAnomaliesTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createTargetReviewItem");
r4eAssert.setTest("Create Commit Item");
- fTargetItem = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
+ fTargetItem = fTestMain.getItemProxy().createCommitItem(fTestUtils.FJavaIProject, 0);
r4eAssert.assertNotNull(fTargetItem);
r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fTargetItem.getItem().getAddedById());
r4eAssert.assertEquals("The.committer@some.com", fTargetItem.getItem().getAuthorRep());
@@ -684,9 +682,9 @@ public class PostponedAnomaliesTests extends TestCase {
.get(2)
.getTarget()
.getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
- // ((R4EUIFileContext) fTargetItem.getChildren()[i]).getContentsContainerElement().getChildren(),
- // true, R4EUIConstants.DELTA_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotations(
+ ((R4EUIFileContext) fTargetItem.getChildren()[i]).getContentsContainerElement().getChildren(),
+ true, R4EUIConstants.DELTA_ANNOTATION_ID));
} else if (((R4EUIFileContext) fTargetItem.getChildren()[i]).getName().equals(
TestUtils.JAVA_FILE4_PROJ_NAME)) {
r4eAssert.assertNull(fTargetItem.getItem().getFileContextList().get(i).getBase());
@@ -715,7 +713,7 @@ public class PostponedAnomaliesTests extends TestCase {
}
r4eAssert.setTest("Create Manual Tree Item");
- fTargetItem2 = fProxy.getItemProxy().createManualTreeItem(TestUtils.FJavaFile3);
+ fTargetItem2 = fTestMain.getItemProxy().createManualTreeItem(fTestUtils.FJavaFile3);
r4eAssert.assertNotNull(fTargetItem2);
r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fTargetItem2.getItem().getAddedById());
r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fTargetItem2.getItem()
@@ -742,12 +740,12 @@ public class PostponedAnomaliesTests extends TestCase {
.get(0)
.getTarget()
.getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
- // ((R4EUIFileContext) fTargetItem2.getChildren()[0]).getContentsContainerElement().getChildren(), false,
- // R4EUIConstants.SELECTION_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotations(
+ ((R4EUIFileContext) fTargetItem2.getChildren()[0]).getContentsContainerElement().getChildren(), false,
+ R4EUIConstants.SELECTION_ANNOTATION_ID));
r4eAssert.setTest("Create Manual Text Item");
- fTargetItem3 = fProxy.getItemProxy().createManualTextItem(TestUtils.FJavaFile4, 50, 20);
+ fTargetItem3 = fTestMain.getItemProxy().createManualTextItem(fTestUtils.FJavaFile4, 50, 20);
r4eAssert.assertNotNull(fTargetItem3);
r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fTargetItem3.getItem().getAddedById());
r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fTargetItem3.getItem()
@@ -774,9 +772,9 @@ public class PostponedAnomaliesTests extends TestCase {
.get(0)
.getTarget()
.getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
- // ((R4EUIFileContext) fTargetItem3.getChildren()[0]).getContentsContainerElement().getChildren(), true,
- // R4EUIConstants.SELECTION_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotations(
+ ((R4EUIFileContext) fTargetItem3.getChildren()[0]).getContentsContainerElement().getChildren(), true,
+ R4EUIConstants.SELECTION_ANNOTATION_ID));
}
// ------------------------------------------------------------------------
@@ -792,7 +790,7 @@ public class PostponedAnomaliesTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("importAnomalies");
r4eAssert.setTest("Import Postponed Anomaly");
- fProxy.getCommandProxy().importPostponedAnomalies(fTargetReview);
+ fTestMain.getCommandProxy().importPostponedAnomalies(fTargetReview);
// Verify that the postponed anomalies were correctly imported
R4EUIPostponedContainer postponedContainer = fTargetReview.getPostponedContainer();
@@ -819,8 +817,8 @@ public class PostponedAnomaliesTests extends TestCase {
r4eAssert.assertEquals(fOriginalReview.getReview().getName(),
fPostponedAnomaly2.getAnomaly().getInfoAtt().get(R4EUIConstants.POSTPONED_ATTR_ORIG_REVIEW_NAME));
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(fPostponedAnomaly2.getParent().getChildren(),
- // false, R4EUIConstants.ANOMALY_CLOSED_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotations(
+ fPostponedAnomaly2.getParent().getChildren(), false, R4EUIConstants.ANOMALY_CLOSED_ANNOTATION_ID));
}
// ------------------------------------------------------------------------
@@ -837,16 +835,16 @@ public class PostponedAnomaliesTests extends TestCase {
// Change postponed anomalies states to ASSIGNED
r4eAssert.setTest("Assign Postponed Anomaly");
- fProxy.getCommandProxy().regressElement(fPostponedAnomaly1);
+ fTestMain.getCommandProxy().regressElement(fPostponedAnomaly1);
r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_ASSIGNED, fPostponedAnomaly1.getAnomaly().getState());
- fProxy.getCommandProxy().regressElement(fPostponedAnomaly2);
+ fTestMain.getCommandProxy().regressElement(fPostponedAnomaly2);
r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_ASSIGNED, fPostponedAnomaly2.getAnomaly().getState());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(fPostponedAnomaly2.getParent().getChildren(),
- // false, R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotations(
+ fPostponedAnomaly2.getParent().getChildren(), false, R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
// Verify that the original anomalies are also updated
r4eAssert.setTest("Verify Original Anomaly");
- fProxy.getCommandProxy().openElement(fOriginalReview);
+ fTestMain.getCommandProxy().openElement(fOriginalReview);
r4eAssert.assertTrue(fOriginalReview.isOpen());
r4eAssert.assertFalse(fTargetReview.isOpen());
@@ -886,14 +884,14 @@ public class PostponedAnomaliesTests extends TestCase {
// Change original anomalies states back to POSTPONED
r4eAssert.setTest("Postpone Anomaly");
- fProxy.getAnomalyProxy().progressAnomaly(fOriginalAnomaly1, TestConstants.ANOMALY_STATE_POSTPONED);
+ fTestMain.getAnomalyProxy().progressAnomaly(fOriginalAnomaly1, TestConstants.ANOMALY_STATE_POSTPONED);
r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalAnomaly1.getAnomaly().getState());
- fProxy.getAnomalyProxy().progressAnomaly(fOriginalAnomaly2, TestConstants.ANOMALY_STATE_POSTPONED);
+ fTestMain.getAnomalyProxy().progressAnomaly(fOriginalAnomaly2, TestConstants.ANOMALY_STATE_POSTPONED);
r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalAnomaly2.getAnomaly().getState());
// Re-import of Target review and make sure the postponed anomalies are back
r4eAssert.setTest("Import Anomalies");
- fProxy.getCommandProxy().openElement(fTargetReview);
+ fTestMain.getCommandProxy().openElement(fTargetReview);
r4eAssert.assertTrue(fTargetReview.isOpen());
r4eAssert.assertFalse(fOriginalReview.isOpen());
importAnomalies();
@@ -913,16 +911,16 @@ public class PostponedAnomaliesTests extends TestCase {
// Set postponed anomalies state to FIXED
r4eAssert.setTest("Fix Anomaly");
- fProxy.getCommandProxy().regressElement(fPostponedAnomaly1);
- fProxy.getAnomalyProxy().progressAnomaly(fPostponedAnomaly1, TestConstants.ANOMALY_STATE_FIXED);
+ fTestMain.getCommandProxy().regressElement(fPostponedAnomaly1);
+ fTestMain.getAnomalyProxy().progressAnomaly(fPostponedAnomaly1, TestConstants.ANOMALY_STATE_FIXED);
r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_FIXED, fPostponedAnomaly1.getAnomaly().getState());
- fProxy.getCommandProxy().regressElement(fPostponedAnomaly2);
- fProxy.getAnomalyProxy().progressAnomaly(fPostponedAnomaly2, TestConstants.ANOMALY_STATE_FIXED);
+ fTestMain.getCommandProxy().regressElement(fPostponedAnomaly2);
+ fTestMain.getAnomalyProxy().progressAnomaly(fPostponedAnomaly2, TestConstants.ANOMALY_STATE_FIXED);
r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_FIXED, fPostponedAnomaly2.getAnomaly().getState());
// Re-import anomalies and make sure they are disabled
r4eAssert.setTest("Check Anomaly");
- fProxy.getCommandProxy().importPostponedAnomalies(fTargetReview);
+ fTestMain.getCommandProxy().importPostponedAnomalies(fTargetReview);
r4eAssert.assertEquals(0, fTargetReview.getPostponedContainer().getChildren().length);
}
@@ -942,7 +940,7 @@ public class PostponedAnomaliesTests extends TestCase {
r4eAssert.setTest("Create Global Anomaly");
// R4EUIAnomalyContainer cont1 = fOriginalReview.getAnomalyContainer();
// R4EUIAnomalyContainer cont2 = R4EUIModelController.getActiveReview().getAnomalyContainer();
- fOriginalGlobalAnomaly = fProxy.getAnomalyProxy().createGlobalAnomaly(fOriginalReview.getAnomalyContainer(),
+ fOriginalGlobalAnomaly = fTestMain.getAnomalyProxy().createGlobalAnomaly(fOriginalReview.getAnomalyContainer(),
ORIGINAL_GLOBAL_ANOMALY_TEST_TITLE, ORIGINAL_GLOBAL_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, TestConstants.ANOMALY_TEST_RANK_MAJOR,
TestConstants.ANOMALY_TEST_DUE_DATE, null, TestConstants.PARTICIPANT_ASSIGN_TO);
@@ -957,7 +955,7 @@ public class PostponedAnomaliesTests extends TestCase {
r4eAssert.assertEquals(TestConstants.PARTICIPANT_ASSIGN_TO, fOriginalGlobalAnomaly.getAnomaly()
.getAssignedTo()
.get(0));
- fProxy.getAnomalyProxy().progressAnomaly(fOriginalGlobalAnomaly, TestConstants.ANOMALY_STATE_POSTPONED);
+ fTestMain.getAnomalyProxy().progressAnomaly(fOriginalGlobalAnomaly, TestConstants.ANOMALY_STATE_POSTPONED);
r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalGlobalAnomaly.getAnomaly().getState());
fOriginalGlobalAnomalyTitle = fOriginalGlobalAnomaly.getAnomaly().getTitle();
}
@@ -975,7 +973,7 @@ public class PostponedAnomaliesTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createGlobalTargetReview");
r4eAssert.setTest("Create Review");
- fGlobalTargetReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
+ fGlobalTargetReview = fTestMain.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
TARGET_GLOBAL_REVIEW_TEST_NAME, TARGET_GLOBAL_REVIEW_TEST_DESCRIPTION,
TestConstants.REVIEW_TEST_DUE_DATE, TestConstants.REVIEW_TEST_PROJECT,
TestConstants.REVIEW_TEST_COMPONENTS, TestConstants.REVIEW_TEST_ENTRY_CRITERIA,
@@ -1013,7 +1011,7 @@ public class PostponedAnomaliesTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("importGlobalAnomalies");
r4eAssert.setTest("Import Postponed Anomaly");
- fProxy.getCommandProxy().importPostponedAnomalies(fGlobalTargetReview);
+ fTestMain.getCommandProxy().importPostponedAnomalies(fGlobalTargetReview);
// Verify that the global postponed anomalies were correctly imported
R4EUIPostponedContainer postponedContainer = fGlobalTargetReview.getPostponedContainer();
@@ -1041,12 +1039,12 @@ public class PostponedAnomaliesTests extends TestCase {
// Change postponed global anomaly states to ASSIGNED
r4eAssert.setTest("Change Postponed Anomaly");
- fProxy.getCommandProxy().regressElement(fGlobalPostponedAnomaly);
+ fTestMain.getCommandProxy().regressElement(fGlobalPostponedAnomaly);
r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_ASSIGNED, fGlobalPostponedAnomaly.getAnomaly().getState());
// Verify that the original global anomaly is also updated
r4eAssert.setTest("Verify Anomaly");
- fProxy.getCommandProxy().openElement(fOriginalReview);
+ fTestMain.getCommandProxy().openElement(fOriginalReview);
r4eAssert.assertTrue(fOriginalReview.isOpen());
r4eAssert.assertFalse(fGlobalTargetReview.isOpen());
fOriginalGlobalAnomaly = (R4EUIAnomalyBasic) fOriginalReview.getAnomalyContainer().getChildren()[0];
@@ -1067,12 +1065,12 @@ public class PostponedAnomaliesTests extends TestCase {
// Change original global anomaly states back to POSTPONED
r4eAssert.setTest("Change Global Anomaly");
- fProxy.getAnomalyProxy().progressAnomaly(fOriginalGlobalAnomaly, TestConstants.ANOMALY_STATE_POSTPONED);
+ fTestMain.getAnomalyProxy().progressAnomaly(fOriginalGlobalAnomaly, TestConstants.ANOMALY_STATE_POSTPONED);
r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_POSTPONED, fOriginalGlobalAnomaly.getAnomaly().getState());
// Re-import of Target review and make sure the postponed anomalies are back
r4eAssert.setTest("Verify Anomaly");
- fProxy.getCommandProxy().openElement(fGlobalTargetReview);
+ fTestMain.getCommandProxy().openElement(fGlobalTargetReview);
r4eAssert.assertTrue(fGlobalTargetReview.isOpen());
r4eAssert.assertFalse(fOriginalReview.isOpen());
importGlobalAnomalies();
@@ -1092,13 +1090,13 @@ public class PostponedAnomaliesTests extends TestCase {
// Set postponed global anomaly state to FIXED
r4eAssert.setTest("Change Global Anomaly");
- fProxy.getCommandProxy().regressElement(fGlobalPostponedAnomaly);
- fProxy.getAnomalyProxy().progressAnomaly(fGlobalPostponedAnomaly, TestConstants.ANOMALY_STATE_FIXED);
+ fTestMain.getCommandProxy().regressElement(fGlobalPostponedAnomaly);
+ fTestMain.getAnomalyProxy().progressAnomaly(fGlobalPostponedAnomaly, TestConstants.ANOMALY_STATE_FIXED);
r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_FIXED, fGlobalPostponedAnomaly.getAnomaly().getState());
// Re-import anomalies and make sure they are disabled
r4eAssert.setTest("Verify Anomaly");
- fProxy.getCommandProxy().importPostponedAnomalies(fGlobalTargetReview);
+ fTestMain.getCommandProxy().importPostponedAnomalies(fGlobalTargetReview);
r4eAssert.assertEquals(0, fGlobalTargetReview.getPostponedContainer().getChildren().length);
}
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PreferencesTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PreferencesTests.java
index 57dbc22..05941eb 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PreferencesTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/PreferencesTests.java
@@ -20,15 +20,13 @@ package org.eclipse.mylyn.reviews.r4e.ui.tests.feature;
import java.io.File;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.runtime.Path;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIModelController;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewBasic;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewGroup;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestCase;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
@@ -36,7 +34,7 @@ import org.junit.After;
import org.junit.Before;
@SuppressWarnings({ "restriction", "nls" })
-public class PreferencesTests extends TestCase {
+public class PreferencesTests extends R4ETestCase {
// ------------------------------------------------------------------------
// Constants
@@ -58,8 +56,6 @@ public class PreferencesTests extends TestCase {
// Member variables
// ------------------------------------------------------------------------
- private R4EUITestMain fProxy = null;
-
private R4EUIReviewGroup fParentGroup = null;
private R4EUIReviewGroup fNonParentGroup = null;
@@ -67,43 +63,44 @@ public class PreferencesTests extends TestCase {
private R4EUIReviewBasic fReview = null;
// ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ private static final String TEST_SUITE_ID = "PreferencesTests";
+
+ public PreferencesTests(String suite) {
+ super(suite);
+ }
+
+ public PreferencesTests() {
+ super(TEST_SUITE_ID);
+ }
+
+ // ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
/**
- * Method suite - Sets up the global test environment, if not already done at the suite level.
- *
- * @return Test
+ * @return Test the test suite
*/
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(PreferencesTests.class);
- return new R4ETestSetup(suite);
+ return suite;
}
- /**
- * Method setUp - Sets up the fixture, for example, open a network connection. This method is called before a test
- * is executed.
- *
- * @throws java.lang.Exception
- */
@Before
@Override
public void setUp() throws Exception {
- fProxy = R4EUITestMain.getInstance();
+ super.setUp();
createReviewGroups();
createReview();
}
- /**
- * Method tearDown
- *
- * @throws java.lang.Exception
- */
@After
@Override
public void tearDown() throws Exception {
- fProxy = null;
+ super.tearDown();
}
// ------------------------------------------------------------------------
@@ -113,6 +110,7 @@ public class PreferencesTests extends TestCase {
/**
* Method testPreferences
*/
+ @org.junit.Test
public void testPreferences() {
TestUtils.waitForJobs();
setReviewTreeTableDisplay();
@@ -144,12 +142,12 @@ public class PreferencesTests extends TestCase {
}
}
if (null == fParentGroup) {
- fParentGroup = fProxy.getReviewGroupProxy().createReviewGroup(
- TestUtils.FSharedFolder + File.separator + PARENT_REVIEW_GROUP_NAME, PARENT_REVIEW_GROUP_NAME,
+ fParentGroup = fTestMain.getReviewGroupProxy().createReviewGroup(
+ fTestUtils.FSharedFolder + File.separator + PARENT_REVIEW_GROUP_NAME, PARENT_REVIEW_GROUP_NAME,
PARENT_REVIEW_GROUP_DESCRIPTION, "", new String[0], new String[0], new String[0]);
r4eAssert.assertNotNull(fParentGroup);
r4eAssert.assertEquals(PARENT_REVIEW_GROUP_NAME, fParentGroup.getReviewGroup().getName());
- r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertEquals(new Path(fTestUtils.FSharedFolder).toPortableString() + "/"
+ PARENT_REVIEW_GROUP_NAME, fParentGroup.getReviewGroup().getFolder());
r4eAssert.assertEquals(PARENT_REVIEW_GROUP_DESCRIPTION, fParentGroup.getReviewGroup().getDescription());
}
@@ -163,13 +161,13 @@ public class PreferencesTests extends TestCase {
}
}
if (null == fNonParentGroup) {
- fNonParentGroup = fProxy.getReviewGroupProxy().createReviewGroup(
- TestUtils.FSharedFolder + File.separator + NONPARENT_REVIEW_GROUP_NAME,
+ fNonParentGroup = fTestMain.getReviewGroupProxy().createReviewGroup(
+ fTestUtils.FSharedFolder + File.separator + NONPARENT_REVIEW_GROUP_NAME,
NONPARENT_REVIEW_GROUP_NAME, NONPARENT_REVIEW_GROUP_DESCRIPTION, "", new String[0], new String[0],
new String[0]);
r4eAssert.assertNotNull(fNonParentGroup);
r4eAssert.assertEquals(NONPARENT_REVIEW_GROUP_NAME, fNonParentGroup.getReviewGroup().getName());
- r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertEquals(new Path(fTestUtils.FSharedFolder).toPortableString() + "/"
+ NONPARENT_REVIEW_GROUP_NAME, fNonParentGroup.getReviewGroup().getFolder());
r4eAssert.assertEquals(NONPARENT_REVIEW_GROUP_DESCRIPTION, fNonParentGroup.getReviewGroup()
.getDescription());
@@ -185,7 +183,7 @@ public class PreferencesTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createReview");
r4eAssert.setTest("Create Review");
- fReview = fProxy.getReviewProxy().createReview(fParentGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
+ fReview = fTestMain.getReviewProxy().createReview(fParentGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
REVIEW_TEST_NAME, REVIEW_TEST_DESCRIPTION, null, null, new String[0], null, null, null);
r4eAssert.assertNotNull(fReview);
r4eAssert.assertNotNull(fReview.getParticipantContainer());
@@ -209,7 +207,7 @@ public class PreferencesTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("setReviewTreeTableDisplay");
r4eAssert.setTest("Change Display");
- fProxy.getCommandProxy().changeDisplay();
+ fTestMain.getCommandProxy().changeDisplay();
r4eAssert.assertFalse(R4EUIModelController.getNavigatorView().isDefaultDisplay());
}
@@ -228,7 +226,7 @@ public class PreferencesTests extends TestCase {
// Remove Review Group from preferences
r4eAssert.setTest("Remove Review Group");
String prefsGroup = fNonParentGroup.getReviewGroup().eResource().getURI().toFileString();
- fProxy.getPreferencesProxy().removeGroupFromPreferences(prefsGroup);
+ fTestMain.getPreferencesProxy().removeGroupFromPreferences(prefsGroup);
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
if (group.getReviewGroup().getName().equals(fNonParentGroup.getReviewGroup().getName())) {
fail("Group " + prefsGroup + " should not be present since it was removed from preferences");
@@ -252,7 +250,7 @@ public class PreferencesTests extends TestCase {
// Remove Review Group from preferences
r4eAssert.setTest("Remove Review Group");
String prefsGroup = fParentGroup.getReviewGroup().eResource().getURI().toFileString();
- fProxy.getPreferencesProxy().removeGroupFromPreferences(prefsGroup);
+ fTestMain.getPreferencesProxy().removeGroupFromPreferences(prefsGroup);
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
if (group.getReviewGroup().getName().equals(fParentGroup.getReviewGroup().getName())) {
fail("Group " + prefsGroup + " should not be present since it was removed from preferences");
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/ReviewWithStrangeCharTest.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/ReviewWithStrangeCharTest.java
index a83f897..e845951 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/ReviewWithStrangeCharTest.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/ReviewWithStrangeCharTest.java
@@ -21,7 +21,6 @@ package org.eclipse.mylyn.reviews.r4e.ui.tests.feature;
import java.io.File;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.runtime.CoreException;
@@ -30,8 +29,7 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIModelController;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewBasic;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewGroup;
import org.eclipse.mylyn.reviews.r4e.ui.internal.navigator.ReviewNavigatorActionGroup;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestCase;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
@@ -43,59 +41,58 @@ import org.junit.Before;
* @version $Revision: 1.0 $
*/
@SuppressWarnings({ "restriction", "nls" })
-public class ReviewWithStrangeCharTest extends TestCase {
+public class ReviewWithStrangeCharTest extends R4ETestCase {
// ------------------------------------------------------------------------
// Member variables
// ------------------------------------------------------------------------
- private R4EUITestMain fProxy = null;
-
private R4EUIReviewGroup fGroup = null;
private R4EUIReviewBasic fReview = null;
// ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ private static final String TEST_SUITE_ID = "ReviewWithStrangeCharTest";
+
+ public ReviewWithStrangeCharTest(String suite) {
+ super(suite);
+ }
+
+ public ReviewWithStrangeCharTest() {
+ super(TEST_SUITE_ID);
+ }
+
+ // ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
/**
- * Method suite - Sets up the global test environment, if not already done at the suite level.
- *
- * @return Test
+ * @return Test the test suite
*/
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(ReviewWithStrangeCharTest.class);
- return new R4ETestSetup(suite);
+ return suite;
}
- /**
- * Method setUp - Sets up the fixture, for example, open a network connection. This method is called before a test
- * is executed.
- *
- * @throws java.lang.Exception
- */
@Before
@Override
public void setUp() throws Exception {
- fProxy = R4EUITestMain.getInstance();
+ super.setUp();
createReviewGroups();
if (((ReviewNavigatorActionGroup) R4EUIModelController.getNavigatorView().getActionSet()).isHideDeltasFilterSet()) {
- fProxy.getCommandProxy().toggleHideDeltasFilter();
+ fTestMain.getCommandProxy().toggleHideDeltasFilter();
}
createReviews();
}
- /**
- * Method tearDown
- *
- * @throws java.lang.Exception
- */
@After
@Override
public void tearDown() throws Exception {
- fProxy = null;
+ super.tearDown();
}
// ------------------------------------------------------------------------
@@ -107,6 +104,7 @@ public class ReviewWithStrangeCharTest extends TestCase {
*
* @throws CoreException
*/
+ @org.junit.Test
public void testUseStrangeCharInGroupReview() throws CoreException {
TestUtils.waitForJobs();
}
@@ -135,14 +133,14 @@ public class ReviewWithStrangeCharTest extends TestCase {
}
}
if (null == fGroup) {
- fGroup = fProxy.getReviewGroupProxy().createReviewGroup(
- TestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME_STRANGE,
+ fGroup = fTestMain.getReviewGroupProxy().createReviewGroup(
+ fTestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME_STRANGE,
TestConstants.REVIEW_GROUP_TEST_NAME_STRANGE, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
r4eAssert.assertNotNull(fGroup);
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME_STRANGE, fGroup.getReviewGroup().getName());
- r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/" //$NON-NLS-1$
+ r4eAssert.assertEquals(new Path(fTestUtils.FSharedFolder).toPortableString() + "/" //$NON-NLS-1$
+ TestConstants.REVIEW_GROUP_TEST_NAME_STRANGE, fGroup.getReviewGroup().getFolder());
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup()
.getDescription());
@@ -172,12 +170,12 @@ public class ReviewWithStrangeCharTest extends TestCase {
r4eAssert.setTest("Open Review Group");
if (!fGroup.isOpen()) {
- fProxy.getCommandProxy().openElement(fGroup);
+ fTestMain.getCommandProxy().openElement(fGroup);
}
r4eAssert.assertTrue(fGroup.isOpen());
r4eAssert.setTest("Create Review");
- fReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
+ fReview = fTestMain.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
TestConstants.REVIEW_STRANGE_NAME_INF, TestConstants.REVIEW_TEST_DESCRIPTION,
TestConstants.REVIEW_TEST_DUE_DATE, TestConstants.REVIEW_TEST_PROJECT,
TestConstants.REVIEW_TEST_COMPONENTS, TestConstants.REVIEW_TEST_ENTRY_CRITERIA,
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/UpgradeVersionTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/UpgradeVersionTests.java
index 19622f9..084aae4 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/UpgradeVersionTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/UpgradeVersionTests.java
@@ -23,7 +23,6 @@ import java.util.GregorianCalendar;
import junit.framework.Assert;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.apache.commons.io.FileUtils;
@@ -49,16 +48,15 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIRuleSet;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIRuleViolation;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUITextPosition;
import org.eclipse.mylyn.reviews.r4e.ui.internal.utils.UIUtils;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestCase;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EDummyCompatibleUpgrader;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
import org.junit.After;
import org.junit.Before;
-@SuppressWarnings("restriction")
-public class UpgradeVersionTests extends TestCase {
+@SuppressWarnings({ "restriction", "nls" })
+public class UpgradeVersionTests extends R4ETestCase {
// ------------------------------------------------------------------------
// Constants
@@ -94,8 +92,6 @@ public class UpgradeVersionTests extends TestCase {
// Member variables
// ------------------------------------------------------------------------
- private R4EUITestMain fProxy = null;
-
private R4EUIReviewGroup fReviewGroup = null;
private R4EUIRuleSet fRuleSet = null;
@@ -111,30 +107,36 @@ public class UpgradeVersionTests extends TestCase {
private URI fCompatibleRuleSetFileURI;
// ------------------------------------------------------------------------
- // Methods
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ private static final String TEST_SUITE_ID = "UpgradeVersionTests";
+
+ public UpgradeVersionTests(String suite) {
+ super(suite);
+ }
+
+ public UpgradeVersionTests() {
+ super(TEST_SUITE_ID);
+ }
+
+ // ------------------------------------------------------------------------
+ // Life cycle
// ------------------------------------------------------------------------
/**
- * Method suite - Sets up the global test environment, if not already done at the suite level.
- *
- * @return Test
+ * @return Test the test suite
*/
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(UpgradeVersionTests.class);
- return new R4ETestSetup(suite);
+ return suite;
}
- /**
- * Method setUp - Sets up the fixture, for example, open a network connection. This method is called before a test
- * is executed.
- *
- * @throws java.lang.Exception
- */
- @Override
@Before
+ @Override
public void setUp() throws Exception {
- fProxy = R4EUITestMain.getInstance();
+ super.setUp();
//Copy own files to target test directory
String baseTargetDir = System.getProperty(ROOT_TEST_DIR);
@@ -166,24 +168,24 @@ public class UpgradeVersionTests extends TestCase {
new R4EDummyCompatibleUpgrader();
}
- /**
- * Method tearDown
- *
- * @throws java.lang.Exception
- */
- @Override
@After
+ @Override
public void tearDown() throws Exception {
- fProxy = null;
+ super.tearDown();
// remove test directory
if (fRootTestDir != null && fRootTestDir.exists()) {
FileUtils.deleteDirectory(fRootTestDir);
}
}
+ // ------------------------------------------------------------------------
+ // Main test case (pretty light...)
+ // ------------------------------------------------------------------------
+
/**
* Method testUpgrades
*/
+ @org.junit.Test
public void testUpgrades() {
TestUtils.waitForJobs();
verifyCompatibleUpgradeCancelled();
@@ -211,8 +213,8 @@ public class UpgradeVersionTests extends TestCase {
COMPATIBLE_NO_UPGRADE_BUTTON_INDEX, true, true);
openRuleSet(COMPATIBLE_UPGRADE_TEST_NAME, fCompatibleRuleSetFileURI, COMPATIBLE_NO_UPGRADE_BUTTON_INDEX, true,
true);
- fProxy.getCommandProxy().closeElement(fReviewGroup);
- fProxy.getCommandProxy().closeElement(fRuleSet);
+ fTestMain.getCommandProxy().closeElement(fReviewGroup);
+ fTestMain.getCommandProxy().closeElement(fRuleSet);
}
/**
@@ -222,7 +224,7 @@ public class UpgradeVersionTests extends TestCase {
openReviewGroup(COMPATIBLE_UPGRADE_TEST_NAME, fCompatibleReviewGroupFileURI, UPGRADE_BUTTON_INDEX, true, false);
openRuleSet(COMPATIBLE_UPGRADE_TEST_NAME, fCompatibleRuleSetFileURI, UPGRADE_BUTTON_INDEX, true, false);
openReview(COMPATIBLE_NO_UPGRADE_BUTTON_INDEX, true, true);
- fProxy.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
openReview(UPGRADE_BUTTON_INDEX, false, true);
}
@@ -238,7 +240,7 @@ public class UpgradeVersionTests extends TestCase {
*/
private void addReviewGroupToPreferences(String aGroupName, URI aReviewGroupUri, boolean aGroupResolved) {
R4EUIReviewGroup reviewGroupFound = null;
- fProxy.getPreferencesProxy().addGroupToPreferences(aReviewGroupUri.toFileString());
+ fTestMain.getPreferencesProxy().addGroupToPreferences(aReviewGroupUri.toFileString());
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
if (group.getName().equals(aGroupName)) {
reviewGroupFound = group;
@@ -270,7 +272,7 @@ public class UpgradeVersionTests extends TestCase {
fReviewGroup = (R4EUIReviewGroup) elem;
}
}
- fProxy.getCommandProxy().openElementWithUpdate(fReviewGroup, aUpgradeDialogIndexButton);
+ fTestMain.getCommandProxy().openElementWithUpdate(fReviewGroup, aUpgradeDialogIndexButton);
Assert.assertNotNull(fReviewGroup);
if (aResolved) {
@@ -307,7 +309,7 @@ public class UpgradeVersionTests extends TestCase {
*/
private void addRuleSetToPreferences(String aRuleSetName, URI aRuleSetUri, boolean aRuleSetResolved) {
R4EUIRuleSet ruleSetFound = null;
- fProxy.getPreferencesProxy().addRuleSetToPreferences(aRuleSetUri.toFileString());
+ fTestMain.getPreferencesProxy().addRuleSetToPreferences(aRuleSetUri.toFileString());
for (R4EUIRuleSet ruleSet : R4EUIModelController.getRootElement().getRuleSets()) {
if (ruleSet.getName().equals(aRuleSetName)) {
ruleSetFound = ruleSet;
@@ -339,7 +341,7 @@ public class UpgradeVersionTests extends TestCase {
fRuleSet = (R4EUIRuleSet) elem;
}
}
- fProxy.getCommandProxy().openElementWithUpdate(fRuleSet, aUpgradeDialogIndexButton);
+ fTestMain.getCommandProxy().openElementWithUpdate(fRuleSet, aUpgradeDialogIndexButton);
Assert.assertNotNull(fRuleSet);
if (aResolved) {
@@ -381,7 +383,7 @@ public class UpgradeVersionTests extends TestCase {
*/
private void openReview(int aUpgradeDialogIndexButton, boolean aAssertReadOnly, boolean aReviewOpen) {
fReview = (R4EUIReview) fReviewGroup.getChildren()[0];
- fProxy.getCommandProxy().openElementWithUpdate(fReview, aUpgradeDialogIndexButton);
+ fTestMain.getCommandProxy().openElementWithUpdate(fReview, aUpgradeDialogIndexButton);
fReview = (R4EUIReview) fReviewGroup.getChildren()[0]; //Need to recheck here after update
Assert.assertNotNull(fReview);
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/UserReviewedTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/UserReviewedTests.java
index 0a602ef..f0cbed2 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/UserReviewedTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/feature/UserReviewedTests.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.List;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.runtime.CoreException;
@@ -38,8 +37,8 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewBasic;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewGroup;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIReviewItem;
import org.eclipse.mylyn.reviews.r4e.ui.internal.navigator.ReviewNavigatorActionGroup;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.internal.utils.R4EUIConstants;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestCase;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
@@ -47,7 +46,7 @@ import org.junit.After;
import org.junit.Before;
@SuppressWarnings({ "restriction", "nls" })
-public class UserReviewedTests extends TestCase {
+public class UserReviewedTests extends R4ETestCase {
// ------------------------------------------------------------------------
// Constants
@@ -67,8 +66,6 @@ public class UserReviewedTests extends TestCase {
// Member variables
// ------------------------------------------------------------------------
- private R4EUITestMain fProxy = null;
-
private R4EUIReviewGroup fReviewGroup = null;
private R4EUIReviewBasic fReview = null;
@@ -86,48 +83,49 @@ public class UserReviewedTests extends TestCase {
private String fItemName2 = null;
// ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ private static final String TEST_SUITE_ID = "UserReviewedTests";
+
+ public UserReviewedTests(String suite) {
+ super(suite);
+ }
+
+ public UserReviewedTests() {
+ super(TEST_SUITE_ID);
+ }
+
+ // ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
/**
- * Method suite - Sets up the global test environment, if not already done at the suite level.
- *
- * @return Test
+ * @return Test the test suite
*/
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(UserReviewedTests.class);
- return new R4ETestSetup(suite);
+ return suite;
}
- /**
- * Method setUp - Sets up the fixture, for example, open a network connection. This method is called before a test
- * is executed.
- *
- * @throws java.lang.Exception
- */
@Before
@Override
public void setUp() throws Exception {
- fProxy = R4EUITestMain.getInstance();
+ super.setUp();
createReviewGroups();
createReview();
createReviewItems();
createParticipants();
if (((ReviewNavigatorActionGroup) R4EUIModelController.getNavigatorView().getActionSet()).isHideDeltasFilterSet()) {
- fProxy.getCommandProxy().toggleHideDeltasFilter();
+ fTestMain.getCommandProxy().toggleHideDeltasFilter();
}
}
- /**
- * Method tearDown
- *
- * @throws java.lang.Exception
- */
@After
@Override
public void tearDown() throws Exception {
- fProxy = null;
+ super.tearDown();
}
// ------------------------------------------------------------------------
@@ -139,6 +137,7 @@ public class UserReviewedTests extends TestCase {
*
* @throws CoreException
*/
+ @org.junit.Test
public void testUserReviewed() throws CoreException {
TestUtils.waitForJobs();
setDelta();
@@ -175,12 +174,12 @@ public class UserReviewedTests extends TestCase {
}
}
if (null == fReviewGroup) {
- fReviewGroup = fProxy.getReviewGroupProxy().createReviewGroup(
- TestUtils.FSharedFolder + File.separator + PARENT_REVIEW_GROUP_NAME, PARENT_REVIEW_GROUP_NAME,
+ fReviewGroup = fTestMain.getReviewGroupProxy().createReviewGroup(
+ fTestUtils.FSharedFolder + File.separator + PARENT_REVIEW_GROUP_NAME, PARENT_REVIEW_GROUP_NAME,
PARENT_REVIEW_GROUP_DESCRIPTION, "", new String[0], new String[0], new String[0]);
r4eAssert.assertNotNull(fReviewGroup);
r4eAssert.assertEquals(PARENT_REVIEW_GROUP_NAME, fReviewGroup.getReviewGroup().getName());
- r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertEquals(new Path(fTestUtils.FSharedFolder).toPortableString() + "/"
+ PARENT_REVIEW_GROUP_NAME, fReviewGroup.getReviewGroup().getFolder());
r4eAssert.assertEquals(PARENT_REVIEW_GROUP_DESCRIPTION, fReviewGroup.getReviewGroup().getDescription());
}
@@ -195,7 +194,7 @@ public class UserReviewedTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createReview");
r4eAssert.setTest("Create Review");
- fReview = fProxy.getReviewProxy().createReview(fReviewGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
+ fReview = fTestMain.getReviewProxy().createReview(fReviewGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
REVIEW_TEST_NAME, REVIEW_TEST_DESCRIPTION, null, null, new String[0], null, null, null);
r4eAssert.assertNotNull(fReview);
r4eAssert.assertNotNull(fReview.getParticipantContainer());
@@ -215,13 +214,13 @@ public class UserReviewedTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createReviewItems");
r4eAssert.setTest("Create Commit Item");
- fItem = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
- fItem2 = fProxy.getItemProxy().createCommitItem(TestUtils.FCIProject, 0);
+ fItem = fTestMain.getItemProxy().createCommitItem(fTestUtils.FJavaIProject, 0);
+ fItem2 = fTestMain.getItemProxy().createCommitItem(fTestUtils.FCIProject, 0);
fItemName = fItem.getName();
fItemName2 = fItem2.getName();
- fProxy.getCommandProxy().closeElement(fReview);
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(fItemName)) {
fItem = (R4EUIReviewItem) elem;
@@ -250,7 +249,8 @@ public class UserReviewedTests extends TestCase {
participant.setId(TestConstants.PARTICIPANT_TEST_ID);
participant.setEmail(TestConstants.PARTICIPANT_TEST_EMAIL);
participants.add(participant);
- fParticipant = fProxy.getParticipantProxy().createParticipant(fReview.getParticipantContainer(), participants);
+ fParticipant = fTestMain.getParticipantProxy().createParticipant(fReview.getParticipantContainer(),
+ participants);
r4eAssert.assertNotNull(fParticipant);
r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, fParticipant.getParticipant().getId());
r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_EMAIL, fParticipant.getParticipant().getEmail());
@@ -283,14 +283,14 @@ public class UserReviewedTests extends TestCase {
r4eAssert.setTest("Mark Delta");
for (R4EUIContent delta : file.getContentsContainerElement().getContentsList()) {
if (delta.getName().equals(DELTA1_NAME)) {
- fProxy.getCommandProxy().changeReviewedState(delta);
+ fTestMain.getCommandProxy().changeReviewedState(delta);
break;
}
}
- fProxy.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
r4eAssert.assertFalse(fReview.isOpen());
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
r4eAssert.assertTrue(fReview.isOpen());
r4eAssert.setTest("Check Review Item");
@@ -316,8 +316,8 @@ public class UserReviewedTests extends TestCase {
for (R4EUIContent delta : file.getContentsContainerElement().getContentsList()) {
if (delta.getName().equals(DELTA1_NAME)) {
r4eAssert.assertTrue(delta.isUserReviewed());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(delta, true,
- // R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotation(delta, true,
+ R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
break;
}
}
@@ -353,12 +353,12 @@ public class UserReviewedTests extends TestCase {
if (delta.getName().equals(DELTA1_NAME)) {
continue;
}
- fProxy.getCommandProxy().changeReviewedState(delta);
+ fTestMain.getCommandProxy().changeReviewedState(delta);
}
- fProxy.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
r4eAssert.assertFalse(fReview.isOpen());
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
r4eAssert.assertTrue(fReview.isOpen());
r4eAssert.setTest("Check Review Items");
@@ -381,8 +381,8 @@ public class UserReviewedTests extends TestCase {
r4eAssert.assertFalse(fReview.isUserReviewed());
r4eAssert.assertFalse(fItem.isUserReviewed());
r4eAssert.assertTrue(file.isUserReviewed());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
- // file.getContentsContainerElement().getChildren(), true, R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotations(
+ file.getContentsContainerElement().getChildren(), true, R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
for (R4EUIContent delta : file.getContentsContainerElement().getContentsList()) {
r4eAssert.assertTrue(delta.isUserReviewed());
}
@@ -413,11 +413,11 @@ public class UserReviewedTests extends TestCase {
// Mark file as reviewed
r4eAssert.setTest("Mark File as Reviewed");
- fProxy.getCommandProxy().changeReviewedState(file);
+ fTestMain.getCommandProxy().changeReviewedState(file);
- fProxy.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
r4eAssert.assertFalse(fReview.isOpen());
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
r4eAssert.assertTrue(fReview.isOpen());
r4eAssert.setTest("Check File");
@@ -448,8 +448,8 @@ public class UserReviewedTests extends TestCase {
}
}
r4eAssert.assertTrue(file.isUserReviewed());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
- // file.getContentsContainerElement().getChildren(), true, R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotations(
+ file.getContentsContainerElement().getChildren(), true, R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
for (R4EUIContent delta : file.getContentsContainerElement().getContentsList()) {
r4eAssert.assertTrue(delta.isUserReviewed());
}
@@ -473,12 +473,12 @@ public class UserReviewedTests extends TestCase {
|| file.getName().equals(TestUtils.JAVA_FILE2_PROJ_NAME)) {
continue;
}
- fProxy.getCommandProxy().changeReviewedState(file);
+ fTestMain.getCommandProxy().changeReviewedState(file);
}
- fProxy.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
r4eAssert.assertFalse(fReview.isOpen());
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
r4eAssert.assertTrue(fReview.isOpen());
r4eAssert.setTest("Check Files");
@@ -520,11 +520,11 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- fProxy.getCommandProxy().changeReviewedState(fItem2);
+ fTestMain.getCommandProxy().changeReviewedState(fItem2);
- fProxy.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
r4eAssert.assertFalse(fReview.isOpen());
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
r4eAssert.assertTrue(fReview.isOpen());
r4eAssert.setTest("Check Review State");
@@ -557,33 +557,33 @@ public class UserReviewedTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("addReviewItemFromOtherUser");
r4eAssert.setTest("Close Element");
- fProxy.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
r4eAssert.assertFalse(fReview.isOpen());
// Change user
r4eAssert.setTest("Change User");
- String originalUser = fProxy.getPreferencesProxy().getUser();
- String originalEmail = fProxy.getPreferencesProxy().getEmail();
- fProxy.getPreferencesProxy().setUser(TestConstants.PARTICIPANT_TEST_ID);
- fProxy.getPreferencesProxy().setEmail(TestConstants.PARTICIPANT_TEST_EMAIL);
+ String originalUser = fTestMain.getPreferencesProxy().getUser();
+ String originalEmail = fTestMain.getPreferencesProxy().getEmail();
+ fTestMain.getPreferencesProxy().setUser(TestConstants.PARTICIPANT_TEST_ID);
+ fTestMain.getPreferencesProxy().setEmail(TestConstants.PARTICIPANT_TEST_EMAIL);
// New user adds new review item
r4eAssert.setTest("New User Adds New Review Item");
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
r4eAssert.assertTrue(fReview.isOpen());
- fItem3 = fProxy.getItemProxy().createCommitItem(TestUtils.FTextIProject, 0);
+ fItem3 = fTestMain.getItemProxy().createCommitItem(fTestUtils.FTextIProject, 0);
r4eAssert.assertNotNull(fItem3);
- fProxy.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
r4eAssert.assertFalse(fReview.isOpen());
// Change back user to original one
r4eAssert.setTest("Change back to Original User");
- fProxy.getPreferencesProxy().setUser(originalUser);
- fProxy.getPreferencesProxy().setEmail(originalEmail);
+ fTestMain.getPreferencesProxy().setUser(originalUser);
+ fTestMain.getPreferencesProxy().setEmail(originalEmail);
// Verify Reviewed State
r4eAssert.setTest("Verify State");
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
r4eAssert.assertTrue(fReview.isOpen());
r4eAssert.assertFalse(fReview.isUserReviewed());
}
@@ -602,7 +602,7 @@ public class UserReviewedTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("unsetDelta");
if (((ReviewNavigatorActionGroup) R4EUIModelController.getNavigatorView().getActionSet()).isHideDeltasFilterSet()) {
- fProxy.getCommandProxy().toggleHideDeltasFilter();
+ fTestMain.getCommandProxy().toggleHideDeltasFilter();
}
fItem = null;
for (IR4EUIModelElement elem : fReview.getChildren()) {
@@ -626,14 +626,14 @@ public class UserReviewedTests extends TestCase {
r4eAssert.setTest("Setup Review State");
for (R4EUIContent delta : file.getContentsContainerElement().getContentsList()) {
if (delta.getName().equals(DELTA1_NAME)) {
- fProxy.getCommandProxy().changeReviewedState(delta);
+ fTestMain.getCommandProxy().changeReviewedState(delta);
break;
}
}
- fProxy.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
r4eAssert.assertFalse(fReview.isOpen());
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
r4eAssert.assertTrue(fReview.isOpen());
r4eAssert.setTest("Check Review State");
@@ -660,10 +660,10 @@ public class UserReviewedTests extends TestCase {
for (R4EUIContent delta : file.getContentsContainerElement().getContentsList()) {
if (delta.getName().equals(DELTA1_NAME)) {
r4eAssert.assertFalse(delta.isUserReviewed());
- //r4eAssert.assertFalse(fProxy.getCommandProxy().verifyAnnotation(delta, true,
- // R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(delta, true,
- // R4EUIConstants.DELTA_ANNOTATION_ID));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().verifyAnnotation(delta, true,
+ R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotation(delta, true,
+ R4EUIConstants.DELTA_ANNOTATION_ID));
break;
}
}
@@ -689,13 +689,13 @@ public class UserReviewedTests extends TestCase {
break;
}
}
- fProxy.getCommandProxy().changeReviewedState(fItem2);
+ fTestMain.getCommandProxy().changeReviewedState(fItem2);
r4eAssert.assertFalse(fItem2.isUserReviewed());
r4eAssert.setTest("Close/Open Review Element");
- fProxy.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
r4eAssert.assertFalse(fReview.isOpen());
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
r4eAssert.assertTrue(fReview.isOpen());
r4eAssert.setTest("Check Review State");
@@ -749,11 +749,11 @@ public class UserReviewedTests extends TestCase {
// Mark file as reviewed
r4eAssert.setTest("Setup Review State");
- fProxy.getCommandProxy().changeReviewedState(file);
+ fTestMain.getCommandProxy().changeReviewedState(file);
- fProxy.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
r4eAssert.assertFalse(fReview.isOpen());
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
r4eAssert.assertTrue(fReview.isOpen());
r4eAssert.setTest("Check Review State");
@@ -779,10 +779,10 @@ public class UserReviewedTests extends TestCase {
r4eAssert.assertFalse(file.isUserReviewed());
for (R4EUIContent delta : file.getContentsContainerElement().getContentsList()) {
r4eAssert.assertFalse(delta.isUserReviewed());
- //r4eAssert.assertFalse(fProxy.getCommandProxy().verifyAnnotation(delta, true,
- // R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(delta, true,
- // R4EUIConstants.DELTA_ANNOTATION_ID));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().verifyAnnotation(delta, true,
+ R4EUIConstants.DELTA_REVIEWED_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotation(delta, true,
+ R4EUIConstants.DELTA_ANNOTATION_ID));
}
}
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestMain.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestMain.java
index 6bcd88e..554b4f4 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestMain.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/proxy/R4EUITestMain.java
@@ -102,7 +102,7 @@ public class R4EUITestMain {
/**
* Constructor for R4ECommandProxy.
*/
- private R4EUITestMain() {
+ public R4EUITestMain() {
fCommandProxy = new R4EUITestCommands(this);
fPreferencesProxy = new R4EUITestPreferences(this);
fReviewGroupProxy = new R4EUITestReviewGroup(this);
@@ -121,17 +121,17 @@ public class R4EUITestMain {
// Methods
// ------------------------------------------------------------------------
- /**
- * Method getInstance.
- *
- * @return R4EUITestProxy
- */
- public static R4EUITestMain getInstance() {
- if (null == FInstance) {
- FInstance = new R4EUITestMain();
- }
- return FInstance;
- }
+// /**
+// * Method getInstance.
+// *
+// * @return R4EUITestProxy
+// */
+// public static R4EUITestMain getInstance() {
+// if (null == FInstance) {
+// FInstance = new R4EUITestMain();
+// }
+// return FInstance;
+// }
/**
* Method getCommandProxy.
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityBasicTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityBasicTests.java
index b674ee3..06bd3a1 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityBasicTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityBasicTests.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.List;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.runtime.CoreException;
@@ -51,8 +50,7 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.navigator.ReviewNavigatorAction
import org.eclipse.mylyn.reviews.r4e.ui.internal.sorters.NavigatorElementComparator;
import org.eclipse.mylyn.reviews.r4e.ui.internal.sorters.ReviewTypeComparator;
import org.eclipse.mylyn.reviews.r4e.ui.internal.utils.R4EUIConstants;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestCase;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
@@ -60,14 +58,12 @@ import org.junit.After;
import org.junit.Before;
@SuppressWarnings({ "restriction", "nls" })
-public class SanityBasicTests extends TestCase {
+public class SanityBasicTests extends R4ETestCase {
// ------------------------------------------------------------------------
// Member variables
// ------------------------------------------------------------------------
- private R4EUITestMain fProxy = null;
-
private R4EUIReviewGroup fGroup = null;
private String fGroupName = null;
@@ -93,45 +89,46 @@ public class SanityBasicTests extends TestCase {
private int fAnomalyFileIndex;
// ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ private static final String TEST_SUITE_ID = "SanityBasicTests";
+
+ public SanityBasicTests(String suite) {
+ super(suite);
+ }
+
+ public SanityBasicTests() {
+ super(TEST_SUITE_ID);
+ }
+
+ // ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
/**
- * Method suite - Sets up the global test environment, if not already done at the suite level.
- *
- * @return Test
+ * @return Test the test suite
*/
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(SanityBasicTests.class);
- return new R4ETestSetup(suite);
+ return suite;
}
- /**
- * Method setUp - Sets up the fixture, for example, open a network connection. This method is called before a test
- * is executed.
- *
- * @throws java.lang.Exception
- */
@Before
@Override
public void setUp() throws Exception {
- fProxy = R4EUITestMain.getInstance();
+ super.setUp();
createReviewGroups();
if (((ReviewNavigatorActionGroup) R4EUIModelController.getNavigatorView().getActionSet()).isHideDeltasFilterSet()) {
- fProxy.getCommandProxy().toggleHideDeltasFilter();
+ fTestMain.getCommandProxy().toggleHideDeltasFilter();
}
}
- /**
- * Method tearDown
- *
- * @throws java.lang.Exception
- */
@After
@Override
public void tearDown() throws Exception {
- fProxy = null;
+ super.tearDown();
}
// ------------------------------------------------------------------------
@@ -143,6 +140,7 @@ public class SanityBasicTests extends TestCase {
*
* @throws CoreException
*/
+ @org.junit.Test
public void testBasicReviews() throws CoreException {
TestUtils.waitForJobs();
createReviews();
@@ -181,14 +179,14 @@ public class SanityBasicTests extends TestCase {
}
}
if (null == fGroup) {
- fGroup = fProxy.getReviewGroupProxy().createReviewGroup(
- TestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME,
+ fGroup = fTestMain.getReviewGroupProxy().createReviewGroup(
+ fTestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME,
TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
r4eAssert.assertNotNull(fGroup);
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName());
- r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertEquals(new Path(fTestUtils.FSharedFolder).toPortableString() + "/"
+ TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getFolder());
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup()
.getDescription());
@@ -228,12 +226,12 @@ public class SanityBasicTests extends TestCase {
}
}
if (!fGroup.isOpen()) {
- fProxy.getCommandProxy().openElement(fGroup);
+ fTestMain.getCommandProxy().openElement(fGroup);
}
r4eAssert.assertTrue(fGroup.isOpen());
r4eAssert.setTest("Create Review");
- fReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_BASIC,
+ fReview = fTestMain.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_BASIC,
TestConstants.REVIEW_TEST_NAME, TestConstants.REVIEW_TEST_DESCRIPTION,
TestConstants.REVIEW_TEST_DUE_DATE, TestConstants.REVIEW_TEST_PROJECT,
TestConstants.REVIEW_TEST_COMPONENTS, TestConstants.REVIEW_TEST_ENTRY_CRITERIA,
@@ -270,10 +268,10 @@ public class SanityBasicTests extends TestCase {
// Close and re-open, so the validation takes de-serialized information
r4eAssert.setTest("Create Commit Item");
- fItem = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
+ fItem = fTestMain.getItemProxy().createCommitItem(fTestUtils.FJavaIProject, 0);
String itemName = fItem.getName();
- fProxy.getCommandProxy().closeElement(fReview);
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(itemName)) {
fItem = (R4EUIReviewItem) elem;
@@ -341,9 +339,9 @@ public class SanityBasicTests extends TestCase {
.get(2)
.getTarget()
.getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
- // ((R4EUIFileContext) fItem.getChildren()[i]).getContentsContainerElement().getChildren(), true,
- // R4EUIConstants.DELTA_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotations(
+ ((R4EUIFileContext) fItem.getChildren()[i]).getContentsContainerElement().getChildren(), true,
+ R4EUIConstants.DELTA_ANNOTATION_ID));
} else if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE4_PROJ_NAME)) {
r4eAssert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem.getItem()
@@ -369,7 +367,7 @@ public class SanityBasicTests extends TestCase {
}
r4eAssert.setTest("Create Manual Tree Item");
- fItem2 = fProxy.getItemProxy().createManualTreeItem(TestUtils.FJavaFile3);
+ fItem2 = fTestMain.getItemProxy().createManualTreeItem(fTestUtils.FJavaFile3);
r4eAssert.assertNotNull(fItem2);
r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem2.getItem().getAddedById());
r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
@@ -396,12 +394,12 @@ public class SanityBasicTests extends TestCase {
.get(0)
.getTarget()
.getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
- // ((R4EUIFileContext) fItem2.getChildren()[0]).getContentsContainerElement().getChildren(), false,
- // R4EUIConstants.SELECTION_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotations(
+ ((R4EUIFileContext) fItem2.getChildren()[0]).getContentsContainerElement().getChildren(), false,
+ R4EUIConstants.SELECTION_ANNOTATION_ID));
r4eAssert.setTest("Create Manual Text Item");
- fItem3 = fProxy.getItemProxy().createManualTextItem(TestUtils.FJavaFile4, 50, 20);
+ fItem3 = fTestMain.getItemProxy().createManualTextItem(fTestUtils.FJavaFile4, 50, 20);
r4eAssert.assertNotNull(fItem3);
r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem3.getItem().getAddedById());
r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
@@ -428,9 +426,9 @@ public class SanityBasicTests extends TestCase {
.get(0)
.getTarget()
.getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
- // ((R4EUIFileContext) fItem3.getChildren()[0]).getContentsContainerElement().getChildren(), true,
- // R4EUIConstants.SELECTION_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotations(
+ ((R4EUIFileContext) fItem3.getChildren()[0]).getContentsContainerElement().getChildren(), true,
+ R4EUIConstants.SELECTION_ANNOTATION_ID));
}
// ------------------------------------------------------------------------
@@ -452,7 +450,8 @@ public class SanityBasicTests extends TestCase {
participant.setId(TestConstants.PARTICIPANT_TEST_ID);
participant.setEmail(TestConstants.PARTICIPANT_TEST_EMAIL);
participants.add(participant);
- fParticipant = fProxy.getParticipantProxy().createParticipant(fReview.getParticipantContainer(), participants);
+ fParticipant = fTestMain.getParticipantProxy().createParticipant(fReview.getParticipantContainer(),
+ participants);
r4eAssert.setTest("Create Participant");
r4eAssert.assertNotNull(fParticipant);
@@ -474,7 +473,7 @@ public class SanityBasicTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createCompareEditorAnomalies");
r4eAssert.setTest("Create Compare Editor Anomaly");
- fCompareEditorAnomaly = fProxy.getAnomalyProxy().createCompareEditorAnomaly(
+ fCompareEditorAnomaly = fTestMain.getAnomalyProxy().createCompareEditorAnomaly(
fItem.getFileContexts().get(fAnomalyFileIndex), 20, 50,
TestConstants.COMPARE_EDITOR_ANOMALY_TEST_TITLE, TestConstants.COMPARE_EDITOR_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_ERRONEOUS, TestConstants.ANOMALY_TEST_RANK_MINOR,
@@ -497,8 +496,8 @@ public class SanityBasicTests extends TestCase {
r4eAssert.assertEquals(50, ((R4ETextPosition) ((R4ETextContent) fCompareEditorAnomaly.getAnomaly()
.getLocation()
.get(0)).getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
- // R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
+ R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
// ------------------------------------------------------------------------
@@ -519,10 +518,10 @@ public class SanityBasicTests extends TestCase {
.getContentsContainerElement()
.getContentsList()
.get(0);
- fLinkedAnomaly = fProxy.getAnomalyProxy().createLinkedAnomaly(content, TestConstants.LINKED_ANOMALY_TEST_TITLE,
- TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
- TestConstants.ANOMALY_TEST_RANK_MAJOR, TestConstants.ANOMALY_TEST_DUE_DATE,
- TestConstants.PARTICIPANT_ASSIGN_TO, null);
+ fLinkedAnomaly = fTestMain.getAnomalyProxy().createLinkedAnomaly(content,
+ TestConstants.LINKED_ANOMALY_TEST_TITLE, TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION,
+ TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, TestConstants.ANOMALY_TEST_RANK_MAJOR,
+ TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null);
r4eAssert.assertNotNull(fLinkedAnomaly);
r4eAssert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_TITLE, fLinkedAnomaly.getAnomaly().getTitle());
r4eAssert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, fLinkedAnomaly.getAnomaly()
@@ -538,8 +537,8 @@ public class SanityBasicTests extends TestCase {
r4eAssert.assertEquals(
((R4EUITextPosition) content.getPosition()).getLength(),
((R4ETextPosition) ((R4ETextContent) fLinkedAnomaly.getAnomaly().getLocation().get(0)).getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fLinkedAnomaly, true,
- // R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotation(fLinkedAnomaly, true,
+ R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
// ------------------------------------------------------------------------
@@ -555,7 +554,7 @@ public class SanityBasicTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createExternalAnomalies");
r4eAssert.setTest("Create External Anomaly");
- fExternalAnomaly = fProxy.getAnomalyProxy().createExternalAnomaly(TestUtils.FJavaFile3,
+ fExternalAnomaly = fTestMain.getAnomalyProxy().createExternalAnomaly(fTestUtils.FJavaFile3,
TestConstants.EXTERNAL_ANOMALY_TEST_TITLE, TestConstants.EXTERNAL_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_QUESTION, TestConstants.ANOMALY_TEST_RANK_MINOR,
TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null);
@@ -573,8 +572,8 @@ public class SanityBasicTests extends TestCase {
r4eAssert.assertEquals(755, ((R4ETextPosition) ((R4ETextContent) fExternalAnomaly.getAnomaly()
.getLocation()
.get(0)).getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fExternalAnomaly, false,
- // R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotation(fExternalAnomaly, false,
+ R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
// ------------------------------------------------------------------------
@@ -590,7 +589,7 @@ public class SanityBasicTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createComments");
r4eAssert.setTest("Create Comment");
- fComment = fProxy.getCommentProxy().createComment(fLinkedAnomaly, TestConstants.COMMENT_TEST);
+ fComment = fTestMain.getCommentProxy().createComment(fLinkedAnomaly, TestConstants.COMMENT_TEST);
r4eAssert.assertNotNull(fComment);
r4eAssert.assertEquals(TestConstants.COMMENT_TEST, fComment.getComment().getDescription());
}
@@ -608,9 +607,10 @@ public class SanityBasicTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("progressReview");
r4eAssert.setTest("Progress Review");
- fProxy.getReviewProxy().progressReview(fReview);
+ fTestMain.getReviewProxy().progressReview(fReview);
r4eAssert.assertEquals(R4EReviewPhase.R4E_REVIEW_PHASE_COMPLETED, ((R4EReviewState) fReview.getReview()
.getState()).getState());
+ r4eAssert.assertNotNull(fReview.getReview().getEndDate());
}
// ------------------------------------------------------------------------
@@ -626,66 +626,66 @@ public class SanityBasicTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("verifySorters");
r4eAssert.setTest("Initial State");
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
// Alpha sorter On/Off
r4eAssert.setTest("Alpha Sorter On/Off");
- fProxy.getCommandProxy().toggleAlphaSorter();
- ViewerComparator activeSorter = fProxy.getCommandProxy().getActiveSorter();
+ fTestMain.getCommandProxy().toggleAlphaSorter();
+ ViewerComparator activeSorter = fTestMain.getCommandProxy().getActiveSorter();
r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
&& !(activeSorter instanceof ReviewTypeComparator));
- r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
- fProxy.getCommandProxy().toggleAlphaSorter();
- r4eAssert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ fTestMain.getCommandProxy().toggleAlphaSorter();
+ r4eAssert.assertTrue(null == fTestMain.getCommandProxy().getActiveSorter());
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
// Review Type sorter On/Off
r4eAssert.setTest("Review Type Sorter On/Off");
- fProxy.getCommandProxy().toggleReviewTypeSorter();
- activeSorter = fProxy.getCommandProxy().getActiveSorter();
+ fTestMain.getCommandProxy().toggleReviewTypeSorter();
+ activeSorter = fTestMain.getCommandProxy().getActiveSorter();
r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof ReviewTypeComparator);
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
- fProxy.getCommandProxy().toggleReviewTypeSorter();
- r4eAssert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ fTestMain.getCommandProxy().toggleReviewTypeSorter();
+ r4eAssert.assertTrue(null == fTestMain.getCommandProxy().getActiveSorter());
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
// AlphaSorter -> ReviewTypeSorter
r4eAssert.setTest("AlphaSorter -> ReviewTypeSorter");
- fProxy.getCommandProxy().toggleAlphaSorter();
- activeSorter = fProxy.getCommandProxy().getActiveSorter();
+ fTestMain.getCommandProxy().toggleAlphaSorter();
+ activeSorter = fTestMain.getCommandProxy().getActiveSorter();
r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
&& !(activeSorter instanceof ReviewTypeComparator));
- r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
- fProxy.getCommandProxy().toggleReviewTypeSorter();
- activeSorter = fProxy.getCommandProxy().getActiveSorter();
+ fTestMain.getCommandProxy().toggleReviewTypeSorter();
+ activeSorter = fTestMain.getCommandProxy().getActiveSorter();
r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof ReviewTypeComparator);
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
// ReviewTypeSorter -> AlphaSorter
r4eAssert.setTest("ReviewTypeSorter -> AlphaSorter");
- fProxy.getCommandProxy().toggleAlphaSorter();
- activeSorter = fProxy.getCommandProxy().getActiveSorter();
+ fTestMain.getCommandProxy().toggleAlphaSorter();
+ activeSorter = fTestMain.getCommandProxy().getActiveSorter();
r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
&& !(activeSorter instanceof ReviewTypeComparator));
- r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
// Remove AlphaSorter
r4eAssert.setTest("Remove AlphaSorter");
- fProxy.getCommandProxy().toggleAlphaSorter();
- r4eAssert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ fTestMain.getCommandProxy().toggleAlphaSorter();
+ r4eAssert.assertTrue(null == fTestMain.getCommandProxy().getActiveSorter());
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
}
// ------------------------------------------------------------------------
@@ -703,15 +703,15 @@ public class SanityBasicTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("sendQuestionNotifications");
r4eAssert.setTest("Send Question Notifications");
- fProxy.getCommandProxy().sendQuestionNotification(fReview);
- r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_SOURCE, fProxy.getCommandProxy()
+ fTestMain.getCommandProxy().sendQuestionNotification(fReview);
+ r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_SOURCE, fTestMain.getCommandProxy()
.getEmailDetails()
.getSource());
- String[] destinations = fProxy.getCommandProxy().getEmailDetails().getDestinations();
+ String[] destinations = fTestMain.getCommandProxy().getEmailDetails().getDestinations();
for (int i = 0; i < destinations.length; i++) {
r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_DESTINATIONS[i], destinations[i]);
}
- r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_SUBJECT, fProxy.getCommandProxy()
+ r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_SUBJECT, fTestMain.getCommandProxy()
.getEmailDetails()
.getSubject());
//TODO: Assert fails, but Strings seem to be identical???
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityInformalTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityInformalTests.java
index e8342d8..8c1f8a6 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityInformalTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanityInformalTests.java
@@ -22,7 +22,6 @@ import java.util.ArrayList;
import java.util.List;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.runtime.CoreException;
@@ -51,8 +50,7 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.navigator.ReviewNavigatorAction
import org.eclipse.mylyn.reviews.r4e.ui.internal.sorters.NavigatorElementComparator;
import org.eclipse.mylyn.reviews.r4e.ui.internal.sorters.ReviewTypeComparator;
import org.eclipse.mylyn.reviews.r4e.ui.internal.utils.R4EUIConstants;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestCase;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
@@ -63,14 +61,12 @@ import org.junit.Before;
* @author lmcbout
*/
@SuppressWarnings({ "restriction", "nls" })
-public class SanityInformalTests extends TestCase {
+public class SanityInformalTests extends R4ETestCase {
// ------------------------------------------------------------------------
// Member variables
// ------------------------------------------------------------------------
- private R4EUITestMain fProxy = null;
-
private R4EUIReviewGroup fGroup = null;
private String fGroupName = null;
@@ -96,45 +92,46 @@ public class SanityInformalTests extends TestCase {
private int fAnomalyFileIndex;
// ------------------------------------------------------------------------
+ // Constructors
+ // ------------------------------------------------------------------------
+
+ private static final String TEST_SUITE_ID = "SanityInformalTests";
+
+ public SanityInformalTests(String suite) {
+ super(suite);
+ }
+
+ public SanityInformalTests() {
+ super(TEST_SUITE_ID);
+ }
+
+ // ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
/**
- * Method suite - Sets up the global test environment, if not already done at the suite level.
- *
- * @return Test
+ * @return Test the test suite
*/
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(SanityInformalTests.class);
- return new R4ETestSetup(suite);
+ return suite;
}
- /**
- * Method setUp - Sets up the fixture, for example, open a network connection. This method is called before a test
- * is executed.
- *
- * @throws java.lang.Exception
- */
@Before
@Override
public void setUp() throws Exception {
- fProxy = R4EUITestMain.getInstance();
+ super.setUp();
createReviewGroups();
if (((ReviewNavigatorActionGroup) R4EUIModelController.getNavigatorView().getActionSet()).isHideDeltasFilterSet()) {
- fProxy.getCommandProxy().toggleHideDeltasFilter();
+ fTestMain.getCommandProxy().toggleHideDeltasFilter();
}
}
- /**
- * Method tearDown
- *
- * @throws java.lang.Exception
- */
@After
@Override
public void tearDown() throws Exception {
- fProxy = null;
+ super.tearDown();
}
// ------------------------------------------------------------------------
@@ -146,6 +143,7 @@ public class SanityInformalTests extends TestCase {
*
* @throws CoreException
*/
+ @org.junit.Test
public void testInformalReviews() throws CoreException {
TestUtils.waitForJobs();
createReviews();
@@ -187,14 +185,14 @@ public class SanityInformalTests extends TestCase {
}
}
if (null == fGroup) {
- fGroup = fProxy.getReviewGroupProxy().createReviewGroup(
- TestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME,
+ fGroup = fTestMain.getReviewGroupProxy().createReviewGroup(
+ fTestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME,
TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
r4eAssert.assertNotNull(fGroup);
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getName());
- r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertEquals(new Path(fTestUtils.FSharedFolder).toPortableString() + "/"
+ TestConstants.REVIEW_GROUP_TEST_NAME, fGroup.getReviewGroup().getFolder());
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, fGroup.getReviewGroup()
.getDescription());
@@ -234,12 +232,12 @@ public class SanityInformalTests extends TestCase {
}
}
if (!fGroup.isOpen()) {
- fProxy.getCommandProxy().openElement(fGroup);
+ fTestMain.getCommandProxy().openElement(fGroup);
}
r4eAssert.assertTrue(fGroup.isOpen());
r4eAssert.setTest("Create Review");
- fReview = fProxy.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
+ fReview = fTestMain.getReviewProxy().createReview(fGroup, TestConstants.REVIEW_TEST_TYPE_INFORMAL,
TestConstants.REVIEW_TEST_NAME_INF, TestConstants.REVIEW_TEST_DESCRIPTION,
TestConstants.REVIEW_TEST_DUE_DATE, TestConstants.REVIEW_TEST_PROJECT,
TestConstants.REVIEW_TEST_COMPONENTS, TestConstants.REVIEW_TEST_ENTRY_CRITERIA,
@@ -276,10 +274,10 @@ public class SanityInformalTests extends TestCase {
// Close and re-open, so the validation takes de-serialized information
r4eAssert.setTest("Create Commit Item");
- fItem = fProxy.getItemProxy().createCommitItem(TestUtils.FJavaIProject, 0);
+ fItem = fTestMain.getItemProxy().createCommitItem(fTestUtils.FJavaIProject, 0);
String itemName = fItem.getName();
- fProxy.getCommandProxy().closeElement(fReview);
- fProxy.getCommandProxy().openElement(fReview);
+ fTestMain.getCommandProxy().closeElement(fReview);
+ fTestMain.getCommandProxy().openElement(fReview);
for (IR4EUIModelElement elem : fReview.getChildren()) {
if (elem.getName().equals(itemName)) {
fItem = (R4EUIReviewItem) elem;
@@ -347,9 +345,9 @@ public class SanityInformalTests extends TestCase {
.get(2)
.getTarget()
.getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
- // ((R4EUIFileContext) fItem.getChildren()[i]).getContentsContainerElement().getChildren(), true,
- // R4EUIConstants.DELTA_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotations(
+ ((R4EUIFileContext) fItem.getChildren()[i]).getContentsContainerElement().getChildren(), true,
+ R4EUIConstants.DELTA_ANNOTATION_ID));
} else if (((R4EUIFileContext) fItem.getChildren()[i]).getName().equals(TestUtils.JAVA_FILE4_PROJ_NAME)) {
r4eAssert.assertNull(fItem.getItem().getFileContextList().get(i).getBase());
r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem.getItem()
@@ -375,7 +373,7 @@ public class SanityInformalTests extends TestCase {
}
r4eAssert.setTest("Create Manual Tree Item");
- fItem2 = fProxy.getItemProxy().createManualTreeItem(TestUtils.FJavaFile3);
+ fItem2 = fTestMain.getItemProxy().createManualTreeItem(fTestUtils.FJavaFile3);
r4eAssert.assertNotNull(fItem2);
r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem2.getItem().getAddedById());
r4eAssert.assertEquals(TestUtils.JAVA_FILE3_PROJ_NAME, fItem2.getItem()
@@ -402,12 +400,12 @@ public class SanityInformalTests extends TestCase {
.get(0)
.getTarget()
.getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
- // ((R4EUIFileContext) fItem2.getChildren()[0]).getContentsContainerElement().getChildren(), false,
- // R4EUIConstants.SELECTION_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotations(
+ ((R4EUIFileContext) fItem2.getChildren()[0]).getContentsContainerElement().getChildren(), false,
+ R4EUIConstants.SELECTION_ANNOTATION_ID));
r4eAssert.setTest("Create Manual Text Item");
- fItem3 = fProxy.getItemProxy().createManualTextItem(TestUtils.FJavaFile4, 50, 20);
+ fItem3 = fTestMain.getItemProxy().createManualTextItem(fTestUtils.FJavaFile4, 50, 20);
r4eAssert.assertNotNull(fItem3);
r4eAssert.assertEquals(R4EUIModelController.getReviewer(), fItem3.getItem().getAddedById());
r4eAssert.assertEquals(TestUtils.JAVA_FILE4_PROJ_NAME, fItem3.getItem()
@@ -434,9 +432,9 @@ public class SanityInformalTests extends TestCase {
.get(0)
.getTarget()
.getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotations(
- // ((R4EUIFileContext) fItem3.getChildren()[0]).getContentsContainerElement().getChildren(), true,
- // R4EUIConstants.SELECTION_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotations(
+ ((R4EUIFileContext) fItem3.getChildren()[0]).getContentsContainerElement().getChildren(), true,
+ R4EUIConstants.SELECTION_ANNOTATION_ID));
}
// ------------------------------------------------------------------------
@@ -458,7 +456,8 @@ public class SanityInformalTests extends TestCase {
participant.setId(TestConstants.PARTICIPANT_TEST_ID);
participant.setEmail(TestConstants.PARTICIPANT_TEST_EMAIL);
participants.add(participant);
- fParticipant = fProxy.getParticipantProxy().createParticipant(fReview.getParticipantContainer(), participants);
+ fParticipant = fTestMain.getParticipantProxy().createParticipant(fReview.getParticipantContainer(),
+ participants);
r4eAssert.assertNotNull(fParticipant);
r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_ID, fParticipant.getParticipant().getId());
r4eAssert.assertEquals(TestConstants.PARTICIPANT_TEST_EMAIL, fParticipant.getParticipant().getEmail());
@@ -478,7 +477,7 @@ public class SanityInformalTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createCompareEditorAnomalies");
r4eAssert.setTest("Create Compare Editor Anomaly");
- fCompareEditorAnomaly = fProxy.getAnomalyProxy().createCompareEditorAnomaly(
+ fCompareEditorAnomaly = fTestMain.getAnomalyProxy().createCompareEditorAnomaly(
fItem.getFileContexts().get(fAnomalyFileIndex), 20, 50,
TestConstants.COMPARE_EDITOR_ANOMALY_TEST_TITLE, TestConstants.COMPARE_EDITOR_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_ERRONEOUS, TestConstants.ANOMALY_TEST_RANK_MINOR,
@@ -501,8 +500,8 @@ public class SanityInformalTests extends TestCase {
r4eAssert.assertEquals(50, ((R4ETextPosition) ((R4ETextContent) fCompareEditorAnomaly.getAnomaly()
.getLocation()
.get(0)).getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
- // R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
+ R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
// ------------------------------------------------------------------------
@@ -523,10 +522,10 @@ public class SanityInformalTests extends TestCase {
.getContentsContainerElement()
.getContentsList()
.get(0);
- fLinkedAnomaly = fProxy.getAnomalyProxy().createLinkedAnomaly(content, TestConstants.LINKED_ANOMALY_TEST_TITLE,
- TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT,
- TestConstants.ANOMALY_TEST_RANK_MAJOR, TestConstants.ANOMALY_TEST_DUE_DATE,
- TestConstants.PARTICIPANT_ASSIGN_TO, null);
+ fLinkedAnomaly = fTestMain.getAnomalyProxy().createLinkedAnomaly(content,
+ TestConstants.LINKED_ANOMALY_TEST_TITLE, TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION,
+ TestConstants.ANOMALY_TEST_CLASS_IMPROVEMENT, TestConstants.ANOMALY_TEST_RANK_MAJOR,
+ TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null);
r4eAssert.assertNotNull(fLinkedAnomaly);
r4eAssert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_TITLE, fLinkedAnomaly.getAnomaly().getTitle());
r4eAssert.assertEquals(TestConstants.LINKED_ANOMALY_TEST_DESCRIPTION, fLinkedAnomaly.getAnomaly()
@@ -542,8 +541,8 @@ public class SanityInformalTests extends TestCase {
r4eAssert.assertEquals(
((R4EUITextPosition) content.getPosition()).getLength(),
((R4ETextPosition) ((R4ETextContent) fLinkedAnomaly.getAnomaly().getLocation().get(0)).getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fLinkedAnomaly, true,
- // R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotation(fLinkedAnomaly, true,
+ R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
// ------------------------------------------------------------------------
@@ -559,7 +558,7 @@ public class SanityInformalTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createExternalAnomalies");
r4eAssert.setTest("Create External Anomaly");
- fExternalAnomaly = fProxy.getAnomalyProxy().createExternalAnomaly(TestUtils.FJavaFile3,
+ fExternalAnomaly = fTestMain.getAnomalyProxy().createExternalAnomaly(fTestUtils.FJavaFile3,
TestConstants.EXTERNAL_ANOMALY_TEST_TITLE, TestConstants.EXTERNAL_ANOMALY_TEST_DESCRIPTION,
TestConstants.ANOMALY_TEST_CLASS_QUESTION, TestConstants.ANOMALY_TEST_RANK_MINOR,
TestConstants.ANOMALY_TEST_DUE_DATE, TestConstants.PARTICIPANT_ASSIGN_TO, null);
@@ -577,8 +576,8 @@ public class SanityInformalTests extends TestCase {
r4eAssert.assertEquals(755, ((R4ETextPosition) ((R4ETextContent) fExternalAnomaly.getAnomaly()
.getLocation()
.get(0)).getLocation()).getLength());
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fExternalAnomaly, false,
- // R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotation(fExternalAnomaly, false,
+ R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
}
// ------------------------------------------------------------------------
@@ -594,7 +593,7 @@ public class SanityInformalTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("createComments");
r4eAssert.setTest("Create Comment");
- fComment = fProxy.getCommentProxy().createComment(fLinkedAnomaly, TestConstants.COMMENT_TEST);
+ fComment = fTestMain.getCommentProxy().createComment(fLinkedAnomaly, TestConstants.COMMENT_TEST);
r4eAssert.assertNotNull(fComment);
r4eAssert.assertEquals(TestConstants.COMMENT_TEST, fComment.getComment().getDescription());
}
@@ -614,15 +613,15 @@ public class SanityInformalTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("sendQuestionNotifications");
r4eAssert.setTest("Send Question Notifications");
- fProxy.getCommandProxy().sendQuestionNotification(fReview);
- r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_SOURCE, fProxy.getCommandProxy()
+ fTestMain.getCommandProxy().sendQuestionNotification(fReview);
+ r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_SOURCE, fTestMain.getCommandProxy()
.getEmailDetails()
.getSource());
- String[] destinations = fProxy.getCommandProxy().getEmailDetails().getDestinations();
+ String[] destinations = fTestMain.getCommandProxy().getEmailDetails().getDestinations();
for (int i = 0; i < destinations.length; i++) {
r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_DESTINATIONS[i], destinations[i]);
}
- r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_SUBJECT_INFORMAL, fProxy.getCommandProxy()
+ r4eAssert.assertEquals(TestConstants.SEND_QUESTION_REVIEW_TEST_SUBJECT_INFORMAL, fTestMain.getCommandProxy()
.getEmailDetails()
.getSubject());
//TODO: Assert fails, but Strings seem to be identical???
@@ -655,13 +654,13 @@ public class SanityInformalTests extends TestCase {
r4eAssert.setTest("Progress Compare Editor Anomaly");
r4eAssert.assertNotNull(fCompareEditorAnomaly);
- fProxy.getAnomalyProxy().progressAnomaly(fCompareEditorAnomaly, TestConstants.ANOMALY_STATE_VERIFIED);
+ fTestMain.getAnomalyProxy().progressAnomaly(fCompareEditorAnomaly, TestConstants.ANOMALY_STATE_VERIFIED);
r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_VERIFIED, fCompareEditorAnomaly.getAnomaly().getState());
- //r4eAssert.assertFalse(fProxy.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
- // R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
- // R4EUIConstants.ANOMALY_CLOSED_ANNOTATION_ID));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
+ R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotation(fCompareEditorAnomaly, true,
+ R4EUIConstants.ANOMALY_CLOSED_ANNOTATION_ID));
}
/**
@@ -674,13 +673,13 @@ public class SanityInformalTests extends TestCase {
r4eAssert.setTest("Progress Linked Anomaly");
r4eAssert.assertNotNull(fLinkedAnomaly);
- fProxy.getAnomalyProxy().progressAnomaly(fLinkedAnomaly, TestConstants.ANOMALY_STATE_FIXED);
+ fTestMain.getAnomalyProxy().progressAnomaly(fLinkedAnomaly, TestConstants.ANOMALY_STATE_FIXED);
r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_FIXED, fLinkedAnomaly.getAnomaly().getState());
- //r4eAssert.assertFalse(fProxy.getCommandProxy().verifyAnnotation(fLinkedAnomaly, true,
- // R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fLinkedAnomaly, true,
- // R4EUIConstants.ANOMALY_CLOSED_ANNOTATION_ID));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().verifyAnnotation(fLinkedAnomaly, true,
+ R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotation(fLinkedAnomaly, true,
+ R4EUIConstants.ANOMALY_CLOSED_ANNOTATION_ID));
}
/**
@@ -693,13 +692,13 @@ public class SanityInformalTests extends TestCase {
r4eAssert.setTest("Progress External Anomaly");
r4eAssert.assertNotNull(fExternalAnomaly);
- fProxy.getAnomalyProxy().progressAnomaly(fExternalAnomaly, TestConstants.ANOMALY_STATE_REJECTED);
+ fTestMain.getAnomalyProxy().progressAnomaly(fExternalAnomaly, TestConstants.ANOMALY_STATE_REJECTED);
r4eAssert.assertEquals(TestConstants.ANOMALY_STATE_REJECTED, fExternalAnomaly.getAnomaly().getState());
- //r4eAssert.assertFalse(fProxy.getCommandProxy().verifyAnnotation(fExternalAnomaly, false,
- // R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
- //r4eAssert.assertTrue(fProxy.getCommandProxy().verifyAnnotation(fExternalAnomaly, false,
- // R4EUIConstants.ANOMALY_CLOSED_ANNOTATION_ID));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().verifyAnnotation(fExternalAnomaly, false,
+ R4EUIConstants.ANOMALY_OPEN_ANNOTATION_ID));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().verifyAnnotation(fExternalAnomaly, false,
+ R4EUIConstants.ANOMALY_CLOSED_ANNOTATION_ID));
}
// ------------------------------------------------------------------------
@@ -719,9 +718,10 @@ public class SanityInformalTests extends TestCase {
.getDecision()
.getValue()); //Test the default exit decision
- fProxy.getReviewProxy().progressReview(fReview);
+ fTestMain.getReviewProxy().progressReview(fReview);
r4eAssert.assertEquals(R4EReviewPhase.R4E_REVIEW_PHASE_COMPLETED, ((R4EReviewState) fReview.getReview()
.getState()).getState());
+ r4eAssert.assertNotNull(fReview.getReview().getEndDate());
}
// ------------------------------------------------------------------------
@@ -737,65 +737,65 @@ public class SanityInformalTests extends TestCase {
R4EAssert r4eAssert = new R4EAssert("verifySorters");
r4eAssert.setTest("Initial State");
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
// Alpha sorter On/Off
r4eAssert.setTest("Alpha Sorter On/Off");
- fProxy.getCommandProxy().toggleAlphaSorter();
- ViewerComparator activeSorter = fProxy.getCommandProxy().getActiveSorter();
+ fTestMain.getCommandProxy().toggleAlphaSorter();
+ ViewerComparator activeSorter = fTestMain.getCommandProxy().getActiveSorter();
r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
&& !(activeSorter instanceof ReviewTypeComparator));
- r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
- fProxy.getCommandProxy().toggleAlphaSorter();
- r4eAssert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ fTestMain.getCommandProxy().toggleAlphaSorter();
+ r4eAssert.assertTrue(null == fTestMain.getCommandProxy().getActiveSorter());
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
// Review Type sorter On/Off
r4eAssert.setTest("Review Type Sorter On/Off");
- fProxy.getCommandProxy().toggleReviewTypeSorter();
- activeSorter = fProxy.getCommandProxy().getActiveSorter();
+ fTestMain.getCommandProxy().toggleReviewTypeSorter();
+ activeSorter = fTestMain.getCommandProxy().getActiveSorter();
r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof ReviewTypeComparator);
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
- fProxy.getCommandProxy().toggleReviewTypeSorter();
- r4eAssert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ fTestMain.getCommandProxy().toggleReviewTypeSorter();
+ r4eAssert.assertTrue(null == fTestMain.getCommandProxy().getActiveSorter());
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
// AlphaSorter -> ReviewTypeSorter
r4eAssert.setTest("AlphaSorter -> ReviewTypeSorter");
- fProxy.getCommandProxy().toggleAlphaSorter();
- activeSorter = fProxy.getCommandProxy().getActiveSorter();
+ fTestMain.getCommandProxy().toggleAlphaSorter();
+ activeSorter = fTestMain.getCommandProxy().getActiveSorter();
r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
&& !(activeSorter instanceof ReviewTypeComparator));
- r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
- fProxy.getCommandProxy().toggleReviewTypeSorter();
- activeSorter = fProxy.getCommandProxy().getActiveSorter();
+ fTestMain.getCommandProxy().toggleReviewTypeSorter();
+ activeSorter = fTestMain.getCommandProxy().getActiveSorter();
r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof ReviewTypeComparator);
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
// ReviewTypeSorter -> AlphaSorter
r4eAssert.setTest("ReviewTypeSorter -> AlphaSorter");
- fProxy.getCommandProxy().toggleAlphaSorter();
- activeSorter = fProxy.getCommandProxy().getActiveSorter();
+ fTestMain.getCommandProxy().toggleAlphaSorter();
+ activeSorter = fTestMain.getCommandProxy().getActiveSorter();
r4eAssert.assertTrue(null != activeSorter && activeSorter instanceof NavigatorElementComparator
&& !(activeSorter instanceof ReviewTypeComparator));
- r4eAssert.assertTrue(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ r4eAssert.assertTrue(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
// Remove AlphaSorter
r4eAssert.setTest("Remove AlphaSorter");
- fProxy.getCommandProxy().toggleAlphaSorter();
- r4eAssert.assertTrue(null == fProxy.getCommandProxy().getActiveSorter());
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
- r4eAssert.assertFalse(fProxy.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
+ fTestMain.getCommandProxy().toggleAlphaSorter();
+ r4eAssert.assertTrue(null == fTestMain.getCommandProxy().getActiveSorter());
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.ALPHA_SORTER_COMMAND));
+ r4eAssert.assertFalse(fTestMain.getCommandProxy().getCommandState(R4EUIConstants.REVIEW_TYPE_SORTER_COMMAND));
}
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanitySetupTests.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanitySetupTests.java
index 501d2ff..a553da5 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanitySetupTests.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/sanity/SanitySetupTests.java
@@ -21,7 +21,6 @@ import java.io.File;
import java.net.URL;
import junit.framework.Test;
-import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.commands.ExecutionException;
@@ -39,8 +38,7 @@ import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIRuleArea;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIRuleSet;
import org.eclipse.mylyn.reviews.r4e.ui.internal.model.R4EUIRuleViolation;
import org.eclipse.mylyn.reviews.r4e.ui.internal.utils.UIUtils;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestSetup;
-import org.eclipse.mylyn.reviews.r4e.ui.tests.proxy.R4EUITestMain;
+import org.eclipse.mylyn.reviews.r4e.ui.tests.R4ETestCase;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.R4EAssert;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestConstants;
import org.eclipse.mylyn.reviews.r4e.ui.tests.utils.TestUtils;
@@ -48,49 +46,45 @@ import org.junit.After;
import org.junit.Before;
@SuppressWarnings({ "restriction", "nls" })
-public class SanitySetupTests extends TestCase {
+public class SanitySetupTests extends R4ETestCase {
// ------------------------------------------------------------------------
- // Member variables
+ // Constructors
// ------------------------------------------------------------------------
- private R4EUITestMain fProxy = null;
+ private static final String TEST_SUITE_ID = "SanitySetupTests";
+
+ public SanitySetupTests(String suite) {
+ super(suite);
+ }
+
+ public SanitySetupTests() {
+ super(TEST_SUITE_ID);
+ }
// ------------------------------------------------------------------------
// Housekeeping
// ------------------------------------------------------------------------
/**
- * Sets up the global test environment, if not already done at the suite level.
- *
- * @return Test
+ * @return Test the test suite
*/
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(SanitySetupTests.class);
- return new R4ETestSetup(suite);
+ return suite;
}
- /**
- * Sets up the fixture, for example, open a network connection. This method is called before a test is executed.
- *
- * @throws java.lang.Exception
- */
@Before
@Override
public void setUp() throws Exception {
- fProxy = R4EUITestMain.getInstance();
+ super.setUp();
}
- /**
- * Cleanup after the test has completed
- *
- * @throws java.lang.Exception
- */
@After
@Override
public void tearDown() throws Exception {
- fProxy = null;
+ super.tearDown();
}
// ------------------------------------------------------------------------
@@ -108,6 +102,7 @@ public class SanitySetupTests extends TestCase {
* @throws ResourceHandlingException
* @throws OutOfSyncException
*/
+ @org.junit.Test
public void testSetup() {
TestUtils.waitForJobs();
createRuleSetSetup();
@@ -136,42 +131,42 @@ public class SanitySetupTests extends TestCase {
// Create a Rule Set
r4eAssert.setTest("Create RuleSet");
- R4EUIRuleSet newRuleSet = fProxy.getRuleSetProxy().createRuleSet(TestUtils.FSharedFolder,
+ R4EUIRuleSet newRuleSet = fTestMain.getRuleSetProxy().createRuleSet(fTestUtils.FSharedFolder,
TestConstants.RULE_SET_TEST_NAME, TestConstants.RULE_SET_TEST_VERSION);
r4eAssert.assertNotNull(newRuleSet);
r4eAssert.assertEquals(TestConstants.RULE_SET_TEST_VERSION, newRuleSet.getRuleSet().getVersion());
- r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString(), newRuleSet.getRuleSet()
+ r4eAssert.assertEquals(new Path(fTestUtils.FSharedFolder).toPortableString(), newRuleSet.getRuleSet()
.getFolder());
r4eAssert.assertEquals(TestConstants.RULE_SET_TEST_NAME, newRuleSet.getRuleSet().getName());
// Create a Second Rule Set
r4eAssert.setTest("Create 2nd RuleSet");
- R4EUIRuleSet newRuleSet2 = fProxy.getRuleSetProxy().createRuleSet(TestUtils.FSharedFolder,
+ R4EUIRuleSet newRuleSet2 = fTestMain.getRuleSetProxy().createRuleSet(fTestUtils.FSharedFolder,
TestConstants.RULE_SET_TEST_NAME2, TestConstants.RULE_SET_TEST_VERSION);
String newRuleSet2Name = newRuleSet2.getName();
r4eAssert.assertNotNull(newRuleSet2);
r4eAssert.assertEquals(TestConstants.RULE_SET_TEST_VERSION, newRuleSet2.getRuleSet().getVersion());
- r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString(), newRuleSet2.getRuleSet()
+ r4eAssert.assertEquals(new Path(fTestUtils.FSharedFolder).toPortableString(), newRuleSet2.getRuleSet()
.getFolder());
r4eAssert.assertEquals(TestConstants.RULE_SET_TEST_NAME2, newRuleSet2.getRuleSet().getName());
// Create Rule Area
r4eAssert.setTest("Create Rule Area");
- R4EUIRuleArea newRuleArea = fProxy.getRuleAreaProxy().createRuleArea(newRuleSet,
+ R4EUIRuleArea newRuleArea = fTestMain.getRuleAreaProxy().createRuleArea(newRuleSet,
TestConstants.RULE_AREA_TEST_NAME);
r4eAssert.assertNotNull(newRuleArea);
r4eAssert.assertEquals(TestConstants.RULE_AREA_TEST_NAME, newRuleArea.getArea().getName());
// Create Rule Violation
r4eAssert.setTest("Create Rule Violation");
- R4EUIRuleViolation newRuleViolation = fProxy.getRuleViolationProxy().createRuleViolation(newRuleArea,
+ R4EUIRuleViolation newRuleViolation = fTestMain.getRuleViolationProxy().createRuleViolation(newRuleArea,
TestConstants.RULE_VIOLATION_TEST_NAME);
r4eAssert.assertNotNull(newRuleViolation);
r4eAssert.assertEquals(TestConstants.RULE_VIOLATION_TEST_NAME, newRuleViolation.getViolation().getName());
// Create Rule
r4eAssert.setTest("Create Rule");
- R4EUIRule newRule = fProxy.getRuleProxy().createRule(newRuleViolation, TestConstants.RULE_TEST_ID,
+ R4EUIRule newRule = fTestMain.getRuleProxy().createRule(newRuleViolation, TestConstants.RULE_TEST_ID,
TestConstants.RULE_TEST_TITLE, TestConstants.RULE_TEST_DESCRIPTION,
UIUtils.getClassFromString(TestConstants.RULE_TEST_CLASS),
UIUtils.getRankFromString(TestConstants.RULE_TEST_RANK));
@@ -184,12 +179,12 @@ public class SanitySetupTests extends TestCase {
// Close a Rule Set
r4eAssert.setTest("Close RuleSet");
- fProxy.getCommandProxy().closeElement(newRuleSet);
+ fTestMain.getCommandProxy().closeElement(newRuleSet);
r4eAssert.assertFalse(newRuleSet.isOpen());
//Open the Closed Rule Set
r4eAssert.setTest("Re-Open RuleSet");
- fProxy.getCommandProxy().openElement(newRuleSet);
+ fTestMain.getCommandProxy().openElement(newRuleSet);
r4eAssert.assertTrue(newRuleSet.isOpen());
r4eAssert.assertEquals(TestConstants.RULE_TEST_ID,
((R4EUIRule) newRuleSet.getChildren()[0].getChildren()[0].getChildren()[0]).getRule().getId());
@@ -197,7 +192,7 @@ public class SanitySetupTests extends TestCase {
// Remove Rule Set from preferences
r4eAssert.setTest("Remove RuleSet");
String prefsRuleSet = newRuleSet2.getRuleSet().eResource().getURI().toFileString();
- fProxy.getPreferencesProxy().removeRuleSetFromPreferences(prefsRuleSet);
+ fTestMain.getPreferencesProxy().removeRuleSetFromPreferences(prefsRuleSet);
for (R4EUIRuleSet ruleSet : R4EUIModelController.getRootElement().getRuleSets()) {
if (ruleSet.getRuleSet().getName().equals(newRuleSet2.getRuleSet().getName())) {
fail("RuleSet " + prefsRuleSet + " should not be present since it was removed from preferences");
@@ -207,7 +202,7 @@ public class SanitySetupTests extends TestCase {
// Add back Rule Set to preferences
r4eAssert.setTest("Put Back RuleSet");
boolean ruleSetFound = false;
- fProxy.getPreferencesProxy().addRuleSetToPreferences(prefsRuleSet);
+ fTestMain.getPreferencesProxy().addRuleSetToPreferences(prefsRuleSet);
for (R4EUIRuleSet ruleSet : R4EUIModelController.getRootElement().getRuleSets()) {
if (ruleSet.getRuleSet().getName().equals(newRuleSet2.getRuleSet().getName())) {
ruleSetFound = true;
@@ -221,7 +216,7 @@ public class SanitySetupTests extends TestCase {
newRuleSet2 = (R4EUIRuleSet) elem;
}
}
- fProxy.getCommandProxy().openElement(newRuleSet2);
+ fTestMain.getCommandProxy().openElement(newRuleSet2);
r4eAssert.assertTrue(newRuleSet2.isOpen());
}
@@ -246,14 +241,14 @@ public class SanitySetupTests extends TestCase {
// Create Review Group
r4eAssert.setTest("Create Review Group");
- R4EUIReviewGroup newGroup = fProxy.getReviewGroupProxy().createReviewGroup(
- TestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME,
+ R4EUIReviewGroup newGroup = fTestMain.getReviewGroupProxy().createReviewGroup(
+ fTestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME,
TestConstants.REVIEW_GROUP_TEST_NAME, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
r4eAssert.assertNotNull(newGroup);
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME, newGroup.getReviewGroup().getName());
- r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertEquals(new Path(fTestUtils.FSharedFolder).toPortableString() + "/"
+ TestConstants.REVIEW_GROUP_TEST_NAME, newGroup.getReviewGroup().getFolder());
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, newGroup.getReviewGroup().getDescription());
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, newGroup.getReviewGroup()
@@ -272,14 +267,14 @@ public class SanitySetupTests extends TestCase {
// Create a second Review Group
r4eAssert.setTest("Create 2nd Review Group");
- R4EUIReviewGroup newGroup2 = fProxy.getReviewGroupProxy().createReviewGroup(
- TestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME2,
+ R4EUIReviewGroup newGroup2 = fTestMain.getReviewGroupProxy().createReviewGroup(
+ fTestUtils.FSharedFolder + File.separator + TestConstants.REVIEW_GROUP_TEST_NAME2,
TestConstants.REVIEW_GROUP_TEST_NAME2, TestConstants.REVIEW_GROUP_TEST_DESCRIPTION,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS,
TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS, new String[0]);
r4eAssert.assertNotNull(newGroup2);
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_NAME2, newGroup2.getReviewGroup().getName());
- r4eAssert.assertEquals(new Path(TestUtils.FSharedFolder).toPortableString() + "/"
+ r4eAssert.assertEquals(new Path(fTestUtils.FSharedFolder).toPortableString() + "/"
+ TestConstants.REVIEW_GROUP_TEST_NAME2, newGroup2.getReviewGroup().getFolder());
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION, newGroup2.getReviewGroup().getDescription());
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA, newGroup2.getReviewGroup()
@@ -297,18 +292,18 @@ public class SanitySetupTests extends TestCase {
// Close a Review Group
r4eAssert.setTest("Close Review Group");
- fProxy.getCommandProxy().closeElement(newGroup);
+ fTestMain.getCommandProxy().closeElement(newGroup);
r4eAssert.assertFalse(newGroup.isOpen());
// Open the closed Review Group
r4eAssert.setTest("Re-Open Review Group");
- fProxy.getCommandProxy().openElement(newGroup);
+ fTestMain.getCommandProxy().openElement(newGroup);
r4eAssert.assertTrue(newGroup.isOpen());
// Remove Review Group from preferences
r4eAssert.setTest("Remove Review Group");
String prefsGroup = newGroup2.getReviewGroup().eResource().getURI().toFileString();
- fProxy.getPreferencesProxy().removeGroupFromPreferences(prefsGroup);
+ fTestMain.getPreferencesProxy().removeGroupFromPreferences(prefsGroup);
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
if (group.getReviewGroup().getName().equals(newGroup2.getReviewGroup().getName())) {
fail("Group " + prefsGroup + " should not be present since it was removed from preferences");
@@ -318,7 +313,7 @@ public class SanitySetupTests extends TestCase {
// Add back Review Group to preferences
r4eAssert.setTest("Add Removed Review Group");
boolean groupFound = false;
- fProxy.getPreferencesProxy().addGroupToPreferences(prefsGroup);
+ fTestMain.getPreferencesProxy().addGroupToPreferences(prefsGroup);
for (R4EUIReviewGroup group : R4EUIModelController.getRootElement().getGroups()) {
if (group.getReviewGroup().getName().equals(newGroup2.getReviewGroup().getName())) {
groupFound = true;
@@ -334,30 +329,30 @@ public class SanitySetupTests extends TestCase {
newGroup = (R4EUIReviewGroup) elem;
}
}
- fProxy.getCommandProxy().openElement(newGroup);
+ fTestMain.getCommandProxy().openElement(newGroup);
r4eAssert.assertTrue(newGroup.isOpen());
// Update Review Group properties
r4eAssert.setTest("Update Properties");
- fProxy.getReviewGroupProxy().changeReviewGroupDescription(newGroup,
+ fTestMain.getReviewGroupProxy().changeReviewGroupDescription(newGroup,
TestConstants.REVIEW_GROUP_TEST_DESCRIPTION2);
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_DESCRIPTION2, newGroup.getReviewGroup().getDescription());
- fProxy.getReviewGroupProxy().changeReviewGroupDefaultEntryCriteria(newGroup,
+ fTestMain.getReviewGroupProxy().changeReviewGroupDefaultEntryCriteria(newGroup,
TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA2);
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_ENTRY_CRITERIA2, newGroup.getReviewGroup()
.getDefaultEntryCriteria());
- fProxy.getReviewGroupProxy().removeReviewGroupAvailableProject(newGroup,
+ fTestMain.getReviewGroupProxy().removeReviewGroupAvailableProject(newGroup,
TestConstants.REVIEW_GROUP_TEST_REM_AVAILABLE_PROJECT);
- fProxy.getReviewGroupProxy().addReviewGroupAvailableProject(newGroup,
+ fTestMain.getReviewGroupProxy().addReviewGroupAvailableProject(newGroup,
TestConstants.REVIEW_GROUP_TEST_ADD_AVAILABLE_PROJECT);
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS2.length; i++) {
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_PROJECTS2[i], newGroup.getReviewGroup()
.getAvailableProjects()
.get(i));
}
- fProxy.getReviewGroupProxy().removeReviewGroupAvailableComponent(newGroup,
+ fTestMain.getReviewGroupProxy().removeReviewGroupAvailableComponent(newGroup,
TestConstants.REVIEW_GROUP_TEST_REM_AVAILABLE_COMPONENT);
- fProxy.getReviewGroupProxy().addReviewGroupAvailableComponent(newGroup,
+ fTestMain.getReviewGroupProxy().addReviewGroupAvailableComponent(newGroup,
TestConstants.REVIEW_GROUP_TEST_ADD_AVAILABLE_COMPONENT);
for (int i = 0; i < TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS2.length; i++) {
r4eAssert.assertEquals(TestConstants.REVIEW_GROUP_TEST_AVAILABLE_COMPONENTS2[i], newGroup.getReviewGroup()
@@ -367,7 +362,7 @@ public class SanitySetupTests extends TestCase {
for (R4EUIRuleSet ruleSet : R4EUIModelController.getRootElement().getRuleSets()) {
if (ruleSet.getName().equals(TestConstants.RULE_SET_TEST_NAME2)) {
- fProxy.getReviewGroupProxy().addReviewGroupRuleSet(newGroup, ruleSet.getRuleSet().getName());
+ fTestMain.getReviewGroupProxy().addReviewGroupRuleSet(newGroup, ruleSet.getRuleSet().getName());
r4eAssert.assertEquals(ruleSet.getRuleSet().getName(), newGroup.getReviewGroup()
.getDesignRuleLocations()
.get(0));
@@ -377,9 +372,9 @@ public class SanitySetupTests extends TestCase {
for (R4EUIRuleSet ruleSet : R4EUIModelController.getRootElement().getRuleSets()) {
if (ruleSet.getName().equals(TestConstants.RULE_SET_TEST_NAME)) {
- fProxy.getReviewGroupProxy().addReviewGroupRuleSet(newGroup, ruleSet.getRuleSet().getName());
+ fTestMain.getReviewGroupProxy().addReviewGroupRuleSet(newGroup, ruleSet.getRuleSet().getName());
} else if (ruleSet.getName().equals(TestConstants.RULE_SET_TEST_NAME2)) {
- fProxy.getReviewGroupProxy().removeReviewGroupRuleSet(newGroup, ruleSet.getRuleSet().getName());
+ fTestMain.getReviewGroupProxy().removeReviewGroupRuleSet(newGroup, ruleSet.getRuleSet().getName());
}
}
@@ -407,10 +402,10 @@ public class SanitySetupTests extends TestCase {
// Verify R4E help is present
r4eAssert.setTest("Help Presence");
- URL openUrl = fProxy.getHelp("/org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/User-Guide.html");
+ URL openUrl = fTestMain.getHelp("/org.eclipse.mylyn.reviews.r4e.help/help/Reviews/R4E/User_Guide/User-Guide.html");
r4eAssert.assertNotNull(openUrl);
- URL ericssonUrl = fProxy.getHelp("/com.ericsson.reviews.r4e.help/doc/r4eEricsson.html");
+ URL ericssonUrl = fTestMain.getHelp("/com.ericsson.reviews.r4e.help/doc/r4eEricsson.html");
r4eAssert.assertNotNull(ericssonUrl);
}
diff --git a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/utils/TestUtils.java b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/utils/TestUtils.java
index af7578d..f8d05ae 100644
--- a/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/utils/TestUtils.java
+++ b/org.eclipse.mylyn.reviews.r4e.ui.tests/src/org/eclipse/mylyn/reviews/r4e/ui/tests/utils/TestUtils.java
@@ -12,7 +12,7 @@
*
* Contributors:
* Sebastien Dubois - Created for Mylyn Review R4E project
- *
+ * Francois Chouinard - Make the WS and shared drive test-independent
******************************************************************************/
package org.eclipse.mylyn.reviews.r4e.ui.tests.utils;
@@ -25,9 +25,9 @@ import java.net.URL;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
-
-import junit.framework.Assert;
+import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.CProjectNature;
@@ -69,6 +69,7 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
+import org.junit.Assert;
@SuppressWarnings({ "restriction", "nls" })
public class TestUtils {
@@ -77,12 +78,12 @@ public class TestUtils {
// Constants
// ------------------------------------------------------------------------
- //Git
- public final static String AUTHOR = "The Author <The.author@some.com>";
+ // Git
+ private static final String AUTHOR = "The Author <The.author@some.com>";
- public final static String COMMITTER = "The Commiter <The.committer@some.com>";
+ private static final String COMMITTER = "The Commiter <The.committer@some.com>";
- //Java
+ // Java
private static final String UI_TEST_JAVA_PROJECT_NAME = "javaProject";
private static final String JAVA_FILE1_EXT_PATH = "testFiles" + File.separator + "extModCommitFile.java";
@@ -111,7 +112,7 @@ public class TestUtils {
private static final String JAVA_FILE5_PROJ_NAME = "noVCSFile.java";
- //C
+ // C
private static final String UI_TEST_C_PROJECT_NAME = "cProject";
private static final String C_FILE1_EXT_PATH = "testFiles" + File.separator + "extModCommitFile.cc";
@@ -138,7 +139,7 @@ public class TestUtils {
private static final String C_FILE5_PROJ_NAME = "noVCSFile.cc";
- //Text
+ // Text
private static final String UI_TEST_TEXT_PROJECT_NAME = "textProject";
private static final String TEXT_FILE1_EXT_PATH = "testFiles" + File.separator + "extModCommitFile.txt";
@@ -165,110 +166,154 @@ public class TestUtils {
private static final String TEXT_FILE5_PROJ_NAME = "noVCSFile.txt";
- //Test Views
- public static final String R4E_NAVIGATOR_VIEW_NAME = "org.eclipse.mylyn.reviews.r4e.ui.navigator.ReviewNavigatorView"; // $codepro.audit.disable constantNamingConvention
+ // Test Views
+ private static final String R4E_NAVIGATOR_VIEW_NAME = "org.eclipse.mylyn.reviews.r4e.ui.navigator.ReviewNavigatorView"; // $codepro.audit.disable constantNamingConvention
// ------------------------------------------------------------------------
// Variables
// ------------------------------------------------------------------------
- public static String FSharedFolder = null;
+ public String FSharedFolder = null;
+
+ private IProject FExtProject = null;
+
+ // Java
+ public IProject FJavaIProject = null;
- public static IProject FExtProject = null;
+ private IJavaProject FJavaIJavaProject = null;
- //Java
- public static IProject FJavaIProject = null;
+ public Repository FJavaRepository = null;
- public static IJavaProject FJavaIJavaProject = null;
+ private String FJavaWorkdirPrefix = null;
- public static Repository FJavaRepository = null;
+ public IFile FJavaFile1 = null;
- public static String FJavaWorkdirPrefix = null;
+ private IFile FJavaFile2 = null;
- public static IFile FJavaFile1 = null;
+ public IFile FJavaFile3 = null;
- public static IFile FJavaFile2 = null;
+ public IFile FJavaFile4 = null;
- public static IFile FJavaFile3 = null;
+ private IFile FJavaFile5 = null;
- public static IFile FJavaFile4 = null;
+ // C
+ public IProject FCIProject = null;
- public static IFile FJavaFile5 = null;
+ private IProject FCICProject = null;
- //C
- public static IProject FCIProject = null;
+ private Repository FCRepository = null;
- public static IProject FCICProject = null;
+ private String FCWorkdirPrefix = null;
- public static Repository FCRepository = null;
+ private IFile FCFile1 = null;
- public static String FCWorkdirPrefix = null;
+ private IFile FCFile2 = null;
- public static IFile FCFile1 = null;
+ private IFile FCFile3 = null;
- public static IFile FCFile2 = null;
+ private IFile FCFile4 = null;
- public static IFile FCFile3 = null;
+ private IFile FCFile5 = null;
- public static IFile FCFile4 = null;
+ // Text
+ public IProject FTextIProject = null;
- public static IFile FCFile5 = null;
+ private Repository FTextRepository = null;
- //Text
- public static IProject FTextIProject = null;
+ private String FTextWorkdirPrefix = null;
- public static Repository FTextRepository = null;
+ private IFile FTextFile1 = null;
- public static String FTextWorkdirPrefix = null;
+ private IFile FTextFile2 = null;
- public static IFile FTextFile1 = null;
+ private IFile FTextFile3 = null;
- public static IFile FTextFile2 = null;
+ private IFile FTextFile4 = null;
- public static IFile FTextFile3 = null;
+ private IFile FTextFile5 = null;
- public static IFile FTextFile4 = null;
+ // UI Model
+ private R4EUIRootElement FRootElement;
- public static IFile FTextFile5 = null;
+ // Test View
+ private ReviewNavigatorView FTestNavigatorView;
+
+ // ------------------------------------------------------------------------
+ // Factory stuff
+ // ------------------------------------------------------------------------
+
+ /**
+ * The TestUtils ID
+ */
+ private String fTestUtilsID = null;
+
+ /**
+ * TestUtils repository
+ */
+ private static Map<String, TestUtils> fTestUtils = new HashMap<String, TestUtils>();
+
+ /**
+ * TestUtils factory. If the requested TestUtils doesn't exist, it will be created.
+ *
+ * @param id
+ * the unique TestUtils ID
+ * @return the corresponding TestUtils
+ */
+ public static TestUtils get(String id) {
+ TestUtils testUtils = fTestUtils.get(id);
+ if (testUtils == null) {
+ testUtils = new TestUtils(id);
+ fTestUtils.put(id, testUtils);
+ }
+ return testUtils;
+ }
- //UI Model
- public static R4EUIRootElement FRootElement;
+ private TestUtils(String id) {
+ fTestUtilsID = id;
+ }
- //Test View
- public static ReviewNavigatorView FTestNavigatorView;
+ /**
+ * @return the TestUtils ID
+ */
+ public String getId() {
+ return fTestUtilsID;
+ }
// ------------------------------------------------------------------------
// Test environment setup
// ------------------------------------------------------------------------
- public static void setupTestEnvironment() throws CoreException, IOException, URISyntaxException {
+ public void setupTestEnvironment() throws CoreException, IOException, URISyntaxException {
FExtProject = ResourcesPlugin.getWorkspace().getRoot().getProject(R4EUITestPlugin.PLUGIN_ID);
-
setupJavaProject();
setupCProject();
setupTextProject();
- setupSharedFolder();
+ setupSharedFolder(ResourcesPlugin.getWorkspace().getRoot().getLocation().toOSString());
}
// ------------------------------------------------------------------------
- // project cleanup
+ // Project cleanup
// ------------------------------------------------------------------------
- public static void cleanupTestEnvironment() throws CoreException, IOException {
- cleanupSharedFolder(FSharedFolder);
- cleanupProject(FTextIProject, FTextRepository);
- cleanupProject(FCIProject, FCRepository);
- cleanupProject(FJavaIProject, FJavaRepository);
+ public void cleanupTestEnvironment() {
+ try {
+ cleanupSharedFolder(FSharedFolder);
+ cleanupProject(FTextIProject, FTextRepository);
+ cleanupProject(FCIProject, FCRepository);
+ cleanupProject(FJavaIProject, FJavaRepository);
+ } catch (Exception e) {
+ // Don't care at this point
+ }
}
// ------------------------------------------------------------------------
// Projects
// ------------------------------------------------------------------------
- private static void setupJavaProject() throws CoreException, IOException, URISyntaxException {
+ private void setupJavaProject() throws CoreException, IOException, URISyntaxException {
//Create project
- FJavaIProject = createProject(UI_TEST_JAVA_PROJECT_NAME);
+ FJavaIProject = createProject(fTestUtilsID + "-" + UI_TEST_JAVA_PROJECT_NAME);
//Create repository
FJavaRepository = createRepository(FJavaIProject);
@@ -311,9 +356,9 @@ public class TestUtils {
FJavaFile5 = addFileToProject(FJavaIProject, JAVA_FILE5_PROJ_NAME, JAVA_FILE5_EXT_PATH);
}
- private static void setupCProject() throws CoreException, IOException, URISyntaxException {
+ private void setupCProject() throws CoreException, IOException, URISyntaxException {
//Create project
- FCIProject = createProject(UI_TEST_C_PROJECT_NAME);
+ FCIProject = createProject(fTestUtilsID + "-" + UI_TEST_C_PROJECT_NAME);
//Create repository
FCRepository = createRepository(FCIProject);
@@ -356,9 +401,9 @@ public class TestUtils {
FCFile5 = addFileToProject(FCIProject, C_FILE5_PROJ_NAME, C_FILE5_EXT_PATH);
}
- private static void setupTextProject() throws CoreException, IOException, URISyntaxException {
+ private void setupTextProject() throws CoreException, IOException, URISyntaxException {
//Create project
- FTextIProject = createProject(UI_TEST_TEXT_PROJECT_NAME);
+ FTextIProject = createProject(fTestUtilsID + "-" + UI_TEST_TEXT_PROJECT_NAME);
//Create repository
FTextRepository = createRepository(FTextIProject);
@@ -398,7 +443,7 @@ public class TestUtils {
FTextFile5 = addFileToProject(FTextIProject, TEXT_FILE5_PROJ_NAME, TEXT_FILE5_EXT_PATH);
}
- private static void cleanupProject(IProject aProject, Repository aRepository) throws CoreException, IOException {
+ private void cleanupProject(IProject aProject, Repository aRepository) throws CoreException, IOException {
//Disconnect project from repository
disconnectProject(aProject);
@@ -413,7 +458,7 @@ public class TestUtils {
// Project helper functions
// ------------------------------------------------------------------------
- private static IProject createProject(String aProjectName) throws CoreException, IOException {
+ private IProject createProject(String aProjectName) throws CoreException, IOException {
TestUtils.waitForJobs();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject project = root.getProject(aProjectName);
@@ -425,7 +470,7 @@ public class TestUtils {
return project;
}
- private static void deleteProject(IProject aProject) throws CoreException, IOException {
+ private void deleteProject(IProject aProject) throws CoreException, IOException {
if (aProject.exists()) {
aProject.refreshLocal(IResource.DEPTH_INFINITE, null);
aProject.close(null);
@@ -438,7 +483,7 @@ public class TestUtils {
}
}
- private static IJavaProject setProjectAsJava(IProject aProject) throws CoreException, IOException {
+ private IJavaProject setProjectAsJava(IProject aProject) throws CoreException, IOException {
IJavaProject javaProject = JavaCore.create(aProject);
IFolder binFolder = aProject.getFolder("bin");
@@ -460,7 +505,7 @@ public class TestUtils {
return javaProject;
}
- private static IProject setProjectAsC(IProject aProject) throws CoreException, IOException {
+ private IProject setProjectAsC(IProject aProject) throws CoreException, IOException {
IProjectDescription description = aProject.getDescription();
description.setNatureIds(new String[] { CProjectNature.C_NATURE_ID });
aProject.setDescription(description, null);
@@ -470,8 +515,8 @@ public class TestUtils {
return cProject;
}
- private static IFile addFileToProject(IProject aProject, String aProjFilepath, String aExtFilePath)
- throws IOException, CoreException, URISyntaxException {
+ private IFile addFileToProject(IProject aProject, String aProjFilepath, String aExtFilePath) throws IOException,
+ CoreException, URISyntaxException {
URL location = FileLocator.find(Platform.getBundle(R4EUITestPlugin.PLUGIN_ID), new Path(aExtFilePath), null);
File extFile = new File(FileLocator.toFileURL(location).toURI());
FileInputStream content = new FileInputStream(extFile);
@@ -498,7 +543,7 @@ public class TestUtils {
// Repository helper functions
// ------------------------------------------------------------------------
- private static Repository createRepository(IProject aProject) throws CoreException, IOException {
+ private Repository createRepository(IProject aProject) throws CoreException, IOException {
TestUtils.waitForJobs();
File gitDir = new File(aProject.getLocation().toOSString(), Constants.DOT_GIT);
Repository repository = new FileRepository(gitDir);
@@ -513,25 +558,24 @@ public class TestUtils {
return repository;
}
- private static void deleteRepository(Repository aRepository) throws CoreException, IOException {
+ private void deleteRepository(Repository aRepository) throws CoreException, IOException {
Repository repository = aRepository;
repository.close();
repository = null;
}
- private static void connectProjectWithRepo(IProject aProject, Repository aRepository) throws CoreException,
- IOException {
+ private void connectProjectWithRepo(IProject aProject, Repository aRepository) throws CoreException, IOException {
ConnectProviderOperation op = new ConnectProviderOperation(aProject, aRepository.getDirectory());
op.execute(null);
}
- private static void disconnectProject(IProject aProject) throws CoreException, IOException {
+ private void disconnectProject(IProject aProject) throws CoreException, IOException {
Collection<IProject> projects = Collections.singleton(aProject.getProject());
DisconnectProviderOperation disconnect = new DisconnectProviderOperation(projects);
disconnect.execute(null);
}
- public static void addFilesToRepository(List<IResource> aResources) throws CoreException {
+ private void addFilesToRepository(List<IResource> aResources) throws CoreException {
new AddToIndexOperation(aResources).execute(null);
}
@@ -539,7 +583,7 @@ public class TestUtils {
// Workspace helper functions
// ------------------------------------------------------------------------
- private static String getWorkDir(Repository aRepository) throws CoreException, IOException {
+ private String getWorkDir(Repository aRepository) throws CoreException, IOException {
String workDir;
try {
workDir = aRepository.getWorkTree().getCanonicalPath();
@@ -553,7 +597,7 @@ public class TestUtils {
return workDir;
}
- public static IFile changeContentOfFile(IFile file, String aNewContentsFilePath) throws CoreException, IOException,
+ public IFile changeContentOfFile(IFile file, String aNewContentsFilePath) throws CoreException, IOException,
URISyntaxException {
URL location = FileLocator.find(Platform.getBundle(R4EUITestPlugin.PLUGIN_ID), new Path(aNewContentsFilePath),
null);
@@ -564,7 +608,7 @@ public class TestUtils {
return file;
}
- public static void commitFiles(IProject aProject, Repository aRepository, String aCommitMsg, boolean aAmend)
+ public void commitFiles(IProject aProject, Repository aRepository, String aCommitMsg, boolean aAmend)
throws CoreException {
CommitOperation commitOperation = new CommitOperation(null, null, null, TestUtils.AUTHOR, TestUtils.COMMITTER,
aCommitMsg);
@@ -575,7 +619,7 @@ public class TestUtils {
aProject.refreshLocal(IResource.DEPTH_INFINITE, null);
}
- public static void commitAmendFiles(IProject aProject, Repository aRepository, String aCommitMsg,
+ public void commitAmendFiles(IProject aProject, Repository aRepository, String aCommitMsg,
Collection<String> acommitFileList) throws CoreException {
CommitOperation commitOperation = new CommitOperation(null, acommitFileList, null, TestUtils.AUTHOR,
TestUtils.COMMITTER, aCommitMsg);
@@ -589,16 +633,15 @@ public class TestUtils {
// Shared folder
// ------------------------------------------------------------------------
- private static void setupSharedFolder() {
- String dir = System.getProperty("java.io.tmpdir");
+ private void setupSharedFolder(String dir) {
if (!dir.endsWith(File.separator)) {
dir += File.separator;
}
- dir = dir + "R4ETest";
+ dir = dir + fTestUtilsID + "-shared";
FSharedFolder = dir;
}
- private static void cleanupSharedFolder(String aFolder) throws IOException {
+ private void cleanupSharedFolder(String aFolder) throws IOException {
if (null != aFolder) {
File f = new File(aFolder);
if (f.exists()) {
@@ -611,7 +654,7 @@ public class TestUtils {
// Review Navigator
// ------------------------------------------------------------------------
- public static void startNavigatorView() {
+ public void startNavigatorView() {
waitForJobs();
Display.getDefault().syncExec(new Runnable() {
public void run() {
@@ -636,7 +679,7 @@ public class TestUtils {
});
}
- public static void stopNavigatorView() {
+ public void stopNavigatorView() {
waitForJobs();
Display.getDefault().syncExec(new Runnable() {
public void run() {
@@ -645,10 +688,39 @@ public class TestUtils {
});
}
+ public R4EUIRootElement getRootElement() {
+ return FRootElement;
+ }
+
+ /**
+ * Get the initial input from the R4E model and populate the UI model with it
+ *
+ * @return the root element of the UI model
+ */
+ public IR4EUIModelElement getInitalInput() {
+ R4EUIModelController.loadModel();
+ final IR4EUIModelElement rootTreeNode = R4EUIModelController.getRootElement();
+ rootTreeNode.getChildren();
+ return rootTreeNode;
+ }
+
+ /**
+ * Method setDefaultUser
+ */
+ public void setDefaultUser(R4EUITestMain proxy) {
+ proxy.getPreferencesProxy().setUser(TestConstants.DEFAULT_USER_ID);
+ proxy.getPreferencesProxy().setEmail(TestConstants.DEFAULT_USER_EMAIL);
+ Assert.assertEquals(TestConstants.DEFAULT_USER_ID, proxy.getPreferencesProxy().getUser());
+ Assert.assertEquals(TestConstants.DEFAULT_USER_EMAIL, proxy.getPreferencesProxy().getEmail());
+ }
+
// ------------------------------------------------------------------------
- // Misc utils
+ // General utilities
// ------------------------------------------------------------------------
+ /**
+ * Wait for the ongoing jobs to complete
+ */
public static void waitForJobs() {
//NOTE: In order to the above to work, no background jobs (such as Usage Data Collector) should be running.
//otherwise we will be blocked forever here. An alternative solution is to join our thread to the
@@ -668,12 +740,18 @@ public class TestUtils {
*/
}
- public static void delay(long aWaitTimeMillis) {
+ /**
+ * Delay (suspend) this job for a certain duration
+ *
+ * @param delay
+ * wait time (ms)
+ */
+ private static void delay(long delay) {
Display display = Display.getCurrent();
//If this is the UI thread, process input
if (null != display) {
- long endTimeMillis = System.currentTimeMillis() + aWaitTimeMillis;
+ long endTimeMillis = System.currentTimeMillis() + delay;
while (System.currentTimeMillis() < endTimeMillis) {
try {
if (!display.isDisposed() && !display.readAndDispatch()) {
@@ -687,39 +765,11 @@ public class TestUtils {
} else {
//Just sleep
try {
- Thread.sleep(aWaitTimeMillis);
+ Thread.sleep(delay);
} catch (InterruptedException e) {
//ignore
}
}
}
- public static R4EUIRootElement getRootElement() {
- return FRootElement;
- }
-
- /**
- * Get the initial input from the R4E model and populate the UI model with it
- *
- * @return the root element of the UI model
- */
- public static IR4EUIModelElement getInitalInput() {
- R4EUIModelController.loadModel();
- final IR4EUIModelElement rootTreeNode = R4EUIModelController.getRootElement();
- rootTreeNode.getChildren();
- return rootTreeNode;
- }
-
- /**
- * Method setDefaultUser
- */
- public static void setDefaultUser() {
- R4EUITestMain.getInstance().getPreferencesProxy().setUser(TestConstants.DEFAULT_USER_ID);
- R4EUITestMain.getInstance().getPreferencesProxy().setEmail(TestConstants.DEFAULT_USER_EMAIL);
- Assert.assertEquals(TestConstants.DEFAULT_USER_ID, R4EUITestMain.getInstance().getPreferencesProxy().getUser());
- Assert.assertEquals(TestConstants.DEFAULT_USER_EMAIL, R4EUITestMain.getInstance()
- .getPreferencesProxy()
- .getEmail());
- }
-
}