Package nexj.core.runtime.platform.generic.tx

Examples of nexj.core.runtime.platform.generic.tx.GenericTransactionManager


     
      ConnectionObjects connection = createPersistenceConnection();
      FileConnection fConn = connection.getConnection();
      XAResource xar = connection.getXAR();
     
      txM = new GenericTransactionManager();
      txM.begin();
      txT = txM.getTransaction();
      txT.enlistResource(xar);
     
      checkAttach(fConn, "data1");
View Full Code Here


      TransactionManager txM;
      ConnectionObjects connection = createPersistenceConnection();
      FileConnection fConn = connection.getConnection();
      XAResource xar = connection.getXAR();
     
      txM = new GenericTransactionManager();
      txM.begin();
      txT = txM.getTransaction();
      txT.enlistResource(xar);
     
      checkAttach(fConn, "data1");
View Full Code Here

      FileConnection fConn3 = connection.makeNewConnectionHandle();
      FileConnection fConn4 = connection.makeNewConnectionHandle();
      FileConnection fConn5 = connection.makeNewConnectionHandle();
      XAResource xar = connection.getXAR();
     
      txM = new GenericTransactionManager();
      txM.begin();
      txT = txM.getTransaction();
      txT.enlistResource(xar);
     
      checkAttach(fConn1, "data1");
View Full Code Here

      TransactionManager txM;
      ConnectionObjects connection = createPersistenceConnection();
      FileConnection fConn1 = connection.getConnection();
      XAResource xar = connection.getXAR();
     
      txM = new GenericTransactionManager();
      txM.begin();
      txT = txM.getTransaction();
      txT.enlistResource(xar);
     
      checkAttach(fConn1, "data1");
View Full Code Here

         XAResource xar2 = outgoing2.getXAR();
        
        
         //Transaction Manager Setup
         Transaction txT;
         TransactionManager txM = new GenericTransactionManager();
        
         txM.begin();
         txT = txM.getTransaction();
        
         txT.enlistResource(xar1);
         txT.enlistResource(xar2);
        
        
         //Write on connection #1
         checkAttach(fConn1, FileNameExpander.expandString(sFileNameTemplate, context, null));
        
         //Do file ops...
         char[] data1 = "Data for the first file.\n".toCharArray();
        
         fConn1.write(String.valueOf(data1));
        
         //Write on connection #2
         checkAttach(fConn2, FileNameExpander.expandString(sFileNameTemplate, context, null));
        
         //Do file ops...
         char[] data2 = "Data for the second file.\n".toCharArray();
        
         fConn2.write(String.valueOf(data2));
        
         //Wind up
         fConn1.close();
         fConn2.close();
        
         txM.commit();
        
        
         //Check Result #1
         verifyData(new File(m_outgoingDirectory, "out.1.txt"), data1);
        
View Full Code Here

      XAResource xar2 = outgoing2.getXAR();
     
     
      //Transaction Manager Setup
      Transaction txT;
      TransactionManager txM = new GenericTransactionManager();
     
      txM.begin();
      txT = txM.getTransaction();
     
      txT.enlistResource(xar1);
      txT.enlistResource(xar2);
     
     
      //Write on connection #1
      checkAttach(fConn1, "out1.txt");
     
      //Do file ops...
      OutputStream ostream1 = fConn1.getOutputStream();
      OutputStreamWriter writer1 = new OutputStreamWriter(ostream1, "UTF-8");
     
      char[] data1 = "Data for the first file.\n".toCharArray();
     
      writer1.write(data1);
      writer1.close();
      writer1 = null;
     
     
      //Write on connection #2
      checkAttach(fConn2, "out2.txt");
     
      //Do file ops...
      char[] data2 = "Data for the second file.\n".toCharArray();

      fConn2.write(String.valueOf(data2));
     
      //Wind up
      fConn1.close();
      fConn2.close();
     
      txM.rollback();

     
      //There should be no output
      assertEquals(0, m_outgoingDirectory.listFiles().length);
     
View Full Code Here

      PrepareFailsXAResource failingXar = new PrepareFailsXAResource();
     
     
      //Transaction Manager Setup
      Transaction txT;
      TransactionManager txM = new GenericTransactionManager();
     
      txM.begin();
      txT = txM.getTransaction();
     
      txT.enlistResource(xar1);
      txT.enlistResource(xar2);
      txT.enlistResource(failingXar);
     
     
      //Write on connection #1
      checkAttach(fConn1, "out1.txt");
     
      //Do file ops...
      OutputStream ostream1 = fConn1.getOutputStream();
      OutputStreamWriter writer1 = new OutputStreamWriter(ostream1, "UTF-8");
     
      char[] data1 = "Data for the first file.\n".toCharArray();

      writer1.write(data1);
      writer1.close();
      writer1 = null;
     
     
      //Write on connection #2
      checkAttach(fConn2, "out2.txt");
     
      //Do file ops...
      char[] data2 = "Data for the second file.\n".toCharArray();
     
      fConn2.write(String.valueOf(data2));
     
      //Wind up
      fConn1.close();
      fConn2.close();
     
     
      //This should not succeed (prepare for 3rd XAR will fail)
      try
      {
         txM.commit();
         fail();
      }
      catch (RollbackException ex)
      {
         //Good
View Full Code Here

      XAResource xar1 = outgoing1.getXAR();
     
     
      //Transaction Manager Setup
      Transaction txT;
      TransactionManager txM = new GenericTransactionManager();
     
      txM.begin();
      txT = txM.getTransaction();
     
      txT.enlistResource(xar1);
     
      //Create attachment failure
      assertTrue(m_outgoingTempDirectory.delete());
     
      //Open connection #1 - should fail
      try
      {
         fConn1.attachToFile("out1.txt");
         fail();
      }
      catch (FileConnectionException ex)
      {
      }
     
      txM.rollback();
     
      //There should be no output
      assertEquals(0, m_outgoingDirectory.listFiles().length);
   }
View Full Code Here

TOP

Related Classes of nexj.core.runtime.platform.generic.tx.GenericTransactionManager

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.