diff options
author | rescobar | 2010-03-12 18:27:25 +0000 |
---|---|---|
committer | rescobar | 2010-03-12 18:27:25 +0000 |
commit | 205aa057fa925d37a3a5375aa8418b9567e99c6d (patch) | |
tree | d33f80b9f727c479b8031aeb352494c38ad9878d /plugins/org.eclipse.osee.ote.define | |
parent | 0e6d2b595cfb4d54eccdf3479e7c5d74d9c736a5 (diff) | |
download | org.eclipse.osee-205aa057fa925d37a3a5375aa8418b9567e99c6d.tar.gz org.eclipse.osee-205aa057fa925d37a3a5375aa8418b9567e99c6d.tar.xz org.eclipse.osee-205aa057fa925d37a3a5375aa8418b9567e99c6d.zip |
Diffstat (limited to 'plugins/org.eclipse.osee.ote.define')
44 files changed, 3019 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.ote.define/.classpath b/plugins/org.eclipse.osee.ote.define/.classpath new file mode 100644 index 00000000000..8a8f1668cdc --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.ote.define/.project b/plugins/org.eclipse.osee.ote.define/.project new file mode 100644 index 00000000000..f8c827e1150 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/.project @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.ote.define</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.core.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.xtext.ui.core.xtextNature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.ote.define/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.osee.ote.define/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 00000000000..4a4a6b87f3a --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Mon Jan 18 14:30:30 MST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/plugins/org.eclipse.osee.ote.define/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.ote.define/META-INF/MANIFEST.MF new file mode 100644 index 00000000000..1ea73ddf306 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/META-INF/MANIFEST.MF @@ -0,0 +1,33 @@ +Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: OTE Define Plug-in (Incubation)
+Bundle-SymbolicName: org.eclipse.osee.ote.define;singleton:=true
+Bundle-Version: 0.9.2.qualifier
+Bundle-Activator: org.eclipse.osee.ote.define.OteDefinePlugin
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.core.filebuffers,
+ org.eclipse.core.filesystem,
+ org.eclipse.osee.framework.jdk.core,
+ org.eclipse.osee.framework.plugin.core,
+ org.eclipse.osee.framework.ui.plugin,
+ org.eclipse.osee.framework.skynet.core
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.osee.ote.define,
+ org.eclipse.osee.ote.define.AUTOGEN,
+ org.eclipse.osee.ote.define.artifacts,
+ org.eclipse.osee.ote.define.jobs,
+ org.eclipse.osee.ote.define.operations,
+ org.eclipse.osee.ote.define.parser,
+ org.eclipse.osee.ote.define.parser.handlers,
+ org.eclipse.osee.ote.define.utilities
+Bundle-Vendor: Eclipse.org
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: org.apache.commons.lang;version="2.4.0",
+ org.eclipse.osee.framework.core.data,
+ org.eclipse.osee.framework.core.enums,
+ org.eclipse.osee.framework.core.exception,
+ org.eclipse.osee.framework.core.model,
+ org.eclipse.osee.framework.core.util,
+ org.eclipse.osee.framework.logging
diff --git a/plugins/org.eclipse.osee.ote.define/build.properties b/plugins/org.eclipse.osee.ote.define/build.properties new file mode 100644 index 00000000000..87d235ce811 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/build.properties @@ -0,0 +1,7 @@ +source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ images/,\
+ support/
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.define/plugin.xml b/plugins/org.eclipse.osee.ote.define/plugin.xml new file mode 100644 index 00000000000..1641a6c6d27 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/plugin.xml @@ -0,0 +1,29 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="OutfileParser" name="OutfileParser" schema="schema/OutfileParser.exsd"/>
+ <extension
+ id="OseeTypesOTE"
+ name="OseeTypesOTE"
+ point="org.eclipse.osee.framework.skynet.core.OseeTypes">
+ <OseeTypes
+ resource="support/OseeTypes_OTE.osee">
+ </OseeTypes>
+ </extension>
+ <extension
+ id="OteOutfileParser"
+ point="org.eclipse.osee.ote.define.OutfileParser">
+ <OutfileParser
+ classname="org.eclipse.osee.ote.define.parser.OteOutfileParser"
+ supportedExtensions="tmo">
+ </OutfileParser>
+ </extension>
+ <extension
+ id="MappedAttributeDataProvider"
+ name="name"
+ point="org.eclipse.osee.framework.skynet.core.AttributeDataProvider">
+ <BinaryAttributeDataProvider
+ class="org.eclipse.osee.ote.define.MappedAttributeDataProviderOld">
+ </BinaryAttributeDataProvider>
+ </extension>
+</plugin>
diff --git a/plugins/org.eclipse.osee.ote.define/schema/OutfileParser.exsd b/plugins/org.eclipse.osee.ote.define/schema/OutfileParser.exsd new file mode 100644 index 00000000000..7b3076cf9b1 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/schema/OutfileParser.exsd @@ -0,0 +1,109 @@ +<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.osee.ote.define" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.osee.ote.define" id="OutfileParser" name="OutfileParser"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="OutfileParser"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="OutfileParser">
+ <complexType>
+ <attribute name="classname" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.osee.ote.define.parser.BaseOutfileParser:"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="supportedExtensions" type="string" use="required">
+ <annotation>
+ <documentation>
+ Can be a list separated by ";"
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/AUTOGEN/OteArtifactTypes.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/AUTOGEN/OteArtifactTypes.java new file mode 100644 index 00000000000..aee1d396fd7 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/AUTOGEN/OteArtifactTypes.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.AUTOGEN; + +import org.eclipse.osee.framework.core.data.IArtifactType; +import org.eclipse.osee.framework.core.data.NamedIdentity; +import org.eclipse.osee.framework.skynet.core.utility.Requirements; + +public class OteArtifactTypes extends NamedIdentity implements IArtifactType { + public static final OteArtifactTypes TEST_RUN = new OteArtifactTypes("AAMFDjqDHWo+orlSpaQA", Requirements.TEST_RUN); + public static final OteArtifactTypes TEST_SCRIPT = + new OteArtifactTypes("AAMFDikEi0TGK27TKPgA", Requirements.TEST_CASE); + + private OteArtifactTypes(String guid, String name) { + super(guid, name); + } +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/AUTOGEN/OteAttributeTypes.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/AUTOGEN/OteAttributeTypes.java new file mode 100644 index 00000000000..fc87c99a2e1 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/AUTOGEN/OteAttributeTypes.java @@ -0,0 +1,61 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.AUTOGEN; + +import org.eclipse.osee.framework.core.data.IAttributeType; +import org.eclipse.osee.framework.core.data.NamedIdentity; + +public class OteAttributeTypes extends NamedIdentity implements IAttributeType { + public static final OteAttributeTypes BUILD_ID = new OteAttributeTypes("AAMFEXG6_W9diA9nUXAA", "Build Id"); + public static final OteAttributeTypes CHECKSUM = new OteAttributeTypes("AAMFEXJbaHt5uKG9kogA", "Checksum"); + public static final OteAttributeTypes ELAPSED_DATE = new OteAttributeTypes("AAMFEWuD6yH04y89M3wA", "Elapsed Date"); + public static final OteAttributeTypes END_DATE = new OteAttributeTypes("AAMFEWryxym0P9FFckgA", "End Date"); + public static final OteAttributeTypes EXTENSION = new OteAttributeTypes("AAMFEcUbJEERZTnwJzAA", "Extension"); + public static final OteAttributeTypes FAILED = new OteAttributeTypes("AAMFEWynSU+XeRG7nRAA", "Failed"); + public static final OteAttributeTypes IS_BATCH_MODE_ALLOWED = + new OteAttributeTypes("AAMFEW+CcA6F5GEjsSgA", "Is Batch Mode Allowed"); + public static final OteAttributeTypes LAST_AUTHOR = new OteAttributeTypes("AAMFEWE83iPq3+2DGrQA", "Last Author"); + public static final OteAttributeTypes LAST_DATE_UPLOADED = + new OteAttributeTypes("AAMFEXCm5ju5gvq142QA", "Last Date Uploaded"); + public static final OteAttributeTypes LAST_MODIFIED_DATE = + new OteAttributeTypes("AAMFEWHw7V1uWv4IKcQA", "Last Modified Date"); + public static final OteAttributeTypes MODIFIED_FLAG = new OteAttributeTypes("AAMFEWCruiS26nCN68wA", "Modified Flag"); + public static final OteAttributeTypes OSEE_SERVER_JAR_VERSION = + new OteAttributeTypes("AAMFEWV1OQtXL67OfOQA", "OSEE Server Jar Version"); + public static final OteAttributeTypes OSEE_SERVER_TITLE = + new OteAttributeTypes("AAMFEWTnXGYRfdzY3gAA", "OSEE Server Title"); + public static final OteAttributeTypes OSEE_VERSION = new OteAttributeTypes("AAMFEWQ_TTkstJvjnGQA", "OSEE Version"); + public static final OteAttributeTypes OS_ARCHITECTURE = + new OteAttributeTypes("AAMFEWKJtG+Jc8OkRYgA", "OS Architecture"); + public static final OteAttributeTypes OS_NAME = new OteAttributeTypes("AAMFEWMdBmP9aCgsysgA", "OS Name"); + public static final OteAttributeTypes OS_VERSION = new OteAttributeTypes("AAMFEWOvQWV6JJvh9NQA", "OS Version"); + public static final OteAttributeTypes OUTFILE_URL = new OteAttributeTypes("AAMFEVlyBndUvySg+gwA", "Outfile URL"); + public static final OteAttributeTypes PASSED = new OteAttributeTypes("AAMFEWwT92IzQp6Dh3gA", "Passed"); + public static final OteAttributeTypes PROCESSOR_ID = new OteAttributeTypes("AAMFEWYOAGkplo4RjTQA", "Processor ID"); + public static final OteAttributeTypes QUALIFICATION_LEVEL = + new OteAttributeTypes("AAMFEXEvTztOWwoGyRAA", "Qualification Level"); + public static final OteAttributeTypes RAN_IN_BATCH_MODE = + new OteAttributeTypes("AAMFEW7uBlg0KLp8mhQA", "Ran In Batch Mode"); + public static final OteAttributeTypes REVISION = new OteAttributeTypes("AAMFEWAal2I3j7EJligA", "Revision"); + public static final OteAttributeTypes SCRIPT_ABORTED = + new OteAttributeTypes("AAMFEW3M12AqHsCve4AA", "Script Aborted"); + public static final OteAttributeTypes START_DATE = new OteAttributeTypes("AAMFEWpeXjfr2W5ZT5QA", "Start Date"); + public static final OteAttributeTypes TEST_SCRIPT_GUID = + new OteAttributeTypes("AAMFEW5fEhinpcjeZ0wA", "Test Script GUID"); + public static final OteAttributeTypes TEST_SCRIPT_URL = + new OteAttributeTypes("AAMFEVn0+mhxtCuACgAA", "Test Script URL"); + public static final OteAttributeTypes TOTAL_TEST_POINTS = + new OteAttributeTypes("AAMFEW05hBfECFGfZkgA", "Total Test Points"); + + private OteAttributeTypes(String guid, String name) { + super(guid, name); + } +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/AUTOGEN/OteRelationTypes.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/AUTOGEN/OteRelationTypes.java new file mode 100644 index 00000000000..dbb103edd8e --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/AUTOGEN/OteRelationTypes.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.AUTOGEN; + +import org.eclipse.osee.framework.core.data.NamedIdentity; +import org.eclipse.osee.framework.core.enums.IRelationEnumeration; +import org.eclipse.osee.framework.core.enums.RelationSide; + +public class OteRelationTypes extends NamedIdentity implements IRelationEnumeration { + public static final OteRelationTypes TEST_SCRIPT_TO_RUN_RELATION__TEST_SCRIPT = + new OteRelationTypes(RelationSide.SIDE_A, "AAMFE+jMyBDK7CV479wA", "Test Case to Run Relation"); + public static final OteRelationTypes TEST_SCRIPT_TO_RUN_RELATION__TEST_RUN = + new OteRelationTypes(RelationSide.SIDE_B, "AAMFE+jMyBDK7CV479wA", "Test Case to Run Relation"); + private final RelationSide relationSide; + + private OteRelationTypes(RelationSide relationSide, String guid, String name) { + super(guid, name); + this.relationSide = relationSide; + } + + @Override + public RelationSide getSide() { + return relationSide; + } +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/MappedAttributeDataProviderOld.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/MappedAttributeDataProviderOld.java new file mode 100644 index 00000000000..22be34c4572 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/MappedAttributeDataProviderOld.java @@ -0,0 +1,16 @@ +/** + * + */ +package org.eclipse.osee.ote.define; + +import org.eclipse.osee.framework.skynet.core.artifact.Attribute; +import org.eclipse.osee.framework.skynet.core.attribute.providers.MappedAttributeDataProvider; + +/** + * @author Ryan D. Brooks + */ +public class MappedAttributeDataProviderOld extends MappedAttributeDataProvider { + public MappedAttributeDataProviderOld(Attribute<?> attribute) { + super(attribute); + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/OteDefinePlugin.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/OteDefinePlugin.java new file mode 100644 index 00000000000..64131fe8e45 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/OteDefinePlugin.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define;
+
+import org.eclipse.osee.framework.ui.plugin.OseeUiActivator; +import org.osgi.framework.BundleContext; +
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class OteDefinePlugin extends OseeUiActivator {
+ public static final String PLUGIN_ID = "org.eclipse.osee.ote.define";
+
+ public OteDefinePlugin() {
+ }
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/TestRunField.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/TestRunField.java new file mode 100644 index 00000000000..9361baa078d --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/TestRunField.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define; + +/** + * @author Roberto E. Escobar + */ +public enum TestRunField { + + INVALID, + USER_ID, + USER_NAME, + SCRIPT_NAME, + + SCRIPT_REVISION, + SCRIPT_MODIFIED_FLAG, + SCRIPT_LAST_AUTHOR, + SCRIPT_LAST_MODIFIED, + SCRIPT_URL, + + SYSTEM_OS_ARCH, + SYSTEM_OS_NAME, + SYSTEM_OS_VERSION, + SYSTEM_OSEE_VERSION, + SYSTEM_OSEE_SERVER_TITLE, + SYSTEM_OSEE_SERVER_JAR_VERSIONS, + + PROCESSOR_ID, + SCRIPT_START_DATE, + SCRIPT_END_DATE, + SCRIPT_ELAPSED_TIME, + SCRIPT_EXECUTION_TIME, + SCRIPT_EXECUTION_RESULTS, + SCRIPT_EXECUTION_ERRORS, + + TEST_POINTS_PASSED, + TEST_POINTS_FAILED, + TOTAL_TEST_POINTS, + TEST_ABORT_STATUS, + + QUALIFICATION_LEVEL, + BUILD_ID, + + IS_BATCH_MODE_ALLOWED, + RAN_IN_BATCH_MODE; +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/OteArtifactFetcher.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/OteArtifactFetcher.java new file mode 100644 index 00000000000..790a337df40 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/OteArtifactFetcher.java @@ -0,0 +1,117 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.artifacts; + +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.logging.Level; +import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist; +import org.eclipse.osee.framework.core.exception.MultipleArtifactsExist; +import org.eclipse.osee.framework.core.exception.OseeArgumentException; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.model.Branch; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager; +import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactQuery; +import org.eclipse.osee.ote.define.OteDefinePlugin; +import org.eclipse.osee.ote.define.AUTOGEN.OteArtifactTypes; + +/** + * @author Roberto E. Escobar + */ +public class OteArtifactFetcher<T extends Artifact> { + private final OteArtifactTypes oteArtifactType; + + protected OteArtifactFetcher(OteArtifactTypes oteArtifactType) { + this.oteArtifactType = oteArtifactType; + } + + /** + * Creates a new Artifact in the specified branch + * + * @param branch + * @throws OseeCoreException + */ + @SuppressWarnings("unchecked") + public T getNewArtifact(Branch branch) throws OseeCoreException { + checkForNull(branch); + return (T) ArtifactTypeManager.addArtifact(oteArtifactType.getName(), branch); + } + + /** + * Retrieves a unique artifact matching input parameter + * + * @param typeName Attribute type name + * @param value attribute value to match + * @param branch to search in + * @return the unique artifact + * @throws MultipleArtifactsExist + * @throws ArtifactDoesNotExist + */ + @SuppressWarnings("unchecked") + public T searchForUniqueArtifactMatching(String attributeTypeName, String attributeValue, Branch branch) throws OseeCoreException { + checkForNull(attributeTypeName); + checkForNull(attributeValue); + checkForNull(branch); + return (T) ArtifactQuery.getArtifactFromTypeAndAttribute(oteArtifactType.getName(), attributeTypeName, + attributeValue, branch); + } + + /** + * Returns all artifact instances found in branch matching the type <b>T</b> + * + * @param branch to search in + * @return artifact instances + * @throws OseeArgumentException + */ + @SuppressWarnings("unchecked") + public Set<T> getAllArtifacts(Branch branch) throws OseeArgumentException { + checkForNull(branch); + Set<T> toReturn = new HashSet<T>(); + try { + Collection<Artifact> artifacts = ArtifactQuery.getArtifactListFromType(oteArtifactType.getName(), branch); + for (Artifact artifact : artifacts) { + toReturn.add((T) artifact); + } + } catch (OseeCoreException ex) { + OseeLog.log(OteDefinePlugin.class, Level.WARNING, String.format("Search for all artifacts failed [%s, %s]", + oteArtifactType.getName(), branch.getName()), ex); + } + return toReturn; + } + + /** + * Returns all artifact instances found in branch matching the type <b>T</b> Results are indexed by artifact + * descriptive name. + * + * @param branch to search in + * @return artifact instances indexed by descriptive name + * @throws OseeArgumentException + */ + public Map<String, T> getAllArtifactsIndexedByName(Branch branch) throws OseeArgumentException { + Map<String, T> toReturn = new HashMap<String, T>(); + Set<T> testScripts = getAllArtifacts(branch); + for (T artifact : testScripts) { + toReturn.put(artifact.getName(), artifact); + } + return toReturn; + } + + private void checkForNull(Object object) throws OseeArgumentException { + if (object == null) { + throw new OseeArgumentException("Object was null"); + } + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/OteToAttributeMap.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/OteToAttributeMap.java new file mode 100644 index 00000000000..6e871eed6c0 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/OteToAttributeMap.java @@ -0,0 +1,137 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.artifacts; + +import java.text.SimpleDateFormat; +import java.util.HashMap; +import java.util.Map; +import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; +import org.eclipse.osee.framework.jdk.core.util.Strings; +import org.eclipse.osee.ote.define.TestRunField; +import org.eclipse.osee.ote.define.AUTOGEN.OteAttributeTypes; + +/** + * @author Roberto E. Escobar + */ +public class OteToAttributeMap { + private static final SimpleDateFormat scriptStartEndDataFormat = new SimpleDateFormat("E MMM dd HH:mm:ss z yyyy"); + private static final SimpleDateFormat lastModifiedFormat = new SimpleDateFormat("MMM dd, yyyy HH:mm:ss a"); + + private static OteToAttributeMap instance = null; + private static Map<TestRunField, String> outfileFieldToAttributeMap; + + private OteToAttributeMap() { + outfileFieldToAttributeMap = new HashMap<TestRunField, String>(); + + outfileFieldToAttributeMap.put(TestRunField.USER_ID, CoreAttributeTypes.USER_ID.getName()); + + outfileFieldToAttributeMap.put(TestRunField.SCRIPT_REVISION, OteAttributeTypes.REVISION.getName()); + outfileFieldToAttributeMap.put(TestRunField.SCRIPT_MODIFIED_FLAG, OteAttributeTypes.MODIFIED_FLAG.getName()); + outfileFieldToAttributeMap.put(TestRunField.SCRIPT_LAST_AUTHOR, OteAttributeTypes.LAST_AUTHOR.getName()); + outfileFieldToAttributeMap.put(TestRunField.SCRIPT_LAST_MODIFIED, OteAttributeTypes.LAST_MODIFIED_DATE.getName()); + outfileFieldToAttributeMap.put(TestRunField.SCRIPT_URL, OteAttributeTypes.TEST_SCRIPT_URL.getName()); + + outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OS_ARCH, OteAttributeTypes.OS_ARCHITECTURE.getName()); + outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OS_NAME, OteAttributeTypes.OS_NAME.getName()); + outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OS_VERSION, OteAttributeTypes.OS_VERSION.getName()); + outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OSEE_VERSION, OteAttributeTypes.OSEE_VERSION.getName()); + outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OSEE_SERVER_TITLE, OteAttributeTypes.OSEE_SERVER_TITLE.getName()); + outfileFieldToAttributeMap.put(TestRunField.SYSTEM_OSEE_SERVER_JAR_VERSIONS, + OteAttributeTypes.OSEE_SERVER_JAR_VERSION.getName()); + + outfileFieldToAttributeMap.put(TestRunField.PROCESSOR_ID, OteAttributeTypes.PROCESSOR_ID.getName()); + outfileFieldToAttributeMap.put(TestRunField.SCRIPT_START_DATE, OteAttributeTypes.START_DATE.getName()); + outfileFieldToAttributeMap.put(TestRunField.SCRIPT_END_DATE, OteAttributeTypes.END_DATE.getName()); + outfileFieldToAttributeMap.put(TestRunField.SCRIPT_ELAPSED_TIME, OteAttributeTypes.ELAPSED_DATE.getName()); + + outfileFieldToAttributeMap.put(TestRunField.TEST_POINTS_PASSED, OteAttributeTypes.PASSED.getName()); + outfileFieldToAttributeMap.put(TestRunField.TEST_POINTS_FAILED, OteAttributeTypes.FAILED.getName()); + outfileFieldToAttributeMap.put(TestRunField.TOTAL_TEST_POINTS, OteAttributeTypes.TOTAL_TEST_POINTS.getName()); + outfileFieldToAttributeMap.put(TestRunField.TEST_ABORT_STATUS, OteAttributeTypes.SCRIPT_ABORTED.getName()); + + outfileFieldToAttributeMap.put(TestRunField.QUALIFICATION_LEVEL, OteAttributeTypes.QUALIFICATION_LEVEL.getName()); + + outfileFieldToAttributeMap.put(TestRunField.BUILD_ID, OteAttributeTypes.BUILD_ID.getName()); + + outfileFieldToAttributeMap.put(TestRunField.IS_BATCH_MODE_ALLOWED, OteAttributeTypes.IS_BATCH_MODE_ALLOWED.getName()); + outfileFieldToAttributeMap.put(TestRunField.RAN_IN_BATCH_MODE, OteAttributeTypes.RAN_IN_BATCH_MODE.getName()); + + // outfileFieldToAttributeMap.put(TestRunField.SCRIPT_EXECUTION_TIME, + // OTE_SKYNET_ATTRIBUTES.EgetName()); + // outfileFieldToAttributeMap.put(TestRunField.SCRIPT_EXECUTION_RESULTS, + // OTE_SKYNET_ATTRIBUTES.getName()); + // outfileFieldToAttributeMap.put(TestRunField.SCRIPT_EXECUTION_ERRORS, + // OTE_SKYNET_ATTRIBUTES.getName()); + } + + public static OteToAttributeMap getInstance() { + if (instance == null) { + instance = new OteToAttributeMap(); + } + return instance; + } + + public String getAttributeName(String rawName) { + TestRunField field = getFieldId(rawName); + return outfileFieldToAttributeMap.get(field); + } + + private TestRunField getFieldId(String name) { + TestRunField field = TestRunField.INVALID; + try { + field = TestRunField.valueOf(name); + } catch (Exception ex) { + field = TestRunField.INVALID; + } + return field; + } + + public Object asTypedObject(String attribute, String value) throws Exception { + Object toReturn = null; + if (isDate(attribute) != false) { + toReturn = getFormat(attribute).parse(value); + } else if (isInteger(attribute) != false) { + if (Strings.isValid(value) != true) { + value = "0"; + } + toReturn = new Integer(value); + } else if (isBoolean(attribute) != false) { + if (Strings.isValid(value) != true) { + value = "false"; + } + toReturn = new Boolean(value); + } else { + toReturn = value; + } + return toReturn; + } + + private SimpleDateFormat getFormat(String attribute) { + SimpleDateFormat toReturn = scriptStartEndDataFormat; + if (attribute.equals(OteAttributeTypes.LAST_MODIFIED_DATE.getName())) { + toReturn = lastModifiedFormat; + } + return toReturn; + } + + private boolean isDate(String attribute) { + return attribute.equals(OteAttributeTypes.LAST_MODIFIED_DATE.getName()) || attribute.equals(OteAttributeTypes.START_DATE.getName()) || attribute.equals(OteAttributeTypes.END_DATE.getName()); + } + + private boolean isInteger(String attribute) { + return attribute.equals(OteAttributeTypes.TOTAL_TEST_POINTS.getName()) || attribute.equals(OteAttributeTypes.PASSED.getName()) || attribute.equals(OteAttributeTypes.FAILED.getName()); + } + + private boolean isBoolean(String attribute) { + return attribute.equals(OteAttributeTypes.SCRIPT_ABORTED.getName()) || attribute.equals(OteAttributeTypes.RAN_IN_BATCH_MODE.getName()) || attribute.equals(OteAttributeTypes.IS_BATCH_MODE_ALLOWED.getName()); + } + +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/TestRunOperator.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/TestRunOperator.java new file mode 100644 index 00000000000..fde3d6b7519 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/artifacts/TestRunOperator.java @@ -0,0 +1,317 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ + +package org.eclipse.osee.ote.define.artifacts; + +import java.io.InputStream; +import java.net.URI; +import java.util.Date; +import java.util.List; +import org.eclipse.osee.framework.core.exception.AttributeDoesNotExist; +import org.eclipse.osee.framework.core.exception.OseeArgumentException; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeExceptions; +import org.eclipse.osee.framework.core.model.Branch; +import org.eclipse.osee.framework.jdk.core.util.Lib; +import org.eclipse.osee.framework.jdk.core.util.Strings; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.framework.skynet.core.artifact.Attribute; +import org.eclipse.osee.framework.skynet.core.attribute.providers.IAttributeDataProvider; +import org.eclipse.osee.framework.skynet.core.attribute.providers.MappedAttributeDataProvider; +import org.eclipse.osee.ote.define.AUTOGEN.OteArtifactTypes; +import org.eclipse.osee.ote.define.AUTOGEN.OteAttributeTypes; + +/** + * @author Roberto E. Escobar + */ +public class TestRunOperator { + private static final OteArtifactFetcher<Artifact> TEST_RUN_ARTIFACT_FETCHER = + new OteArtifactFetcher<Artifact>(OteArtifactTypes.TEST_RUN); + + private static final OteArtifactFetcher<Artifact> TEST_SCRIPT_ARTIFACT_FETCHER = + new OteArtifactFetcher<Artifact>(OteArtifactTypes.TEST_SCRIPT); + + private final Artifact artifact; + + public TestRunOperator(Artifact artifact) throws OseeArgumentException { + checkForNull(artifact); + checkForType(artifact); + this.artifact = artifact; + } + + private void checkForNull(Artifact artifact) throws OseeArgumentException { + if (artifact == null) { + throw new OseeArgumentException("Artifact was null."); + } + } + + private void checkForType(Artifact artifact) throws OseeArgumentException { + try { + if (!artifact.isOfType(OteArtifactTypes.TEST_RUN.getName())) { + throw new OseeArgumentException(String.format("Unable to operate on type [%s]. Only [%s] allowed.", + artifact.getArtifactTypeName(), OteArtifactTypes.TEST_RUN.getName())); + } + } catch (OseeCoreException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static TestRunOperator getNewArtifactWithOperator(Branch branch) throws OseeCoreException { + return new TestRunOperator(TEST_RUN_ARTIFACT_FETCHER.getNewArtifact(branch)); + } + + public static OteArtifactFetcher<Artifact> getTestRunFetcher() { + return TEST_RUN_ARTIFACT_FETCHER; + } + + public static OteArtifactFetcher<Artifact> getTestScriptFetcher() { + return TEST_SCRIPT_ARTIFACT_FETCHER; + } + + public Artifact getTestRunArtifact() { + return artifact; + } + + public String getDescriptiveName() { + return artifact.getName(); + } + + public String getScriptRevision() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.REVISION.getName(), ""); + } + + public String getScriptUrl() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.TEST_SCRIPT_URL.getName(), ""); + } + + public void setLastDateUploaded(Date value) throws OseeCoreException { + artifact.setSoleAttributeValue(OteAttributeTypes.LAST_DATE_UPLOADED.getName(), value); + } + + public Date getLastDateUploaded() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.LAST_DATE_UPLOADED.getName(), null); + } + + public void setChecksum(String value) throws OseeCoreException { + artifact.setSoleAttributeValue(OteAttributeTypes.CHECKSUM.getName(), value); + } + + public String getChecksum() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.CHECKSUM.getName(), ""); + } + + public String getOutfileExtension() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.EXTENSION.getName(), ""); + } + + public void setOutfileExtension(String outfile) throws OseeCoreException { + artifact.setSoleAttributeValue(OteAttributeTypes.EXTENSION.getName(), outfile); + } + + public boolean isFromLocalWorkspace() throws OseeCoreException, AttributeDoesNotExist { + return getLastDateUploaded() == null; + } + + public void setLocalOutfileURI(String uri) throws OseeCoreException, AttributeDoesNotExist { + IAttributeDataProvider provider = getOutfileAttribute().getAttributeDataProvider(); + if (provider instanceof MappedAttributeDataProvider) { + ((MappedAttributeDataProvider) provider).setLocalUri(uri); + } + } + + public String getOutfileUrl() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.OUTFILE_URL.getName()); + } + + public String getOutfileContents() throws OseeCoreException { + String toReturn = null; + try { + toReturn = Lib.inputStreamToString(new URI(getOutfileUrl()).toURL().openStream()); + } catch (Exception ex) { + OseeExceptions.wrapAndThrow(ex); + } + return toReturn; + } + + public Attribute<InputStream> getOutfileAttribute() throws AttributeDoesNotExist, OseeCoreException { + List<Attribute<InputStream>> attributes = artifact.getAttributes(OteAttributeTypes.OUTFILE_URL.getName()); + return attributes != null && attributes.size() > 0 ? attributes.get(0) : null; + } + + public boolean isScriptRevisionValid() { + boolean toReturn = false; + try { + URI url = new URI(getScriptUrl()); + if (url != null) { + String revision = getScriptRevision(); + if (Strings.isValid(revision)) { + toReturn = true; + } + } + } catch (Exception ex) { + } + return toReturn; + } + + public boolean hasNotBeenCommitted() { + Artifact fetched = null; + try { + fetched = + getTestRunFetcher().searchForUniqueArtifactMatching(OteAttributeTypes.CHECKSUM.getName(), getChecksum(), + artifact.getBranch()); + } catch (Exception ex) { + } + return fetched == null; + } + + public boolean isCommitAllowed() { + return isScriptRevisionValid() && hasNotBeenCommitted(); + } + + public boolean hasValidArtifact() { + return artifact != null && artifact.isDeleted() != true; + } + + public void createTestScriptSoftLink() throws OseeCoreException { + Artifact testScript = + getTestScriptFetcher().searchForUniqueArtifactMatching("Name", artifact.getName(), artifact.getBranch()); + if (testScript != null) { + artifact.setSoleAttributeValue(OteAttributeTypes.TEST_SCRIPT_GUID.getName(), testScript.getGuid()); + } + } + + public String getPartition() { + String name = artifact.getName(); + String[] data = name.split("\\."); + if (data.length - 3 > 0) { + name = data[data.length - 3]; + } + return name; + } + + public String getSubsystem() { + String name = artifact.getName(); + String[] data = name.split("\\."); + if (data.length - 2 > 0) { + name = data[data.length - 2]; + } + return name; + } + + public int getTestPointsPassed() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.PASSED.getName()); + } + + public int getTestPointsFailed() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.FAILED.getName()); + } + + public int getTotalTestPoints() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.TOTAL_TEST_POINTS.getName()); + } + + public Date getEndDate() throws OseeCoreException { + return processDateAttribute(OteAttributeTypes.END_DATE); + } + + public Date getLastModifiedDate() throws OseeCoreException { + return processDateAttribute(OteAttributeTypes.LAST_MODIFIED_DATE); + } + + public Date getTestStartDate() throws OseeCoreException { + return processDateAttribute(OteAttributeTypes.START_DATE); + } + + private Date processDateAttribute(OteAttributeTypes attributeType) throws OseeCoreException { + Date date = artifact.getSoleAttributeValue(attributeType.getName(), null); + if (date == null) { + date = new Date(0); + } + return date; + } + + public boolean wasAborted() { + boolean toReturn = true; + try { + toReturn = artifact.getSoleAttributeValue(OteAttributeTypes.SCRIPT_ABORTED.getName(), false); + } catch (Exception ex) { + } + return toReturn; + } + + public String getTestResultStatus() throws OseeCoreException { + String result = "FAILED"; + if (wasAborted() != true) { + int total = getTotalTestPoints(); + if (total > 0) { + if (getTestPointsFailed() <= 0) { + int passed = getTestPointsPassed(); + if (passed == total) { + result = "PASSED"; + } + } + } + } + return result; + } + + public boolean isBatchModeAllowed() { + boolean toReturn = false; + try { + toReturn = artifact.getSoleAttributeValue(OteAttributeTypes.IS_BATCH_MODE_ALLOWED.getName(), false); + } catch (Exception ex) { + } + return toReturn; + } + + public String getOseeVersion() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.OSEE_VERSION.getName(), "").trim(); + } + + public String getOseeServerTitle() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.OSEE_SERVER_TITLE.getName(), "").trim(); + } + + public String getOseeServerVersion() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.OSEE_SERVER_JAR_VERSION.getName(), "").trim(); + } + + public String getProcessorId() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.PROCESSOR_ID.getName(), ""); + } + + public String getRunDuration() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.ELAPSED_DATE.getName(), ""); + } + + public String getQualificationLevel() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.QUALIFICATION_LEVEL.getName(), ""); + } + + public String getBuildId() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.BUILD_ID.getName(), ""); + } + + public String getRanOnOperatingSystem() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.OS_NAME.getName(), ""); + } + + public String getLastAuthor() throws OseeCoreException { + return artifact.getSoleAttributeValue(OteAttributeTypes.LAST_AUTHOR.getName(), null); + } + + public String getScriptSimpleName() { + String rawName = getDescriptiveName(); + String[] qualifiers = rawName.split("\\."); + return qualifiers[qualifiers.length - 1]; + } +}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/FindCommitableJob.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/FindCommitableJob.java new file mode 100644 index 00000000000..f3aed72f441 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/FindCommitableJob.java @@ -0,0 +1,88 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.jobs;
+
+import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.osee.framework.core.exception.OseeArgumentException; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.ote.define.OteDefinePlugin; +import org.eclipse.osee.ote.define.artifacts.TestRunOperator; +
+/**
+ * @author Roberto E. Escobar
+ */
+public class FindCommitableJob extends Job {
+
+ private static final String JOB_NAME = "Check commit allowed";
+ private Artifact[] artifactsToSort;
+ private Artifact[] itemsToCommit;
+ private Artifact[] nonCommitableItems;
+
+ public FindCommitableJob(Artifact... artifactsToSort) {
+ super(JOB_NAME);
+ setUser(true);
+ setPriority(Job.LONG);
+ this.artifactsToSort = artifactsToSort;
+ this.itemsToCommit = this.nonCommitableItems = new Artifact[0];
+ }
+
+ public Artifact[] getAll() {
+ return this.artifactsToSort;
+ }
+
+ public Artifact[] getCommitAllowed() {
+ return itemsToCommit;
+ }
+
+ public Artifact[] getCommitNotAllowed() {
+ return nonCommitableItems;
+ }
+
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ IStatus toReturn = Status.CANCEL_STATUS;
+ monitor.beginTask(getName(), artifactsToSort.length);
+ List<Artifact> commitable = new ArrayList<Artifact>();
+ List<Artifact> nonCommitable = new ArrayList<Artifact>();
+ for (Artifact artifact : artifactsToSort) {
+ try {
+ TestRunOperator operator = new TestRunOperator(artifact);
+ if (operator.isCommitAllowed() == true) {
+ commitable.add(artifact);
+ } else {
+ nonCommitable.add(artifact);
+ }
+ } catch (OseeArgumentException ex) {
+ OseeLog.log(OteDefinePlugin.class, Level.SEVERE, ex);
+ }
+
+ if (monitor.isCanceled() == true) {
+ break;
+ }
+ monitor.worked(1);
+ }
+ itemsToCommit = commitable.toArray(new Artifact[commitable.size()]);
+ nonCommitableItems = nonCommitable.toArray(new Artifact[nonCommitable.size()]);
+ if (monitor.isCanceled() != true) {
+ toReturn = Status.OK_STATUS;
+ }
+ monitor.subTask("Done");
+ monitor.done();
+ return toReturn;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/OutfileToArtifactJob.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/OutfileToArtifactJob.java new file mode 100644 index 00000000000..bf2c27741aa --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/OutfileToArtifactJob.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.jobs;
+
+import java.net.URI; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.osee.framework.core.model.Branch; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.ote.define.OteDefinePlugin; +import org.eclipse.osee.ote.define.operations.LinkTestRunToTestScriptOperation; +import org.eclipse.osee.ote.define.operations.OutfileToArtifactOperation; +
+/**
+ * @author Roberto E. Escobar
+ */
+public class OutfileToArtifactJob extends Job {
+
+ private static final String JOB_NAME = "Convert Outfile to Artifact";
+ private URI[] filesToImport;
+ private Artifact[] results;
+ private URI[] filesWithErrors;
+ private Branch branch;
+
+ public OutfileToArtifactJob(Branch branch, URI... filesToImport) {
+ super(JOB_NAME);
+ setUser(true);
+ setPriority(Job.LONG);
+ this.branch = branch;
+ this.filesToImport = filesToImport;
+ this.results = new Artifact[0];
+ this.filesWithErrors = new URI[0];
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ IStatus toReturn = Status.OK_STATUS;
+ try {
+ monitor.beginTask(getName(), filesToImport.length * 2);
+ OutfileToArtifactOperation outfileToArtifactOperation = new OutfileToArtifactOperation(branch, filesToImport);
+ outfileToArtifactOperation.execute(monitor);
+ results = outfileToArtifactOperation.getResults();
+ filesWithErrors = outfileToArtifactOperation.getUnparseableFiles();
+ if (monitor.isCanceled() != true) {
+ LinkTestRunToTestScriptOperation linkingOperation = new LinkTestRunToTestScriptOperation(results);
+ linkingOperation.execute(monitor);
+ }
+
+ } catch (Exception ex) {
+ toReturn = new Status(Status.ERROR, OteDefinePlugin.PLUGIN_ID, -1, ex.getMessage(), ex);
+ } finally {
+ monitor.subTask("Done");
+ monitor.done();
+ }
+ return toReturn;
+ }
+
+ public Artifact[] getResults() {
+ return results;
+ }
+
+ public URI[] getUnparseableFiles() {
+ return filesWithErrors;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/RemoteResourceRequestJob.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/RemoteResourceRequestJob.java new file mode 100644 index 00000000000..01e5fb7a422 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/jobs/RemoteResourceRequestJob.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.jobs;
+
+import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.osee.ote.define.OteDefinePlugin; +import org.eclipse.osee.ote.define.operations.RemoteResourceRequestOperation; +
+/**
+ * @author Roberto E. Escobar
+ */
+public class RemoteResourceRequestJob extends Job {
+ private static final String JOB_NAME = "Download Resource";
+ private String urlRequest;
+ private String targetFileName;
+ private IFile downloaded;
+
+ public RemoteResourceRequestJob(String urlRequest, String targetFileName) {
+ super(JOB_NAME);
+ this.urlRequest = urlRequest;
+ this.targetFileName = targetFileName;
+ setUser(false);
+ setPriority(Job.LONG);
+ }
+
+ public IFile getDownloadedFile() {
+ return downloaded;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ IStatus status = Status.CANCEL_STATUS;
+ try {
+ RemoteResourceRequestOperation remoteRequest =
+ new RemoteResourceRequestOperation("TEMP", urlRequest, targetFileName);
+ remoteRequest.execute(monitor);
+ downloaded = remoteRequest.getResults();
+ status = Status.OK_STATUS;
+ } catch (Exception ex) {
+ status =
+ new Status(Status.ERROR, OteDefinePlugin.PLUGIN_ID, String.format("Error downloading resource [%s]",
+ targetFileName), ex);
+ }
+ return status;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/AbstractRemoteResourceRequestTemplate.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/AbstractRemoteResourceRequestTemplate.java new file mode 100644 index 00000000000..34209045b15 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/AbstractRemoteResourceRequestTemplate.java @@ -0,0 +1,135 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.operations;
+
+import java.io.File; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.logging.Level; +import org.eclipse.core.filebuffers.manipulation.ContainerCreator; +import org.eclipse.core.filesystem.EFS; +import org.eclipse.core.filesystem.IFileStore; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IFolder; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.plugin.core.util.OseeData; +import org.eclipse.osee.ote.define.OteDefinePlugin; +
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class AbstractRemoteResourceRequestTemplate {
+ private static final int CONNECTION_TIMEOUT = 120000;
+ private static final int CONNECTION_READ_TIMEOUT = 10000;
+ private IFile remoteFile;
+ private String tempFolderName;
+ private String remoteRequestUrl;
+
+ public AbstractRemoteResourceRequestTemplate(String tempFolderName, String remoteRequestUrl) {
+ super();
+ this.tempFolderName = tempFolderName;
+ this.remoteRequestUrl = remoteRequestUrl;
+ this.remoteFile = null;
+ createTemporaryDirectory();
+ }
+
+ private void createTemporaryDirectory() {
+ try {
+ final IProject project = OseeData.getProject();
+ final IFolder folder = project.getFolder(tempFolderName + File.separator);
+ if (folder != null && folder.exists() != true) {
+ ContainerCreator containerCreator = new ContainerCreator(folder.getWorkspace(), folder.getFullPath());
+ containerCreator.createContainer(new NullProgressMonitor());
+ }
+ } catch (CoreException ex1) {
+ OseeLog.log(OteDefinePlugin.class, Level.SEVERE, ex1.toString(), ex1);
+ }
+ }
+
+ private boolean isLocalFileAvailable(IFile file) {
+ boolean found = false;
+ if (file != null) {
+ try {
+ IFileStore store = EFS.getStore(file.getLocationURI());
+ found = store.fetchInfo().exists();
+ } catch (Exception ex) {
+ OseeLog.log(OteDefinePlugin.class, Level.SEVERE, "Error retrieving file system. ", ex);
+ }
+ }
+ return found;
+ }
+
+ public IFile getResults() {
+ return remoteFile;
+ }
+
+ protected HttpURLConnection setupConnection(URL url) throws IOException {
+ HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setConnectTimeout(CONNECTION_TIMEOUT);
+ connection.setReadTimeout(CONNECTION_READ_TIMEOUT);
+ return connection;
+ }
+
+ public int getTotalWork() throws Exception {
+ return isLocalFileAvailable(getLocalStorageIFile()) != true ? 4 : 1;
+ }
+
+ private boolean isRemoteRequestNeeded() throws Exception {
+ return isLocalFileAvailable(getLocalStorageIFile()) != true;
+ }
+
+ public void execute(IProgressMonitor monitor) throws Exception {
+ if (isRemoteRequestNeeded() != false) {
+ HttpURLConnection connection = null;
+ try {
+ monitor.setTaskName(String.format("Requesting Resource: [%s]", getRemoteFileName()));
+ connection = setupConnection(new URL(remoteRequestUrl));
+ connection.connect();
+ monitor.worked(1);
+ if (monitor.isCanceled() != true) {
+ this.remoteFile = handleTransfer(monitor, connection);
+ monitor.worked(1);
+ }
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ } else {
+ this.remoteFile = getLocalStorageIFile();
+ }
+ monitor.worked(1);
+ }
+
+ protected IFile getLocalStorageIFile() throws Exception {
+ return OseeData.getIFile(getLocalStorageName());
+ }
+
+ protected String getRemoteRequestUrl() {
+ return remoteRequestUrl;
+ }
+
+ protected String getTempFolderName() {
+ return tempFolderName;
+ }
+
+ protected abstract String getLocalStorageName() throws Exception;
+
+ protected abstract String getRemoteFileName();
+
+ protected abstract IFile handleTransfer(IProgressMonitor monitor, HttpURLConnection connection) throws Exception;
+
+}
\ No newline at end of file diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/ImportOutfileOperation.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/ImportOutfileOperation.java new file mode 100644 index 00000000000..105b620b0a7 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/ImportOutfileOperation.java @@ -0,0 +1,152 @@ +/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ote.define.operations;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.osee.framework.core.exception.OseeArgumentException;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.core.model.Branch;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.utility.Artifacts;
+import org.eclipse.osee.ote.define.artifacts.TestRunOperator;
+import org.eclipse.osee.ote.define.jobs.FindCommitableJob;
+import org.eclipse.osee.ote.define.jobs.OutfileToArtifactJob;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ImportOutfileOperation {
+
+ private final URI[] fileSystemObjects;
+ private final Branch selectedBranch;
+
+ public ImportOutfileOperation(Branch selectedBranch, URI... fileSystemObjects) throws OseeCoreException {
+ checkForNull(selectedBranch);
+ checkForNull(fileSystemObjects);
+ checkForEmpty(fileSystemObjects);
+
+ this.fileSystemObjects = fileSystemObjects;
+ this.selectedBranch = selectedBranch;
+ }
+
+ private void checkSuccessful(IStatus status) throws OseeStateException {
+ if (status.equals(Status.OK_STATUS) != true && status.equals(Status.OK) != true) {
+ throw new OseeStateException(String.format("Error detected: %s", status.getMessage()));
+ }
+ }
+
+ private void checkForEmpty(Object[] items) throws OseeArgumentException {
+ if (items.length <= 0) {
+ throw new OseeArgumentException("No items to process. Size was 0.");
+ }
+ }
+
+ private void checkForNull(Object object) throws OseeArgumentException {
+ if (object == null) {
+ throw new OseeArgumentException("Object cannot be null");
+ }
+ }
+
+ public void execute(IProgressMonitor monitor) throws Exception {
+ OutfileToArtifactJob job = new OutfileToArtifactJob(selectedBranch, fileSystemObjects);
+ job.setUser(false);
+ job.schedule();
+ job.join();
+
+ checkSuccessful(job.getResult());
+
+ // Report Parse Errors
+ URI[] itemsWithError = job.getUnparseableFiles();
+ if (itemsWithError.length > 0) {
+ throw new Exception(String.format("Error parsing files [%s]", Arrays.deepToString(itemsWithError)));
+ } else {
+ launchFindCommitableJob(monitor, "", job.getResults());
+ }
+ }
+
+ private void launchFindCommitableJob(IProgressMonitor monitor, String commitComment, final Artifact[] artifacts) throws Exception {
+ // Find Commit Allowed
+ FindCommitableJob job = new FindCommitableJob(artifacts);
+ job.setUser(false);
+ job.schedule();
+ job.join();
+
+ checkSuccessful(job.getResult());
+
+ Artifact[] notAllowed = job.getCommitNotAllowed();
+ if (notAllowed.length > 0) {
+ throw new IllegalArgumentException(String.format("Some items are not commitable. [%s]", toString(notAllowed)));
+ }
+ commitSelectedArtifacts(monitor, commitComment, job.getCommitAllowed());
+ }
+
+ private String toString(Artifact[] artifacts) {
+ List<String> toReturn = new ArrayList<String>();
+ for (Artifact artifact : artifacts) {
+ toReturn.add(artifact.getName());
+ }
+ return org.eclipse.osee.framework.jdk.core.util.Collections.toString(toReturn, ",\n");
+ }
+
+ private void commitSelectedArtifacts(IProgressMonitor monitor, String commitComment, Object[] items) throws Exception {
+ Map<Branch, List<Artifact>> commitMap = getArtifactsByBranch(items);
+ for (Branch branch : commitMap.keySet()) {
+ monitor.setTaskName(String.format("Committing Artifacts into Branch: [%s]", branch.getName()));
+ List<Artifact> artList = commitMap.get(branch);
+ commitTestRunTx(monitor, commitComment, branch, artList.toArray(new Artifact[artList.size()]));
+ }
+ }
+
+ private Map<Branch, List<Artifact>> getArtifactsByBranch(Object[] items) {
+ Map<Branch, List<Artifact>> branchMap = new HashMap<Branch, List<Artifact>>();
+ for (Object object : items) {
+ Artifact testRun = (Artifact) object;
+ Branch branch = testRun.getBranch();
+ List<Artifact> artList = branchMap.get(branch);
+ if (artList == null) {
+ artList = new ArrayList<Artifact>();
+ branchMap.put(branch, artList);
+ }
+ artList.add(testRun);
+ }
+ return branchMap;
+ }
+
+ public static void commitTestRunTx(IProgressMonitor monitor, String commitComment, Branch branch, Artifact... artifacts) throws OseeCoreException {
+ monitor.setTaskName("Persist Test Runs");
+ for (Artifact artifact : artifacts) {
+ monitor.subTask(String.format("Persisting: [%s] ", artifact.getName()));
+
+ TestRunOperator operator = new TestRunOperator(artifact);
+ operator.setLastDateUploaded(new Date());
+ if (monitor.isCanceled() != false) {
+ break;
+ }
+ monitor.worked(1);
+ }
+
+ Artifacts.persistInTransaction(commitComment, artifacts);
+ if (monitor.isCanceled() != false) {
+ throw new OseeCoreException("User Cancelled");
+ }
+ monitor.done();
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/LinkTestRunToTestScriptOperation.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/LinkTestRunToTestScriptOperation.java new file mode 100644 index 00000000000..e64a1ae3623 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/LinkTestRunToTestScriptOperation.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.operations;
+
+import java.util.ArrayList; +import java.util.List; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.osee.framework.core.exception.OseeArgumentException; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.ote.define.artifacts.TestRunOperator; +
+/**
+ * @author Roberto E. Escobar
+ */
+public class LinkTestRunToTestScriptOperation {
+ private static final String OPERATION_NAME = "Link Test Run to Test Script";
+ private Artifact[] artifacts;
+ private List<Artifact> unlinked;
+ private List<Artifact> linked;
+
+ public LinkTestRunToTestScriptOperation(Artifact... artifacts) {
+ this.artifacts = artifacts;
+ this.unlinked = new ArrayList<Artifact>();
+ this.linked = new ArrayList<Artifact>();
+ }
+
+ public void execute(IProgressMonitor monitor) throws OseeArgumentException {
+ int count = 0;
+ monitor.setTaskName(OPERATION_NAME);
+ for (Artifact testRun : artifacts) {
+
+ monitor.subTask(String.format("Linking [%s] [%s of %s] ", testRun.getName(), ++count,
+ artifacts.length));
+ TestRunOperator operator = new TestRunOperator(testRun);
+ try {
+ operator.createTestScriptSoftLink();
+ linked.add(testRun);
+ } catch (Exception ex) {
+ unlinked.add(testRun);
+ }
+ if (monitor.isCanceled() == true) {
+ break;
+ }
+ monitor.worked(1);
+ }
+ }
+
+ public Artifact[] getLinkedArtifacts() {
+ return linked.toArray(new Artifact[linked.size()]);
+ }
+
+ public Artifact[] getUnlinkedArtifacts() {
+ return unlinked.toArray(new Artifact[unlinked.size()]);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/OutfileToArtifactOperation.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/OutfileToArtifactOperation.java new file mode 100644 index 00000000000..b2a174fd91b --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/OutfileToArtifactOperation.java @@ -0,0 +1,105 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.operations; + +import java.io.InputStream; +import java.net.URI; +import java.net.URL; +import java.util.ArrayList; +import java.util.List; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.osee.framework.core.model.Branch; +import org.eclipse.osee.framework.jdk.core.util.ChecksumUtil; +import org.eclipse.osee.framework.jdk.core.util.Lib; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.ote.define.artifacts.TestRunOperator; +import org.eclipse.osee.ote.define.parser.BaseOutfileParser; +import org.eclipse.osee.ote.define.utilities.OutfileDataCollector; +import org.eclipse.osee.ote.define.utilities.OutfileParserExtensionManager; + +/** + * @author Roberto E. Escobar + */ +public class OutfileToArtifactOperation { + private Branch branch; + private URI[] filesToImport; + private List<Artifact> results; + private List<URI> filesWithErrors; + + public OutfileToArtifactOperation(Branch branch, URI... filesToImport) { + this.branch = branch; + this.filesToImport = filesToImport; + this.results = new ArrayList<Artifact>(); + this.filesWithErrors = new ArrayList<URI>(); + } + + public void execute(IProgressMonitor monitor) throws Exception { + this.results.clear(); + monitor.setTaskName("Outfiles to Artifact Conversion..."); + for (URI targetUri : filesToImport) { + TestRunOperator operator = null; + try { + operator = TestRunOperator.getNewArtifactWithOperator(branch); + + OutfileDataCollector collector = getOutfileData(monitor, targetUri.toURL()); + collector.populate(operator.getTestRunArtifact()); + + String path = targetUri.toURL().toString(); + operator.setLocalOutfileURI(path); + operator.setOutfileExtension(Lib.getExtension(path)); + addChecksum(operator, targetUri.toURL()); + results.add(operator.getTestRunArtifact()); + + if (monitor.isCanceled() == true) { + break; + } + } catch (Exception ex) { + if (operator.getTestRunArtifact() == null) { + throw new Exception( + "Unable to create Test Run Artifact. Make sure type information exists in the selected branch."); + } + filesWithErrors.add(targetUri); + } + operator = null; + monitor.worked(1); + } + } + + private void addChecksum(TestRunOperator operator, URL targetURL) throws Exception { + InputStream inputStream = null; + try { + inputStream = targetURL.openStream(); + String checkSum = ChecksumUtil.createChecksumAsString(inputStream, ChecksumUtil.MD5); + operator.setChecksum(checkSum); + } finally { + if (inputStream != null) { + inputStream.close(); + } + } + } + + private OutfileDataCollector getOutfileData(IProgressMonitor monitor, URL fileToImport) throws Exception { + OutfileDataCollector collector = new OutfileDataCollector(); + BaseOutfileParser outfileParser = OutfileParserExtensionManager.getInstance().getOutfileParserFor(fileToImport); + outfileParser.registerListener(collector); + outfileParser.execute(monitor, fileToImport); + outfileParser.deregisterListener(collector); + return collector; + } + + public Artifact[] getResults() { + return results.toArray(new Artifact[results.size()]); + } + + public URI[] getUnparseableFiles() { + return filesWithErrors.toArray(new URI[filesWithErrors.size()]); + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/RemoteResourceRequestOperation.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/RemoteResourceRequestOperation.java new file mode 100644 index 00000000000..7c8563aa9d9 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/RemoteResourceRequestOperation.java @@ -0,0 +1,75 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.operations;
+
+import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URL; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.IProgressMonitor; +
+/**
+ * @author Roberto E. Escobar
+ */
+public class RemoteResourceRequestOperation extends AbstractRemoteResourceRequestTemplate {
+ private static final String STORAGE_PATH = "TEMP";
+ private String fileName;
+
+ public RemoteResourceRequestOperation(String tempFolderName, String remoteRequestUrl, String fileName) {
+ super(STORAGE_PATH, remoteRequestUrl);
+ this.fileName = fileName;
+ }
+
+ @Override
+ protected String getLocalStorageName() throws Exception {
+ StringBuilder builder = new StringBuilder();
+ builder.append(getTempFolderName());
+ builder.append(File.separator);
+ builder.append(fileName);
+ return builder.toString();
+ }
+
+ @Override
+ protected String getRemoteFileName() {
+ return fileName;
+ }
+
+ protected HttpURLConnection setupConnection(URL url) throws IOException {
+ HttpURLConnection connection = super.setupConnection(url);
+ connection.setAllowUserInteraction(false);
+ connection.setDoInput(true);
+ connection.setDoOutput(true);
+ connection.setInstanceFollowRedirects(true);
+ return connection;
+ }
+
+ @Override
+ protected IFile handleTransfer(IProgressMonitor monitor, HttpURLConnection connection) throws Exception {
+ IFile file = null;
+ InputStream stream = null;
+ try {
+ int result = connection.getResponseCode();
+ if (result == 200) {
+ stream = (InputStream) connection.getContent();
+ file = getLocalStorageIFile();
+ file.create(stream, true, monitor);
+ monitor.setTaskName("File Transfer Complete.");
+ }
+ } finally {
+ if (stream != null) {
+ stream.close();
+ }
+ }
+ return file;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/BaseOutfileParser.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/BaseOutfileParser.java new file mode 100644 index 00000000000..7e2d35dff5c --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/BaseOutfileParser.java @@ -0,0 +1,71 @@ +/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.ote.define.parser;
+
+import java.io.File;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class BaseOutfileParser {
+ private Set<IDataListener> listeners;
+
+ public BaseOutfileParser() {
+ this.listeners = new HashSet<IDataListener>();
+ }
+
+ public void registerListener(IDataListener listener) {
+ listeners.add(listener);
+ }
+
+ public void deregisterListener(IDataListener listener) {
+ listeners.remove(listener);
+ }
+
+ protected Set<IDataListener> getDataListeners() {
+ return listeners;
+ }
+
+ protected void notifyOnDataEvent(String name, String value) {
+ for (IDataListener listener : listeners) {
+ listener.notifyDataEvent(name, value);
+ }
+ }
+
+ public final void execute(IProgressMonitor monitor, URL fileToParse) throws Exception {
+ long time = System.currentTimeMillis();
+ String file = new File(fileToParse.toURI()).getName();
+ monitor.subTask(String.format("Parsing: [%s]", file));
+ InputStream inputStream = null;
+ try {
+ inputStream = fileToParse.openStream();
+ doParse(monitor, file, inputStream);
+ } finally {
+ try {
+ if (inputStream != null) {
+ inputStream.close();
+ }
+ } finally {
+ long elapsedTime = System.currentTimeMillis() - time;
+ monitor.subTask(String.format("Parsed: [%s] in [%d] ms", file, elapsedTime));
+ }
+ }
+ }
+
+ public abstract boolean isValidParser(URL fileToParse);
+
+ protected abstract void doParse(IProgressMonitor monitor, String fileName, InputStream inputStream) throws Exception;
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/CollectionParser.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/CollectionParser.java new file mode 100644 index 00000000000..f315582275c --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/CollectionParser.java @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.parser;
+
+import java.util.ArrayList; +import java.util.List; +import org.eclipse.osee.framework.jdk.core.util.io.xml.AbstractSaxHandler; +import org.xml.sax.Attributes; +import org.xml.sax.SAXException; +
+public class CollectionParser extends AbstractSaxHandler implements ICollectionSource {
+
+ private List<SaxChunkCollector> collectors;
+
+ public CollectionParser(ArrayList<SaxChunkCollector> collectors) {
+ this.collectors = collectors;
+ }
+
+ public CollectionParser() {
+ collectors = new ArrayList<SaxChunkCollector>();
+ }
+
+ @Override
+ public void endElementFound(String uri, String localName, String name) throws SAXException {
+ for (SaxChunkCollector collector : collectors) {
+ collector.endElementFound(localName, this);
+ }
+ }
+
+ @Override
+ public void startElementFound(String uri, String localName, String name, Attributes attributes) throws SAXException {
+ for (SaxChunkCollector collector : collectors) {
+ collector.startElementFound(localName, attributes, this);
+ }
+ }
+
+ public List<SaxChunkCollector> getCollectors() {
+ return collectors;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/ICollectionSource.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/ICollectionSource.java new file mode 100644 index 00000000000..d775451716d --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/ICollectionSource.java @@ -0,0 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.parser;
+
+public interface ICollectionSource {
+ String getContents();
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/IDataListener.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/IDataListener.java new file mode 100644 index 00000000000..fb6cfb53eff --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/IDataListener.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.parser;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface IDataListener {
+
+ public void notifyDataEvent(String name, String value);
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/ISaxElementHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/ISaxElementHandler.java new file mode 100644 index 00000000000..49ff36869ce --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/ISaxElementHandler.java @@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.parser;
+
+public interface ISaxElementHandler {
+
+ public void processSaxChunkCollectorData(String currentLocalName, String xmlData);
+
+ public void addListener(IDataListener listener);
+
+ public void removeListener(IDataListener listener);
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/OteOutfileParser.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/OteOutfileParser.java new file mode 100644 index 00000000000..df1b7c9facd --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/OteOutfileParser.java @@ -0,0 +1,82 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.parser; + +import java.io.InputStream; +import java.net.URL; +import java.util.ArrayList; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.osee.framework.jdk.core.util.Lib; +import org.eclipse.osee.ote.define.parser.handlers.ConfigHandler; +import org.eclipse.osee.ote.define.parser.handlers.CurrentProcessorHandler; +import org.eclipse.osee.ote.define.parser.handlers.DemoInfoHandler; +import org.eclipse.osee.ote.define.parser.handlers.ElapsedTimeHandler; +import org.eclipse.osee.ote.define.parser.handlers.ExecutionStatusHandler; +import org.eclipse.osee.ote.define.parser.handlers.RuntimeVersionsHandler; +import org.eclipse.osee.ote.define.parser.handlers.SystemInfoHandler; +import org.eclipse.osee.ote.define.parser.handlers.TestPointResultsHandler; +import org.eclipse.osee.ote.define.parser.handlers.VersionInformationHandler; +import org.xml.sax.InputSource; +import org.xml.sax.XMLReader; +import org.xml.sax.helpers.XMLReaderFactory; + +/** + * @author Roberto E. Escobar + */ +public class OteOutfileParser extends BaseOutfileParser { + private ArrayList<SaxChunkCollector> collectors; + + public OteOutfileParser() { + super(); + collectors = new ArrayList<SaxChunkCollector>(); + collectors.add(new SaxChunkCollector(new ConfigHandler(), "Config")); + collectors.add(new SaxChunkCollector(new RuntimeVersionsHandler(), "RuntimeVersions")); + collectors.add(new SaxChunkCollector(new SystemInfoHandler(), "SystemInfo")); + collectors.add(new SaxChunkCollector(new CurrentProcessorHandler(), "CurrentProcessor")); + collectors.add(new SaxChunkCollector(new ExecutionStatusHandler(), "ExecutionStatus")); + collectors.add(new SaxChunkCollector(new ElapsedTimeHandler(), "TimeSummary")); + collectors.add(new SaxChunkCollector(new VersionInformationHandler(), "Version")); + collectors.add(new SaxChunkCollector(new TestPointResultsHandler(), "TestPointResults")); + collectors.add(new SaxChunkCollector(new DemoInfoHandler(), "Qualification")); + } + + public void registerListener(IDataListener listener) { + super.registerListener(listener); + for (SaxChunkCollector collector : collectors) { + collector.getHandler().addListener(listener); + } + } + + public void deregisterListener(IDataListener listener) { + super.deregisterListener(listener); + for (SaxChunkCollector collector : collectors) { + collector.getHandler().removeListener(listener); + } + } + + @Override + protected void doParse(IProgressMonitor monitor, String fileName, InputStream inputStream) throws Exception { + XMLReader xmlReader = XMLReaderFactory.createXMLReader(); + CollectionParser handler = new CollectionParser(collectors); + xmlReader.setContentHandler(handler); + xmlReader.parse(new InputSource(inputStream)); + } + + @Override + public boolean isValidParser(URL fileToParse) { + boolean result = false; + if (fileToParse != null) { + String extension = Lib.getExtension(fileToParse.getFile()); + result = extension != null && extension.contains("tmo"); + } + return result; + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/SaxChunkCollector.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/SaxChunkCollector.java new file mode 100644 index 00000000000..a39f753a986 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/SaxChunkCollector.java @@ -0,0 +1,89 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.parser;
+
+import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import org.xml.sax.Attributes; +
+public class SaxChunkCollector {
+
+ private Set<String> collectionElement;
+ private int currentDepth = 0;
+ private boolean isCollecting = false;
+ private StringBuilder builder;
+ private List<String> collectionChunks;
+ private ISaxElementHandler handler;
+ private String currentLocalName;
+
+ public SaxChunkCollector(ISaxElementHandler handler, String... collect) {
+ this.collectionElement = new HashSet<String>();
+ for (String item : collect) {
+ collectionElement.add(item);
+ }
+ this.handler = handler;
+ collectionChunks = new ArrayList<String>();
+ builder = new StringBuilder(5000);
+ }
+
+ /**
+ * @param localName
+ * @param collectionParser
+ */
+ public void endElementFound(String localName, ICollectionSource collectionSource) {
+ if (isCollecting) {
+ currentDepth--;
+ builder.append(collectionSource.getContents());
+ builder.append("</");
+ builder.append(localName);
+ builder.append(">");
+ if (currentDepth < 1) {
+ isCollecting = false;
+ String data = builder.toString();
+ collectionChunks.add(data);
+ handler.processSaxChunkCollectorData(currentLocalName, data);
+ builder.setLength(0);
+ }
+ }
+ }
+
+ public ISaxElementHandler getHandler() {
+ return handler;
+ }
+
+ /**
+ * @param localName
+ * @param attributes
+ * @param collectionParser
+ */
+ public void startElementFound(String localName, Attributes attributes, CollectionParser collectionParser) {
+ if (collectionElement.contains(localName)) {
+ isCollecting = true;
+ currentLocalName = localName;
+ }
+
+ if (isCollecting) {
+ currentDepth++;
+ builder.append("<");
+ builder.append(localName);
+ for (int i = 0; i < attributes.getLength(); i++) {
+ builder.append(" ");
+ builder.append(attributes.getLocalName(i));
+ builder.append("=\"");
+ builder.append(attributes.getValue(i));
+ builder.append("\"");
+ }
+ builder.append(" >");
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/AbstractParseHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/AbstractParseHandler.java new file mode 100644 index 00000000000..28cf8b44ba6 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/AbstractParseHandler.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.parser.handlers;
+
+import java.util.Collections; +import java.util.HashSet; +import java.util.Set; +import java.util.logging.Level; +import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.ote.define.OteDefinePlugin; +import org.eclipse.osee.ote.define.parser.IDataListener; +import org.eclipse.osee.ote.define.parser.ISaxElementHandler; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class AbstractParseHandler implements ISaxElementHandler {
+ private Set<IDataListener> listeners;
+
+ protected AbstractParseHandler() {
+ this.listeners = Collections.synchronizedSet(new HashSet<IDataListener>());
+ }
+
+ public void addListener(IDataListener listener) {
+ if (!listeners.contains(listener)) {
+ listeners.add(listener);
+ }
+ }
+
+ public void removeListener(IDataListener listener) {
+ if (listeners.contains(listener)) {
+ listeners.remove(listener);
+ }
+ }
+
+ public void notifyOnDataEvent(String name, String value) {
+ for (final IDataListener listener : listeners) {
+ listener.notifyDataEvent(name, value);
+ }
+ }
+
+ public void processSaxChunkCollectorData(String currentLocalName, String xmlData) {
+ try {
+ Document doc = Jaxp.readXmlDocument(xmlData);
+ Element root = doc.getDocumentElement();
+ if (root != null) {
+ processSaxChunk(root);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(OteDefinePlugin.class, Level.SEVERE, ex);
+ }
+ }
+
+ protected abstract void processSaxChunk(Element element);
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ConfigHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ConfigHandler.java new file mode 100644 index 00000000000..c009e1422c7 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ConfigHandler.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.parser.handlers;
+
+import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; +import org.eclipse.osee.ote.define.TestRunField; +import org.w3c.dom.Element; +
+/**
+ * @author Roberto E. Escobar
+ */
+public class ConfigHandler extends AbstractParseHandler {
+
+ @Override
+ protected void processSaxChunk(Element element) {
+ Element user = Jaxp.getChildDirect(element, "User");
+ if (user != null) {
+ notifyOnDataEvent(TestRunField.USER_ID.toString(), user.getAttribute("id"));
+ notifyOnDataEvent(TestRunField.USER_NAME.toString(), user.getAttribute("name"));
+ }
+ notifyOnDataEvent(TestRunField.SCRIPT_NAME.toString(), Jaxp.getChildTextTrim(element, "ScriptName"));
+ Element versionElement = Jaxp.getChild(element, "ScriptVersion");
+ if (versionElement != null) {
+ notifyOnDataEvent(TestRunField.SCRIPT_REVISION.toString(), versionElement.getAttribute("revision"));
+ notifyOnDataEvent(TestRunField.SCRIPT_MODIFIED_FLAG.toString(), versionElement.getAttribute("modifiedFlag"));
+ notifyOnDataEvent(TestRunField.SCRIPT_LAST_AUTHOR.toString(), versionElement.getAttribute("lastAuthor"));
+ notifyOnDataEvent(TestRunField.SCRIPT_LAST_MODIFIED.toString(), versionElement.getAttribute("lastModified"));
+ notifyOnDataEvent(TestRunField.SCRIPT_URL.toString(), versionElement.getAttribute("url"));
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/CurrentProcessorHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/CurrentProcessorHandler.java new file mode 100644 index 00000000000..0a37ab042eb --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/CurrentProcessorHandler.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.parser.handlers;
+
+import org.eclipse.osee.ote.define.TestRunField; +import org.w3c.dom.Element; +
+/**
+ * @author Roberto E. Escobar
+ */
+public class CurrentProcessorHandler extends AbstractParseHandler {
+
+ @Override
+ protected void processSaxChunk(Element element) {
+ notifyOnDataEvent(TestRunField.PROCESSOR_ID.toString(), element.getAttribute("proc"));
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/DemoInfoHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/DemoInfoHandler.java new file mode 100644 index 00000000000..57e41fca417 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/DemoInfoHandler.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.parser.handlers;
+
+import org.eclipse.osee.framework.jdk.core.util.Strings; +import org.eclipse.osee.ote.define.TestRunField; +import org.w3c.dom.Element; +
+/**
+ * @author Roberto E. Escobar
+ */
+public class DemoInfoHandler extends AbstractParseHandler {
+
+ @Override
+ protected void processSaxChunk(Element element) {
+ String formalityLevel = element.getAttribute("level");
+ String buildId = element.getAttribute("buildId");
+
+ if (Strings.isValid(formalityLevel) != true) {
+ formalityLevel = "DEVELOPMENT";
+ }
+ notifyOnDataEvent(TestRunField.QUALIFICATION_LEVEL.toString(), formalityLevel.toUpperCase());
+
+ if (Strings.isValid(buildId) != true) {
+ buildId = "unknown";
+ }
+ notifyOnDataEvent(TestRunField.BUILD_ID.toString(), buildId);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ElapsedTimeHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ElapsedTimeHandler.java new file mode 100644 index 00000000000..27a3d2408a1 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ElapsedTimeHandler.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.parser.handlers;
+
+import org.eclipse.osee.ote.define.TestRunField; +import org.w3c.dom.Element; +
+/**
+ * @author Roberto E. Escobar
+ */
+public class ElapsedTimeHandler extends AbstractParseHandler {
+
+ @Override
+ protected void processSaxChunk(Element element) {
+ /*
+ * <RuntimeVersions> <Version>B3_V1_FTB1.PROPOSED.2007_08_28_14:12:23</Version>
+ * <Version>VER1__13-September-2007_03:19:29</Version> </RuntimeVersions>
+ *
+ * <ElapsedTime elapsed="0:01:28" endDate="Thu Sep 13 15:50:24 MDT 2007" milliseconds="88768"
+ * startDate="Thu Sep 13 15:48:55 MDT 2007"/> <TestPointResults fail="41" pass="167"
+ * total="208"/>
+ *
+ */
+ notifyOnDataEvent(TestRunField.SCRIPT_END_DATE.toString(), element.getAttribute("endDate"));
+ notifyOnDataEvent(TestRunField.SCRIPT_START_DATE.toString(), element.getAttribute("startDate"));
+ notifyOnDataEvent(TestRunField.SCRIPT_ELAPSED_TIME.toString(), element.getAttribute("elapsed"));
+ // callback.addOverviewData("Time Info", String.format("Elapsed [ %s ] Start [ %s ] Stop [
+ // %s ]", elapsed, startDate, endDate));
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ExecutionStatusHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ExecutionStatusHandler.java new file mode 100644 index 00000000000..7e26e1b8543 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/ExecutionStatusHandler.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.parser.handlers;
+
+import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; +import org.eclipse.osee.ote.define.TestRunField; +import org.w3c.dom.Element; +
+/**
+ * @author Roberto E. Escobar
+ */
+public class ExecutionStatusHandler extends AbstractParseHandler {
+
+ @Override
+ protected void processSaxChunk(Element element) {
+ notifyOnDataEvent(TestRunField.SCRIPT_EXECUTION_TIME.toString(), Jaxp.getChildText(element, "Time"));
+ notifyOnDataEvent(TestRunField.SCRIPT_EXECUTION_RESULTS.toString(), Jaxp.getChildText(element, "ExecutionResult"));
+ notifyOnDataEvent(TestRunField.SCRIPT_EXECUTION_ERRORS.toString(), Jaxp.getChildText(element, "ExecutionDetails"));
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/RuntimeVersionsHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/RuntimeVersionsHandler.java new file mode 100644 index 00000000000..bfbd9af1e3b --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/RuntimeVersionsHandler.java @@ -0,0 +1,33 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.parser.handlers;
+
+import java.util.List; +import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; +import org.eclipse.osee.ote.define.TestRunField; +import org.w3c.dom.Element; +
+/**
+ * @author Roberto E. Escobar
+ */
+public class RuntimeVersionsHandler extends AbstractParseHandler {
+
+ @Override
+ protected void processSaxChunk(Element element) {
+ List<Element> versions = Jaxp.getChildDirects(element, "Version");
+ StringBuilder sb = new StringBuilder();
+ for (Element el : versions) {
+ sb.append(Jaxp.getElementCharacterData(el));
+ sb.append(" ");
+ }
+ notifyOnDataEvent(TestRunField.SYSTEM_OSEE_SERVER_JAR_VERSIONS.toString(), sb.toString());
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/SystemInfoHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/SystemInfoHandler.java new file mode 100644 index 00000000000..dc259120b1c --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/SystemInfoHandler.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.parser.handlers;
+
+import org.eclipse.osee.ote.define.TestRunField; +import org.w3c.dom.Element; +
+/**
+ * @author Roberto E. Escobar
+ */
+public class SystemInfoHandler extends AbstractParseHandler {
+
+ @Override
+ protected void processSaxChunk(Element element) {
+ /*
+ * <RuntimeVersions> <Version>B3_V1_FTB1.PROPOSED.2007_08_28_14:12:23</Version>
+ * <Version>VER1__13-September-2007_03:19:29</Version> </RuntimeVersions> <SystemInfo
+ * osArch="i386" osName="Linux" osVersion="2.6.11.12" oseeVersion="Development"/>
+ */
+ notifyOnDataEvent(TestRunField.SYSTEM_OS_ARCH.toString(), element.getAttribute("osArch"));
+ notifyOnDataEvent(TestRunField.SYSTEM_OS_NAME.toString(), element.getAttribute("osName"));
+ notifyOnDataEvent(TestRunField.SYSTEM_OS_VERSION.toString(), element.getAttribute("osVersion"));
+ notifyOnDataEvent(TestRunField.SYSTEM_OSEE_VERSION.toString(), element.getAttribute("oseeVersion"));
+ notifyOnDataEvent(TestRunField.SYSTEM_OSEE_SERVER_TITLE.toString(), element.getAttribute("oseeServerTitle"));
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/TestPointResultsHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/TestPointResultsHandler.java new file mode 100644 index 00000000000..bfa14c6191a --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/TestPointResultsHandler.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.parser.handlers;
+
+import org.eclipse.osee.ote.define.TestRunField; +import org.w3c.dom.Element; +
+/**
+ * @author Roberto E. Escobar
+ */
+public class TestPointResultsHandler extends AbstractParseHandler {
+
+ @Override
+ protected void processSaxChunk(Element element) {
+ notifyOnDataEvent(TestRunField.TEST_POINTS_PASSED.toString(), element.getAttribute("pass"));
+ notifyOnDataEvent(TestRunField.TEST_POINTS_FAILED.toString(), element.getAttribute("fail"));
+ notifyOnDataEvent(TestRunField.TOTAL_TEST_POINTS.toString(), element.getAttribute("total"));
+ notifyOnDataEvent(TestRunField.TEST_ABORT_STATUS.toString(), element.getAttribute("aborted"));
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/VersionInformationHandler.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/VersionInformationHandler.java new file mode 100644 index 00000000000..24df840b65d --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/parser/handlers/VersionInformationHandler.java @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.parser.handlers;
+
+import java.util.List; +import org.eclipse.osee.framework.jdk.core.util.xml.Jaxp; +import org.w3c.dom.Element; +
+/**
+ * @author Roberto E. Escobar
+ */
+public class VersionInformationHandler extends AbstractParseHandler {
+
+ @Override
+ protected void processSaxChunk(Element element) {
+ List<Element> versions = Jaxp.getChildDirects(element, "Version");
+ for (Element version : versions) {
+ notifyOnDataEvent("name", version.getAttribute("name"));
+ notifyOnDataEvent("underTest", version.getAttribute("underTest"));
+ notifyOnDataEvent("version", version.getAttribute("version"));
+ notifyOnDataEvent("versionUnit", version.getAttribute("versionUnit"));
+ // item.getChildren().add(new BaseOutfileTreeItem(name, versionTitle,
+ // String.format("unitId[%s] underTest[%s]", unit, underTest), null));
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/utilities/OutfileDataCollector.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/utilities/OutfileDataCollector.java new file mode 100644 index 00000000000..6de29cb1352 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/utilities/OutfileDataCollector.java @@ -0,0 +1,63 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.utilities; + +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Level; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.util.Conditions; +import org.eclipse.osee.framework.jdk.core.util.Strings; +import org.eclipse.osee.framework.logging.OseeLog; +import org.eclipse.osee.framework.skynet.core.artifact.Artifact; +import org.eclipse.osee.ote.define.OteDefinePlugin; +import org.eclipse.osee.ote.define.TestRunField; +import org.eclipse.osee.ote.define.artifacts.OteToAttributeMap; +import org.eclipse.osee.ote.define.parser.IDataListener; + +/** + * @author Roberto E. Escobar + */ +public class OutfileDataCollector implements IDataListener { + private static final OteToAttributeMap oteToAttributeMap = OteToAttributeMap.getInstance(); + + private final Map<String, String> collectedData; + + public OutfileDataCollector() { + this.collectedData = new HashMap<String, String>(); + } + + public void notifyDataEvent(String name, String value) { + collectedData.put(name, value); + } + + public void populate(Artifact artifact) throws OseeCoreException { + Conditions.checkNotNull(artifact, "artifact"); + for (String fieldName : collectedData.keySet()) { + String attribute = oteToAttributeMap.getAttributeName(fieldName); + if (Strings.isValid(attribute) && artifact.isAttributeTypeValid(attribute)) { + try { + String value = collectedData.get(fieldName); + Object object = oteToAttributeMap.asTypedObject(attribute, value); + artifact.setSoleAttributeValue(attribute, object); + } catch (Exception ex) { + OseeLog.log(OteDefinePlugin.class, Level.SEVERE, ex); + } + } + } + artifact.setName(getField(TestRunField.SCRIPT_NAME.name())); + } + + public String getField(String name) { + String toReturn = collectedData.get(name); + return Strings.isValid(toReturn) ? toReturn : ""; + } +} diff --git a/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/utilities/OutfileParserExtensionManager.java b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/utilities/OutfileParserExtensionManager.java new file mode 100644 index 00000000000..0b07132019a --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/utilities/OutfileParserExtensionManager.java @@ -0,0 +1,141 @@ +/******************************************************************************* + * Copyright (c) 2004, 2007 Boeing. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Boeing - initial API and implementation + *******************************************************************************/ +package org.eclipse.osee.ote.define.utilities;
+
+import java.lang.reflect.Method; +import java.net.URL; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.Platform; +import org.eclipse.osee.framework.core.exception.OseeCoreException; +import org.eclipse.osee.framework.core.exception.OseeStateException; +import org.eclipse.osee.framework.jdk.core.type.HashCollection; +import org.eclipse.osee.framework.jdk.core.util.Strings; +import org.eclipse.osee.framework.plugin.core.util.ExtensionPoints; +import org.eclipse.osee.ote.define.OteDefinePlugin; +import org.eclipse.osee.ote.define.parser.BaseOutfileParser; +import org.osgi.framework.Bundle; +
+/**
+ * @author Roberto E. Escobar
+ */
+public class OutfileParserExtensionManager {
+
+ private static final String OUTFILE_PARSER = "OutfileParser";
+ private static final String CLASS_NAME = "classname";
+ private static final String SUPPORTED_EXTENSIONS = "supportedExtensions";
+ private final Map<String, BaseOutfileParser> contributions;
+ private final HashCollection<String, BaseOutfileParser> extensionsToParsers;
+
+ private static OutfileParserExtensionManager instance = null;
+
+ private OutfileParserExtensionManager() {
+ contributions = new HashMap<String, BaseOutfileParser>();
+ extensionsToParsers = new HashCollection<String, BaseOutfileParser>(false, HashSet.class);
+ }
+
+ public static OutfileParserExtensionManager getInstance() {
+ if (instance == null) {
+ instance = new OutfileParserExtensionManager();
+ }
+ return instance;
+ }
+
+ public String[] getSupportedExtensions() throws OseeCoreException {
+ checkObjectsLoaded();
+ Set<String> set = extensionsToParsers.keySet();
+ return set.toArray(new String[set.size()]);
+ }
+
+ public BaseOutfileParser getOutfileParserFor(URL fileToImport) throws OseeCoreException {
+ checkObjectsLoaded();
+ BaseOutfileParser toReturn = null;
+ for (BaseOutfileParser parser : getOutfileParsers()) {
+ if (parser.isValidParser(fileToImport)) {
+ toReturn = parser;
+ break;
+ }
+ }
+ if (toReturn == null) {
+ throw new OseeStateException(String.format("Unsupported outfile type [%s] no valid outfile parser found",
+ fileToImport));
+ }
+ return toReturn;
+ }
+
+ public BaseOutfileParser getOutfileParserById(String id) throws OseeCoreException {
+ checkObjectsLoaded();
+ return contributions.get(id);
+ }
+
+ public Collection<BaseOutfileParser> getOutfileParsers() throws OseeCoreException {
+ checkObjectsLoaded();
+ return contributions.values();
+ }
+
+ private void checkObjectsLoaded() throws OseeCoreException {
+ if (contributions.isEmpty()) {
+ List<IConfigurationElement> elements =
+ ExtensionPoints.getExtensionElements(OteDefinePlugin.PLUGIN_ID + "." + OUTFILE_PARSER, OUTFILE_PARSER);
+ for (IConfigurationElement element : elements) {
+ IExtension extension = ((IExtension) element.getParent());
+ String identifier = extension.getUniqueIdentifier();
+ String bundleName = element.getContributor().getName();
+ String parserClassName = element.getAttribute(CLASS_NAME);
+ String supportedExtensions = element.getAttribute(SUPPORTED_EXTENSIONS);
+ Set<String> supportedSet = getSupportedExtensions(supportedExtensions);
+ BaseOutfileParser parser = (BaseOutfileParser) loadClass(bundleName, parserClassName);
+ if (parser != null) {
+ contributions.put(identifier, parser);
+ for (String extensionType : supportedSet) {
+ extensionsToParsers.put(extensionType, parser);
+ }
+ }
+ }
+ }
+ }
+
+ private Set<String> getSupportedExtensions(String rawExtensions) {
+ Set<String> toReturn = new HashSet<String>();
+ for (String value : rawExtensions.split(";")) {
+ value = value.trim();
+ if (Strings.isValid(value)) {
+ toReturn.add(value);
+ }
+ }
+ return toReturn;
+ }
+
+ private Object loadClass(String bundleName, String className) throws OseeCoreException {
+ Object object = null;
+ if (Strings.isValid(bundleName) && Strings.isValid(className)) {
+ try {
+ Bundle bundle = Platform.getBundle(bundleName);
+ Class<?> taskClass = bundle.loadClass(className);
+ try {
+ Method getInstance = taskClass.getMethod("getInstance", new Class[] {});
+ object = getInstance.invoke(null, new Object[] {});
+ } catch (Exception ex) {
+ object = taskClass.newInstance();
+ }
+ } catch (Exception ex) {
+ throw new OseeCoreException(String.format("Unable to Load: [%s - %s]", bundleName, className), ex);
+ }
+ }
+ return object;
+ }
+}
diff --git a/plugins/org.eclipse.osee.ote.define/support/OseeTypes_OTE.osee b/plugins/org.eclipse.osee.ote.define/support/OseeTypes_OTE.osee new file mode 100644 index 00000000000..aae7a1232f2 --- /dev/null +++ b/plugins/org.eclipse.osee.ote.define/support/OseeTypes_OTE.osee @@ -0,0 +1,338 @@ +import +"platform:/plugin/org.eclipse.osee.framework.skynet.core/support/OseeTypes_Framework.osee" +artifactType "Test Case" extends "Test Unit" { + guid "AAMFDikEi0TGK27TKPgA" +} + +artifactType "Test Support" extends "Test Unit" { + guid "AAMFDj+FW0f_Ut72ocQA" +} + +artifactType "Test Run Disposition" extends "Artifact" { + guid "AAMFDjeNxhi0KmXZcKQA" + attribute "Disposition" +} + +artifactType "Test Run" extends "Abstract Test Result" { + guid "AAMFDjqDHWo+orlSpaQA" + attribute "Test Script GUID" + attribute "Test Script URL" + attribute "Outfile URL" + attribute "User Id" + attribute "Revision" + attribute "Modified Flag" + attribute "Last Author" + attribute "Last Modified Date" + attribute "OS Architecture" + attribute "OS Name" + attribute "OS Version" + attribute "OSEE Version" + attribute "OSEE Server Title" + attribute "OSEE Server Jar Version" + attribute "Processor ID" + attribute "Start Date" + attribute "End Date" + attribute "Elapsed Date" + attribute "Ran In Batch Mode" + attribute "Is Batch Mode Allowed" + attribute "Passed" + attribute "Failed" + attribute "Total Test Points" + attribute "Script Aborted" + attribute "Last Date Uploaded" + attribute "Qualification Level" + attribute "Build Id" + attribute "Checksum" + attribute "Extension" +} + +attributeType "Outfile URL" extends StringAttribute { + guid "AAMFEVlyBndUvySg+gwA" + dataProvider org.eclipse.osee.ote.define.MappedAttributeDataProvider + min 1 + max 1 description "Test Run Content" + defaultValue "\"\"" fileExtension "tmo" +} + +attributeType "Test Script URL" extends StringAttribute { + guid "AAMFEVn0+mhxtCuACgAA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "Url of the test script used" +} + +attributeType "Revision" extends StringAttribute { + guid "AAMFEWAal2I3j7EJligA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "Version" +} + +attributeType "Modified Flag" extends StringAttribute { + guid "AAMFEWCruiS26nCN68wA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "File Modification Flag from Repository" +} + +attributeType "Last Author" extends StringAttribute { + guid "AAMFEWE83iPq3+2DGrQA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 + taggerId DefaultAttributeTaggerProvider description "Last Author" +} + +attributeType "Last Modified Date" extends DateAttribute { + guid "AAMFEWHw7V1uWv4IKcQA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "Last Modified" +} + +attributeType "OS Architecture" extends StringAttribute { + guid "AAMFEWKJtG+Jc8OkRYgA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 + taggerId DefaultAttributeTaggerProvider description "OS Architecture" +} + +attributeType "OS Name" extends StringAttribute { + guid "AAMFEWMdBmP9aCgsysgA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "OS Name" +} + +attributeType "OS Version" extends StringAttribute { + guid "AAMFEWOvQWV6JJvh9NQA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "OS Version" +} + +attributeType "OSEE Version" extends StringAttribute { + guid "AAMFEWQ_TTkstJvjnGQA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "OSEE Version" +} + +attributeType "OSEE Server Title" extends StringAttribute { + guid "AAMFEWTnXGYRfdzY3gAA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "OSEE Server Title" +} + +attributeType "OSEE Server Jar Version" extends StringAttribute { + guid "AAMFEWV1OQtXL67OfOQA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "OSEE Server Jar Version" +} + +attributeType "Processor ID" extends StringAttribute { + guid "AAMFEWYOAGkplo4RjTQA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "Processor ID" +} + +attributeType "Start Date" extends DateAttribute { + guid "AAMFEWpeXjfr2W5ZT5QA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "Start Date" +} + +attributeType "End Date" extends DateAttribute { + guid "AAMFEWryxym0P9FFckgA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "Stop Date" +} + +attributeType "Elapsed Date" extends StringAttribute { + guid "AAMFEWuD6yH04y89M3wA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "Time Elapsed from the start to the end of the script" +} + +attributeType "Passed" extends IntegerAttribute { + guid "AAMFEWwT92IzQp6Dh3gA" + dataProvider DefaultAttributeDataProvider + min 1 + max 1 description "Number of test points that passed" + defaultValue "0" +} + +attributeType "Failed" extends IntegerAttribute { + guid "AAMFEWynSU+XeRG7nRAA" + dataProvider DefaultAttributeDataProvider + min 1 + max 1 description "Number of test points that failed" + defaultValue "0" +} + +attributeType "Total Test Points" extends IntegerAttribute { + guid "AAMFEW05hBfECFGfZkgA" + dataProvider DefaultAttributeDataProvider + min 1 + max 1 description "Total test points" + defaultValue "0" +} + +attributeType "Script Aborted" extends BooleanAttribute { + guid "AAMFEW3M12AqHsCve4AA" + dataProvider DefaultAttributeDataProvider + min 1 + max 1 + taggerId DefaultAttributeTaggerProvider description "Test Abort status" + defaultValue "yes" +} + +attributeType "Test Script GUID" extends StringAttribute { + guid "AAMFEW5fEhinpcjeZ0wA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "Test Case GUID" +} + +attributeType "Ran In Batch Mode" extends BooleanAttribute { + guid "AAMFEW7uBlg0KLp8mhQA" + dataProvider DefaultAttributeDataProvider + min 1 + max 1 description "Run was performed as part of a batch" + defaultValue "no" +} + +attributeType "Is Batch Mode Allowed" extends BooleanAttribute { + guid "AAMFEW+CcA6F5GEjsSgA" + dataProvider DefaultAttributeDataProvider + min 1 + max 1 description "Whether Test Script is allowed to run as part of a batch" + defaultValue "yes" +} + +attributeType "Last Date Uploaded" extends DateAttribute { + guid "AAMFEXCm5ju5gvq142QA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "Last time outfile was uploaded" +} + +attributeType "Qualification Level" extends StringAttribute { + guid "AAMFEXEvTztOWwoGyRAA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 + taggerId DefaultAttributeTaggerProvider description "Qualification level" + defaultValue "DEVELOPMENT" +} + +attributeType "Build Id" extends StringAttribute { + guid "AAMFEXG6_W9diA9nUXAA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 + taggerId DefaultAttributeTaggerProvider description "Build Id" + defaultValue "unknown" +} + +attributeType "Checksum" extends StringAttribute { + guid "AAMFEXJbaHt5uKG9kogA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "Test Case Checksum" +} + +attributeType "Disposition" extends StringAttribute { + guid "AAMFEXfoPWRZHNiOR3gA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "Disposition" +} + +oseeEnumType "enum.test.run.status" { + guid "ABbjHCGo_TQNo1pha8AA" + entry "Pass" entryGuid "CArJmMNCPUkt72j8fGgA" + entry "Fail" entryGuid "CArJmMOtrEWczci+BkwA" + entry "Aborted" entryGuid "CArJmMQc80VqSa4AWZAA" + entry "Exception" entryGuid "CArJmMSKtjAY7O+M4KwA" +} + +attributeType "Test Status" extends EnumeratedAttribute { + guid "AAMFERRDznjwkYn+ugAA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 + enumType "enum.test.run.status" + description "Test Status" +} + +attributeType "Test Pass" extends IntegerAttribute { + guid "AAMFERTXIHAmwjVkjFgA" + dataProvider DefaultAttributeDataProvider + min 1 + max 1 + defaultValue "0" +} + +attributeType "Test Fail" extends IntegerAttribute { + guid "AAMFERVnLHThpASHn1wA" + dataProvider DefaultAttributeDataProvider + min 1 + max 1 + defaultValue "0" +} + +attributeType "Version" extends StringAttribute { + guid "AAMFERX4UAvPcLnvswwA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "Version" +} + +attributeType "Repository Type" extends StringAttribute { + guid "AAMFERaLojPfsL4I2AwA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "Repository Type" +} + +attributeType "Modification Flag" extends StringAttribute { + guid "AAMFERccxh8La5wlEmgA" + dataProvider DefaultAttributeDataProvider + min 0 + max 1 description "File Modification Flag from Repository" +} + +attributeType "Test Log" extends CompressedContentAttribute { + guid "AAMFERet6VP3iltwxMwA" + dataProvider UriAttributeDataProvider + min 0 + max 1 description "Compressed Data" fileExtension "txt" +} + +relationType "Test Case to Run Relation" { + guid "AAMFE+jMyBDK7CV479wA" + sideAName "Test Case" + sideAArtifactType "Test Case" + sideBName "Test Run" + sideBArtifactType "Test Run" + defaultOrderType Unordered + multiplicity ONE_TO_MANY +} + +relationType "Uses" { + guid "AAMFE_GV43rvba32QqwA" + sideAName "requirement" + sideAArtifactType "Requirement" + sideBName "Test Unit" + sideBArtifactType "Test Unit" + defaultOrderType Unordered + multiplicity MANY_TO_MANY +} |