Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2008-07-01 02:09:54 -0400
committerslewis2008-07-01 02:09:54 -0400
commitcdaa1f19b60694b9c2714ef5730762581c09cff9 (patch)
tree752b5347fc41ae4cc6acf8ba717a94f697438ae5
parent5cb366483db9db74c48615b0bb2216669460e4c4 (diff)
downloadorg.eclipse.ecf-cdaa1f19b60694b9c2714ef5730762581c09cff9.tar.gz
org.eclipse.ecf-cdaa1f19b60694b9c2714ef5730762581c09cff9.tar.xz
org.eclipse.ecf-cdaa1f19b60694b9c2714ef5730762581c09cff9.zip
Added ID store tests for longid
-rwxr-xr-xtests/bundles/org.eclipse.ecf.tests.storage/src/org/eclipse/ecf/tests/securestorage/IDStoreTest.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/bundles/org.eclipse.ecf.tests.storage/src/org/eclipse/ecf/tests/securestorage/IDStoreTest.java b/tests/bundles/org.eclipse.ecf.tests.storage/src/org/eclipse/ecf/tests/securestorage/IDStoreTest.java
index 13f2cf8d0..e015b5c59 100755
--- a/tests/bundles/org.eclipse.ecf.tests.storage/src/org/eclipse/ecf/tests/securestorage/IDStoreTest.java
+++ b/tests/bundles/org.eclipse.ecf.tests.storage/src/org/eclipse/ecf/tests/securestorage/IDStoreTest.java
@@ -67,6 +67,11 @@ public class IDStoreTest extends TestCase {
return idStore.store(newID);
}
+ protected IIDEntry addLongID(long value) throws IDCreateException {
+ final ID newID = IDFactory.getDefault().createLongID(value);
+ return idStore.store(newID);
+ }
+
public void testStoreGUID() throws Exception {
final ISecurePreferences prefs = addGUID().getPreferences();
assertNotNull(prefs);
@@ -78,6 +83,12 @@ public class IDStoreTest extends TestCase {
testStoreGUID();
}
+ public void testStoreLongIDs() throws Exception {
+ addLongID(1);
+ addLongID(2);
+ addLongID(3);
+ }
+
public void testListEmptyNamespaces() throws Exception {
final INamespaceEntry[] namespaces = idStore.getNamespaceEntries();
assertNotNull(namespaces);
@@ -120,6 +131,21 @@ public class IDStoreTest extends TestCase {
assertTrue(persistedGUID.equals(newGUID));
}
+ public void testGetLongIDEntries() throws Exception {
+ final ID newLongID = IDFactory.getDefault().createLongID(1);
+ idStore.store(newLongID);
+ // Get namespace entry
+ final INamespaceEntry namespaceEntry = idStore.getNamespaceEntry(newLongID.getNamespace());
+ assertNotNull(namespaceEntry);
+
+ final IIDEntry[] idEntries = namespaceEntry.getIDEntries();
+ assertTrue(idEntries.length == 1);
+ // Create LongID from idEntry
+ final ID persistedLongID = idEntries[0].createID();
+ assertNotNull(persistedLongID);
+ assertTrue(persistedLongID.equals(newLongID));
+ }
+
public void testCreateAssociation() throws Exception {
// Create two GUIDs and store them in idStore
final ID guid1 = IDFactory.getDefault().createGUID();
@@ -171,6 +197,9 @@ public class IDStoreTest extends TestCase {
// Get entry1a
final IIDEntry entry1a = idStore.store(guid1);
assertNotNull(entry1a);
+ final ID guid1a = entry1a.createID();
+ System.out.println("guid1a=" + guid1a);
+ assertTrue(guid1.equals(guid1a));
// Get associates (should include entry2)
final IIDEntry[] entries1 = entry1a.getAssociates(key1);

Back to the top