[453911] Adds CHE014 and MER014 tests Bug: 453911 Change-Id: Iba513f426b9af7ae2c82a8845db65bc0e9d351b3 Signed-off-by: Axel Richard <axel.richard@obeo.fr>
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 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 @@ } /** + * @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 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 @@ 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 @@ } /** + * @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()