Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.coverage.test/src/org/eclipse/osee/coverage/test/util/CoverageTestUtil.java')
-rw-r--r--plugins/org.eclipse.osee.coverage.test/src/org/eclipse/osee/coverage/test/util/CoverageTestUtil.java184
1 files changed, 92 insertions, 92 deletions
diff --git a/plugins/org.eclipse.osee.coverage.test/src/org/eclipse/osee/coverage/test/util/CoverageTestUtil.java b/plugins/org.eclipse.osee.coverage.test/src/org/eclipse/osee/coverage/test/util/CoverageTestUtil.java
index ef3e30f154a..503a9f6c9ee 100644
--- a/plugins/org.eclipse.osee.coverage.test/src/org/eclipse/osee/coverage/test/util/CoverageTestUtil.java
+++ b/plugins/org.eclipse.osee.coverage.test/src/org/eclipse/osee/coverage/test/util/CoverageTestUtil.java
@@ -8,95 +8,95 @@
* Contributors:
* Boeing - initial API and implementation
*******************************************************************************/
-package org.eclipse.osee.coverage.test.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.eclipse.osee.coverage.model.CoverageItem;
-import org.eclipse.osee.coverage.model.CoverageOption;
-import org.eclipse.osee.coverage.model.CoveragePackageBase;
-import org.eclipse.osee.coverage.model.CoverageUnit;
-import org.eclipse.osee.coverage.model.ICoverage;
-import org.eclipse.osee.coverage.store.CoverageArtifactTypes;
-import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
-import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
-import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
-import org.eclipse.osee.framework.skynet.core.artifact.PurgeArtifacts;
-import org.eclipse.osee.framework.skynet.core.artifact.StaticIdManager;
-
-/**
- * @author Donald G. Dunne
- */
-public class CoverageTestUtil {
- private static String COVERAGE_STATIC_ID = "coverage.artifact";
-
- public static void cleanupCoverageTests() throws OseeCoreException {
- try {
- new PurgeArtifacts(getAllCoverageArtifacts()).execute();
- } catch (ArtifactDoesNotExist ex) {
- // do nothing
- }
- }
-
- /**
- * Adds the static id to the artifact to ensure that test cleans (purges) this artifact after completion.
- */
- public static void registerAsTestArtifact(Artifact artifact) throws OseeCoreException {
- registerAsTestArtifact(artifact, false);
- }
-
- /**
- * Adds the static id to the artifact to ensure that test cleans (purges) this artifact after completion.
- */
- public static void registerAsTestArtifact(Artifact artifact, boolean recurse) throws OseeCoreException {
- StaticIdManager.setSingletonAttributeValue(artifact, CoverageTestUtil.COVERAGE_STATIC_ID);
- if (recurse) {
- for (Artifact childArt : artifact.getChildren()) {
- if (childArt.isOfType(CoverageArtifactTypes.CoveragePackage) || childArt.isOfType(CoverageArtifactTypes.CoveragePackage)) {
- registerAsTestArtifact(childArt, recurse);
- }
- }
- }
- }
-
- public static ICoverage getFirstCoverageByName(CoveragePackageBase coveragePackageBase, String name) {
- for (ICoverage coverage : coveragePackageBase.getChildren(true)) {
- if (coverage.getName().equals(name)) {
- return coverage;
- }
- }
- return null;
- }
-
- public static Collection<Artifact> getAllCoverageArtifacts() throws OseeCoreException {
- List<Artifact> artifacts = new ArrayList<Artifact>();
- artifacts.addAll(getCoveragePackageArtifacts());
- artifacts.addAll(getCoverageUnitArtifacts());
- artifacts.addAll(getCoverageRecordArtifacts());
- return artifacts;
- }
-
- public static Collection<Artifact> getCoverageUnitArtifacts() throws OseeCoreException {
- return StaticIdManager.getArtifactsFromArtifactQuery(CoverageArtifactTypes.CoverageUnit, COVERAGE_STATIC_ID,
- BranchManager.getCommonBranch());
- }
-
- public static Collection<Artifact> getCoveragePackageArtifacts() throws OseeCoreException {
- return StaticIdManager.getArtifactsFromArtifactQuery(CoverageArtifactTypes.CoveragePackage, COVERAGE_STATIC_ID,
- BranchManager.getCommonBranch());
- }
-
- public static Collection<Artifact> getCoverageRecordArtifacts() throws OseeCoreException {
- return StaticIdManager.getArtifactsFromArtifactQuery(CoreArtifactTypes.GeneralDocument, COVERAGE_STATIC_ID,
- BranchManager.getCommonBranch());
- }
-
- public static void setAllCoverageMethod(CoverageUnit coverageUnit, CoverageOption CoverageOption, boolean recurse) {
- for (CoverageItem item : coverageUnit.getCoverageItems(recurse)) {
- item.setCoverageMethod(CoverageOption);
- }
- }
-}
+package org.eclipse.osee.coverage.test.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.osee.coverage.model.CoverageItem;
+import org.eclipse.osee.coverage.model.CoverageOption;
+import org.eclipse.osee.coverage.model.CoveragePackageBase;
+import org.eclipse.osee.coverage.model.CoverageUnit;
+import org.eclipse.osee.coverage.model.ICoverage;
+import org.eclipse.osee.coverage.store.CoverageArtifactTypes;
+import org.eclipse.osee.framework.core.enums.CoreArtifactTypes;
+import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
+import org.eclipse.osee.framework.skynet.core.artifact.PurgeArtifacts;
+import org.eclipse.osee.framework.skynet.core.artifact.StaticIdManager;
+
+/**
+ * @author Donald G. Dunne
+ */
+public class CoverageTestUtil {
+ private static String COVERAGE_STATIC_ID = "coverage.artifact";
+
+ public static void cleanupCoverageTests() throws OseeCoreException {
+ try {
+ new PurgeArtifacts(getAllCoverageArtifacts()).execute();
+ } catch (ArtifactDoesNotExist ex) {
+ // do nothing
+ }
+ }
+
+ /**
+ * Adds the static id to the artifact to ensure that test cleans (purges) this artifact after completion.
+ */
+ public static void registerAsTestArtifact(Artifact artifact) throws OseeCoreException {
+ registerAsTestArtifact(artifact, false);
+ }
+
+ /**
+ * Adds the static id to the artifact to ensure that test cleans (purges) this artifact after completion.
+ */
+ public static void registerAsTestArtifact(Artifact artifact, boolean recurse) throws OseeCoreException {
+ StaticIdManager.setSingletonAttributeValue(artifact, CoverageTestUtil.COVERAGE_STATIC_ID);
+ if (recurse) {
+ for (Artifact childArt : artifact.getChildren()) {
+ if (childArt.isOfType(CoverageArtifactTypes.CoveragePackage) || childArt.isOfType(CoverageArtifactTypes.CoveragePackage)) {
+ registerAsTestArtifact(childArt, recurse);
+ }
+ }
+ }
+ }
+
+ public static ICoverage getFirstCoverageByName(CoveragePackageBase coveragePackageBase, String name) {
+ for (ICoverage coverage : coveragePackageBase.getChildren(true)) {
+ if (coverage.getName().equals(name)) {
+ return coverage;
+ }
+ }
+ return null;
+ }
+
+ public static Collection<Artifact> getAllCoverageArtifacts() throws OseeCoreException {
+ List<Artifact> artifacts = new ArrayList<Artifact>();
+ artifacts.addAll(getCoveragePackageArtifacts());
+ artifacts.addAll(getCoverageUnitArtifacts());
+ artifacts.addAll(getCoverageRecordArtifacts());
+ return artifacts;
+ }
+
+ public static Collection<Artifact> getCoverageUnitArtifacts() throws OseeCoreException {
+ return StaticIdManager.getArtifactsFromArtifactQuery(CoverageArtifactTypes.CoverageUnit, COVERAGE_STATIC_ID,
+ BranchManager.getCommonBranch());
+ }
+
+ public static Collection<Artifact> getCoveragePackageArtifacts() throws OseeCoreException {
+ return StaticIdManager.getArtifactsFromArtifactQuery(CoverageArtifactTypes.CoveragePackage, COVERAGE_STATIC_ID,
+ BranchManager.getCommonBranch());
+ }
+
+ public static Collection<Artifact> getCoverageRecordArtifacts() throws OseeCoreException {
+ return StaticIdManager.getArtifactsFromArtifactQuery(CoreArtifactTypes.GeneralDocument, COVERAGE_STATIC_ID,
+ BranchManager.getCommonBranch());
+ }
+
+ public static void setAllCoverageMethod(CoverageUnit coverageUnit, CoverageOption CoverageOption, boolean recurse) {
+ for (CoverageItem item : coverageUnit.getCoverageItems(recurse)) {
+ item.setCoverageMethod(CoverageOption);
+ }
+ }
+}

Back to the top