Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Recreate li 907 branch.

  • Loading branch information...
commit 08da446f53f9a1f98a094d7a35556859236fc438 2 parents 766a896 + 799800f
jkreps authored January 30, 2009
27  build.xml
@@ -27,23 +27,7 @@
27 27
     </sequential>
28 28
   </macrodef>
29 29
 
30  
-  <target name="all" depends="clean, jar, war, test" description="Build all artifacts." />
31  
-
32  
-  <target name="usage">
33  
-    <echo message=""/>
34  
-    <echo message="${name} build file"/>
35  
-    <echo message="-----------------------------------"/>
36  
-    <echo message=""/>
37  
-    <echo message="Available targets are:"/>
38  
-    <echo message=""/>
39  
-    <echo message="build -- Build the application"/>
40  
-    <echo message="client -- Build a jar file for clients to use"/>
41  
-    <echo message="jar -- Build a jar file for the client."/>
42  
-    <echo message="war -- Build a war file for deploying the server to a servlet container"/>
43  
-    <echo message="docs -- Create html documentation"/>
44  
-    <echo message="clean -- Delete generated files"/>
45  
-    <echo message=""/>
46  
-  </target>
  30
+  <target name="all" depends="clean, srcjar, jar, war, test" description="Build all artifacts." />
47 31
 
48 32
   <target name="clean" description="Delete generated files.">
49 33
     <delete dir="${dist.dir}" />
@@ -83,6 +67,15 @@
83 67
       </fileset>
84 68
     </jar>
85 69
   </target>
  70
+    
  71
+  <target name="srcjar" description="Build source jar file">
  72
+    <mkdir dir="${dist.dir}"/>
  73
+    <jar destfile="${dist.dir}/${name}-${curr.release}-src.jar">
  74
+      <fileset dir="${java.dir}">
  75
+        <include name="**/*.java"/>
  76
+      </fileset>
  77
+    </jar>
  78
+  </target>
86 79
   
87 80
   <target name="utils" depends="build" description="Build a jar file with voldemort util classes.">
88 81
     <tstamp>
20  src/java/voldemort/serialization/json/JsonTypeSerializer.java
@@ -203,8 +203,7 @@ private Object read(DataInputStream stream, Object type) throws IOException {
203 203
         }
204 204
     }
205 205
 
206  
-    private void writeBoolean(DataOutputStream output, Boolean o) throws IOException {
207  
-        Boolean b = (Boolean) o;
  206
+    private void writeBoolean(DataOutputStream output, Boolean b) throws IOException {
208 207
         if(b == null)
209 208
             output.writeByte(-1);
210 209
         else if(b.booleanValue())
@@ -329,8 +328,7 @@ private Byte readInt8(DataInputStream stream) throws IOException {
329 328
             return b;
330 329
     }
331 330
 
332  
-    private void writeInt8(DataOutputStream output, Byte o) throws IOException {
333  
-        Byte b = (Byte) o;
  331
+    private void writeInt8(DataOutputStream output, Byte b) throws IOException {
334 332
         if(b == null)
335 333
             output.writeByte(Byte.MIN_VALUE);
336 334
         else if(b.byteValue() == Byte.MIN_VALUE)
@@ -349,8 +347,7 @@ private Short readInt16(DataInputStream stream) throws IOException {
349 347
             return s;
350 348
     }
351 349
 
352  
-    private void writeInt16(DataOutputStream output, Short o) throws IOException {
353  
-        Short s = (Short) o;
  350
+    private void writeInt16(DataOutputStream output, Short s) throws IOException {
354 351
         if(s == null)
355 352
             output.writeShort(Short.MIN_VALUE);
356 353
         else if(s.shortValue() == Short.MIN_VALUE)
@@ -369,8 +366,7 @@ private Integer readInt32(DataInputStream stream) throws IOException {
369 366
             return i;
370 367
     }
371 368
 
372  
-    private void writeInt32(DataOutputStream output, Integer o) throws IOException {
373  
-        Integer i = (Integer) o;
  369
+    private void writeInt32(DataOutputStream output, Integer i) throws IOException {
374 370
         if(i == null)
375 371
             output.writeInt(Integer.MIN_VALUE);
376 372
         else if(i.intValue() == Integer.MIN_VALUE)
@@ -389,8 +385,7 @@ private Long readInt64(DataInputStream stream) throws IOException {
389 385
             return l;
390 386
     }
391 387
 
392  
-    private void writeInt64(DataOutputStream output, Long o) throws IOException {
393  
-        Long l = (Long) o;
  388
+    private void writeInt64(DataOutputStream output, Long l) throws IOException {
394 389
         if(l == null)
395 390
             output.writeLong(Long.MIN_VALUE);
396 391
         else if(l.longValue() == Long.MIN_VALUE)
@@ -409,8 +404,7 @@ private Float readFloat32(DataInputStream stream) throws IOException {
409 404
             return f;
410 405
     }
411 406
 
412  
-    private void writeFloat32(DataOutputStream output, Float o) throws IOException {
413  
-        Float f = (Float) o;
  407
+    private void writeFloat32(DataOutputStream output, Float f) throws IOException {
414 408
         if(f == null)
415 409
             output.writeFloat(Float.MIN_VALUE);
416 410
         else if(f.floatValue() == Float.MIN_VALUE)
@@ -470,7 +464,7 @@ else if(d.getTime() == Long.MIN_VALUE)
470 464
     }
471 465
 
472 466
     private byte[] readBytes(DataInputStream stream) throws IOException {
473  
-        int size = (int) stream.readShort();
  467
+        int size = stream.readShort();
474 468
         if(size < 0)
475 469
             return null;
476 470
         byte[] bytes = new byte[size];
3  src/java/voldemort/server/storage/StorageService.java
@@ -136,6 +136,7 @@ protected void startInner() {
136 136
         Cluster cluster = this.metadataStore.getCluster();
137 137
         List<StoreDefinition> storeDefs = this.metadataStore.getStores();
138 138
         logger.info("Initializing stores:");
  139
+        Time time = new SystemTime();
139 140
         for(StoreDefinition def: storeDefs) {
140 141
             if(!def.getName().equals(MetadataStore.METADATA_STORE_NAME)) {
141 142
                 logger.info("Opening " + def.getName() + ".");
@@ -157,7 +158,7 @@ protected void startInner() {
157 158
                                                    routingStrategy);
158 159
                 }
159 160
                 if(voldemortConfig.isVerboseLoggingEnabled())
160  
-                    store = new LoggingStore<byte[], byte[]>(store);
  161
+                    store = new LoggingStore<byte[], byte[]>(store, cluster.getName(), time);
161 162
                 if(voldemortConfig.isStatTrackingEnabled())
162 163
                     store = new StatTrackingStore<byte[], byte[]>(store);
163 164
                 this.localStoreMap.put(def.getName(), store);
2  src/java/voldemort/store/StorageEngineType.java
@@ -72,4 +72,4 @@ public static StorageEngineType fromDisplay(String type) {
72 72
     public String toDisplay() {
73 73
         return text;
74 74
     }
75  
-};
  75
+}
15  src/java/voldemort/store/bdb/BdbStorageEngine.java
@@ -66,7 +66,8 @@
66 66
 
67 67
     public BdbStorageEngine(String name, Environment environment, Database database) {
68 68
         assertNotNull("The store name cannot be null.", name);
69  
-        assertNotNull("The database cannot be null.", name);
  69
+        assertNotNull("The database cannot be null.", database);
  70
+        assertNotNull("The environment cannot be null.", environment);
70 71
         this.name = name;
71 72
         this.bdbDatabase = database;
72 73
         this.environment = environment;
@@ -246,12 +247,11 @@ public int hashCode() {
246 247
         return name.hashCode();
247 248
     }
248 249
 
249  
-    @SuppressWarnings("unchecked")
250 250
     public boolean equals(Object o) {
251  
-        if(o == null || !Store.class.equals(o.getClass()))
  251
+        if(o == null || !Store.class.isAssignableFrom(o.getClass()))
252 252
             return false;
253  
-        Store s = (Store) o;
254  
-        return s.getName().equals(o);
  253
+        Store<?, ?> s = (Store<?, ?>) o;
  254
+        return s.getName().equals(s.getName());
255 255
     }
256 256
 
257 257
     public void close() throws PersistenceFailureException {
@@ -280,7 +280,8 @@ private void attemptCommit(Transaction transaction) {
280 280
         }
281 281
     }
282 282
 
283  
-    private class BdbStoreIterator implements ClosableIterator<Entry<byte[], Versioned<byte[]>>> {
  283
+    private static class BdbStoreIterator implements
  284
+            ClosableIterator<Entry<byte[], Versioned<byte[]>>> {
284 285
 
285 286
         private volatile boolean isOpen;
286 287
         private final Cursor cursor;
@@ -350,7 +351,7 @@ public void close() {
350 351
         }
351 352
 
352 353
         @Override
353  
-        public void finalize() {
  354
+        protected void finalize() {
354 355
             if(isOpen) {
355 356
                 logger.error("Failure to close cursor, will be forcably closed.");
356 357
                 close();
5  src/java/voldemort/store/gzip/GzipStore.java
@@ -27,7 +27,6 @@
27 27
 import voldemort.VoldemortException;
28 28
 import voldemort.store.DelegatingStore;
29 29
 import voldemort.store.Store;
30  
-import voldemort.versioning.VectorClock;
31 30
 import voldemort.versioning.Versioned;
32 31
 
33 32
 /**
@@ -48,7 +47,7 @@ public GzipStore(Store<K, byte[]> innerStore) {
48 47
         try {
49 48
             for(Versioned<byte[]> item: found)
50 49
                 results.add(new Versioned<byte[]>(IOUtils.toByteArray(new GZIPInputStream(new ByteArrayInputStream(item.getValue()))),
51  
-                                                  (VectorClock) item.getVersion()));
  50
+                                                  item.getVersion()));
52 51
         } catch(IOException e) {
53 52
             throw new VoldemortException(e);
54 53
         }
@@ -60,7 +59,7 @@ public void put(K key, Versioned<byte[]> value) throws VoldemortException {
60 59
         try {
61 60
             getInnerStore().put(key,
62 61
                                 new Versioned<byte[]>(IOUtils.toByteArray(new GZIPInputStream(new ByteArrayInputStream(value.getValue()))),
63  
-                                                      (VectorClock) value.getVersion()));
  62
+                                                      value.getVersion()));
64 63
         } catch(IOException e) {
65 64
             throw new VoldemortException(e);
66 65
         }
57  src/java/voldemort/store/logging/LoggingStore.java
@@ -38,18 +38,39 @@
38 38
 
39 39
     private final Logger logger;
40 40
     private final Time time;
41  
-    private final String storeType;
  41
+    private final String instanceName;
42 42
 
  43
+    /**
  44
+     * Create a logging store that wraps the given store
  45
+     * 
  46
+     * @param store The store to wrap
  47
+     */
43 48
     public LoggingStore(Store<K, V> store) {
44 49
         this(store, new SystemTime());
45 50
     }
46 51
 
  52
+    /**
  53
+     * Create a logging store that wraps the given store
  54
+     * 
  55
+     * @param store The store to wrap
  56
+     * @param time The time implementation to use for computing ellapsed time
  57
+     */
47 58
     public LoggingStore(Store<K, V> store, Time time) {
  59
+        this(store, null, time);
  60
+    }
  61
+
  62
+    /**
  63
+     * Create a logging store that wraps the given store
  64
+     * 
  65
+     * @param store The store to wrap
  66
+     * @param instance The instance name to display in logging messages
  67
+     * @param time The time implementation to use for computing ellapsed time
  68
+     */
  69
+    public LoggingStore(Store<K, V> store, String instance, Time time) {
48 70
         super(store);
49 71
         this.logger = Logger.getLogger(store.getClass());
50 72
         this.time = time;
51  
-        String name = store.getClass().getName();
52  
-        this.storeType = name.substring(Math.max(0, name.lastIndexOf('.')), name.length());
  73
+        this.instanceName = instance == null ? ": " : instance + ": ";
53 74
     }
54 75
 
55 76
     @Override
@@ -70,12 +91,7 @@ public boolean delete(K key, Version version) throws VoldemortException {
70 91
             succeeded = true;
71 92
             return deletedSomething;
72 93
         } finally {
73  
-            if(logger.isDebugEnabled()) {
74  
-                double elapsedMs = (time.getNanoseconds() - startTimeNs) / (double) Time.NS_PER_MS;
75  
-                logger.debug("DELETE from store '" + getName() + "' completed "
76  
-                             + (succeeded ? "successfully" : "unsuccessfully") + " in " + elapsedMs
77  
-                             + " ms.");
78  
-            }
  94
+            printTimedMessage("DELETE", succeeded, startTimeNs);
79 95
         }
80 96
     }
81 97
 
@@ -90,12 +106,7 @@ public boolean delete(K key, Version version) throws VoldemortException {
90 106
             succeeded = true;
91 107
             return l;
92 108
         } finally {
93  
-            if(logger.isDebugEnabled()) {
94  
-                double elapsedMs = (time.getNanoseconds() - startTimeNs) / (double) Time.NS_PER_MS;
95  
-                logger.debug("GET from store '" + getName() + "' completed "
96  
-                             + (succeeded ? "successfully" : "unsuccessfully") + " in " + elapsedMs
97  
-                             + " ms.");
98  
-            }
  109
+            printTimedMessage("GET", succeeded, startTimeNs);
99 110
         }
100 111
     }
101 112
 
@@ -110,12 +121,16 @@ public void put(K key, Versioned<V> value) throws VoldemortException {
110 121
             getInnerStore().put(key, value);
111 122
             succeeded = true;
112 123
         } finally {
113  
-            if(logger.isDebugEnabled()) {
114  
-                double elapsedMs = (time.getNanoseconds() - startTimeNs) / (double) Time.NS_PER_MS;
115  
-                logger.debug("PUT from store '" + getName() + "' completed "
116  
-                             + (succeeded ? "successfully" : "unsuccessfully") + " in " + elapsedMs
117  
-                             + " ms.");
118  
-            }
  124
+            printTimedMessage("PUT", succeeded, startTimeNs);
  125
+        }
  126
+    }
  127
+
  128
+    private void printTimedMessage(String operation, boolean success, long startNs) {
  129
+        if(logger.isDebugEnabled()) {
  130
+            double elapsedMs = (time.getNanoseconds() - startNs) / (double) Time.NS_PER_MS;
  131
+            logger.debug(instanceName + operation + " operation on store '" + getName()
  132
+                         + "' completed " + (success ? "successfully" : "unsuccessfully") + " in "
  133
+                         + elapsedMs + " ms.");
119 134
         }
120 135
     }
121 136
 
5  src/java/voldemort/store/serialized/SerializingStore.java
@@ -23,7 +23,6 @@
23 23
 import voldemort.serialization.Serializer;
24 24
 import voldemort.store.Store;
25 25
 import voldemort.utils.Utils;
26  
-import voldemort.versioning.VectorClock;
27 26
 import voldemort.versioning.Version;
28 27
 import voldemort.versioning.Versioned;
29 28
 
@@ -58,7 +57,7 @@ public boolean delete(K key, Version version) throws VoldemortException {
58 57
         List<Versioned<V>> results = new ArrayList<Versioned<V>>(found.size());
59 58
         for(Versioned<byte[]> versioned: found)
60 59
             results.add(new Versioned<V>(valueSerializer.toObject(versioned.getValue()),
61  
-                                         (VectorClock) versioned.getVersion()));
  60
+                                         versioned.getVersion()));
62 61
         return results;
63 62
     }
64 63
 
@@ -69,7 +68,7 @@ public String getName() {
69 68
     public void put(K key, Versioned<V> value) throws VoldemortException {
70 69
         store.put(keySerializer.toBytes(key),
71 70
                   new Versioned<byte[]>(valueSerializer.toBytes(value.getValue()),
72  
-                                        (VectorClock) value.getVersion()));
  71
+                                        value.getVersion()));
73 72
     }
74 73
 
75 74
     public void close() {
2  src/java/voldemort/store/slop/Slop.java
@@ -48,7 +48,7 @@ private Operation(byte opCode) {
48 48
         public byte getOpCode() {
49 49
             return opCode;
50 50
         }
51  
-    };
  51
+    }
52 52
 
53 53
     final private byte[] key;
54 54
     final private byte[] value;
2  src/java/voldemort/store/slop/SloppyStore.java
@@ -30,8 +30,6 @@
30 30
 import voldemort.versioning.Version;
31 31
 import voldemort.versioning.Versioned;
32 32
 
33  
-;
34  
-
35 33
 /**
36 34
  * A Sloppy store is a store wrapper that delegates to an inner store, and if
37 35
  * that store fails, instead stores some slop in the first of a list of backup
6  src/java/voldemort/store/socket/SocketStore.java
@@ -64,7 +64,7 @@ public void close() throws VoldemortException {
64 64
 
65 65
     public boolean delete(byte[] key, Version version) throws VoldemortException {
66 66
         StoreUtils.assertValidKey(key);
67  
-        SocketAndStreams sands = (SocketAndStreams) pool.checkout(destination);
  67
+        SocketAndStreams sands = pool.checkout(destination);
68 68
         try {
69 69
             DataOutputStream outputStream = sands.getOutputStream();
70 70
             outputStream.writeByte(VoldemortOpCode.DELETE_OP_CODE);
@@ -88,7 +88,7 @@ public boolean delete(byte[] key, Version version) throws VoldemortException {
88 88
 
89 89
     public List<Versioned<byte[]>> get(byte[] key) throws VoldemortException {
90 90
         StoreUtils.assertValidKey(key);
91  
-        SocketAndStreams sands = (SocketAndStreams) pool.checkout(destination);
  91
+        SocketAndStreams sands = pool.checkout(destination);
92 92
         try {
93 93
             DataOutputStream outputStream = sands.getOutputStream();
94 94
             outputStream.writeByte(VoldemortOpCode.GET_OP_CODE);
@@ -120,7 +120,7 @@ public boolean delete(byte[] key, Version version) throws VoldemortException {
120 120
 
121 121
     public void put(byte[] key, Versioned<byte[]> value) throws VoldemortException {
122 122
         StoreUtils.assertValidKey(key);
123  
-        SocketAndStreams sands = (SocketAndStreams) pool.checkout(destination);
  123
+        SocketAndStreams sands = pool.checkout(destination);
124 124
         try {
125 125
             DataOutputStream outputStream = sands.getOutputStream();
126 126
             outputStream.writeByte(VoldemortOpCode.PUT_OP_CODE);
8  src/java/voldemort/utils/ByteUtils.java
@@ -422,6 +422,10 @@ public static String getString(byte[] bytes, String encoding) {
422 422
      * Compare two byte arrays. Two arrays are equal if they are the same size
423 423
      * and have the same contents. Otherwise b1 is smaller iff it is a prefix of
424 424
      * b2 or for the first index i for which b1[i] != b2[i], b1[i] < b2[i].
  425
+     * <p>
  426
+     * <strong> bytes are considered unsigned. passing negative values into byte
  427
+     * will cause them to be considered as unsigned two's complement value.
  428
+     * </strong>
425 429
      * 
426 430
      * @param b1 The first array
427 431
      * @param b2 The second array
@@ -432,9 +436,9 @@ public static int compare(byte[] b1, byte[] b2) {
432 436
             int a = (b1[i] & 0xff);
433 437
             int b = (b2[j] & 0xff);
434 438
             if(a != b) {
435  
-                return a - b;
  439
+                return (a - b) / (Math.abs(a - b));
436 440
             }
437 441
         }
438  
-        return b1.length - b2.length;
  442
+        return (b1.length - b2.length) / (Math.max(1, Math.abs(b1.length - b2.length)));
439 443
     }
440 444
 }
12  src/java/voldemort/versioning/VectorClock.java
@@ -116,7 +116,7 @@ public VectorClock(byte[] bytes, int offset) {
116 116
         // write the number of versions
117 117
         ByteUtils.writeShort(serialized, (short) versions.size(), 0);
118 118
         // write the size of each version in bytes
119  
-        byte versionSize = (byte) ByteUtils.numberOfBytesRequired(getMaxVersion());
  119
+        byte versionSize = ByteUtils.numberOfBytesRequired(getMaxVersion());
120 120
         serialized[2] = versionSize;
121 121
 
122 122
         int clockEntrySize = ByteUtils.SIZE_OF_SHORT + versionSize;
@@ -134,7 +134,7 @@ public VectorClock(byte[] bytes, int offset) {
134 134
     }
135 135
 
136 136
     public int sizeInBytes() {
137  
-        byte versionSize = (byte) ByteUtils.numberOfBytesRequired(getMaxVersion());
  137
+        byte versionSize = ByteUtils.numberOfBytesRequired(getMaxVersion());
138 138
         return ByteUtils.SIZE_OF_SHORT + 1 + this.versions.size()
139 139
                * (ByteUtils.SIZE_OF_SHORT + versionSize) + ByteUtils.SIZE_OF_LONG;
140 140
     }
@@ -250,18 +250,18 @@ public VectorClock merge(VectorClock clock) {
250 250
                 i++;
251 251
                 j++;
252 252
             } else if(v1.getNodeId() < v2.getNodeId()) {
253  
-                newClock.versions.add((ClockEntry) v1.clone());
  253
+                newClock.versions.add(v1.clone());
254 254
                 i++;
255 255
             } else {
256  
-                newClock.versions.add((ClockEntry) v2.clone());
  256
+                newClock.versions.add(v2.clone());
257 257
             }
258 258
         }
259 259
 
260 260
         // Okay now there may be leftovers on one or the other list remaining
261 261
         for(int k = i; k < this.versions.size(); k++)
262  
-            newClock.versions.add((ClockEntry) this.versions.get(k).clone());
  262
+            newClock.versions.add(this.versions.get(k).clone());
263 263
         for(int k = j; k < this.versions.size(); k++)
264  
-            newClock.versions.add((ClockEntry) clock.versions.get(k).clone());
  264
+            newClock.versions.add(clock.versions.get(k).clone());
265 265
 
266 266
         return newClock;
267 267
     }
1  src/java/voldemort/xml/ClusterMapper.java
@@ -99,7 +99,6 @@ public Cluster readCluster(Reader input) {
99 99
         }
100 100
     }
101 101
 
102  
-    @SuppressWarnings("unchecked")
103 102
     public Node readServer(Element server) {
104 103
         int id = Integer.parseInt(server.getChildText(SERVER_ID_ELMT));
105 104
         String host = server.getChildText(HOST_ELMT);
1  test/integration/voldemort/MultithreadedStressTest.java
@@ -40,7 +40,6 @@
40 40
     private final int numberOfValues;
41 41
     private final int numberOfRequests;
42 42
 
43  
-    @SuppressWarnings("unchecked")
44 43
     public MultithreadedStressTest(Store<byte[], byte[]> store,
45 44
                                    int numberOfValues,
46 45
                                    int numberOfRequests,
8  test/unit/voldemort/UtilsTest.java
@@ -194,6 +194,14 @@ public void testByteComparison() {
194 194
         assertEquals(-1, ByteUtils.compare(new byte[] {}, new byte[] { 1 }));
195 195
         assertEquals(0, ByteUtils.compare(new byte[] { 0, 1, 2 }, new byte[] { 0, 1, 2 }));
196 196
         assertEquals(-1, ByteUtils.compare(new byte[] { 0, 1, 1 }, new byte[] { 0, 1, 2 }));
  197
+        assertEquals(-1, ByteUtils.compare(new byte[] { 0, 1, 1 }, new byte[] { 0, 1, 1, 2 }));
  198
+        assertEquals(1, ByteUtils.compare(new byte[] { 0, 1, 2 }, new byte[] { 0, 1, 1, 1 }));
  199
+        assertEquals(-1, ByteUtils.compare(new byte[] { 0, 1, 2 }, new byte[] { 4, 1, 1, 1 }));
  200
+        assertEquals(1, ByteUtils.compare(new byte[] { 0, 1, 4 }, new byte[] { 0, 1, 1, 1 }));
  201
+        assertEquals(-1, ByteUtils.compare(new byte[] { 1 }, new byte[] { -1 }));
  202
+        assertEquals(0, ByteUtils.compare(new byte[] { -1 }, new byte[] { -1 }));
  203
+        assertEquals(1, ByteUtils.compare(new byte[] { -1 }, new byte[] { -4 }));
  204
+        assertEquals(-1, ByteUtils.compare(new byte[] { -4 }, new byte[] { -1 }));
197 205
     }
198 206
 
199 207
 }
26  test/unit/voldemort/store/bdb/BdbStorageEngineTest.java
@@ -101,4 +101,30 @@ public void testPersistence() throws Exception {
101 101
         TestUtils.bytesEqual("cdef".getBytes(), vals.get(0).getValue());
102 102
     }
103 103
 
  104
+    public void testEquals() {
  105
+        String name = "someName";
  106
+        assertEquals(new BdbStorageEngine(name, environment, database),
  107
+                     new BdbStorageEngine(name, environment, database));
  108
+    }
  109
+
  110
+    public void testNullConstructorParameters() {
  111
+        try {
  112
+            new BdbStorageEngine(null, environment, database);
  113
+        } catch(IllegalArgumentException e) {
  114
+            return;
  115
+        }
  116
+        fail("No exception thrown for null name.");
  117
+        try {
  118
+            new BdbStorageEngine("name", null, database);
  119
+        } catch(IllegalArgumentException e) {
  120
+            return;
  121
+        }
  122
+        fail("No exception thrown for null environment.");
  123
+        try {
  124
+            new BdbStorageEngine("name", environment, null);
  125
+        } catch(IllegalArgumentException e) {
  126
+            return;
  127
+        }
  128
+        fail("No exception thrown for null database.");
  129
+    }
104 130
 }
4  test/unit/voldemort/versioning/ClockEntryTest.java
@@ -35,8 +35,8 @@ public void testEquality() {
35 35
         v2 = new ClockEntry((short) 0, (short) 2);
36 36
         assertTrue(!v1.equals(v2));
37 37
 
38  
-        v1 = new ClockEntry((short) Short.MAX_VALUE, (short) 256);
39  
-        v2 = new ClockEntry((short) Short.MAX_VALUE, (short) 256);
  38
+        v1 = new ClockEntry(Short.MAX_VALUE, (short) 256);
  39
+        v2 = new ClockEntry(Short.MAX_VALUE, (short) 256);
40 40
         assertEquals(v1, v2);
41 41
     }
42 42
 

0 notes on commit 08da446

Please sign in to comment.
Something went wrong with that request. Please try again.