@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()); }
/** * 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()); }