Browse Source

restore the reading of the old random number in mongo update test

Cody Lerum 11 years ago
parent
commit
b85f69510b
1 changed files with 6 additions and 0 deletions
  1. 6 0
      undertow/src/main/java/hello/UpdatesMongoHandler.java

+ 6 - 0
undertow/src/main/java/hello/UpdatesMongoHandler.java

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 import com.mongodb.BasicDBObject;
 import com.mongodb.DB;
 import com.mongodb.DBObject;
+
 import io.undertow.server.HttpHandler;
 import io.undertow.server.HttpServerExchange;
 import io.undertow.util.Headers;
@@ -42,6 +43,11 @@ final class UpdatesMongoHandler implements HttpHandler {
       // produce the correct output and side effects.
       //
       DBObject object = database.getCollection("World").findOne(key);
+      
+      @SuppressWarnings("unused")
+      // Per test requirement the old value must be read
+      int oldRandomNumber = ((Number) object.get("randomNumber")).intValue(); 
+      
       int newRandomNumber = Helper.randomWorld();
       object.put("randomNumber", newRandomNumber);
       database.getCollection("World").update(key, object);