Exemple #1
0
  @Ignore
  public void test05CommitWithoutResolutionErrors() {
    SevereLoggingMonitor monitorLog = new SevereLoggingMonitor();
    OseeLog.registerLoggerListener(monitorLog);
    try {
      ConflictManagerExternal conflictManager =
          new ConflictManagerExternal(
              ConflictTestManager.getDestBranch(), ConflictTestManager.getSourceBranch());
      BranchManager.commitBranch(null, conflictManager, false, false);
      assertTrue("Commit did not complete as expected", ConflictTestManager.validateCommit());

      assertEquals(
          "Source Branch state incorrect",
          BranchState.COMMITTED,
          ConflictTestManager.getSourceBranch().getBranchState());

    } catch (Exception ex) {
      fail(
          "No Exceptions should have been thrown. Not even the "
              + ex.getLocalizedMessage()
              + "Exception");
    }

    assertTrue(
        String.format("%d SevereLogs during test.", monitorLog.getSevereLogs().size()),
        monitorLog.getSevereLogs().isEmpty());
  }
Exemple #2
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());
  }
Exemple #3
0
  /**
   * Test method for {@link
   * org.eclipse.osee.framework.skynet.core.artifact.BranchManager#getMergeBranch(Branch, Branch)} .
   */
  @org.junit.Test
  public void test01GetMergeBranchNotCreated() throws Exception {
    SevereLoggingMonitor monitorLog = new SevereLoggingMonitor();
    OseeLog.registerLoggerListener(monitorLog);
    try {
      Branch mergeBranch =
          BranchManager.getMergeBranch(
              ConflictTestManager.getSourceBranch(), ConflictTestManager.getDestBranch());

      assertTrue(
          "The merge branch should be null as it hasn't been created yet", mergeBranch == null);
    } catch (Exception ex) {
      fail(ex.getMessage());
    }
    assertTrue(
        String.format("%d SevereLogs during test.", monitorLog.getSevereLogs().size()),
        monitorLog.getSevereLogs().isEmpty());
  }
Exemple #4
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());
 }
Exemple #5
0
  /**
   * Test method for {@link
   * org.eclipse.osee.framework.skynet.core.artifact.BranchManager#getMergeBranch(Branch, Branch)} .
   */
  @org.junit.Test
  public void test03GetMergeBranchCreated() throws Exception {
    SevereLoggingMonitor monitorLog = new SevereLoggingMonitor();
    OseeLog.registerLoggerListener(monitorLog);
    try {
      Branch mergeBranch =
          BranchManager.getMergeBranch(
              ConflictTestManager.getSourceBranch(), ConflictTestManager.getDestBranch());
      assertFalse(mergeBranch == null);
      Collection<Artifact> artifacts =
          ArtifactQuery.getArtifactListFromBranch(mergeBranch, INCLUDE_DELETED);

      int expectedNumber = ConflictTestManager.numberOfArtifactsOnMergeBranch();
      int actualNumber = artifacts.size();
      assertTrue(
          "(Intermittent failures - needs re-write) - The merge Branch does not contain the expected number of artifacts: ",
          (expectedNumber <= actualNumber) && (actualNumber <= (expectedNumber + 1)));
    } catch (Exception ex) {
      fail(ex.getMessage());
    }
    assertTrue(
        String.format("%d SevereLogs during test.", monitorLog.getAllLogs().size()),
        monitorLog.getAllLogs().isEmpty());
  }