Examples of ByteArrayKey


Examples of org.infinispan.util.ByteArrayKey

   public void testHotRodCodec() throws Exception {
      Cache<ByteArrayKey, CacheValue> cache = cacheManager.getCache();
      RemoteCache<String, String> remoteCache = remoteCacheManager.getCache();
      remoteCache.put("k1", "v1");
      GenericJBossMarshaller marshaller = new GenericJBossMarshaller();
      ByteArrayKey k1 = new ByteArrayKey(marshaller.objectToByteBuffer("k1"));
      assertTrue(cache.containsKey(k1));

      String sessionId = interpreter.createSessionId(BasicCacheContainer.DEFAULT_CACHE_NAME);
      Map<String, String> response = interpreter.execute(sessionId, "get --codec=hotrod k1;");
      assertEquals("v1", response.get(ResultKeys.OUTPUT.toString()));
View Full Code Here

Examples of org.infinispan.util.ByteArrayKey

   public void testHotRodEncoding() throws Exception {
      Cache<ByteArrayKey, CacheValue> cache = cacheManager.getCache();
      RemoteCache<String, String> remoteCache = remoteCacheManager.getCache();
      remoteCache.put("k1", "v1");
      GenericJBossMarshaller marshaller = new GenericJBossMarshaller();
      ByteArrayKey k1 = new ByteArrayKey(marshaller.objectToByteBuffer("k1"));
      assertTrue(cache.containsKey(k1));

      String sessionId = interpreter.createSessionId(BasicCacheContainer.DEFAULT_CACHE_NAME);
      interpreter.execute(sessionId, "encoding hotrod;");
      Map<String, String> response = interpreter.execute(sessionId, "get k1;");
View Full Code Here

Examples of org.infinispan.util.ByteArrayKey

      int threads = Runtime.getRuntime().availableProcessors();
      ComponentRegistry cr = cache.getAdvancedCache().getComponentRegistry();
      CacheLoaderManager loaderManager = cr.getComponent(CacheLoaderManager.class);
      List<RemoteCacheStore> stores = loaderManager.getCacheLoaders(RemoteCacheStore.class);
      Marshaller marshaller = new GenericJBossMarshaller();
      ByteArrayKey knownKeys;
      try {
         knownKeys = new ByteArrayKey(marshaller.objectToByteBuffer(MIGRATION_MANAGER_HOT_ROD_KNOWN_KEYS));
      } catch (Exception e) {
         throw new CacheException(e);
      }

      for (RemoteCacheStore store : stores) {
View Full Code Here

Examples of org.infinispan.util.ByteArrayKey

         assert inf.toString().contains("in object java.lang.Object@");
      }
   }

   public void testByteArrayKey() throws Exception {
      ByteArrayKey o = new ByteArrayKey("123".getBytes());
      marshallAndAssertEquality(o);
   }
View Full Code Here

Examples of org.infinispan.util.ByteArrayKey

   public void testByteArrayKey(Method m) {
      CacheContainer localCacheContainer = getContainerWithCacheLoader();
      try {
         Cache<ByteArrayKey, Object> cache = localCacheContainer.getCache();
         cache.put(new ByteArrayKey(m.getName().getBytes()), "hello");
      } finally {
         TestingUtil.killCacheManagers(localCacheContainer);
      }
   }
View Full Code Here

Examples of org.infinispan.util.ByteArrayKey

         assert inf.toString().contains("in object java.lang.Object@");
      }
   }

   public void testByteArrayKey() throws Exception {
      ByteArrayKey o = new ByteArrayKey("123".getBytes());
      marshallAndAssertEquality(o);
   }
View Full Code Here

Examples of org.infinispan.util.ByteArrayKey

   @Override
   public Object encodeKey(Object key) throws CodecException {
      if (key != null) {
         try {
            return new ByteArrayKey(marshaller.objectToByteBuffer(key));
         } catch (Exception e) {
            throw log.keyEncodingFailed(e, this.getName());
         }
      } else {
         return null;
View Full Code Here

Examples of org.infinispan.util.ByteArrayKey

   @Override
   public Object decodeKey(Object key) throws CodecException {
      if (key != null) {
         try {
            ByteArrayKey byteKey = (ByteArrayKey) key;
            return marshaller.objectFromByteBuffer(byteKey.getData());
         } catch (Exception e) {
            throw log.keyDecodingFailed(e, this.getName());
         }
      } else {
         return null;
View Full Code Here

Examples of org.infinispan.util.ByteArrayKey

   private void assertCacheContainsKey(InetSocketAddress serverAddress, byte[] keyBytes) {
      CacheContainer cacheContainer = hrServ2CacheManager.get(serverAddress);
      Cache<Object, Object> cache = cacheContainer.getCache();
      DataContainer dataContainer = cache.getAdvancedCache().getDataContainer();
      assert dataContainer.keySet().contains(new ByteArrayKey(keyBytes));
   }
View Full Code Here

Examples of org.infinispan.util.ByteArrayKey

      return entry;
   }

   private ByteArrayKey toBinaryKey(String key) throws Exception {
      byte[] keyBytes = marshaller.objectToByteBuffer(key, 64);
      return new ByteArrayKey(keyBytes);
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.