Exemplo n.º 1
0
  @Override
  protected void restoreWidgetValues() {
    super.restoreWidgetValues();
    IDialogSettings settings = getDialogSettings();
    if (settings != null) {
      if (getDefaultSourceFile() == null) {
        directoryFileSelector.setDirectorySelected(settings.getBoolean("isDirectory"));
        String file = settings.get("source.file");
        if (Strings.isValid(file)) {
          directoryFileSelector.setText(file);
        }
      }

      String parser = settings.get("selected.parser");
      if (Strings.isValid(parser)) {
        for (IArtifactExtractor item : importContributionManager.getExtractors()) {
          if (parser.equals(item.getClass().getSimpleName())) {
            parserSelectPanel.setArtifactExtractor(item);
          }
        }
      }
      if (getDefaultDestinationArtifact() == null) {
        String guid = settings.get("destination.artifact.guid");
        String branchUuidStr = settings.get("destination.branch.uuid");

        if (GUID.isValid(guid) && Strings.isNumeric(branchUuidStr)) {
          try {
            Long bramchUuid = Long.valueOf(branchUuidStr);
            Artifact artifact =
                ArtifactQuery.getArtifactFromId(guid, BranchManager.getBranchByUuid(bramchUuid));
            artifactSelectPanel.setDefaultItem(artifact);
          } catch (OseeCoreException ex) {
            OseeLog.logf(
                Activator.class,
                Level.SEVERE,
                "Unable to restore destination artifact- guid:[%s] branch uuid:[%d]",
                guid,
                branchUuidStr);
          }
        }
      }

      boolean toUpdate = settings.getBoolean("is.update.existing.selected");
      updateExistingArtifacts.setSelection(toUpdate);
      deleteUnmatchedArtifacts.setEnabled(toUpdate);
      if (toUpdate) {
        try {
          ArtifactType artType = ArtifactTypeManager.getType(getArtifactType());
          attributeTypeSelectPanel.setAllowedAttributeTypes(
              artType.getAttributeTypes(getDestinationArtifact().getFullBranch()));
        } catch (OseeCoreException ex) {
          OseeLog.log(Activator.class, Level.SEVERE, ex);
        }
      } else {
        attributeTypeSelectPanel.setAllowedAttributeTypes(new ArrayList<IAttributeType>());
      }
    }
  }
Exemplo n.º 2
0
  @Override
  public boolean handleAltLeftClick(TreeColumn treeColumn, TreeItem treeItem) {
    try {
      if (treeItem.getData() instanceof Artifact) {
        Artifact useArt = (Artifact) treeItem.getData();
        if (useArt.isOfType(AtsArtifactTypes.Action)) {
          if (ActionManager.getTeams(useArt).size() == 1) {
            useArt = ActionManager.getFirstTeam(useArt);
          } else {
            return false;
          }
        }
        if (!(useArt instanceof AbstractWorkflowArtifact)) {
          return false;
        }
        AbstractWorkflowArtifact awa = (AbstractWorkflowArtifact) useArt;
        boolean modified = promptChangeAssignees(Arrays.asList(awa), isPersistViewer());
        XViewer xViewer = ((XViewerColumn) treeColumn.getData()).getTreeViewer();
        if (modified && isPersistViewer(xViewer)) {
          AtsChangeSet.execute("persist assignees via alt-left-click", awa);
        }
        if (modified) {
          xViewer.update(awa, null);
          return true;
        }
      }
    } catch (OseeCoreException ex) {
      OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
    }

    return false;
  }
 @Override
 public void dispose() {
   scriptTable.dispose();
   testManagerEditor.storeValue(testManagerEditor.scriptsQualName, scriptTable.getStorageString());
   OseeLog.log(TestManagerPlugin.class, Level.INFO, "ScriptPage Dispose Called");
   super.dispose();
 }
Exemplo n.º 4
0
  @Override
  public ISubscriptionState onMessageDbFound(AbstractMessageDataBase msgDB) {
    try {
      DataType requestedType = getMemType();
      if (requestedType == null && getSubscription().getRequestedDataType() != null) {
        instance =
            msgDB.acquireInstance(
                msgClassName, getMode(), getSubscription().getRequestedDataType());
      } else {
        instance = msgDB.acquireInstance(msgClassName, getMode(), requestedType);
      }

      this.type = instance.getType();
      getSubscription().notifyResolved();
      return new InactiveState(instance, msgDB, this);
    } catch (Exception e) {
      // Yes we do need to log this
      OseeLog.log(
          UnresolvedState.class,
          Level.SEVERE,
          "problems acquring instance for " + getMsgClassName());
      getSubscription().notifyInvalidated();
      return this;
    }
  }
Exemplo n.º 5
0
 public static IOseeBranch getAtsBranch() {
   synchronized (lock) {
     if (atsBranch == null) {
       // Preference store overrides all
       if (AtsPreferencesService.isAvailable()) {
         try {
           String atsBranchUuid = AtsPreferencesService.get(ATS_BRANCH_UUID);
           setConfig(atsBranchUuid, AtsPreferencesService.get(ATS_BRANCH_NAME));
         } catch (Exception ex) {
           OseeLog.log(AtsUtilCore.class, Level.SEVERE, "Error processing stored ATS Branch.", ex);
         }
       }
       // osee.ini -D option overrides default
       if (atsBranch == null) {
         String atsBranchUuid = System.getProperty(ATS_BRANCH_UUID);
         if (Strings.isValid(atsBranchUuid)) {
           setConfig(atsBranchUuid, System.getProperty(ATS_BRANCH_NAME));
         }
       }
       // default is always common
       if (atsBranch == null) {
         atsBranch = CoreBranches.COMMON;
         atsConfigName = CoreBranches.COMMON.getName();
       }
     }
   }
   return atsBranch;
 }
Exemplo n.º 6
0
 @Override
 public IAtsVersion getTargetedVersionByTeamWf(IAtsTeamWorkflow teamWf) throws OseeCoreException {
   IAtsVersion version = versionCache.getVersion(teamWf);
   if (version == null) {
     if (getArtifact(teamWf)
             .getRelatedArtifactsCount(AtsRelationTypes.TeamWorkflowTargetedForVersion_Version)
         > 0) {
       List<Artifact> verArts =
           getArtifact(teamWf)
               .getRelatedArtifacts(AtsRelationTypes.TeamWorkflowTargetedForVersion_Version);
       if (verArts.size() > 1) {
         OseeLog.log(
             Activator.class,
             Level.SEVERE,
             "Multiple targeted versions for artifact " + teamWf.toStringWithId());
         version =
             cacheProvider
                 .get()
                 .getSoleByGuid(verArts.iterator().next().getGuid(), IAtsVersion.class);
       } else {
         version =
             cacheProvider
                 .get()
                 .getSoleByGuid(verArts.iterator().next().getGuid(), IAtsVersion.class);
       }
       versionCache.cache(teamWf, version);
     }
   }
   return version;
 }
Exemplo n.º 7
0
  private static String[] constructChoices(
      final ConflictManagerExternal conflictManager, boolean allConflictsResolved) {
    String[] choices;
    boolean isAdmin = false;
    try {
      if (AccessControlManager.isOseeAdmin()) {
        isAdmin = true;
      }
    } catch (OseeCoreException ex) {
      isAdmin = false;
      OseeLog.log(Activator.class, Level.SEVERE, ex.toString(), ex);
    }

    if (allConflictsResolved) {
      choices = new String[] {"Commit", "Launch Merge Manager", "Delete Merge", "Cancel"};
    } else {
      if (isAdmin) {
        choices =
            new String[] {
              "Launch Merge Manager", "Delete Merge", "Cancel", "Force Commit (Admin Only)"
            };
      } else {
        choices = new String[] {"Launch Merge Manager", "Delete Merge", "Cancel"};
      }
    }
    return choices;
  }
  private void createStatusWindow(Composite parent) {
    statusWindow = new StatusWindowWidget(parent);

    statusWindow.setLabelAndValue(
        UpdateableLabel.HOSTLABEL.name(),
        "Selected Host",
        NOT_CONNECTED,
        SWT.BOLD,
        SWT.COLOR_DARK_RED);

    String selectedFile = testManagerEditor.loadValue(testManagerEditor.configFileName);
    if (!Strings.isValid(selectedFile)) {
      selectedFile = testManagerEditor.getDefaultConfigPath();
      testManagerEditor.storeValue(testManagerEditor.configFileName, selectedFile);
    }
    OseeLog.log(TestManagerPlugin.class, Level.INFO, "The default config is: " + selectedFile);

    statusWindow.setLabelAndValue(
        UpdateableLabel.CONFIGPATHLABEL.name(), "Config File Path", selectedFile);

    saveWidget.setStatusLabel(statusWindow);
    loadWidget.setStatusLabel(statusWindow);

    // // Status ICON Labels
    // connectStatusIconLabel = new
    // Label(statusWindow.getStatusIconComposite(), SWT.NONE);
    // hostWidget.setConnectStatusLabel(connectStatusIconLabel);
    // connectStatusIconLabel.setVisible(false);

    statusWindow.refresh();
  }
Exemplo n.º 9
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());
  }
 @Override
 public ArtifactData nativeToJava(TransferData transferData) {
   /**
    * The resource serialization format is: (int) number of artifacts Then, the following for each
    * resource: (int) artID (int) tagID
    */
   byte[] bytes = (byte[]) super.nativeToJava(transferData);
   if (bytes == null) {
     return null;
   }
   DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));
   try {
     int count = in.readInt();
     Artifact[] artifacts = new Artifact[count];
     for (int i = 0; i < count; i++) {
       artifacts[i] = readArtifact(in);
     }
     int urlLength = in.readInt();
     int sourceLength = in.readInt();
     String url = "";
     for (int x = 0; x < urlLength; x++) {
       url += in.readChar();
     }
     String source = "";
     for (int x = 0; x < sourceLength; x++) {
       source += in.readChar();
     }
     return new ArtifactData(artifacts, url, source);
   } catch (Exception ex) {
     OseeLog.log(Activator.class, Level.SEVERE, ex);
     return null;
   }
 }
Exemplo n.º 11
0
  @Override
  public boolean handleAltLeftClick(TreeColumn treeColumn, TreeItem treeItem) {
    try {
      if (treeItem.getData() instanceof Artifact) {
        Artifact useArt = (Artifact) treeItem.getData();
        if (!(useArt.isOfType(AtsArtifactTypes.AbstractWorkflowArtifact))) {
          return false;
        }

        boolean modified = promptChangeSprint(useArt, isPersistViewer());

        XViewer xViewer = ((XViewerColumn) treeColumn.getData()).getTreeViewer();
        if (modified && isPersistViewer(xViewer)) {
          useArt.persist("persist sprints via alt-left-click");
        }
        if (modified) {
          xViewer.update(useArt, null);
          return true;
        }
      }
    } catch (OseeCoreException ex) {
      OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
    }

    return false;
  }
Exemplo n.º 12
0
 private void setUserBooleanSetting(String settingKey, Button button) {
   try {
     UserManager.setSetting(settingKey, String.valueOf(button.getSelection()));
   } catch (OseeCoreException ex) {
     OseeLog.log(Activator.class, Level.SEVERE, ex);
   }
 }
Exemplo n.º 13
0
 private boolean getUserBooleanSetting(String settingKey) {
   try {
     return UserManager.getBooleanSetting(settingKey);
   } catch (OseeCoreException ex) {
     OseeLog.log(Activator.class, Level.SEVERE, ex);
     return false;
   }
 }
  /** Create the TableViewer */
  private void okSelected() {
    ArrayList<ArtifactModel> artifactList =
        relationTableViewer.getArtifactList().getArtifactModel();

    for (int i = 0; i < artifactList.size(); i++) {
      ArtifactModel model = artifactList.get(i);

      if (model.isAdd()) {
        Artifact artifact = model.getArtifact();
        descriptor = model.getDescriptor();
        if (artifact == null) {
          if (descriptor != null) {
            try {
              artifact = ArtifactTypeManager.addArtifact(descriptor, branch);
              artifact.setName(model.getName());
              artifact.setSoleAttributeValue(
                  CoreAttributeTypes.ContentUrl, urls.get(names.indexOf(model.getName())));
              artifact.persist(getClass().getSimpleName());
            } catch (Exception ex) {
              OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
            }
          }
        } else {
          artifact = model.getArtifact();
        }

        if (artifact != null) {
          try {
            relationGroup.getArtifact().addRelation(relationGroup, artifact);
          } catch (OseeCoreException ex) {
            OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
          }
        }
      }
    }
    if (persistOnOk) {
      try {
        relationGroup.getArtifact().persist(getClass().getSimpleName());
      } catch (OseeCoreException ex) {
        OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
      }
    }
    shell.dispose();
    viewer.refresh();
  }
Exemplo n.º 15
0
 public static boolean promptChangeAttribute(
     IAttributeType attributeType,
     final Collection<? extends Artifact> artifacts,
     boolean persist,
     boolean multiLine) {
   boolean result = false;
   ArtifactPrompt prompt = getArtifactPrompt();
   if (prompt != null) {
     try {
       result = prompt.promptChangeAttribute(attributeType, artifacts, persist, multiLine);
     } catch (Exception ex) {
       OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
     }
   } else {
     OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, "Artifact prompt was null");
   }
   return result;
 }
 public static void sleep(long milliseconds) {
   try {
     System.out.println("Sleeping " + milliseconds);
     Thread.sleep(milliseconds);
     System.out.println("Awake");
   } catch (Exception ex) {
     OseeLog.log(Activator.class, Level.SEVERE, ex);
   }
 }
 public static String getValidateReviewFollowupUsersStr(TeamWorkFlowArtifact teamArt) {
   try {
     return org.eclipse.osee.ats.core.client.internal.user.UsersByIds.getStorageString(
         getValidateReviewFollowupUsers(teamArt));
   } catch (Exception ex) {
     OseeLog.log(Activator.class, Level.SEVERE, ex);
     return ex.getLocalizedMessage();
   }
 }
 public static void addDatabaseSourceId(IMemento memento) {
   if (memento != null) {
     try {
       memento.putString(MEMENTO_SOURCE_GUID, OseeInfo.getDatabaseGuid());
     } catch (OseeCoreException ex) {
       OseeLog.log(Activator.class, Level.WARNING, "Unable to set memento source db guid");
     }
   }
 }
  public SMAEstimatedHoursHeader(
      Composite parent, int style, final AbstractWorkflowArtifact sma, final SMAEditor editor) {
    super(parent, style);
    this.awa = sma;
    setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
    setLayout(ALayout.getZeroMarginLayout(2, false));
    editor.getToolkit().adapt(this);

    try {
      if (!sma.isCancelled() && !sma.isCompleted()) {
        Hyperlink link = editor.getToolkit().createHyperlink(this, LABEL, SWT.NONE);
        link.addHyperlinkListener(
            new IHyperlinkListener() {

              @Override
              public void linkEntered(HyperlinkEvent e) {
                // do nothing
              }

              @Override
              public void linkExited(HyperlinkEvent e) {
                // do nothing
              }

              @Override
              public void linkActivated(HyperlinkEvent e) {
                try {
                  if (editor.isDirty()) {
                    editor.doSave(null);
                  }
                  PromptChangeUtil.promptChangeAttribute(
                      sma, AtsAttributeTypes.EstimatedHours, true, false);
                } catch (Exception ex) {
                  OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
                }
              }
            });
      } else {
        Label origLabel = editor.getToolkit().createLabel(this, LABEL);
        origLabel.setLayoutData(new GridData());
      }

      valueLabel = editor.getToolkit().createLabel(this, "0.0");
      valueLabel.setToolTipText(getToolTip());
      valueLabel.setLayoutData(new GridData());
      updateLabel(sma);

    } catch (OseeCoreException ex) {
      Label errorLabel =
          editor.getToolkit().createLabel(this, "Error: " + ex.getLocalizedMessage());
      errorLabel.setForeground(Displays.getSystemColor(SWT.COLOR_RED));
      OseeLog.log(Activator.class, Level.SEVERE, ex);
    }
  }
Exemplo n.º 20
0
 public static Image getCoverageItemUserImage(ICoverage coverageItem) {
   try {
     if (coverageItem.isAssignable() && Strings.isValid(coverageItem.getAssignees())) {
       return FrameworkArtifactImageProvider.getUserImage(
           UsersByIds.getUsers(coverageItem.getAssignees()));
     }
   } catch (OseeCoreException ex) {
     OseeLog.log(Activator.class, Level.SEVERE, ex);
   }
   return null;
 }
Exemplo n.º 21
0
 @Override
 public boolean performOk() {
   setUserBooleanSetting(IDENTFY_IMAGE_CHANGES, identifyImageChangesInWord);
   setUserBooleanSetting(MUTI_EDIT_SAVE_ALL_CHANGES, saveAllChanges);
   setUserBooleanSetting(IGNORE_FIELD_CODE_CHANGES, ignoreFieldCodes);
   try {
     UserManager.getUser().persist(getClass().getSimpleName());
   } catch (OseeCoreException ex) {
     OseeLog.log(Activator.class, Level.SEVERE, ex);
   }
   return super.performOk();
 }
Exemplo n.º 22
0
 @Override
 public byte[] find(String path) throws IOException {
   try {
     File bundleFile = new File(rootFolder, path);
     if (bundleFile.exists()) {
       return Lib.inputStreamToBytes(new FileInputStream(bundleFile));
     }
   } catch (Exception ex) {
     OseeLog.logf(getClass(), Level.SEVERE, "Error trying to read: [%s]", path);
   }
   return null;
 }
Exemplo n.º 23
0
  @Override
  public void run(TableLoadOption... tableLoadOptions) throws OseeCoreException {

    List<Artifact> activeTeams = new LinkedList<>();
    for (Artifact agTeam :
        ArtifactQuery.getArtifactListFromType(
            AtsArtifactTypes.AgileTeam, AtsUtilCore.getAtsBranch())) {
      if (agTeam.getSoleAttributeValue(AtsAttributeTypes.Active, true)) {
        activeTeams.add(agTeam);
      }
    }
    FilteredTreeArtifactDialog dialog =
        new FilteredTreeArtifactDialog(
            getName(),
            "Select Agile Team",
            activeTeams,
            new ArtifactTreeContentProvider(),
            new ArtifactLabelProvider());
    if (dialog.open() == 0) {

      EntryDialog ed =
          new EntryDialog(getName(), "Enter new Agile Sprint name(s) (comma delimited)");
      if (ed.open() == 0) {
        if (Strings.isValid(ed.getEntry())) {
          try {
            AgileEndpointApi ageilEp = AtsClientService.getAgileEndpoint();
            JaxNewAgileSprint newSprint = new JaxNewAgileSprint();
            int teamUuid = ((Artifact) dialog.getSelectedFirst()).getArtId();
            for (String name : ed.getEntry().split(",")) {
              newSprint.setName(name);
              newSprint.setTeamUuid(teamUuid);
              Response response = ageilEp.createSprint(new Long(teamUuid), newSprint);
              JaxAgileSprint sprint = response.readEntity(JaxAgileSprint.class);
              if (sprint != null) {
                long uuid = sprint.getUuid();
                Artifact sprintArt =
                    ArtifactQuery.getArtifactFromId(
                        new Long(uuid).intValue(), AtsUtilCore.getAtsBranch());
                sprintArt.getParent().reloadAttributesAndRelations();
                AtsUtil.openArtifact(sprintArt.getGuid(), OseeCmEditor.CmPcrEditor);
              } else {
                AWorkbench.popup("Error creating Agile Team [%s]", response.toString());
                return;
              }
            }
          } catch (Exception ex) {
            OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
          }
        }
      }
    }
  }
Exemplo n.º 24
0
 @Override
 public void handleColumnMultiEdit(TreeColumn treeColumn, Collection<TreeItem> treeItems) {
   try {
     Set<AbstractWorkflowArtifact> awas = new HashSet<>();
     for (TreeItem item : treeItems) {
       Artifact art = (Artifact) item.getData();
       if (art instanceof AbstractWorkflowArtifact) {
         awas.add((AbstractWorkflowArtifact) art);
       }
     }
     promptChangeSprint(awas, true);
     return;
   } catch (OseeCoreException ex) {
     OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
   }
 }
Exemplo n.º 25
0
  private synchronized void updateExtractedElements() {
    selectionLatch.setCurrentValues(getDestinationArtifact(), getSourceFile(), getArtifactParser());
    if (selectionLatch.areSelectionsValid()) {
      selectionLatch.latch();

      collector.reset();

      final Artifact destinationArtifact = selectionLatch.currentSelected.destinationArtifact;
      final File sourceFile = selectionLatch.currentSelected.sourceFile;
      final IArtifactExtractor extractor = selectionLatch.currentSelected.extractor;

      operationReportMessages.setLength(0);

      IOperation op =
          ArtifactImportOperationFactory.createArtifactsCompOperation(
              "Extracting data from source",
              sourceFile,
              destinationArtifact,
              new OperationLogger() {
                @Override
                public void log(String... row) {
                  for (String warningMessage : row) {
                    operationReportMessages.append(warningMessage);
                  }
                };
              },
              extractor,
              collector,
              selectedArtifactTypes,
              true);

      selectedArtifactTypes.clear();

      if (executeOperation(op)) {
        artifactTypeSelectPanel.setAllowedArtifactTypes(selectedArtifactTypes);
        try {
          if (getArtifactType() != null) {
            ArtifactType specificArtifactType = ArtifactTypeManager.getType(getArtifactType());
            attributeTypeSelectPanel.setAllowedAttributeTypes(
                specificArtifactType.getAttributeTypes(getDestinationArtifact().getFullBranch()));
          }
        } catch (Exception ex) {
          OseeLog.log(Activator.class, Level.SEVERE, ex);
        }
      }
    }
  }
Exemplo n.º 26
0
 @Override
 public void process(
     Object message, Map<String, Object> headers, ReplyConnection replyConnection) {
   if (message instanceof byte[]) {
     OteEventMessage msg = new OteEventMessage((byte[]) message);
     UUID id = OteEventMessageUtil.getUUID(msg);
     if (!id.equals(MYID)) {
       OteEventMessageUtil.setUUID(msg, MYID);
       Map<String, Object> data = new HashMap<>();
       data.put(OteEventMessageUtil.BYTE_KEY, msg.getData());
       Event newevent = new Event(msg.getHeader().TOPIC.getValue(), data);
       eventAdmin.sendEvent(newevent);
     }
   } else {
     OseeLog.log(
         EventToJmsComponent.class, Level.SEVERE, "not a recognized message" + message.getClass());
   }
 }
 public static boolean isSourceValid(IMemento memento) throws OseeCoreException {
   boolean result = false;
   if (memento != null) {
     String dbId = memento.getString(MEMENTO_SOURCE_GUID);
     if (Strings.isValid(dbId)) {
       String currentDbId = null;
       try {
         currentDbId = OseeInfo.getDatabaseGuid();
       } catch (OseeDataStoreException ex) {
         OseeLog.log(Activator.class, Level.WARNING, "Unable to set memento source db guid");
       }
       if (dbId.equals(currentDbId)) {
         result = true;
       }
     }
   }
   return result;
 }
Exemplo n.º 28
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());
  }
 public static IStatus runIt(
     IProgressMonitor monitor,
     String jobName,
     Collection<TeamWorkFlowArtifact> teamArts,
     IAttributeType attributeType) {
   XResultData rd = new XResultData();
   try {
     if (teamArts.isEmpty()) {
       throw new OseeStateException("No Actions/Workflows Specified");
     }
     retrieveData(monitor, teamArts, attributeType, rd);
     if (rd.toString().equals("")) {
       rd.log("No Problems Found");
     }
     final String html =
         XResultDataUI.getReport(rd, jobName)
             .getManipulatedHtml(Arrays.asList(Manipulations.NONE));
     final String title = jobName;
     Displays.pendInDisplayThread(
         new Runnable() {
           @Override
           public void run() {
             Result result = new HtmlExportTable(title, html, true, false).exportCsv();
             if (result.isFalse()) {
               AWorkbench.popup(result);
               return;
             }
             AWorkbench.popup(
                 title,
                 "Completed "
                     + title
                     + "\n\nFile saved to "
                     + System.getProperty("user.home")
                     + File.separator
                     + "table.csv");
           }
         });
     monitor.done();
     return Status.OK_STATUS;
   } catch (Exception ex) {
     OseeLog.log(Activator.class, Level.SEVERE, ex);
     return new Status(IStatus.ERROR, Activator.PLUGIN_ID, -1, "Failed", ex);
   }
 }
Exemplo n.º 30
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());
  }