Package org.jboss.cache.mock

Examples of org.jboss.cache.mock.NodeSpiMock


      assert null == command.perform(ctx);
   }

   public void testForExistingNode()
   {
      NodeSpiMock node = new NodeSpiMock(testFqn);
      node.putDirect("k1", "v1");
      node.putDirect("k2", "v2");
      expect(container.peek(testFqn)).andReturn(node);
      replay(container);
      Map result = (Map) command.perform(ctx);
      assert 2 == result.entrySet().size();
      assert result.get("k1").equals("v1");
View Full Code Here


      assert null == command.perform(ctx);
   }

   public void testForExistingNode()
   {
      NodeSpiMock node = new NodeSpiMock(testFqn);
      node.putDirect("k1", "v1");
      node.putDirect("k2", "v2");
      expect(container.peek(testFqn)).andReturn(node);
      replay(container);
      Set result = (Set) command.perform(ctx);
      assert 2 == result.size();
      assert result.contains("k1");
View Full Code Here

      command.initialize(container);
   }

   public void testPerformNoChildren()
   {
      NodeSpiMock node = new NodeSpiMock(testFqn);
      expect(container.peek(testFqn)).andReturn(node);
      replay(container);
      Set result = (Set) command.perform(ctx);
      assert result.isEmpty() : "empty result expected";
   }
View Full Code Here

      command = new PessPutDataMapCommand(gtx, testFqn, dataMap);
      control = createStrictControl();
      notifier = control.createMock(Notifier.class);
      container = control.createMock(DataContainer.class);
      command.initialize(notifier, container);
      node = new NodeSpiMock(testFqn);
      node.put("k", "v");
      ctx = createLegacyInvocationContext(container);
   }
View Full Code Here

      control.verify();
   }

   public void testDeadBeackup() throws Exception
   {
      NodeSpiMock root = new NodeSpiMock(Fqn.ROOT);

      //add first dead child
      IpAddress firstAddress = new IpAddress("127.0.0.1", 1234);
      NodeSpiMock firstDeadNode = (NodeSpiMock) root.addChildDirect(fqnTransformer.getDeadBackupRoot(firstAddress));
      firstDeadNode.addChildDirect(Fqn.fromElements(0));
      firstDeadNode.addChildDirect(Fqn.fromElements(1));
      firstDeadNode.addChildDirect(Fqn.fromElements(2));

      //add second dead child
      IpAddress secondAddress = new IpAddress("127.0.0.1", 4321);
      NodeSpiMock secondDeadNode = (NodeSpiMock) root.addChildDirect(fqnTransformer.getDeadBackupRoot(secondAddress));
      secondDeadNode.addChildDirect(Fqn.fromElements(0));


      expect(spiMock.getNode(fqn)).andReturn(null);
      NodeSPI buddyBackupRoot = (NodeSPI) root.getChild(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN);
      expect(containerMock.peek(BuddyManager.BUDDY_BACKUP_SUBTREE_FQN)).andReturn(buddyBackupRoot);

      control.checkOrder(false);
      expect(spiMock.getChildrenNames(firstDeadNode.getFqn())).andReturn(firstDeadNode.getChildrenNames());
      Object fqnElement = fqn.getLastElement();//this is only composed from one element
      expect(spiMock.peek(Fqn.fromRelativeElements(firstDeadNode.getFqn(), 0, fqnElement), false)).andReturn(null);
      expect(spiMock.peek(Fqn.fromRelativeElements(firstDeadNode.getFqn(), 1, fqnElement), false)).andReturn(null);
      expect(spiMock.peek(Fqn.fromRelativeElements(firstDeadNode.getFqn(), 2, fqnElement), false)).andReturn(null);

      expect(spiMock.getChildrenNames(secondDeadNode.getFqn())).andReturn(secondDeadNode.getChildrenNames());
      expect(spiMock.peek(Fqn.fromRelativeElements(secondDeadNode.getFqn(), 0, fqnElement), false)).andReturn(null);
      control.checkOrder(true);

      control.replay();
      assert GravitateResult.noDataFound().equals(command.perform(ctx));
      control.verify();
View Full Code Here

      command = new PessPutDataMapCommand(gtx, testFqn, dataMap);
      control = createStrictControl();
      notifier = control.createMock(Notifier.class);
      container = control.createMock(DataContainer.class);
      command.initialize(notifier, container);
      node = new NodeSpiMock(testFqn);
      node.put("k", "v");
      ctx = createLegacyInvocationContext(container);
   }
View Full Code Here

TOP

Related Classes of org.jboss.cache.mock.NodeSpiMock

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.