Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2009-01-08 18:12:07 +0000
committerddunne2009-01-08 18:12:07 +0000
commita833a30bfdc1ed207e6cc4b1d47c046c85471af3 (patch)
tree8c3d3860371030507e5aa82f5e60019d0843bfa0
parent3f67c62dee05a1496cf5182e019ca97b48ef8911 (diff)
downloadorg.eclipse.osee-a833a30bfdc1ed207e6cc4b1d47c046c85471af3.tar.gz
org.eclipse.osee-a833a30bfdc1ed207e6cc4b1d47c046c85471af3.tar.xz
org.eclipse.osee-a833a30bfdc1ed207e6cc4b1d47c046c85471af3.zip
-rw-r--r--org.eclipse.osee.framework.skynet.core.test/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/nonproduction/StaticIdManagerTest.java14
-rw-r--r--org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactCache.java4
3 files changed, 19 insertions, 2 deletions
diff --git a/org.eclipse.osee.framework.skynet.core.test/META-INF/MANIFEST.MF b/org.eclipse.osee.framework.skynet.core.test/META-INF/MANIFEST.MF
index 6ee7d293199..97f340ff726 100644
--- a/org.eclipse.osee.framework.skynet.core.test/META-INF/MANIFEST.MF
+++ b/org.eclipse.osee.framework.skynet.core.test/META-INF/MANIFEST.MF
@@ -31,6 +31,7 @@ Import-Package: org.eclipse.core.runtime,
org.eclipse.osee.framework.skynet.core.transaction,
org.osgi.framework;version="1.3.0"
Require-Bundle: org.junit,
- org.eclipse.osee.framework.skynet.core
+ org.eclipse.osee.framework.skynet.core,
+ org.eclipse.osee.framework.jdk.core;bundle-version="0.4.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.eclipse.osee.framework.skynet.core.test.nonproduction.components
diff --git a/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/nonproduction/StaticIdManagerTest.java b/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/nonproduction/StaticIdManagerTest.java
index 5760d02cc29..dba19076907 100644
--- a/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/nonproduction/StaticIdManagerTest.java
+++ b/org.eclipse.osee.framework.skynet.core.test/src/org/eclipse/osee/framework/skynet/core/test/nonproduction/StaticIdManagerTest.java
@@ -11,7 +11,9 @@ import junit.framework.TestCase;
import org.eclipse.osee.framework.db.connection.exception.ArtifactDoesNotExist;
import org.eclipse.osee.framework.db.connection.exception.MultipleArtifactsExist;
import org.eclipse.osee.framework.db.connection.exception.OseeCoreException;
+import org.eclipse.osee.framework.jdk.core.util.GUID;
import org.eclipse.osee.framework.skynet.core.artifact.Artifact;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactCache;
import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.artifact.GeneralData;
@@ -53,6 +55,18 @@ public class StaticIdManagerTest extends TestCase {
}
}
+ public void testStaticIdsGettingCached() throws OseeCoreException {
+ String staticId = "org." + GUID.generateGuidStr();
+ Collection<Artifact> artifacts = ArtifactCache.getArtifactsByStaticId(staticId);
+ assertTrue("Should be 0; Returned " + artifacts.size(), artifacts.size() == 0);
+ Artifact art = ArtifactTypeManager.addArtifact(GeneralData.ARTIFACT_TYPE, BranchManager.getCommonBranch());
+ art.addAttribute(StaticIdManager.STATIC_ID_ATTRIBUTE, staticId);
+ art.persistAttributesAndRelations();
+
+ artifacts = ArtifactCache.getArtifactsByStaticId(staticId);
+ assertTrue("Should be 1; Returned " + artifacts.size(), artifacts.size() == 1);
+ }
+
/**
* Test method for
* {@link org.eclipse.osee.framework.skynet.core.artifact.StaticIdManager#getSingletonArtifact(java.lang.String, java.lang.String, org.eclipse.osee.framework.skynet.core.artifact.Branch, boolean)}
diff --git a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactCache.java b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactCache.java
index 783d55931f4..c4b528b3b15 100644
--- a/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactCache.java
+++ b/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/ArtifactCache.java
@@ -81,7 +81,9 @@ public class ArtifactCache {
public static Collection<Artifact> getArtifactsByStaticId(String staticId) {
Set<Artifact> artifacts = new HashSet<Artifact>();
- for (Artifact artifact : instance.staticIdArtifactCache.getValues(staticId)) {
+ Collection<Artifact> cachedArts = instance.staticIdArtifactCache.getValues(staticId);
+ if (cachedArts == null) return artifacts;
+ for (Artifact artifact : cachedArts) {
if (!artifact.isDeleted()) artifacts.add(artifact);
}
return artifacts;

Back to the top