Package org.jboss.cache.optimistic

Examples of org.jboss.cache.optimistic.DefaultDataVersion


      // Actually, it shouldn't have been invalidated, should be null
      // But, this assertion will pass if it is null, and we want
      CacheLoaderInvalidationTest.assertHasBeenInvalidated(cache1.getNode(fqn), "Should have been invalidated");
      assertNull("Should be null", cache2.getNode(fqn));

      cache1.getInvocationContext().getOptionOverrides().setDataVersion(new DefaultDataVersion());
      cache1.put(fqn, "key", "value");

      assertEquals("value", cache1.getNode(fqn).get("key"));
      CacheLoaderInvalidationTest.assertHasBeenInvalidated(cache2.getNode(fqn), "Should have been invalidated");
   }
View Full Code Here


      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

            if (trace) log.trace("Fqn " + f + " not found in workspace; not using a data version.");
            return null;
         }
         if (n.isVersioningImplicit())
         {
            DefaultDataVersion v = (DefaultDataVersion) n.getVersion();
            if (trace)
               log.trace("Fqn " + f + " has implicit versioning.  Broadcasting an incremented version.");

            // potential bug here - need to check if we *need* to increment at all, because of Configuration.isLockParentForChildInsertRemove()
            return v.increment();
         }
         else
         {
            if (trace) log.trace("Fqn " + f + " has explicit versioning.  Broadcasting the version as-is.");
            return n.getVersion();
View Full Code Here

      // Actually, it shouldn't have been invalidated, should be null
      // But, this assertion will pass if it is null, and we want
      assertHasBeenInvalidated(cache1.getNode(fqn), "Should have been invalidated");
      assertNull("Should be null", cache2.getNode(fqn));

      cache1.getInvocationContext().getOptionOverrides().setDataVersion(new DefaultDataVersion());
      cache1.put(fqn, "key", "value");

      assertEquals("value", cache1.getNode(fqn).get("key"));
      assertHasBeenInvalidated(cache2.getNode(fqn), "Should have been invalidated");
   }
View Full Code Here

      control = createStrictControl();
      container = control.createMock(DataContainer.class);
      notifier = control.createMock(Notifier.class);
      nodes = new MockNodesFixture();
      globalTransaction = new GlobalTransaction();
      dataVersion = new DefaultDataVersion(10);
      ctx = createLegacyInvocationContext(container);

      AbstractVersionedDataCommand command = moreSetUp();
      command.initialize(notifier, container);
   }
View Full Code Here

   }

   @SuppressWarnings("deprecation")
   protected DefaultDataVersion unmarshallDefaultDataVersion(ObjectInputStream in) throws Exception
   {
      return new DefaultDataVersion(readUnsignedLong(in));
   }
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

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.