Examples of TxSession


Examples of org.gridkit.coherence.txlite.TxSession

  @Test
  public void testReadThenWrite() {
   
    TxManager txman = TxLite.getManager();
   
    TxSession rsession = txman.openReadOnlySession();
    TxSession wsession = txman.openReadWriteSession();
    NamedCache writeA = wsession.connect(cacheA);
    NamedCache rrA = rsession.connect(cacheA);
    NamedCache rcA = txman.toReadCommited(cacheA);

    Assert.assertThat(rrA.get("A"), IsNull.nullValue());
    Assert.assertThat(rcA.get("A"), IsNull.nullValue());
    Assert.assertThat(cacheA.get("A"), IsNull.nullValue());
    Assert.assertThat(writeA.get("A"), IsNull.nullValue());
   
    writeA.put("A", "A");
 
    Assert.assertThat(rrA.get("A"), IsNull.nullValue());
    Assert.assertThat(rcA.get("A"), IsNull.nullValue());
    Assert.assertThat((String)cacheA.get("A"), Is.is("A"));
    Assert.assertThat((String)writeA.get("A"), Is.is("A"));

    wsession.commit();
   
    Assert.assertThat(rrA.get("A"), IsNull.nullValue());
    Assert.assertThat((String)rcA.get("A"), Is.is("A"));

    rsession.commit();
View Full Code Here

Examples of org.gridkit.coherence.txlite.TxSession

  @Test
  public void testReadThenWrite() {
   
    TxManager txman = new TxManager(superviser);
   
    TxSession readSession = txman.openReadOnlySession();
    NamedCache readA = readSession.connect(cacheA);
    TxCacheWrapper dirtyA = new TxCacheWrapper(cacheA, new DirtyReadCacheAccessAdapter());
   
    TxSession writeSession = txman.openReadWriteSession();
    NamedCache writeA = writeSession.connect(cacheA);
   
    Assert.assertThat(readA.get("A"), IsNull.nullValue());
    Assert.assertThat(dirtyA.get("A"), IsNull.nullValue());
    Assert.assertThat(writeA.get("A"), IsNull.nullValue());
   
    writeA.put("A", "A");
   
    Assert.assertThat(readA.get("A"), IsNull.nullValue());
    Assert.assertThat((String)dirtyA.get("A"), Is.is("A"));
    Assert.assertThat((String)writeA.get("A"), Is.is("A"));
   
    writeSession.commit();
    Assert.assertThat(readA.get("A"), IsNull.nullValue());
    readSession.commit();
    Assert.assertThat((String)readA.get("A"), Is.is("A"));
  }
View Full Code Here

Examples of org.gridkit.coherence.txlite.TxSession

  @Test
  public void testReadThenWriteThenRollback() {
   
    TxManager txman = new TxManager(superviser);
   
    TxSession readSession = txman.openReadOnlySession();
    NamedCache readA = readSession.connect(cacheA);
    TxCacheWrapper dirtyA = new TxCacheWrapper(cacheA, new DirtyReadCacheAccessAdapter());
   
    TxSession writeSession = txman.openReadWriteSession();
    NamedCache writeA = writeSession.connect(cacheA);
   
    Assert.assertThat(readA.get("A"), IsNull.nullValue());
    Assert.assertThat(dirtyA.get("A"), IsNull.nullValue());
    Assert.assertThat(writeA.get("A"), IsNull.nullValue());
   
    writeA.put("A", "A");
   
    Assert.assertThat(readA.get("A"), IsNull.nullValue());
    Assert.assertThat((String)dirtyA.get("A"), Is.is("A"));
    Assert.assertThat((String)writeA.get("A"), Is.is("A"));
   
    writeSession.rollback();
    Assert.assertThat(readA.get("A"), IsNull.nullValue());
    readSession.commit();
    Assert.assertThat(readA.get("A"), IsNull.nullValue());
    Assert.assertThat(dirtyA.get("A"), IsNull.nullValue());
    Assert.assertThat(writeA.get("A"), IsNull.nullValue());
    writeSession.rollback();
  }
View Full Code Here

Examples of org.jboss.test.perf.interfaces.TxSession

      getLog().debug("+++ testTxTimings()");
      Object obj = getInitialContext().lookup(TX_SESSION);
      obj = PortableRemoteObject.narrow(obj, TxSessionHome.class);
      TxSessionHome home = (TxSessionHome) obj;
      getLog().debug("Found TxSession @ jndiName=TxSession");
      TxSession bean = home.create();
      getLog().debug("Created TxSession");
      txRequired(bean);
      txRequiresNew(bean);
      txSupports(bean);
      txNotSupported(bean);
View Full Code Here

Examples of org.jboss.test.perf.interfaces.TxSession

      try
      {
         Object obj = new InitialContext().lookup("perf.TxSession");
         TxSessionHome home = (TxSessionHome) obj;
         results.append("\nFound TxSession @ jndiName=TxSession");
         TxSession bean = home.create();
         results.append("\nCreated TxSession");
         txRequired(bean, results);
         txRequiresNew(bean, results);
         txSupports(bean, results);
         txNotSupported(bean, results);
View Full Code Here

Examples of org.jboss.test.testbean.interfaces.TxSession

      getLog().debug(++test+"- "+"Looking up home for nextgen.TxSession...");
      TxSessionHome txHome = (TxSessionHome) ctx.lookup("nextgen.TxSession");
      if (txHome != null )getLog().debug("ok");

      getLog().debug(++test+"- "+"Calling create on the home...");
      TxSession txBean = null;

      // Let's try to create the instance
      try {

         txBean =  txHome.create();
      } catch (Exception e) {

         getLog().debug("Exception: ", e);
      }


      if (txBean!= null) getLog().debug("ok");

      getLog().debug(++test+"- "+"calling supports... ");
      getLog().debug(txBean.txSupports());

      getLog().debug(++test+"- "+"calling required... ");
      getLog().debug(txBean.txRequired());

      getLog().debug(++test+"- "+"calling requiresNew... ");
      getLog().debug(txBean.txRequiresNew());

      getLog().debug(++test+"- "+"calling not supported... ");
      getLog().debug(txBean.txNotSupported());

      getLog().debug(++test+"- "+"calling mandatory (should get an exception)...");
      try {
         getLog().debug(txBean.txMandatory());
      } catch (Exception e) {
         getLog().debug("got Exception, ok");
      }

      getLog().debug(++test+"- "+"calling requiredToSupports... ");
      getLog().debug(txBean.requiredToSupports());

      getLog().debug(++test+"- "+"calling requiredToNotSupported... ");
      getLog().debug(txBean.requiredToNotSupported());

      getLog().debug(++test+"- "+"calling requiredToRequiresNew... ");
      getLog().debug(txBean.requiredToRequiresNew());

      getLog().debug("ok");
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.