diff options
author | Roberto E. Escobar | 2014-01-28 00:46:59 +0000 |
---|---|---|
committer | Ryan D. Brooks | 2014-01-28 00:46:59 +0000 |
commit | 94558850317f840147f60d2fb2b6313eeb063bb9 (patch) | |
tree | 9984fcc2a9648f2ae85a456cb6397b6e65325926 /plugins | |
parent | 5e8012264791ed3dcbd7fdde5a663dade2eca475 (diff) | |
download | org.eclipse.osee-94558850317f840147f60d2fb2b6313eeb063bb9.tar.gz org.eclipse.osee-94558850317f840147f60d2fb2b6313eeb063bb9.tar.xz org.eclipse.osee-94558850317f840147f60d2fb2b6313eeb063bb9.zip |
bug: ArtifactQueryTest getArtifactListFromType fix
Fix test failure caused by incorrectly searching all branches
instead of just checking baseline branches. This resolves issues
caused by other tests creating and purging branches.
Change-Id: I956055c017220546e0fbcc1d6de19850649fb1b2
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java index e8ad60e3763..4f6df73e044 100644 --- a/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java +++ b/plugins/org.eclipse.osee.client.integration.tests/src/org/eclipse/osee/client/integration/tests/integration/skynet/core/ArtifactQueryTest.java @@ -11,23 +11,27 @@ package org.eclipse.osee.client.integration.tests.integration.skynet.core; import static org.eclipse.osee.client.demo.DemoChoice.OSEE_CLIENT_DEMO; -import static org.eclipse.osee.framework.core.enums.CoreArtifactTypes.SoftwareRequirement; import java.util.ArrayList; import java.util.HashMap; +import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Set; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.osee.client.demo.DemoBranches; import org.eclipse.osee.client.test.framework.OseeClientIntegrationRule; import org.eclipse.osee.client.test.framework.OseeLogMonitorRule; import org.eclipse.osee.client.test.framework.TestInfo; +import org.eclipse.osee.framework.core.data.IOseeBranch; +import org.eclipse.osee.framework.core.enums.BranchType; import org.eclipse.osee.framework.core.enums.CoreArtifactTypes; import org.eclipse.osee.framework.core.enums.CoreAttributeTypes; import org.eclipse.osee.framework.core.enums.DeletionFlag; import org.eclipse.osee.framework.core.exception.ArtifactDoesNotExist; import org.eclipse.osee.framework.core.model.Branch; import org.eclipse.osee.framework.core.model.TransactionRecord; +import org.eclipse.osee.framework.core.model.cache.BranchFilter; import org.eclipse.osee.framework.jdk.core.type.HashCollection; import org.eclipse.osee.framework.jdk.core.type.MatchLocation; import org.eclipse.osee.framework.jdk.core.type.OseeCoreException; @@ -106,23 +110,32 @@ public class ArtifactQueryTest { @Test public void testGetArtifactListFromType() throws OseeCoreException { - List<Artifact> artifacts = - ArtifactQuery.getArtifactListFromType(SoftwareRequirement, DemoBranches.SAW_Bld_1, - DeletionFlag.INCLUDE_DELETED); - - Assert.assertFalse("No artifacts found in testGetArtifactListFromType()", artifacts.isEmpty()); - - // ensure all of correct type - boolean pass = true; - - for (Artifact artifact : artifacts) { - if (!artifact.isOfType(SoftwareRequirement)) { - pass = false; - break; + // Should exist + Set<Artifact> searchedArtifacts = new LinkedHashSet<Artifact>(); + List<Branch> branches = BranchManager.getBranches(new BranchFilter(BranchType.BASELINE)); + for (IOseeBranch branch : branches) { + List<Artifact> results = + ArtifactQuery.getArtifactListFromType(CoreArtifactTypes.SoftwareRequirement, branch, + DeletionFlag.INCLUDE_DELETED); + searchedArtifacts.addAll(results); + } + // make sure at least one artifact exists + Assert.assertTrue("No artifacts found", searchedArtifacts.size() > 0); + + //check to see if there are multiple branches found + String firstGuid = ""; + Boolean pass = false; + for (Artifact a : searchedArtifacts) { + if ("" == firstGuid) { + firstGuid = a.getBranchGuid(); + } else { + if (firstGuid != a.getBranchGuid()) { + pass = true; + break; + } } } - - Assert.assertTrue("Artifact is not a Software Requirement", pass); + Assert.assertTrue("No artifacts on multiple branches found", pass); } @Test |