Package org.jboss.cache.optimistic

Examples of org.jboss.cache.optimistic.DefaultDataVersion


      cache[0].put(fqn, key, "value");// TestVersion-99 should be on both caches now

      TransactionManager mgr = cache[0].getTransactionManager();
      mgr.begin();

      DataVersion version = new DefaultDataVersion(300);
      cache[1].getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache[1].put(fqn, key, "value2");
      mgr.commit();
   }
View Full Code Here


    *
    * @throws Exception
    */
   public void testCompatibleVersionTypesOutDatedVersion2() throws Exception
   {
      DataVersion version = new DefaultDataVersion(200);
      cache[0].getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache[0].put(fqn, key, "value");// TestVersion-99 should be on both caches now

      TransactionManager mgr = cache[0].getTransactionManager();
      mgr.begin();

      version = new DefaultDataVersion(100);
      cache[1].getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache[1].put(fqn, key, "value2");
      try
      {
         // this call will use implicit versioning and will hence fail.
View Full Code Here

      }
   }

   public void testPropagationOfDefaultVersions() throws Exception
   {
      DefaultDataVersion expected = new DefaultDataVersion();
      expected = (DefaultDataVersion) expected.increment();

      cache[0].put(fqn, key, "value");

      assertEquals("value", cache[0].get(fqn, key));
      assertEquals("value", cache[1].get(fqn, key));
      assertEquals(expected, cache[0].getNode(fqn).getVersion());
      assertEquals(expected, cache[1].getNode(fqn).getVersion());

      cache[1].put(fqn, key, "value2");
      expected = (DefaultDataVersion) expected.increment();

      assertEquals("value2", cache[0].get(fqn, key));
      assertEquals("value2", cache[1].get(fqn, key));
      assertEquals(expected, cache[0].getNode(fqn).getVersion());
      assertEquals(expected, cache[1].getNode(fqn).getVersion());
View Full Code Here

      NodeSPI observerNode = (NodeSPI) observer.getRoot().getChild(parent);
      assert observerNode == null : "Should be removed";

      // now try a put on a with a newer data version; should work
      modifier.getInvocationContext().getOptionOverrides().setDataVersion(new DefaultDataVersion(10));
      modifier.put(parent, K, V);

      NodeSPI modifierNode = (NodeSPI) modifier.getRoot().getChild(parent);
      assert modifierNode != null : "Should not be null";
      assert modifierNode.isValid() : "No longer a tombstone";
View Full Code Here

      NodeSPI observerNode = (NodeSPI) observer.getRoot().getChild(parent);
      assert observerNode == null : "Should be removed";

      // now try a put on a with a newer data version; should work
      modifier.getInvocationContext().getOptionOverrides().setDataVersion(new DefaultDataVersion(1));
      try
      {
         modifier.put(parent, K, V);
         assert false : "Should have barfed!";
      }
View Full Code Here

      DataVersion version = new TestVersion("99");
      cache.getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache.put(fqn, key, "value");
      TransactionManager mgr = cache.getTransactionManager();
      mgr.begin();
      cache.getInvocationContext().getOptionOverrides().setDataVersion(new DefaultDataVersion(777));
      cache.put(fqn, key, "value2");
      try
      {
         // this call will use implicit versioning and will hence fail.
         mgr.commit();
View Full Code Here

      tmMock = control.createMock(TransactionManager.class);
      spiMock = control.createMock(CacheSPI.class);
      nodes = new MockNodesFixture();

      command = new VersionedInvalidateCommand(testFqn);
      dataVersion = new DefaultDataVersion(10);
      command.setDataVersion(dataVersion);
      command.initialize(spiMock, container, notifier);
      command.initialize(tmMock);
   }
View Full Code Here

   public void testWithExistingNodeInvalidVersion()
   {
      nodes.adfNode.put("key", "value");
      nodes.adfNode.setDataLoaded(true);
      nodes.adfNode.setVersion(new DefaultDataVersion(100));
      expect(spiMock.getNode(testFqn)).andReturn(nodes.adfNode);
      control.replay();

      try
      {
View Full Code Here

      DataVersion version = new TestVersion("99");
      cache.getInvocationContext().getOptionOverrides().setDataVersion(version);
      cache.put(fqn, key, "value");
      TransactionManager mgr = cache.getTransactionManager();
      mgr.begin();
      cache.getInvocationContext().getOptionOverrides().setDataVersion(new DefaultDataVersion(777));
      cache.put(fqn, key, "value2");
      try
      {
         // this call will use implicit versioning and will hence fail.
         mgr.commit();
View Full Code Here

      NodeSPI observerNode = (NodeSPI) observer.getRoot().getChild(parent);
      assert observerNode == null : "Should be removed";

      // now try a put on a with a newer data version; should work
      modifier.getInvocationContext().getOptionOverrides().setDataVersion(new DefaultDataVersion(10));
      modifier.put(parent, K, V);

      NodeSPI modifierNode = (NodeSPI) modifier.getRoot().getChild(parent);
      assert modifierNode != null : "Should not be null";
      assert modifierNode.isValid() : "No longer a tombstone";
View Full Code Here

TOP

Related Classes of org.jboss.cache.optimistic.DefaultDataVersion

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.