Search in sources :

Example 1 with SimpleRecordOperation

use of org.springframework.jca.cci.object.SimpleRecordOperation in project spring-framework by spring-projects.

the class EisOperationTests method testSimpleRecordOperationWithInputOutputRecord.

@Test
public void testSimpleRecordOperationWithInputOutputRecord() throws ResourceException {
    ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
    Connection connection = mock(Connection.class);
    Interaction interaction = mock(Interaction.class);
    Record inputOutputRecord = mock(Record.class);
    InteractionSpec interactionSpec = mock(InteractionSpec.class);
    SimpleRecordOperation query = new SimpleRecordOperation(connectionFactory, interactionSpec);
    given(connectionFactory.getConnection()).willReturn(connection);
    given(connection.createInteraction()).willReturn(interaction);
    given(interaction.execute(interactionSpec, inputOutputRecord, inputOutputRecord)).willReturn(true);
    query.execute(inputOutputRecord, inputOutputRecord);
    verify(interaction).execute(interactionSpec, inputOutputRecord, inputOutputRecord);
    verify(interaction).close();
    verify(connection).close();
}
Also used : ConnectionFactory(javax.resource.cci.ConnectionFactory) Interaction(javax.resource.cci.Interaction) InteractionSpec(javax.resource.cci.InteractionSpec) Connection(javax.resource.cci.Connection) SimpleRecordOperation(org.springframework.jca.cci.object.SimpleRecordOperation) Record(javax.resource.cci.Record) Test(org.junit.Test)

Example 2 with SimpleRecordOperation

use of org.springframework.jca.cci.object.SimpleRecordOperation in project spring-framework by spring-projects.

the class EisOperationTests method testSimpleRecordOperation.

@Test
public void testSimpleRecordOperation() throws ResourceException {
    ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
    Connection connection = mock(Connection.class);
    Interaction interaction = mock(Interaction.class);
    Record inputRecord = mock(Record.class);
    Record outputRecord = mock(Record.class);
    InteractionSpec interactionSpec = mock(InteractionSpec.class);
    SimpleRecordOperation query = new SimpleRecordOperation(connectionFactory, interactionSpec);
    given(connectionFactory.getConnection()).willReturn(connection);
    given(connection.createInteraction()).willReturn(interaction);
    given(interaction.execute(interactionSpec, inputRecord)).willReturn(outputRecord);
    query.execute(inputRecord);
    verify(interaction).execute(interactionSpec, inputRecord);
    verify(interaction).close();
    verify(connection).close();
}
Also used : ConnectionFactory(javax.resource.cci.ConnectionFactory) Interaction(javax.resource.cci.Interaction) InteractionSpec(javax.resource.cci.InteractionSpec) Connection(javax.resource.cci.Connection) SimpleRecordOperation(org.springframework.jca.cci.object.SimpleRecordOperation) Record(javax.resource.cci.Record) Test(org.junit.Test)

Example 3 with SimpleRecordOperation

use of org.springframework.jca.cci.object.SimpleRecordOperation in project spring-framework by spring-projects.

the class EisOperationTests method testSimpleRecordOperationWithExplicitOutputRecord.

@Test
public void testSimpleRecordOperationWithExplicitOutputRecord() throws ResourceException {
    ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
    Connection connection = mock(Connection.class);
    Interaction interaction = mock(Interaction.class);
    Record inputRecord = mock(Record.class);
    Record outputRecord = mock(Record.class);
    InteractionSpec interactionSpec = mock(InteractionSpec.class);
    SimpleRecordOperation operation = new SimpleRecordOperation(connectionFactory, interactionSpec);
    given(connectionFactory.getConnection()).willReturn(connection);
    given(connection.createInteraction()).willReturn(interaction);
    given(interaction.execute(interactionSpec, inputRecord, outputRecord)).willReturn(true);
    operation.execute(inputRecord, outputRecord);
    verify(interaction).execute(interactionSpec, inputRecord, outputRecord);
    verify(interaction).close();
    verify(connection).close();
}
Also used : ConnectionFactory(javax.resource.cci.ConnectionFactory) Interaction(javax.resource.cci.Interaction) InteractionSpec(javax.resource.cci.InteractionSpec) Connection(javax.resource.cci.Connection) SimpleRecordOperation(org.springframework.jca.cci.object.SimpleRecordOperation) Record(javax.resource.cci.Record) Test(org.junit.Test)

Aggregations

Connection (javax.resource.cci.Connection)3 ConnectionFactory (javax.resource.cci.ConnectionFactory)3 Interaction (javax.resource.cci.Interaction)3 InteractionSpec (javax.resource.cci.InteractionSpec)3 Record (javax.resource.cci.Record)3 Test (org.junit.Test)3 SimpleRecordOperation (org.springframework.jca.cci.object.SimpleRecordOperation)3