Package javax.resource.cci

Examples of javax.resource.cci.Connection


    MockControl connectionFactoryControl = MockControl.createControl(ConnectionFactory.class);
    final ConnectionFactory connectionFactory = (ConnectionFactory) connectionFactoryControl.getMock();
    MockControl recordFactoryControl = MockControl.createStrictControl(RecordFactory.class);
    RecordFactory recordFactory = (RecordFactory) recordFactoryControl.getMock();
    MockControl connectionControl = MockControl.createControl(Connection.class);
    Connection connection = (Connection) connectionControl.getMock();
    MockControl interactionControl = MockControl.createControl(Interaction.class);
    Interaction interaction = (Interaction) interactionControl.getMock();

    MockControl inputRecordControl = MockControl.createControl(Record.class);
    Record inputRecord = (Record) inputRecordControl.getMock();
    MockControl outputRecordControl = MockControl.createControl(Record.class);
    Record outputRecord = (Record) outputRecordControl.getMock();

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

    MockControl callDetectorControl = MockControl.createControl(QueryCallDetector.class);
    QueryCallDetector callDetector = (QueryCallDetector) callDetectorControl.getMock();

    MappingRecordOperationImpl query = new MappingRecordOperationImpl(connectionFactory, interactionSpec);
    query.setCallDetector(callDetector);

    Object inObj = new Object();
    Object outObj = new Object();

    connectionFactory.getRecordFactory();
    connectionFactoryControl.setReturnValue(recordFactory, 1);

    callDetector.callCreateInputRecord(recordFactory, inObj);
    callDetectorControl.setReturnValue(inputRecord, 1);

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

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

    interaction.execute(interactionSpec, inputRecord);
    interactionControl.setReturnValue(outputRecord, 1);

    callDetector.callExtractOutputData(outputRecord);
    callDetectorControl.setReturnValue(outObj, 1);

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

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

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


    MockControl connectionFactoryControl = MockControl.createControl(ConnectionFactory.class);
    final ConnectionFactory connectionFactory = (ConnectionFactory) connectionFactoryControl.getMock();
    MockControl recordFactoryControl = MockControl.createStrictControl(RecordFactory.class);
    RecordFactory recordFactory = (RecordFactory) recordFactoryControl.getMock();
    MockControl connectionControl = MockControl.createControl(Connection.class);
    Connection connection = (Connection) connectionControl.getMock();
    MockControl interactionControl = MockControl.createControl(Interaction.class);
    Interaction interaction = (Interaction) interactionControl.getMock();

    MockControl inputRecordControl = MockControl.createControl(Record.class);
    Record inputRecord = (Record) inputRecordControl.getMock();
    MockControl outputRecordControl = MockControl.createControl(Record.class);
    Record outputRecord = (Record) outputRecordControl.getMock();
    MockControl outputCreatorControl = MockControl.createControl(RecordCreator.class);
    RecordCreator outputCreator = (RecordCreator) outputCreatorControl.getMock();

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

    MockControl callDetectorControl = MockControl.createControl(QueryCallDetector.class);
    QueryCallDetector callDetector = (QueryCallDetector) callDetectorControl.getMock();

    MappingRecordOperationImpl query = new MappingRecordOperationImpl(connectionFactory, interactionSpec);
    query.setOutputRecordCreator(outputCreator);
    query.setCallDetector(callDetector);

    Object inObj = new Object();
    Object outObj = new Object();

    connectionFactory.getRecordFactory();
    connectionFactoryControl.setReturnValue(recordFactory, 1);

    callDetector.callCreateInputRecord(recordFactory, inObj);
    callDetectorControl.setReturnValue(inputRecord, 1);

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

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

    connectionFactory.getRecordFactory();
    connectionFactoryControl.setReturnValue(recordFactory, 1);

    outputCreator.createRecord(recordFactory);
    outputCreatorControl.setReturnValue(outputRecord, 1);

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

    callDetector.callExtractOutputData(outputRecord);
    callDetectorControl.setReturnValue(outObj, 1);

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

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

    connectionFactoryControl.replay();
    connectionControl.replay();
    interactionControl.replay();
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 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

     * @throws Throwable in case of an error
     */
    public void testConnectionFactory(ConnectionFactory connectionFactory)
            throws Throwable {
        assertNotNull(connectionFactory);
        Connection c = connectionFactory.getConnection();
        assertNotNull(c);
        c.close();
    }
View Full Code Here

    public void testProxy() throws Exception {
        Object proxy = kernel.invoke(connectionManagerName, "createConnectionFactory");
        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

                try {
                    ((AbstractConnectionManager) connectionManager).doStart();
                    try {
                        final Object cf = managedConnectionFactory.createConnectionFactory(connectionManager);
                        if (cf instanceof ConnectionFactory) {
                            final Connection connection = ((ConnectionFactory) cf).getConnection();
                            connection.getMetaData();
                            connection.close();
                        }
                    } catch (final Exception e) {
                        // no-op: just to force eager init of pool
                    }
                } catch (final Exception e) {
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.