Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjmisinco2011-08-08 22:05:55 +0000
committerRyan D. Brooks2011-08-08 22:05:55 +0000
commita73624060f62976c03fba512bd9f623e5ee89756 (patch)
tree1e611a1b35a119702202dcd87ecc1e3128835aef /plugins/org.eclipse.osee.ote.define
parent5646155dee7c2fb868fe8f38f7cc6874beb4578a (diff)
downloadorg.eclipse.osee-a73624060f62976c03fba512bd9f623e5ee89756.tar.gz
org.eclipse.osee-a73624060f62976c03fba512bd9f623e5ee89756.tar.xz
org.eclipse.osee-a73624060f62976c03fba512bd9f623e5ee89756.zip
feature: Allow DetailTestStatus to pull traceability from imported artifacts
Diffstat (limited to 'plugins/org.eclipse.osee.ote.define')
-rw-r--r--plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/operations/OutfileToArtifactOperation.java24
-rw-r--r--plugins/org.eclipse.osee.ote.define/src/org/eclipse/osee/ote/define/utilities/OutfileDataCollector.java4
2 files changed, 26 insertions, 2 deletions
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
index 81719fa020..6189c1ec1b 100644
--- 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
@@ -17,8 +17,13 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.osee.framework.core.data.IOseeBranch;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreRelationTypes;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+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.OseeSystemArtifacts;
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;
@@ -44,13 +49,14 @@ public class OutfileToArtifactOperation {
public void execute(IProgressMonitor monitor) throws Exception {
this.results.clear();
monitor.setTaskName("Outfiles to Artifact Conversion...");
+ Artifact parent = getParentArtifact();
for (URI targetUri : filesToImport) {
TestRunOperator operator = null;
try {
operator = TestRunOperator.getNewArtifactWithOperator(branch);
OutfileDataCollector collector = getOutfileData(monitor, targetUri.toURL());
- collector.populate(operator.getTestRunArtifact());
+ collector.populate(operator.getTestRunArtifact(), parent);
String path = targetUri.toURL().toString();
operator.setLocalOutfileURI(path);
@@ -73,6 +79,22 @@ public class OutfileToArtifactOperation {
}
}
+ private Artifact getParentArtifact() throws OseeCoreException {
+ Artifact root = OseeSystemArtifacts.getDefaultHierarchyRootArtifact(branch);
+ Artifact testFolder = OseeSystemArtifacts.getOrCreateArtifact(CoreArtifactTypes.Folder, "Test", (Branch) branch);
+ if (!root.isRelated(CoreRelationTypes.Default_Hierarchical__Child, testFolder)) {
+ root.addChild(testFolder);
+ root.persist("New Test Folder");
+ }
+ Artifact scriptFolder =
+ OseeSystemArtifacts.getOrCreateArtifact(CoreArtifactTypes.Folder, "Test Script Results", (Branch) branch);
+ if (!testFolder.isRelated(CoreRelationTypes.Default_Hierarchical__Child, scriptFolder)) {
+ testFolder.addChild(scriptFolder);
+ testFolder.persist("New Test Script Results Folder");
+ }
+ return scriptFolder;
+ }
+
private void addChecksum(TestRunOperator operator, URL targetURL) throws Exception {
InputStream inputStream = null;
try {
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
index a7f3ac3b37..6499f70a7d 100644
--- 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
@@ -41,8 +41,9 @@ public class OutfileDataCollector implements IDataListener {
collectedData.put(name, value);
}
- public void populate(Artifact artifact) throws OseeCoreException {
+ public void populate(Artifact artifact, Artifact parent) throws OseeCoreException {
Conditions.checkNotNull(artifact, "artifact");
+ Conditions.checkNotNull(parent, "parent");
for (String fieldName : collectedData.keySet()) {
IAttributeType attributeType = oteToAttributeMap.getAttributeType(fieldName);
if (attributeType != null && artifact.isAttributeTypeValid(attributeType)) {
@@ -56,6 +57,7 @@ public class OutfileDataCollector implements IDataListener {
}
}
artifact.setName(getField(TestRunField.SCRIPT_NAME.name()));
+ parent.addChild(artifact);
}
public String getField(String name) {

Back to the top