Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Richard2014-12-02 16:30:08 +0000
committerAxel Richard2015-05-22 10:02:48 +0000
commit4372f5cc407565004b9800662e4d9e837cff97c8 (patch)
treef8100ed3653e9a8dd4f65401864d0020769f5dff
parent6ffe537bfeebd15ad14ab239b7d6b297be8c12a5 (diff)
downloadorg.eclipse.emf.compare-cli-4372f5cc407565004b9800662e4d9e837cff97c8.tar.gz
org.eclipse.emf.compare-cli-4372f5cc407565004b9800662e4d9e837cff97c8.tar.xz
org.eclipse.emf.compare-cli-4372f5cc407565004b9800662e4d9e837cff97c8.zip
[453911] Adds CHE014 and MER014 testsHEADmaster
Bug: 453911 Change-Id: Iba513f426b9af7ae2c82a8845db65bc0e9d351b3 Signed-off-by: Axel Richard <axel.richard@obeo.fr>
-rw-r--r--plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/app/CherryPickApplicationTest.java34
-rw-r--r--plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/app/MergeApplicationTest.java39
2 files changed, 72 insertions, 1 deletions
diff --git a/plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/app/CherryPickApplicationTest.java b/plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/app/CherryPickApplicationTest.java
index 605dede..9204332 100644
--- a/plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/app/CherryPickApplicationTest.java
+++ b/plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/app/CherryPickApplicationTest.java
@@ -17,6 +17,7 @@ import static org.junit.Assert.assertEquals;
import com.google.common.collect.Sets;
import java.nio.file.Path;
+import java.util.HashSet;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -214,6 +215,39 @@ public class CherryPickApplicationTest extends AbstractApplicationTest {
}
/**
+ * @see ContextSetup#setupREB014()
+ * @throws Exception
+ */
+ @Test
+ public void testCHE014() throws Exception {
+ contextSetup = new ContextSetup(getGit(), getTestTmpFolder());
+ contextSetup.setupREB014();
+
+ runCherryPick(Returns.ABORTED, "branch_b");
+
+ assertOutputMessageEnd(getExpectedConflictMessage("[" + getShortId("branch_b")
+ + "]... Creates association between C1 & C2", null)
+ + EOL);
+
+ // Checks that the expected file are marked as conflicting
+ HashSet<String> conflictingFile = Sets.newHashSet("REB014/model.notation",//
+ "REB014/P1.uml",//
+ "REB014/P2.uml");
+ assertEquals(conflictingFile, getGit().status().call().getConflicting());
+ // Checks that the model files were not corrupted by <<< and >>> markers.
+ Path projectPath = contextSetup.getProjectPath();
+ assertNoConflitMarker(projectPath.resolve("model.uml"), //
+ projectPath.resolve("model.notation"),//
+ projectPath.resolve("model.di"),//
+ projectPath.resolve("P1.uml"),//
+ projectPath.resolve("P1.notation"),//
+ projectPath.resolve("P1.di"),//
+ projectPath.resolve("P2.uml"),//
+ projectPath.resolve("P2.notation"),//
+ projectPath.resolve("P2.di"));
+ }
+
+ /**
* @see ContextSetup#setupREB016()
* @throws Exception
*/
diff --git a/plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/app/MergeApplicationTest.java b/plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/app/MergeApplicationTest.java
index d8ea4f8..f89cf6e 100644
--- a/plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/app/MergeApplicationTest.java
+++ b/plugins/org.eclipse.emf.compare.git.pgm.tests/src/org/eclipse/emf/compare/git/pgm/internal/app/MergeApplicationTest.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.assertTrue;
import com.google.common.collect.Sets;
import java.nio.file.Path;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
@@ -176,7 +177,6 @@ public class MergeApplicationTest extends AbstractApplicationTest {
contextSetup.getUserSetupFile().getAbsolutePath(), getShortId("branch_a"));
runCommand(Returns.COMPLETE);
-
assertOutputMessageEnd("Already up to date." + EOL + EOL);
assertTrue(getGit().status().call().isClean());
@@ -448,6 +448,43 @@ public class MergeApplicationTest extends AbstractApplicationTest {
}
/**
+ * @see ContextSetup#setupREB014()
+ * @throws Exception
+ */
+ @Test
+ public void testMER014() throws Exception {
+ contextSetup = new ContextSetup(getGit(), getTestTmpFolder());
+ contextSetup.setupREB014();
+
+ runMerge(Returns.ABORTED, "branch_b");
+
+ StringBuilder expectedOut = new StringBuilder();
+ expectedOut.append("Auto-merging failed in ").append("REB014/P1.uml").append(EOL);
+ expectedOut.append("Auto-merging failed in ").append("REB014/P2.uml").append(EOL);
+ expectedOut.append("Auto-merging failed in ").append("REB014/model.notation").append(EOL);
+ expectedOut.append("Automatic merge failed; fix conflicts and then commit the result.").append(EOL)
+ .append(EOL);
+ assertOutputMessageEnd(expectedOut.toString());
+
+ // Checks that the expected file are marked as conflicting
+ HashSet<String> conflictingFile = Sets.newHashSet("REB014/model.notation",//
+ "REB014/P1.uml",//
+ "REB014/P2.uml");
+ assertEquals(conflictingFile, getGit().status().call().getConflicting());
+ // Checks that the model files were not corrupted by <<< and >>> markers.
+ Path projectPath = contextSetup.getProjectPath();
+ assertNoConflitMarker(projectPath.resolve("model.uml"), //
+ projectPath.resolve("model.notation"),//
+ projectPath.resolve("model.di"),//
+ projectPath.resolve("P1.uml"),//
+ projectPath.resolve("P1.notation"),//
+ projectPath.resolve("P1.di"),//
+ projectPath.resolve("P2.uml"),//
+ projectPath.resolve("P2.notation"),//
+ projectPath.resolve("P2.di"));
+ }
+
+ /**
* {@inheritDoc}
*
* @see org.eclipse.emf.compare.git.pgm.internal.app.AbstractApplicationTest#buildApp()

Back to the top