Package org.infinispan.server.websocket.json

Examples of org.infinispan.server.websocket.json.JsonObject


      return jsonObj;
   }

   private JsonObject toGet(String key) {
      JsonObject jsonObj = JsonObject.createNew();

      jsonObj.put(OpHandler.OP_CODE, "get");
      jsonObj.put(OpHandler.CACHE_NAME, cacheName);
      jsonObj.put(OpHandler.KEY, key);

      return jsonObj;
   }
View Full Code Here


      return jsonObj;
   }

   private JsonObject toRemove(String key) {
      JsonObject jsonObj = JsonObject.createNew();

      jsonObj.put(OpHandler.OP_CODE, "remove");
      jsonObj.put(OpHandler.CACHE_NAME, cacheName);
      jsonObj.put(OpHandler.KEY, key);

      return jsonObj;
   }
View Full Code Here

      return jsonObj;
   }

   private JsonObject toNotify(String key) {
      JsonObject jsonObj = JsonObject.createNew();

      jsonObj.put(OpHandler.OP_CODE, "notify");
      jsonObj.put(OpHandler.CACHE_NAME, cacheName);
      jsonObj.put(OpHandler.KEY, key);

      return jsonObj;
   }
View Full Code Here

      return jsonObj;
   }

   private JsonObject toUnnotify(String key) {
      JsonObject jsonObj = JsonObject.createNew();

      jsonObj.put(OpHandler.OP_CODE, "unnotify");
      jsonObj.put(OpHandler.CACHE_NAME, cacheName);
      jsonObj.put(OpHandler.KEY, key);

      return jsonObj;
   }
View Full Code Here

   public void shouldReturnPreviouslyPutValueInJsonPayload() throws Exception {
      //when
      cacheClient.put("a", "aVal");
      cacheClient.get("a");
      JsonObject payload = serverChannel.getJSONPayload();

      //then
      assertThat(payload).hasCacheName(CACHE_NAME).hasKey("a").hasValue("aVal").hasMimeType("text/plain");
   }
View Full Code Here

   }

   public void shouldReturnNullWhenValueIsNotInCache() throws Exception {
      //when
      cacheClient.get("notInCache");
      JsonObject payload = serverChannel.getJSONPayload();

      //then
      assertThat(payload).hasCacheName(CACHE_NAME).hasKey("notInCache").hasValue(null);
   }
View Full Code Here

      //given
      cacheClient.put("a", "aVal");

      //when
      cacheClient.notify("a");
      JsonObject payload = serverChannel.getJSONPayload(1000);

      //then
      assertThat(payload).hasKey("a").hasValue("aVal");
   }
View Full Code Here

      cacheClient.notify("a");
      serverChannel.getJSONPayload(1000);

      //when
      cacheClient.getCache().put("a", "newValue");
      JsonObject payload = serverChannel.getJSONPayload();

      //then
      assertThat(payload).hasKey("a").hasValue("newValue");
   }
View Full Code Here

      serverChannel.getJSONPayload();

      //when
      cacheClient.getCache().put("irrelevantKey", "newValue");
      try {
         JsonObject jsonPayload = serverChannel.getJSONPayload(250);
         fail("Expected timeout" + jsonPayload);
      } catch (RuntimeException e) {
         assertEquals(e.getMessage(), "Timed out waiting for data to be pushed onto the channel.");
      }
   }
View Full Code Here

      cacheClient.notify("*");
      serverChannel.getJSONPayload();

      //when
      cacheClient.getCache().put("b", "newValue");
      JsonObject payload = serverChannel.getJSONPayload();

      //then
      assertThat(payload).hasKey("b").hasValue("newValue");
   }
View Full Code Here

TOP

Related Classes of org.infinispan.server.websocket.json.JsonObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.