test updated BLD200411301900
authordprusa@netbeans.org
Tue, 30 Nov 2004 15:17:46 +0000
changeset 5445990fa1ddaea2
parent 5444 a52fdceff448
child 5446 dbdd935e2804
test updated
mdr/test/unit/src/org/netbeans/mdr/test/StorageTest.java
     1.1 --- a/mdr/test/unit/src/org/netbeans/mdr/test/StorageTest.java	Mon Nov 29 19:22:40 2004 +0000
     1.2 +++ b/mdr/test/unit/src/org/netbeans/mdr/test/StorageTest.java	Tue Nov 30 15:17:46 2004 +0000
     1.3 @@ -72,7 +72,9 @@
     1.4              storage = factory.createStorage(new HashMap());
     1.5              storage.create (true, new Resolver());
     1.6              random = new Random(RAND_VAL);
     1.7 -            doSingleTest(storage, "btree");
     1.8 +            doSingleTest(storage, "btree", "test1");
     1.9 +            
    1.10 +            System.out.println("single test done");
    1.11              
    1.12              // memory storage, singlevalued index
    1.13              getLog().println();
    1.14 @@ -80,32 +82,39 @@
    1.15              getLog().println("memory storage, singlevalued index");
    1.16              getLog().println("-------------------------------------------------");
    1.17              factory = new StorageFactoryImpl ();
    1.18 -            storage = factory.createStorage(new HashMap());
    1.19 -            storage.create (true, new Resolver());
    1.20 +            Storage memStorage = factory.createStorage(new HashMap());
    1.21 +            memStorage.create (true, new Resolver());
    1.22              random = new Random(RAND_VAL);
    1.23 -            doSingleTest(storage, "memory");
    1.24 +            doSingleTest(memStorage, "memory", "test2");
    1.25 +            memStorage.close();
    1.26              
    1.27 +            System.out.println("single test (memory) done");
    1.28 +
    1.29              // btree storage, multivalued index
    1.30              getLog().println();
    1.31              getLog().println("*************************************************");
    1.32              getLog().println("btree storage, multivalued test");
    1.33              getLog().println("-------------------------------------------------");
    1.34              factory = new BtreeFactory();
    1.35 -            storage = factory.createStorage(new HashMap());
    1.36 -            storage.create (true, new Resolver());
    1.37 +            // storage = factory.createStorage(new HashMap());
    1.38 +            // storage.create (true, new Resolver());
    1.39              random = new Random(RAND_VAL);
    1.40 -            doMultiTest(storage, "btree");
    1.41 +            doMultiTest(storage, "btree", "test3");
    1.42  
    1.43 +            System.out.println("multivalued test done");
    1.44 +            
    1.45              // btree storage, several indexes
    1.46              getLog().println();
    1.47              getLog().println("*************************************************");
    1.48              getLog().println("btree storage, several indexes");
    1.49              getLog().println("-------------------------------------------------");
    1.50              factory = new BtreeFactory();
    1.51 -            storage = factory.createStorage(new HashMap());
    1.52 -            storage.create (true, new Resolver());
    1.53 +            // storage = factory.createStorage(new HashMap());
    1.54 +            // storage.create (true, new Resolver());
    1.55              random = new Random(RAND_VAL);
    1.56 -            doSeveralIndexesTest(storage, "btree");
    1.57 +            doSeveralIndexesTest(storage, "btree", "test4");
    1.58 +            
    1.59 +            System.out.println("several indexes test done");
    1.60              
    1.61              // btree storage, primary index
    1.62              getLog().println();
    1.63 @@ -113,36 +122,27 @@
    1.64              getLog().println("btree storage, primary index");
    1.65              getLog().println("-------------------------------------------------");
    1.66              factory = new BtreeFactory();
    1.67 -            storage = factory.createStorage(new HashMap());
    1.68 -            storage.create (true, new Resolver());
    1.69 +            // storage = factory.createStorage(new HashMap());
    1.70 +            // storage.create (true, new Resolver());
    1.71              random = new Random(RAND_VAL);
    1.72 -            doPrimaryIndexTest(storage, "btree");
    1.73 +            doPrimaryIndexTest(storage, "btree", "test5");
    1.74              
    1.75 -            /*
    1.76 -            // memory storage, multivalued index
    1.77 -            getLog().println();
    1.78 -            getLog().println("*************************************************");
    1.79 -            getLog().println("memory storage, multivalued test");
    1.80 -            getLog().println("-------------------------------------------------");
    1.81 -            factory = new StorageFactoryImpl ();
    1.82 -            storage = factory.createStorage(new HashMap());
    1.83 -            storage.create (true, new Resolver());
    1.84 -            random = new Random(RAND_VAL);
    1.85 -            doMultiTest(storage, "memory");
    1.86 -             */
    1.87 +            System.out.println("primary index test done");
    1.88 +            
    1.89 +            storage.close();
    1.90          } catch (Exception e) {
    1.91              e.printStackTrace ();
    1.92              fail (e.getMessage ());
    1.93          }
    1.94      }
    1.95      
    1.96 -    public void doSingleTest(Storage storage, String info) throws StorageException {
    1.97 +    public void doSingleTest(Storage storage, String info, String prefix) throws StorageException {
    1.98          final int KEYS_NUM = 10000;
    1.99          final int VALUES_NUM = 2000;
   1.100          final long OPS_NUM = 1000000;
   1.101          
   1.102          Storage.EntryType entryType = Storage.EntryType.MOFID;
   1.103 -        SinglevaluedIndex index = storage.createSinglevaluedIndex("singleIndex", entryType, entryType);
   1.104 +        SinglevaluedIndex index = storage.createSinglevaluedIndex(prefix + "singleIndex", entryType, entryType);
   1.105          MOFID[] keys = new MOFID[KEYS_NUM];
   1.106          MOFID[] values = new MOFID[VALUES_NUM];
   1.107          for (int x = 0; x < KEYS_NUM; x++) {
   1.108 @@ -188,7 +188,7 @@
   1.109              m.print(getLog());
   1.110          }
   1.111          time = System.currentTimeMillis();
   1.112 -        storage.close();
   1.113 +        // storage.close();
   1.114          
   1.115          totalTime += System.currentTimeMillis() - time;
   1.116          getLog().println();
   1.117 @@ -197,13 +197,13 @@
   1.118          getLog().println("#deletions: " + deletions);
   1.119      }
   1.120      
   1.121 -    public void doMultiTest(Storage storage, String info) throws StorageException {
   1.122 +    public void doMultiTest(Storage storage, String info, String prefix) throws StorageException {
   1.123          final int KEYS_NUM = 10000;
   1.124          final int VALUES_NUM = 2000;
   1.125          final long OPS_NUM = 1000000;
   1.126          
   1.127          Storage.EntryType entryType = Storage.EntryType.MOFID;
   1.128 -        MultivaluedIndex index = storage.createMultivaluedIndex("multiIndex", entryType, entryType, false);
   1.129 +        MultivaluedIndex index = storage.createMultivaluedIndex(prefix + "multiIndex", entryType, entryType, false);
   1.130          MOFID[] keys = new MOFID[KEYS_NUM];
   1.131          MOFID[] values = new MOFID[VALUES_NUM];
   1.132          for (int x = 0; x < KEYS_NUM; x++) {
   1.133 @@ -239,7 +239,7 @@
   1.134              m.print(getLog());
   1.135          }
   1.136          time = System.currentTimeMillis();
   1.137 -        storage.close();
   1.138 +        // storage.close();
   1.139          
   1.140          totalTime += System.currentTimeMillis() - time;
   1.141          getLog().println();
   1.142 @@ -248,7 +248,7 @@
   1.143          getLog().println("#deletions: " + deletions);
   1.144      }
   1.145  
   1.146 -    public void doSeveralIndexesTest(Storage storage, String info) throws StorageException {
   1.147 +    public void doSeveralIndexesTest(Storage storage, String info, String prefix) throws StorageException {
   1.148          final int KEYS_NUM = 10000;
   1.149          final int VALUES_NUM = 1000;
   1.150          final long OPS_NUM = 500000;
   1.151 @@ -268,15 +268,15 @@
   1.152          for (int x = 0; x < INDEXES_NUM; x++) {
   1.153              if (random.nextBoolean()) {
   1.154                  // singlevalued index
   1.155 -                indexes[x] = storage.createSinglevaluedIndex("index" + x, entryType, entryType);
   1.156 +                indexes[x] = storage.createSinglevaluedIndex(prefix + "index" + x, entryType, entryType);
   1.157              } else {
   1.158                  // multivalued index
   1.159                  boolean unique = random.nextBoolean();
   1.160                  boolean ordered = random.nextBoolean();
   1.161                  if (ordered) {
   1.162 -                    indexes[x] = storage.createMultivaluedOrderedIndex("index" + x, entryType, entryType, unique);
   1.163 +                    indexes[x] = storage.createMultivaluedOrderedIndex(prefix + "index" + x, entryType, entryType, unique);
   1.164                  } else {
   1.165 -                    indexes[x] = storage.createMultivaluedIndex("index" + x, entryType, entryType, unique);
   1.166 +                    indexes[x] = storage.createMultivaluedIndex(prefix + "index" + x, entryType, entryType, unique);
   1.167                  }
   1.168              }
   1.169          } // for
   1.170 @@ -319,7 +319,7 @@
   1.171                  }
   1.172              }
   1.173          }
   1.174 -        storage.close();
   1.175 +        // storage.close();
   1.176          totalTime = System.currentTimeMillis() - time;
   1.177          getLog().println();
   1.178          getLog().println(info + ", test time: " + totalTime);
   1.179 @@ -327,7 +327,7 @@
   1.180          getLog().println("#deletions: " + deletions);
   1.181      }
   1.182      
   1.183 -    public void doPrimaryIndexTest(Storage storage, String info) throws StorageException {
   1.184 +    public void doPrimaryIndexTest(Storage storage, String info, String prefix) throws StorageException {
   1.185          final int ITEMS_NUM = 8000;
   1.186          final long OPS_NUM = 500000;
   1.187          
   1.188 @@ -363,7 +363,7 @@
   1.189              m.print(getLog());
   1.190          }
   1.191          time = System.currentTimeMillis();
   1.192 -        storage.close();
   1.193 +        // storage.close();
   1.194          
   1.195          totalTime += System.currentTimeMillis() - time;
   1.196          getLog().println();
   1.197 @@ -412,7 +412,7 @@
   1.198              TreeMetrics m = ((Btree) index).computeMetrics();
   1.199              m.print();
   1.200          }
   1.201 -        storage.close();
   1.202 +        // storage.close();
   1.203          
   1.204          totalTime += System.currentTimeMillis() - time;
   1.205          getLog().println();
   1.206 @@ -450,7 +450,7 @@
   1.207                  coll.remove(random.nextInt(size));
   1.208              }
   1.209          }
   1.210 -        storage.close();
   1.211 +        // storage.close();
   1.212          getLog().println(info + ", test time: " + (System.currentTimeMillis() - time));
   1.213      }
   1.214       */