Package org.jboss.cache.commands.remote

Examples of org.jboss.cache.commands.remote.ReplicateCommand


   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

      list.add(call1);
      list.add(call2);
      list.add(call3);
      list.add(call4);

      ReplicateCommand call5 = new ReplicateCommand(list);

      BuddyManager bm = createBasicBuddyManager();

      ReplicateCommand newReplicatedCall = bm.transformReplicateCommand(call5);
      List<ReplicableCommand> l = newReplicatedCall.getModifications();

      // should use object refs to transform the original MethodCall.
      String expected = "/" + BuddyManager.BUDDY_BACKUP_SUBTREE + "/" + DUMMY_LOCAL_ADDRESS;

      int i = 0;
View Full Code Here

      public Object objectFromByteBuffer(byte bytes[]) throws Exception
      {
         Object result = marshaller.objectFromByteBuffer(bytes);
         if (result instanceof ReplicateCommand && expectedCommands != null)
         {
            ReplicateCommand replicateCommand = (ReplicateCommand) result;
            return new ReplicateCommandDelegate(replicateCommand);
         }
         return result;
      }
View Full Code Here

      public Object objectFromByteBuffer(byte[] bytes, int i, int i1) throws Exception
      {
         Object result = marshaller.objectFromByteBuffer(bytes, i, i1);
         if (result instanceof ReplicateCommand && expectedCommands != null)
         {
            ReplicateCommand replicateCommand = (ReplicateCommand) result;
            return new ReplicateCommandDelegate(replicateCommand);
         }
         return result;
      }
View Full Code Here

      public RegionalizedMethodCall regionalizedMethodCallFromByteBuffer(byte[] buffer) throws Exception
      {
         RegionalizedMethodCall result = realOne.regionalizedMethodCallFromByteBuffer(buffer);
         if (result.command instanceof ReplicateCommand && expectedCommands != null)
         {
            ReplicateCommand replicateCommand = (ReplicateCommand) result.command;
            result.command = new ReplicateCommandDelegate(replicateCommand);
         }
         return result;
      }
View Full Code Here

   {
      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

      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);

      byte[] buf = marshaller.objectToByteBuffer(replAllCmd);

      assertEquals(replAllCmd, marshaller.objectFromByteBuffer(buf));
   }
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

TOP

Related Classes of org.jboss.cache.commands.remote.ReplicateCommand

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.