示例#1
0
  @org.junit.Test
  public void test04ResolveConflicts() {
    SevereLoggingMonitor monitorLog = new SevereLoggingMonitor();
    OseeLog.registerLoggerListener(monitorLog);
    try {
      Collection<Conflict> conflicts =
          ConflictManagerInternal.getConflictsPerBranch(
              ConflictTestManager.getSourceBranch(),
              ConflictTestManager.getDestBranch(),
              ConflictTestManager.getSourceBranch().getBaseTransaction(),
              new NullProgressMonitor());

      for (Conflict conflict : conflicts) {
        if (conflict instanceof AttributeConflict) {
          ConflictTestManager.resolveAttributeConflict((AttributeConflict) conflict);
          conflict.setStatus(ConflictStatus.RESOLVED);
        } else if (conflict instanceof RelationConflict) {
          fail("Relation Conflicts are not supported yet");
        }
      }

      conflicts =
          ConflictManagerInternal.getConflictsPerBranch(
              ConflictTestManager.getSourceBranch(),
              ConflictTestManager.getDestBranch(),
              ConflictTestManager.getSourceBranch().getBaseTransaction(),
              new NullProgressMonitor());

      for (Conflict conflict : conflicts) {
        ConflictStatus status = conflict.getStatus();
        assertTrue(
            "This conflict was not found to be resolved ArtId = "
                + conflict.getArtId()
                + " "
                + conflict.getSourceDisplayData(),
            status.isResolved() || status.isInformational());
      }
    } catch (Exception ex) {
      fail(Lib.exceptionToString(ex));
    }
    assertTrue(
        String.format("%d SevereLogs during test.", monitorLog.getAllLogs().size()),
        monitorLog.getAllLogs().isEmpty());
  }
示例#2
0
 /**
  * Test method for {@link
  * org.eclipse.osee.framework.skynet.core.revision.ConflictManagerInternal#getConflictsPerBranch(org.eclipse.osee.framework.core.model.Branch,
  * org.eclipse.osee.framework.core.model.Branch,
  * org.eclipse.osee.framework.skynet.core.transaction.TransactionId)} .
  */
 @org.junit.Test
 public void test02GetConflictsPerBranch() {
   SevereLoggingMonitor monitorLog = new SevereLoggingMonitor();
   OseeLog.registerLoggerListener(monitorLog);
   Collection<Conflict> conflicts = null;
   try {
     conflicts =
         ConflictManagerInternal.getConflictsPerBranch(
             ConflictTestManager.getSourceBranch(),
             ConflictTestManager.getDestBranch(),
             ConflictTestManager.getSourceBranch().getBaseTransaction(),
             new NullProgressMonitor());
   } 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());
 }