Package org.jboss.cache.commands.write

Examples of org.jboss.cache.commands.write.PutKeyValueCommand


   public void testFqnManipulation()
   {
      Fqn fqn1 = Fqn.fromString("/hello/world");

      PutKeyValueCommand call1 = new PutKeyValueCommand(null, fqn1, "key", "value");
      ReplicateCommand call2 = new ReplicateCommand(call1);

      BuddyManager bm = createBasicBuddyManager();

      ReplicateCommand newReplicatedCall = bm.transformReplicateCommand(call2);
      PutKeyValueCommand newPutCall = (PutKeyValueCommand) newReplicatedCall.getSingleModification();

      // should use object refs to transform the original MethodCall.
      Fqn expected = Fqn.fromString("/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + DUMMY_LOCAL_ADDRESS + "/hello/world");
      assertEquals(expected, newPutCall.getFqn());

   }
View Full Code Here


   public void testRootFqnManipulation()
   {
      Fqn fqn1 = Fqn.ROOT;

      ReplicableCommand call1 = new PutKeyValueCommand(null, fqn1, "key", "value");
      ReplicateCommand call2 = new ReplicateCommand(call1);

      BuddyManager bm = createBasicBuddyManager();

      ReplicateCommand newReplicatedCall = bm.transformReplicateCommand(call2);
      PutKeyValueCommand newPutCall = (PutKeyValueCommand) newReplicatedCall.getSingleModification();

      // should use object refs to transform the original MethodCall.
      Fqn expected = Fqn.fromString("/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + DUMMY_LOCAL_ADDRESS);
      assertEquals(expected, newPutCall.getFqn());
   }
View Full Code Here

      Fqn fqn1 = Fqn.ROOT;
      Fqn fqn2 = Fqn.fromString("/hello/world");
      Fqn fqn3 = Fqn.fromString("/hello/again");
      Fqn fqn4 = Fqn.fromString("/buddy/replication");

      PutKeyValueCommand call1 = new PutKeyValueCommand(null, fqn1, "key", "value");
      PutKeyValueCommand call2 = new PutKeyValueCommand(null, fqn2, "key", "value");
      PutKeyValueCommand call3 = new PutKeyValueCommand(null, fqn3, "key", "value");
      PutKeyValueCommand call4 = new PutKeyValueCommand(null, fqn4, "key", "value");
      List<ReplicableCommand> list = new ArrayList<ReplicableCommand>();
      list.add(call1);
      list.add(call2);
      list.add(call3);
      list.add(call4);
View Full Code Here

   public void testMethodCall() throws Exception
   {
      CacheMarshallerTestBaseTL tl = threadLocal.get();
      VersionAwareMarshaller marshaller = tl.marshaller;
      Fqn fqn = Fqn.fromElements(3, false);
      ReplicableCommand cmd = new PutKeyValueCommand(null, fqn, "key", "value");
      byte[] asBytes = marshaller.objectToByteBuffer(cmd);
      Object o2 = marshaller.objectFromByteBuffer(asBytes);

      assertTrue("Unmarshalled object should be a method call", o2 instanceof ReplicableCommand);
      ReplicableCommand cmd2 = (ReplicableCommand) o2;
View Full Code Here

   public void testNestedMethodCall() throws Exception
   {
      CacheMarshallerTestBaseTL tl = threadLocal.get();
      VersionAwareMarshaller marshaller = tl.marshaller;
      Fqn fqn = Fqn.fromElements(3, false);
      ReplicableCommand cmd = new PutKeyValueCommand(null, fqn, "key", "value");
      ReplicableCommand replicateCmd = new ReplicateCommand(cmd);
      byte[] asBytes = marshaller.objectToByteBuffer(replicateCmd);
      Object o2 = marshaller.objectFromByteBuffer(asBytes);
      assertTrue("Unmarshalled object should be a method call", o2 instanceof ReplicableCommand);
      ReplicableCommand cmd2 = (ReplicableCommand) o2;
View Full Code Here

      List<ReplicableCommand> calls = new ArrayList<ReplicableCommand>();

      Fqn f = Fqn.fromElements("BlahBlah", 3, false);
      String k = "key", v = "value";

      ReplicableCommand cmd = new PutKeyValueCommand(null, f, k, v);
      ReplicableCommand replCmd = new ReplicateCommand(cmd);

      calls.add(replCmd);

      cmd = new PutKeyValueCommand(null, f, k, v);
      replCmd = new ReplicateCommand(cmd);

      calls.add(replCmd);

      ReplicableCommand replAllCmd = new ReplicateCommand(calls);
View Full Code Here

      }
   }

   private Long getExpirationFromCommand(DataCommand command) {
      if (command instanceof PutKeyValueCommand) {
         PutKeyValueCommand putKeyCommand = (PutKeyValueCommand) command;
         if (putKeyCommand.getKey().equals(config.getExpirationKeyName())) {
            return (Long) putKeyCommand.getValue();
         }
      } else if (command instanceof PutDataMapCommand) {
         PutDataMapCommand putDataCommand = (PutDataMapCommand) command;
         Object expiration = putDataCommand.getData().get(config.getExpirationKeyName());
         if (expiration != null) {
View Full Code Here

   public void testFqnManipulation()
   {
      Fqn fqn1 = Fqn.fromString("/hello/world");

      PutKeyValueCommand call1 = new PutKeyValueCommand(null, fqn1, "key", "value");
      ReplicateCommand call2 = new ReplicateCommand(call1);

      BuddyManager bm = createBasicBuddyManager();

      ReplicateCommand newReplicatedCall = bm.transformReplicateCommand(call2);
      PutKeyValueCommand newPutCall = (PutKeyValueCommand) newReplicatedCall.getSingleModification();

      // should use object refs to transform the original MethodCall.
      Fqn expected = Fqn.fromString("/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + DUMMY_LOCAL_ADDRESS + "/hello/world");
      assertEquals(expected, newPutCall.getFqn());

   }
View Full Code Here

   public void testRootFqnManipulation()
   {
      Fqn fqn1 = Fqn.ROOT;

      ReplicableCommand call1 = new PutKeyValueCommand(null, fqn1, "key", "value");
      ReplicateCommand call2 = new ReplicateCommand(call1);

      BuddyManager bm = createBasicBuddyManager();

      ReplicateCommand newReplicatedCall = bm.transformReplicateCommand(call2);
      PutKeyValueCommand newPutCall = (PutKeyValueCommand) newReplicatedCall.getSingleModification();

      // should use object refs to transform the original MethodCall.
      Fqn expected = Fqn.fromString("/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + DUMMY_LOCAL_ADDRESS);
      assertEquals(expected, newPutCall.getFqn());
   }
View Full Code Here

      Fqn fqn1 = Fqn.ROOT;
      Fqn fqn2 = Fqn.fromString("/hello/world");
      Fqn fqn3 = Fqn.fromString("/hello/again");
      Fqn fqn4 = Fqn.fromString("/buddy/replication");

      PutKeyValueCommand call1 = new PutKeyValueCommand(null, fqn1, "key", "value");
      PutKeyValueCommand call2 = new PutKeyValueCommand(null, fqn2, "key", "value");
      PutKeyValueCommand call3 = new PutKeyValueCommand(null, fqn3, "key", "value");
      PutKeyValueCommand call4 = new PutKeyValueCommand(null, fqn4, "key", "value");
      List<ReplicableCommand> list = new ArrayList<ReplicableCommand>();
      list.add(call1);
      list.add(call2);
      list.add(call3);
      list.add(call4);
View Full Code Here

TOP

Related Classes of org.jboss.cache.commands.write.PutKeyValueCommand

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.