Beispiel #1
0
  private Branch getPortBranchFromWorkflow(
      TeamWorkFlowArtifact sourceWorkflow, TeamWorkFlowArtifact destinationWorkflow)
      throws OseeCoreException {
    if (!sourceWorkflow.isRelated(AtsRelationTypes.Port_To, destinationWorkflow)) {
      sourceWorkflow.addRelation(AtsRelationTypes.Port_To, destinationWorkflow);
      sourceWorkflow.persist("create port relation");
    }

    Collection<Branch> branches =
        BranchManager.getBranchesByName(
            String.format("Porting [%s] branch", sourceWorkflow.getAtsId()));

    if (branches.isEmpty()) {
      TransactionRecord transRecord =
          (TransactionRecord)
              AtsClientService.get().getBranchService().getEarliestTransactionId(sourceWorkflow);
      if (transRecord == null) {
        return null;
      } else {
        return BranchManager.createWorkingBranchFromTx(
            transRecord, String.format("Porting [%s] branch", sourceWorkflow.getAtsId()), null);
      }
    } else {
      return branches.iterator().next();
    }
  }
 private void makeChanges1(TeamWorkFlowArtifact teamArt) throws OseeCoreException {
   // Make changes and persist
   teamArt.setSoleAttributeFromString(AtsAttributeTypes.Description, "description 2");
   ChangeTypeUtil.setChangeType(teamArt, ChangeType.Problem);
   teamArt.setSoleAttributeFromString(AtsAttributeTypes.PriorityType, "2");
   teamArt.setSoleAttributeFromString(AtsAttributeTypes.ValidationRequired, "true");
   AtsVersionService.get().setTargetedVersionAndStore(teamArt, getVersion256());
   teamArt.persist("Remote Event Test");
 }
 private void makeChanges4(TeamWorkFlowArtifact teamArt) throws OseeCoreException {
   // Make changes and persist
   teamArt.deleteAttributes(AtsAttributeTypes.ValidationRequired);
   teamArt.deleteAttributes(AtsAttributeTypes.Resolution);
   teamArt.setSoleAttributeFromString(AtsAttributeTypes.Description, "description 4");
   ChangeTypeUtil.setChangeType(teamArt, ChangeType.Support);
   teamArt.setSoleAttributeFromString(AtsAttributeTypes.PriorityType, "3");
   AtsVersionService.get().setTargetedVersionAndStore(teamArt, getVersion258());
   teamArt.persist("Remote Event Test");
 }
 private void makeChanges2(TeamWorkFlowArtifact teamArt) throws OseeCoreException {
   // Make changes and persist
   teamArt.setSoleAttributeFromString(AtsAttributeTypes.Description, "description 3");
   teamArt.setSoleAttributeFromString(AtsAttributeTypes.ProposedResolution, "this is resolution");
   teamArt.persist(getClass().getSimpleName());
 }
 private void makeChanges3(TeamWorkFlowArtifact teamArt) throws OseeCoreException {
   // Make changes and persist
   AtsVersionService.get().setTargetedVersionAndStore(teamArt, getVersion257());
   teamArt.setSoleAttributeFromString(AtsAttributeTypes.ValidationRequired, "false");
   teamArt.persist(getClass().getSimpleName());
 }
 private void makeChanges5(TeamWorkFlowArtifact teamArt) throws OseeCoreException {
   // Make changes and persist
   teamArt.setSoleAttributeFromString(AtsAttributeTypes.ValidationRequired, "true");
   teamArt.persist(getClass().getSimpleName());
 }
 private void makeChanges6(TeamWorkFlowArtifact teamArt) throws OseeCoreException {
   // Make changes and transition
   AtsVersionService.get().setTargetedVersionAndStore(teamArt, getVersion257());
   teamArt.setSoleAttributeFromString(AtsAttributeTypes.ValidationRequired, "false");
   teamArt.persist("Remote Event Test");
 }
  private void runClientTest() throws OseeCoreException {
    String title = getName() + " - Destination Client Test";
    resultData.log("Running " + title);
    NewActionJob job = null;
    job =
        new NewActionJob(
            "tt",
            "description",
            ChangeType.Improvement,
            "1",
            null,
            false,
            getActionableItemsByToken(Arrays.asList(atsActionableItem)),
            null,
            null);
    job.setUser(true);
    job.setPriority(Job.LONG);
    job.schedule();
    try {
      job.join();
    } catch (InterruptedException ex) {
      OseeLog.log(Activator.class, Level.SEVERE, ex);
    }

    Artifact actionArt = job.getActionArt();
    resultData.log("Created Action " + actionArt);
    TeamWorkFlowArtifact teamArt = ActionManager.getFirstTeam(actionArt);

    // Make current user assignee for convenience to developer
    teamArt.getStateMgr().addAssignee(AtsClientService.get().getUserAdmin().getCurrentUser());
    teamArt.persist(getClass().getSimpleName());

    validateActionAtStart(actionArt);

    // Wait for destination client to start
    if (!MessageDialog.openConfirm(
        Displays.getActiveShell(),
        getName(),
        "Launch \"Destination Client - Start\" test, enter \""
            + actionArt.getName().replaceFirst("tt ", "")
            + "\" and press Ok")) {
      return;
    }

    int sleepTime = 250;
    makeChanges1(teamArt);
    sleep(sleepTime);
    makeChanges2(teamArt);
    sleep(sleepTime);
    makeChanges3(teamArt);
    sleep(sleepTime);
    makeChanges4(teamArt);
    sleep(sleepTime);
    makeChanges5(teamArt);
    sleep(sleepTime);
    makeChanges6(teamArt);
    sleep(sleepTime);
    makeChanges7(teamArt);
    sleep(sleepTime);

    validateActionAtEnd(actionArt);

    // Wait for destination client to end
    if (!MessageDialog.openConfirm(
        Displays.getActiveShell(),
        getName(),
        "Launch \"Destination Client - End\" test, enter \""
            + actionArt.getName().replaceFirst("tt ", "")
            + "\" and press Ok")) {
      return;
    }

    XResultDataUI.report(resultData, title);
  }