Package org.jboss.cache

Examples of org.jboss.cache.Modification


      loader.put(list);
      checkModifications(list);

      /* REMOVE_KEY_VALUE */
      list = new ArrayList<Modification>();
      Modification mod = new Modification();
      mod.setType(Modification.ModificationType.REMOVE_KEY_VALUE);
      mod.setFqn(FQN);
      mod.setKey("one");
      list.add(mod);
      loader.put(list);
      checkModifications(list);

      /* REMOVE_NODE */
      list = new ArrayList<Modification>();
      mod = new Modification();
      mod.setType(Modification.ModificationType.REMOVE_NODE);
      mod.setFqn(FQN);
      list.add(mod);
      loader.put(list);
      checkModifications(list);
      assertEquals(null, loader.get(FQN));

      /* REMOVE_DATA */
      loader.put(FQN, "one", "two");
      list = new ArrayList<Modification>();
      mod = new Modification();
      mod.setType(Modification.ModificationType.REMOVE_DATA);
      mod.setFqn(FQN);
      list.add(mod);
      loader.put(list);
      checkModifications(list);
      assertNotNull(loader.get(FQN));
      assertEquals(0, loader.get(FQN).size());
View Full Code Here


   private List<Modification> createUpdates()
   {

      List<Modification> list = new ArrayList<Modification>();

      Modification mod = new Modification();
      mod.setType(Modification.ModificationType.PUT_KEY_VALUE);
      mod.setFqn(FQN);
      mod.setKey("one");
      mod.setValue("two");
      list.add(mod);

      mod = new Modification();
      mod.setType(Modification.ModificationType.PUT_KEY_VALUE);
      mod.setFqn(FQN);
      mod.setKey("three");
      mod.setValue("four");
      list.add(mod);

      /*
      Map<String, String> map = new HashMap<String, String>();
      map.put("five", "six");
View Full Code Here

         throws Exception
   {

      for (int i = 0; i < list.size(); i += 1)
      {
         Modification mod = list.get(i);
         Fqn fqn = mod.getFqn();
         switch (mod.getType())
         {
            case PUT_KEY_VALUE:
               assertEquals(mod.getValue(), loader.get(fqn).get(mod.getKey()));
               break;
            case PUT_DATA:
               Map map = mod.getData();
               for (Object key : map.keySet())
               {
                  assertEquals(map.get(key), loader.get(fqn).get(key));
               }
               break;
            case REMOVE_KEY_VALUE:
               assertEquals(null, loader.get(fqn).get(mod.getKey()));
               break;
            case REMOVE_DATA:
               assertTrue(loader.exists(fqn));
               assertNotNull(loader.get(fqn));
               assertEquals(0, loader.get(fqn).size());
View Full Code Here

      CacheLoader loader = cache.getCacheLoaderManager().getCacheLoader();
      Fqn fqn = Fqn.fromString("/a/b/c/d");
      HashMap<Object, Object> map = new HashMap<Object, Object>();
      map.put("c", "d");
      // Three kinds of puts!
      Modification mod = new Modification(Modification.ModificationType.PUT_KEY_VALUE, fqn, "e", "f");
      loader.put(fqn, map);
      loader.put(fqn, "a", "b");
      loader.put(Collections.singletonList(mod));
      assertEquals("put right away", 3, loader.get(fqn).size());
      loader.remove(fqn);
View Full Code Here

      @Override
      public Object visitPutDataMapCommand(InvocationContext ctx, PutDataMapCommand command) throws Throwable
      {
         if (generateStatistics) putCount++;
         modifications.add(new Modification(Modification.ModificationType.PUT_DATA, command.getFqn(), command.getData()));
         affectedFqns.add(command.getFqn());
         return null;
      }
View Full Code Here

      @Override
      public Object visitPutKeyValueCommand(InvocationContext ctx, PutKeyValueCommand command) throws Throwable
      {
         if (generateStatistics) putCount++;
         modifications.add(new Modification(Modification.ModificationType.PUT_KEY_VALUE, command.getFqn(),
               command.getKey(), command.getValue()));
         affectedFqns.add(command.getFqn());
         return null;
      }
View Full Code Here

      }

      @Override
      public Object visitRemoveKeyCommand(InvocationContext ctx, RemoveKeyCommand command) throws Throwable
      {
         modifications.add(new Modification(Modification.ModificationType.REMOVE_KEY_VALUE, command.getFqn(), command.getKey()));
         affectedFqns.add(command.getFqn());
         return null;
      }
View Full Code Here

      }

      @Override
      public Object visitClearDataCommand(InvocationContext ctx, ClearDataCommand command) throws Throwable
      {
         modifications.add(new Modification(Modification.ModificationType.REMOVE_DATA, command.getFqn()));
         affectedFqns.add(command.getFqn());
         return null;
      }
View Full Code Here

      }

      @Override
      public Object visitRemoveNodeCommand(InvocationContext ctx, RemoveNodeCommand command) throws Throwable
      {
         modifications.add(new Modification(Modification.ModificationType.REMOVE_NODE, command.getFqn()));
         affectedFqns.add(command.getFqn());
         return null;
      }
View Full Code Here

      public Object visitMoveCommand(InvocationContext ctx, MoveCommand command) throws Throwable
      {
         Fqn moveFrom = command.getFqn();
         affectedFqns.add(command.getFqn());
         affectedFqns.add(moveFrom);
         Modification mod = new Modification(Modification.ModificationType.MOVE, moveFrom, command.getTo());
         modifications.add(mod);
         return null;
      }
View Full Code Here

TOP

Related Classes of org.jboss.cache.Modification

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.