Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/StoreOutfileJob.java')
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/StoreOutfileJob.java228
1 files changed, 114 insertions, 114 deletions
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/StoreOutfileJob.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/StoreOutfileJob.java
index 1bbecc39cee..bdae93a4c19 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/StoreOutfileJob.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/jobs/StoreOutfileJob.java
@@ -38,129 +38,129 @@ import org.eclipse.osee.ote.ui.test.manager.pages.scriptTable.ScriptTask;
*/
public class StoreOutfileJob extends Job {
- private final ScriptManager userEnvironment;
- private final ScriptTask scriptTask;
- private final boolean isValidRun;
- private final TestManagerEditor testManagerEditor;
- private final ITestEnvironment env;
+ private final ScriptManager userEnvironment;
+ private final ScriptTask scriptTask;
+ private final boolean isValidRun;
+ private final TestManagerEditor testManagerEditor;
+ private final ITestEnvironment env;
- private final String clientOutfilePath;
+ private final String clientOutfilePath;
- private final String serverOutfilePath;
+ private final String serverOutfilePath;
- public StoreOutfileJob(ITestEnvironment env, TestManagerEditor testManagerEditor, ScriptManager userEnvironment, ScriptTask scriptTask, String clientOutfilePath, String serverOutfilePath, boolean isValidRun) {
- super("Store: " + scriptTask.getName());
- this.env = env;
- this.scriptTask = scriptTask;
- this.testManagerEditor = testManagerEditor;
- this.userEnvironment = userEnvironment;
- this.isValidRun = isValidRun;
- this.clientOutfilePath = clientOutfilePath;
- this.serverOutfilePath = serverOutfilePath;
- }
+ public StoreOutfileJob(ITestEnvironment env, TestManagerEditor testManagerEditor, ScriptManager userEnvironment, ScriptTask scriptTask, String clientOutfilePath, String serverOutfilePath, boolean isValidRun) {
+ super("Store: " + scriptTask.getName());
+ this.env = env;
+ this.scriptTask = scriptTask;
+ this.testManagerEditor = testManagerEditor;
+ this.userEnvironment = userEnvironment;
+ this.isValidRun = isValidRun;
+ this.clientOutfilePath = clientOutfilePath;
+ this.serverOutfilePath = serverOutfilePath;
+ }
- public static void scheduleJob(Job job) {
- job.setUser(false);
- job.setPriority(Job.SHORT);
- job.schedule();
- }
+ public static void scheduleJob(Job job) {
+ job.setUser(false);
+ job.setPriority(Job.SHORT);
+ job.schedule();
+ }
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- if (isValidRun == true) {
- try {
- storeOutfile(scriptTask);
- } catch (Exception e) {
- return new Status(Status.ERROR, TestManagerPlugin.PLUGIN_ID, "Failed to write out file to workspace", e);
- }
- }
- // scriptTask.computeExists();
- userEnvironment.updateScriptTableViewer(scriptTask);
- try {
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- processOutFile(scriptTask);
- } catch (Exception ex) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, ex);
- }
- return Status.OK_STATUS;
- }
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ if (isValidRun == true) {
+ try {
+ storeOutfile(scriptTask);
+ } catch (Exception e) {
+ return new Status(IStatus.ERROR, TestManagerPlugin.PLUGIN_ID, "Failed to write out file to workspace", e);
+ }
+ }
+ // scriptTask.computeExists();
+ userEnvironment.updateScriptTableViewer(scriptTask);
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ processOutFile(scriptTask);
+ } catch (Exception ex) {
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE, ex);
+ }
+ return Status.OK_STATUS;
+ }
- public void processOutFile(ScriptTask task) {
- OseeLog.log(TestManagerPlugin.class, Level.INFO, "Processing Outfile: " + task.getName());
- // task.computeExists();
- File xmlSourceFile = task.getScriptModel().getOutputModel().getFile();
- IFile javaSourceIFile = task.getScriptModel().getIFile();
+ public void processOutFile(ScriptTask task) {
+ OseeLog.log(TestManagerPlugin.class, Level.INFO, "Processing Outfile: " + task.getName());
+ // task.computeExists();
+ File xmlSourceFile = task.getScriptModel().getOutputModel().getFile();
+ IFile javaSourceIFile = task.getScriptModel().getIFile();
- if (!xmlSourceFile.exists()) {
- TestManagerPlugin.getInstance().getOteConsoleService().writeError("Output File Not Created");
- } else {
- // Refresh the parent so the workspace knows the new tmo file exists
- AWorkspace.refreshResource(javaSourceIFile);
- task.getScriptModel().getOutputModel().updateTestPointsFromOutfile();
- int failedPoints = task.getScriptModel().getOutputModel().getFailedTestPoints();
- userEnvironment.updateScriptTableViewer(scriptTask);
- if (failedPoints > 0) {
- // Print fails in red, but don't force the console to popup
- TestManagerPlugin.getInstance().getOteConsoleService().write(
- String.format("Test Point Failures => %s[%d]", task.getName(), failedPoints),
- OseeConsole.CONSOLE_ERROR, false);
- }
- }
- }
+ if (!xmlSourceFile.exists()) {
+ TestManagerPlugin.getInstance().getOteConsoleService().writeError("Output File Not Created");
+ } else {
+ // Refresh the parent so the workspace knows the new tmo file exists
+ AWorkspace.refreshResource(javaSourceIFile);
+ task.getScriptModel().getOutputModel().updateTestPointsFromOutfile();
+ int failedPoints = task.getScriptModel().getOutputModel().getFailedTestPoints();
+ userEnvironment.updateScriptTableViewer(scriptTask);
+ if (failedPoints > 0) {
+ // Print fails in red, but don't force the console to popup
+ TestManagerPlugin.getInstance().getOteConsoleService().write(
+ String.format("Test Point Failures => %s[%d]", task.getName(), failedPoints), OseeConsole.CONSOLE_ERROR,
+ false);
+ }
+ }
+ }
- private boolean isKeepSavedOutfileEnabled() {
- return testManagerEditor.getPropertyStore().getBoolean(TestManagerStorageKeys.KEEP_OLD_OUTFILE_COPIES_ENABLED_KEY);
- }
+ private boolean isKeepSavedOutfileEnabled() {
+ return testManagerEditor.getPropertyStore().getBoolean(TestManagerStorageKeys.KEEP_OLD_OUTFILE_COPIES_ENABLED_KEY);
+ }
- private void storeOutfile(ScriptTask scriptTask) throws Exception {
- if (clientOutfilePath.equals(serverOutfilePath) != true) {
- // the paths are different so we need to copy the file
- byte[] outBytes = env.getScriptOutfile(serverOutfilePath);
- if (outBytes != null && outBytes.length > 0) {
+ private void storeOutfile(ScriptTask scriptTask) throws Exception {
+ if (clientOutfilePath.equals(serverOutfilePath) != true) {
+ // the paths are different so we need to copy the file
+ byte[] outBytes = env.getScriptOutfile(serverOutfilePath);
+ if (outBytes != null && outBytes.length > 0) {
- if (isKeepSavedOutfileEnabled()) {
- moveOutputToNextAvailableSpot(scriptTask);
- }
- // else {
- // task.getScriptModel().getOutputModel().getIFile().delete(true, null);
- // }
- IFile file = AIFile.constructIFile(clientOutfilePath);
- if (file != null) {
- AIFile.writeToFile(file, new ByteArrayInputStream(outBytes));
- MarkerPlugin.getDefault().addMarkers(file);
- } else {
- Lib.writeBytesToFile(outBytes, new File(clientOutfilePath));
- }
- }
- }
- }
+ if (isKeepSavedOutfileEnabled()) {
+ moveOutputToNextAvailableSpot(scriptTask);
+ }
+ // else {
+ // task.getScriptModel().getOutputModel().getIFile().delete(true, null);
+ // }
+ IFile file = AIFile.constructIFile(clientOutfilePath);
+ if (file != null) {
+ AIFile.writeToFile(file, new ByteArrayInputStream(outBytes));
+ MarkerPlugin.getDefault().addMarkers(file);
+ } else {
+ Lib.writeBytesToFile(outBytes, new File(clientOutfilePath));
+ }
+ }
+ }
+ }
- private void moveOutputToNextAvailableSpot(ScriptTask task) {
- OutputModel outputModel = task.getScriptModel().getOutputModel();
- File oldFile = outputModel.getFile();
- if (oldFile != null && oldFile.exists() && oldFile.isFile() && oldFile.canRead()) {
- String outputExtension = "." + outputModel.getFileExtension();
- int fileNum = 1;
- File destFile =
- new File(oldFile.getAbsoluteFile().toString().replaceFirst(outputExtension,
- "." + fileNum + outputExtension));
- if (destFile.exists()) {
- while (destFile.exists()) {
- fileNum++;
- destFile =
- new File(oldFile.getAbsoluteFile().toString().replaceFirst(outputExtension,
- "." + fileNum + outputExtension));
- }
- }
- try {
- Lib.copyFile(oldFile, destFile);
- } catch (IOException e2) {
- OseeLog.log(TestManagerPlugin.class, Level.SEVERE, "Failed to move output file to next available spot", e2);
- }
- }
- }
+ private void moveOutputToNextAvailableSpot(ScriptTask task) {
+ OutputModel outputModel = task.getScriptModel().getOutputModel();
+ File oldFile = outputModel.getFile();
+ if (oldFile != null && oldFile.exists() && oldFile.isFile() && oldFile.canRead()) {
+ String outputExtension = "." + outputModel.getFileExtension();
+ int fileNum = 1;
+ File destFile =
+ new File(
+ oldFile.getAbsoluteFile().toString().replaceFirst(outputExtension, "." + fileNum + outputExtension));
+ if (destFile.exists()) {
+ while (destFile.exists()) {
+ fileNum++;
+ destFile =
+ new File(oldFile.getAbsoluteFile().toString().replaceFirst(outputExtension,
+ "." + fileNum + outputExtension));
+ }
+ }
+ try {
+ Lib.copyFile(oldFile, destFile);
+ } catch (IOException e2) {
+ OseeLog.log(TestManagerPlugin.class, Level.SEVERE, "Failed to move output file to next available spot", e2);
+ }
+ }
+ }
} \ No newline at end of file

Back to the top