private void runDestinationTestEnd(String ttNum) throws OseeCoreException { String title = getName() + " - Destination Client Test - End"; String actionTitle = "tt " + ttNum; resultData.log("Running " + title); Artifact actionArt = ArtifactQuery.getArtifactFromTypeAndName( AtsArtifactTypes.Action, actionTitle, AtsUtil.getAtsBranch()); if (actionArt == null) { resultData.logError(String.format("Couldn't load Action named [%s]", actionTitle)); } else { resultData.log("Loaded Action " + actionArt); AtsUtil.openATSAction(actionArt, AtsOpenOption.OpenOneOrPopupSelect); } validateActionAtEnd(actionArt); XResultDataUI.report(resultData, title); }
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); } }
@Override protected void doWork(IProgressMonitor monitor) throws Exception { data.validate(); data.getResultData().log(getName() + "\n"); monitor.worked(calculateWork(0.20)); try { AtsChangeSet changes = new AtsChangeSet(getName()); // Import Work Definition sheets data.getResultData().log("Importing Work Definitions"); Artifact folder = getWorkDefinitionFolder(); Set<String> stateNames = new HashSet<String>(); AtsWorkDefinitionSheetProviders.importWorkDefinitionSheets( data.getResultData(), changes, folder, data.getWorkDefSheets(), stateNames); monitor.worked(calculateWork(0.30)); data.getResultData().log("Importing Work Definitions...Complete"); // Import AI and Team sheets data.getResultData().log("Importing AIs and Teams"); for (WorkDefinitionSheet sheet : data.getTeamsAiSheets()) { AtsWorkDefinitionSheetProviders.importAIsAndTeamsToDb(sheet, changes); } monitor.worked(calculateWork(0.40)); // Perform specialized configuration code (eg set extra attributes, create branches, etc) data.performPostConfig(changes, data); if (data.getResultData().isErrors()) { String errorStr = "Errors found, not persisting. May need to restart your OSEE"; data.getResultData().log(errorStr); AWorkbench.popup(errorStr); } else { changes.execute(); } } catch (Exception ex) { data.getResultData().logError("Exception " + ex.getLocalizedMessage()); } XResultDataUI.report(data.getResultData(), getName()); monitor.worked(calculateWork(0.10)); }
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); }