1 package mir.storage.store.test;
6 * Copyright: Copyright (c) 2002
12 import mir.storage.store.*;
14 public class TestStore {
16 private static ObjectStore o_store = ObjectStore.getInstance();
22 public static void main(String[] args) {
23 long startTime = System.currentTimeMillis();
24 System.out.println("Starting testrun on ObjectStore...");
25 TestStore testStore1 = new TestStore();
26 testStore1.startTest();
27 System.out.println("Finished testrun on ObjectStore. ("
28 + (System.currentTimeMillis() - startTime) + " ms)");
31 public void startTest() {
33 EntityC1 c1 = new EntityC1("1");
34 o_store.add(c1.getStoreIdentifier());
35 EntityC1 c12 = new EntityC1("2");
36 o_store.add(c12.getStoreIdentifier());
37 o_store.add(c12.getStoreIdentifier()); // should not be added as it's there already
40 for (int i=0; i<20; i++) {
41 c2 = new EntityC2(""+i);
42 o_store.add(c2.getStoreIdentifier());
43 } // should contain only 10
45 // test cycle: search in store
47 StorableObject reference; StoreIdentifier search_sid;
49 // search for EntityC1
50 search_sid=new StoreIdentifier(EntityC1.class,"1");
51 reference=o_store.use(search_sid);
53 System.out.println("--- should have found" + search_sid.toString());
55 search_sid=new StoreIdentifier(EntityC1.class,"A");
56 reference=o_store.use(search_sid);
58 System.out.println("--- should not have found" + search_sid.toString());
60 search_sid=new StoreIdentifier(EntityC3.class,"1");
61 reference=o_store.use(search_sid);
63 System.out.println("--- should not have found" + search_sid.toString());
66 System.out.println(o_store.toString());
67 /** @todo compare values of store and state failed if values are not
70 /** @todo test cycle: search in store */
71 /** @todo test cycle: invalidation */