diff options
author | Ryan D. Brooks | 2016-06-01 07:08:30 +0000 |
---|---|---|
committer | Angel Avila | 2016-06-01 07:08:30 +0000 |
commit | de190f34a36b1df492bccec98d6e7a37baf79d5f (patch) | |
tree | 3e71fc6c953416e0571be6ed5e8b89fd1f87f444 /plugins/org.eclipse.osee.client.integration.tests | |
parent | 0beb7e2979dcffb5467bde99d255757e1a6bc1dc (diff) | |
download | org.eclipse.osee-de190f34a36b1df492bccec98d6e7a37baf79d5f.tar.gz org.eclipse.osee-de190f34a36b1df492bccec98d6e7a37baf79d5f.tar.xz org.eclipse.osee-de190f34a36b1df492bccec98d6e7a37baf79d5f.zip |
refactor: Use TransactionId with Conflicts
Change-Id: I9b2cd1f0d0a65aedca7683428357b9ea6d0b8f86
Diffstat (limited to 'plugins/org.eclipse.osee.client.integration.tests')
3 files changed, 27 insertions, 29 deletions
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictDeletionTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictDeletionTest.java index ff9b7d90073..b377e1c297b 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictDeletionTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictDeletionTest.java @@ -133,7 +133,7 @@ public class ConflictDeletionTest { if (chStmt.next()) { fail( "Artifact " + artifact.getArtId() + " old Transaction < " + artifact.getTransaction() + " is set to " + chStmt.getInt( - "tx_current") + " , should be 0 on branch " + artifact.getBranch().getGuid()); + "tx_current") + " , should be 0 on branch " + artifact.getBranchId()); } } finally { chStmt.close(); @@ -142,11 +142,11 @@ public class ConflictDeletionTest { chStmt.runPreparedQuery(CHECK_FOR_DELETED_TX_CURRENT, artifact.getBranchId(), artifact.getArtId()); if (chStmt.next()) { assertTrue( - "Artifact " + artifact.getArtId() + " Transaction: " + artifact.getTransaction() + " should be 3 on branch " + artifact.getBranch().getGuid(), + "Artifact " + artifact.getArtId() + " Transaction: " + artifact.getTransaction() + " should be 3 on branch " + artifact.getBranchId(), artifact.getTransaction().equals(chStmt.getLong("transaction_id"))); } else { fail( - "Artifact " + artifact.getArtId() + " was not given a tx_current value of 2 when it was deleted on branch " + artifact.getBranch().getGuid() + " on transaction " + artifact.getTransaction()); + "Artifact " + artifact.getArtId() + " was not given a tx_current value of 2 when it was deleted on branch " + artifact.getBranchId() + " on transaction " + artifact.getTransaction()); } } finally { chStmt.close(); @@ -190,15 +190,14 @@ public class ConflictDeletionTest { if (chStmt.next()) { if (deletionTransaction.equals(chStmt.getLong("transaction_id"))) { fail("Artifact " + artifact.getArtId() + " tx_current set on " + chStmt.getInt( - "transaction_id") + " when it should be < " + deletionTransaction + " on branch " + artifact.getBranch().getGuid()); + "transaction_id") + " when it should be < " + deletionTransaction + " on branch " + artifact.getBranchId()); } if (chStmt.next()) { fail( - "Artifact " + artifact.getArtId() + " has multiple tx_current set on " + artifact.getBranch().getGuid()); + "Artifact " + artifact.getArtId() + " has multiple tx_current set on " + artifact.getBranchId()); } } else { - fail( - "Artifact " + artifact.getArtId() + " has no tx_current set on " + artifact.getBranch().getGuid()); + fail("Artifact " + artifact.getArtId() + " has no tx_current set on " + artifact.getBranchId()); } } finally { chStmt.close(); @@ -216,15 +215,14 @@ public class ConflictDeletionTest { if (chStmt.next()) { if (deletionTransaction.equals(chStmt.getLong("transaction_id"))) { fail("Attribute " + attribute.getId() + " tx_current set on " + chStmt.getInt( - "transaction_id") + " when it should be < " + deletionTransaction + " on branch " + artifact.getBranch().getGuid()); + "transaction_id") + " when it should be < " + deletionTransaction + " on branch " + artifact.getBranchId()); } if (chStmt.next()) { fail( - "Attribute " + attribute.getId() + " has multiple tx_current set on " + artifact.getBranch().getGuid()); + "Attribute " + attribute.getId() + " has multiple tx_current set on " + artifact.getBranchId()); } } else { - fail( - "Attribute " + attribute.getId() + " has no tx_current set on " + artifact.getBranch().getGuid()); + fail("Attribute " + attribute.getId() + " has no tx_current set on " + artifact.getBranchId()); } } finally { chStmt.close(); @@ -241,15 +239,14 @@ public class ConflictDeletionTest { if (chStmt.next()) { if (deletionTransaction.equals(chStmt.getLong("transaction_id"))) { fail("Relation " + relation.getId() + " tx_current set on " + chStmt.getInt( - "transaction_id") + " when it should be < " + deletionTransaction + " on branch " + artifact.getBranch().getGuid()); + "transaction_id") + " when it should be < " + deletionTransaction + " on branch " + artifact.getBranchId()); } if (chStmt.next()) { fail( - "Relation " + relation.getId() + " has multiple tx_current set on " + artifact.getBranch().getGuid()); + "Relation " + relation.getId() + " has multiple tx_current set on " + artifact.getBranchId()); } } else { - fail( - "Relation " + relation.getId() + " has no tx_current set on " + artifact.getBranch().getGuid()); + fail("Relation " + relation.getId() + " has no tx_current set on " + artifact.getBranchId()); } } finally { chStmt.close(); @@ -318,7 +315,7 @@ public class ConflictDeletionTest { if (chStmt.next()) { fail( "Attribute " + attribute.getId() + " old Transaction < : " + artifact.getTransaction() + " is set to " + chStmt.getInt( - "tx_current") + " , should be 0 on branch " + artifact.getBranch().getGuid()); + "tx_current") + " , should be 0 on branch " + artifact.getBranchId()); } } finally { chStmt.close(); @@ -332,7 +329,7 @@ public class ConflictDeletionTest { artifact.getTransaction().equals(chStmt.getLong("transaction_id"))); } else { fail( - "Attribute " + attribute.getId() + " was not given a tx_current value of 3 when it was deleted on branch " + artifact.getBranch().getGuid()); + "Attribute " + attribute.getId() + " was not given a tx_current value of 3 when it was deleted on branch " + artifact.getBranchId()); } } finally { chStmt.close(); @@ -350,13 +347,13 @@ public class ConflictDeletionTest { if (chStmt.next()) { fail( "Relation " + relation.getId() + " old Transaction < : " + artifact.getTransaction() + " is set to " + chStmt.getInt( - "tx_current") + " , should be 0 on branch " + artifact.getBranch().getGuid()); + "tx_current") + " , should be 0 on branch " + artifact.getBranchId()); } } finally { chStmt.close(); } try { - chStmt.runPreparedQuery(CHECK_FOR_DELETED_TX_CURRENT_RELATION, artifact.getBranch().getGuid(), value, + chStmt.runPreparedQuery(CHECK_FOR_DELETED_TX_CURRENT_RELATION, artifact.getBranchId(), value, relation.getId()); if (chStmt.next()) { assertTrue( @@ -364,11 +361,11 @@ public class ConflictDeletionTest { artifact.getTransaction().isOlderThan(TransactionId.valueOf(chStmt.getLong("transaction_id")))); if (chStmt.next()) { fail( - "Relation " + relation.getId() + " has multiple tx_current values of " + value + " when it was deleted on branch " + artifact.getBranch().getGuid() + " on transaction " + artifact.getTransaction()); + "Relation " + relation.getId() + " has multiple tx_current values of " + value + " when it was deleted on branch " + artifact.getBranchId() + " on transaction " + artifact.getTransaction()); } } else { fail( - "Relation " + relation.getId() + " was not given a tx_current value of " + value + " when it was deleted on branch " + artifact.getBranch().getGuid() + " on transaction " + artifact.getTransaction()); + "Relation " + relation.getId() + " was not given a tx_current value of " + value + " when it was deleted on branch " + artifact.getBranchId() + " on transaction " + artifact.getTransaction()); } } finally { chStmt.close(); diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictIntroduceTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictIntroduceTest.java index 1f4c7ea30f5..f579245ba14 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictIntroduceTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictIntroduceTest.java @@ -12,6 +12,7 @@ package org.eclipse.osee.client.integration.tests.integration.skynet.core; import static org.eclipse.osee.client.demo.DemoChoice.OSEE_CLIENT_DEMO; import static org.eclipse.osee.framework.core.enums.DemoBranches.SAW_Bld_1; +import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; @@ -97,10 +98,10 @@ public class ConflictIntroduceTest { try { conflicts = ConflictManagerInternal.getConflictsPerBranch(sourceBranch, destinationBranch, BranchManager.getBaseTransaction(sourceBranch), new NullProgressMonitor()); + assertEquals(0, conflicts.size()); } catch (Exception ex) { fail(Lib.exceptionToString(ex)); } - assertTrue("Unexpected conflict found", conflicts.size() == 0); } @Test @@ -122,10 +123,10 @@ public class ConflictIntroduceTest { try { conflicts = ConflictManagerInternal.getConflictsPerBranch(sourceBranch, destinationBranch, BranchManager.getBaseTransaction(sourceBranch), new NullProgressMonitor()); + assertEquals(2, conflicts.size()); } catch (Exception ex) { fail(Lib.exceptionToString(ex)); } - assertTrue("Expected conflict not found", conflicts.size() == 2); } @Test @@ -146,10 +147,10 @@ public class ConflictIntroduceTest { try { conflicts = ConflictManagerInternal.getConflictsPerBranch(sourceBranch, destinationBranch, BranchManager.getBaseTransaction(sourceBranch), new NullProgressMonitor()); + assertEquals(1, conflicts.size()); } catch (Exception ex) { fail(Lib.exceptionToString(ex)); } - assertTrue("Expected conflict not found", conflicts.size() == 1); } @AfterClass diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictTest.java index 6e04e5a5e26..96f6e00dc17 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ConflictTest.java @@ -108,14 +108,14 @@ public class ConflictTest { conflicts = ConflictManagerInternal.getConflictsPerBranch(ConflictTestManager.getSourceBranch(), ConflictTestManager.getDestBranch(), ConflictTestManager.getSourceBaseTransaction(), new NullProgressMonitor()); + int expectedNumber = ConflictTestManager.numberOfConflicts(); + int actualNumber = conflicts.size(); + assertTrue( + "(Intermittent failures - needs re-write) - Number of conflicts found is not equal to the number of conflicts expected", + expectedNumber <= actualNumber && actualNumber <= expectedNumber + 1); } catch (Exception ex) { fail(Lib.exceptionToString(ex)); } - int expectedNumber = ConflictTestManager.numberOfConflicts(); - int actualNumber = conflicts.size(); - assertTrue( - "(Intermittent failures - needs re-write) - Number of conflicts found is not equal to the number of conflicts expected", - expectedNumber <= actualNumber && actualNumber <= expectedNumber + 1); assertTrue(String.format("%d SevereLogs during test.", monitorLog.getSevereLogs().size()), monitorLog.getSevereLogs().isEmpty()); } |