Package org.jboss.cache.marshall

Examples of org.jboss.cache.marshall.MethodCall


      assertTrue(!cache.exists("/one/two"));
      assertEquals(null, dummy.getCalled());

      //lets change one of the underlying version numbers
      //now let us do a prepare
      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, gtx, entry.getModifications(), null, gtx.getAddress(), Boolean.FALSE);

      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
         fail();
      }
      catch (Throwable t)
      {
         assertTrue(true);
      }

      MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod_id, gtx);
      TestingUtil.getRemoteDelegate(cache)._replicate(rollbackMethod);


      assertEquals(0, workspace.getNodes().size());
      assertNull(workspace.getNode(Fqn.fromString("/one/two")));
View Full Code Here


      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
      TransactionTable table = cache.getTransactionTable();
      OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
      assertNotNull(mgr.getTransaction());
      MethodCall meth = entry.getModifications().get(0);
      mgr.commit();

      //test local calls
      List<?> calls = dummy.getAllCalledIds();
      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
      assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));
      assertNull(mgr.getTransaction());

      assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());


      GlobalTransaction remoteGtx = new GlobalTransaction();

      remoteGtx.setAddress(new DummyAddress());
      //hack the method call to make it have the remote gtx

      meth.getArgs()[0] = remoteGtx;
      //call our remote method
      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
      }
      catch (Throwable t)
View Full Code Here

      GlobalTransaction remoteGtx = new GlobalTransaction();

      remoteGtx.setAddress(new DummyAddress());
      //hack the method call to make it have the remote gtx
      MethodCall meth = entry.getModifications().get(0);

      meth.getArgs()[0] = remoteGtx;
      //call our remote method
      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
      }
      catch (Throwable t)
View Full Code Here

      GlobalTransaction remoteGtx = new GlobalTransaction();

      remoteGtx.setAddress(new DummyAddress());
      //hack the method call to make it have the remote gtx
      MethodCall meth = entry.getModifications().get(0);

      meth.getArgs()[0] = remoteGtx;
      //call our remote method
      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
      }
      catch (Throwable t)
      {
         fail();
      }

      assertEquals(2, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(2, cache.getTransactionTable().getNumLocalTransactions());

//        call our remote method
      MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod_id, remoteGtx);
      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
      }
      catch (Throwable t)
View Full Code Here

      GlobalTransaction remoteGtx = new GlobalTransaction();

      remoteGtx.setAddress(new DummyAddress());
      //hack the method call to make it have the remote gtx
      MethodCall meth = entry.getModifications().get(0);

      meth.getArgs()[0] = remoteGtx;
      //call our remote method
      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
      }
      catch (Throwable t)
      {
         fail();
      }

      assertEquals(2, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(2, cache.getTransactionTable().getNumLocalTransactions());

//        call our remote method
      MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod_id, remoteGtx);
      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(rollbackMethod);
      }
      catch (Throwable t)
View Full Code Here

      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
      TransactionTable table = cache.getTransactionTable();
      OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
      assertNotNull(mgr.getTransaction());
      MethodCall meth = entry.getModifications().get(0);
      mgr.commit();

      //test local calls
      List<?> calls = dummy.getAllCalledIds();
      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
      assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));

      assertNull(mgr.getTransaction());

      assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());


      GlobalTransaction remoteGtx = new GlobalTransaction();

      remoteGtx.setAddress(new DummyAddress());

//      hack the method call to make it have the remote gtx

      meth.getArgs()[0] = remoteGtx;
      //call our remote method
      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
      }
      catch (Throwable t)
      {
         fail();
      }

      //our thread should be null
      assertNull(mgr.getTransaction());
      assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());

      //   there should be a registration for the remote gtx
      assertNotNull(table.get(remoteGtx));
      assertNotNull(table.getLocalTransaction(remoteGtx));
      //this is not populated until replication interceptor is used

      calls = dummy.getAllCalledIds();
      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));

      assertNull(mgr.getTransaction());
//      call our remote method
      MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod_id, remoteGtx, Boolean.TRUE);
      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
      }
      catch (Throwable t)
View Full Code Here

      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
      TransactionTable table = cache.getTransactionTable();
      OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
      assertNotNull(mgr.getTransaction());
      MethodCall meth = entry.getModifications().get(0);
      mgr.commit();

      //test local calls
      List<?> calls = dummy.getAllCalledIds();
      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(0));
      assertEquals(MethodDeclarations.commitMethod_id, calls.get(1));

      GlobalTransaction remoteGtx = new GlobalTransaction();

      remoteGtx.setAddress(new DummyAddress());

//      hack the method call to make it have the remote gtx

      meth.getArgs()[0] = remoteGtx;
      //call our remote method
      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), Boolean.FALSE);
      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
      }
      catch (Throwable t)
      {
         fail();
      }

      //our thread should be null
      assertNull(mgr.getTransaction());

      //   there should be a registration for the remote gtx
      assertNotNull(table.get(remoteGtx));
      assertNotNull(table.getLocalTransaction(remoteGtx));
      //this is not populated until replication interceptor is used
      calls = dummy.getAllCalledIds();
      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));

//      call our remote method
      MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod_id, remoteGtx);
      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(rollbackMethod);
      }
      catch (Throwable t)
View Full Code Here

      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
      TransactionTable table = cache.getTransactionTable();
      OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
      assertNotNull(mgr.getTransaction());
      MethodCall meth = entry.getModifications().get(0);
      mgr.commit();

      GlobalTransaction remoteGtx = new GlobalTransaction();

      remoteGtx.setAddress(new TestAddress());
      //hack the method call to make it have the remote gtx

      meth.getArgs()[0] = remoteGtx;
      //call our remote method
      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), false);
      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
      }
      catch (Throwable t)
View Full Code Here

      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
      TransactionTable table = cache.getTransactionTable();
      OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
      assertNotNull(mgr.getTransaction());
      MethodCall meth = entry.getModifications().get(0);
      mgr.commit();

      GlobalTransaction remoteGtx = new GlobalTransaction();

      remoteGtx.setAddress(new TestAddress());
      //hack the method call to make it have the remote gtx
      meth.getArgs()[0] = remoteGtx;
      //call our remote method
      MethodCall prepareMethod = MethodCallFactory.create(MethodDeclarations.optimisticPrepareMethod_id, remoteGtx, injectDataVersion(entry.getModifications()), null, remoteGtx.getAddress(), false);
      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(prepareMethod);
      }
      catch (Throwable t)
      {
         fail();
      }

      //our thread should be null
      assertNull(mgr.getTransaction());

      //   there should be a registration for the remote gtx
      assertNotNull(table.get(remoteGtx));
      assertNotNull(table.getLocalTransaction(remoteGtx));
      //assert that this is populated
      assertEquals(3, entry.getTransactionWorkSpace().getNodes().size());
      List calls = dummy.getAllCalledIds();
      assertEquals(MethodDeclarations.optimisticPrepareMethod_id, calls.get(2));


      assertEquals(1, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(1, cache.getTransactionTable().getNumLocalTransactions());

      //      call our remote method
      MethodCall rollbackMethod = MethodCallFactory.create(MethodDeclarations.rollbackMethod_id, remoteGtx);
      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(rollbackMethod);
      }
      catch (Throwable t)
View Full Code Here

      GlobalTransaction gtx = cache.getCurrentTransaction(tx, true);
      TransactionTable table = cache.getTransactionTable();
      OptimisticTransactionEntry entry = (OptimisticTransactionEntry) table.get(gtx);
      assertNotNull(mgr.getTransaction());
      MethodCall meth = entry.getModifications().get(0);
      mgr.commit();


      GlobalTransaction remoteGtx = new GlobalTransaction();

      remoteGtx.setAddress(new TestAddress());
      //hack the method call to make it have the remote gtx

      meth.getArgs()[0] = remoteGtx;

      List calls = dummy.getAllCalledIds();
      assertEquals(2, calls.size());

      assertEquals(0, cache.getTransactionTable().getNumGlobalTransactions());
      assertEquals(0, cache.getTransactionTable().getNumLocalTransactions());

      //      call our remote method
      MethodCall commitMethod = MethodCallFactory.create(MethodDeclarations.commitMethod_id, remoteGtx);
      try
      {
         TestingUtil.getRemoteDelegate(cache)._replicate(commitMethod);
         fail();
      }
View Full Code Here

TOP

Related Classes of org.jboss.cache.marshall.MethodCall

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.