Package javax.resource.cci

Examples of javax.resource.cci.Connection


   }
   
   public void cfGetConn() throws Exception
   {
      log.info(tid() + " CF_GET_CONN (" + id + ")");
      Connection conn = cf.getConnection();
      connections.put(id, conn);
   }
View Full Code Here


   }
  
   public void cnCloseConn() throws Exception
   {
      log.info(tid() + " CN_CLOSE_CONN (" + id + ")");
      Connection conn = (Connection)connections.get(id);
      conn.close();
   }
View Full Code Here

      {

         InitialContext ctx = new InitialContext();
         ConnectionFactory cf1 = (ConnectionFactory) ctx.lookup("java:/JBossTestCF");
         ConnectionFactory cf2 = (ConnectionFactory) ctx.lookup("java:/JBossTestCF2");
         Connection c1 = cf1.getConnection();
         try
         {
            TestConnection c2 = (TestConnection) cf2.getConnection();
            try
            {
               c2.setFailInPrepare(true, XAException.XA_RBROLLBACK);
            }
            finally
            {
               c2.close();
            }
         }
         finally
         {
            c1.close();
         }
      }
      catch (Exception e)
      {
         log.warn("Unexpected: ", e);
View Full Code Here

   * transactions. Throws the original ResourceException, if any.
   * @return a transactional Connection if any, a new one else
   * @see org.springframework.jca.cci.connection.ConnectionFactoryUtils#doGetConnection
   */
  public Connection getConnection() throws ResourceException {
    Connection con = ConnectionFactoryUtils.doGetConnection(getTargetConnectionFactory());
    return getTransactionAwareConnectionProxy(con, getTargetConnectionFactory());
  }
View Full Code Here

    if (conHolder != null) {
      return conHolder.getConnection();
    }

    logger.debug("Opening CCI Connection");
    Connection con = cf.getConnection();

    if (TransactionSynchronizationManager.isSynchronizationActive()) {
      logger.debug("Registering transaction synchronization for CCI Connection");
      conHolder = new ConnectionHolder(con);
      conHolder.setSynchronizedWithTransaction(true);
View Full Code Here


  public Object execute(ConnectionCallback action) throws DataAccessException {
    Assert.notNull(action, "Callback object must not be null");

    Connection con = ConnectionFactoryUtils.getConnection(getConnectionFactory(), getConnectionSpec());
    try {
      return action.doInConnection(con, getConnectionFactory());
    }
    catch (NotSupportedException ex) {
      throw new CciOperationNotSupportedException("CCI operation not supported by connector", ex);
View Full Code Here

    public void testProxy() throws Exception {
        Object proxy = kernel.invoke(managedConnectionFactoryName, "$getResource");
        assertNotNull(proxy);
        assertTrue(proxy instanceof ConnectionFactory);
        Connection connection = ((ConnectionFactory) proxy).getConnection();
        assertNotNull(connection);
        kernel.stopGBean(managedConnectionFactoryName);
        try {
            ((ConnectionFactory) proxy).getConnection();
//            fail();
View Full Code Here

        oos.close();
        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
        Object proxy2 = ois.readObject();
        assertNotNull(proxy2);
        assertTrue(proxy instanceof ConnectionFactory);
        Connection connection = proxy.getConnection();
        assertNotNull(connection);
        kernel.stopGBean(managedConnectionFactoryName);
        ObjectInputStream ois2 = new ObjectInputStream(new ByteArrayInputStream(bytes));
        ConnectionFactory proxy3 = (ConnectionFactory) ois2.readObject();
        try {
View Full Code Here

  public void testTemplateExecuteInputTrueTrue() throws ResourceException {
    MockControl connectionFactoryControl = MockControl.createStrictControl(ConnectionFactory.class);
    ConnectionFactory connectionFactory = (ConnectionFactory) connectionFactoryControl.getMock();
    MockControl connectionControl = MockControl.createStrictControl(Connection.class);
    Connection connection = (Connection) connectionControl.getMock();
    MockControl interactionControl = MockControl.createStrictControl(Interaction.class);
    Interaction interaction = (Interaction) interactionControl.getMock();

    MockControl inputOutputRecordControl = MockControl.createStrictControl(Record.class);
    Record inputOutputRecord = (Record) inputOutputRecordControl.getMock();

    MockControl interactionSpecControl = MockControl.createStrictControl(InteractionSpec.class);
    InteractionSpec interactionSpec = (InteractionSpec) interactionSpecControl.getMock();

    connectionFactory.getConnection();
    connectionFactoryControl.setReturnValue(connection);

    connection.createInteraction();
    connectionControl.setReturnValue(interaction);

    interaction.execute(interactionSpec, inputOutputRecord, inputOutputRecord);
    interactionControl.setReturnValue(true, 1);

    interaction.close();
    interactionControl.setVoidCallable(1);

    connection.close();
    connectionControl.setVoidCallable(1);

    connectionFactoryControl.replay();
    connectionControl.replay();
    interactionControl.replay();
View Full Code Here

  public void testTemplateExecuteInputFalseTrue() throws ResourceException {
    MockControl connectionFactoryControl = MockControl.createStrictControl(ConnectionFactory.class);
    ConnectionFactory connectionFactory = (ConnectionFactory) connectionFactoryControl.getMock();
    MockControl connectionControl = MockControl.createStrictControl(Connection.class);
    Connection connection = (Connection) connectionControl.getMock();
    MockControl interactionControl = MockControl.createStrictControl(Interaction.class);
    Interaction interaction = (Interaction) interactionControl.getMock();

    MockControl inputOutputRecordControl = MockControl.createStrictControl(Record.class);
    Record inputOutputRecord = (Record) inputOutputRecordControl.getMock();

    MockControl interactionSpecControl = MockControl.createStrictControl(InteractionSpec.class);
    InteractionSpec interactionSpec = (InteractionSpec) interactionSpecControl.getMock();

    connectionFactory.getConnection();
    connectionFactoryControl.setReturnValue(connection);

    connection.createInteraction();
    connectionControl.setReturnValue(interaction);

    interaction.execute(interactionSpec, inputOutputRecord);
    interactionControl.setReturnValue(null, 1);

    interaction.close();
    interactionControl.setVoidCallable(1);

    connection.close();
    connectionControl.setVoidCallable(1);

    connectionFactoryControl.replay();
    connectionControl.replay();
    interactionControl.replay();
View Full Code Here

TOP

Related Classes of javax.resource.cci.Connection

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.