当前位置: 首页>>代码示例>>Java>>正文


Java CciTemplate.execute方法代码示例

本文整理汇总了Java中org.springframework.jca.cci.core.CciTemplate.execute方法的典型用法代码示例。如果您正苦于以下问题:Java CciTemplate.execute方法的具体用法?Java CciTemplate.execute怎么用?Java CciTemplate.execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.jca.cci.core.CciTemplate的用法示例。


在下文中一共展示了CciTemplate.execute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testTemplateExecuteInputOutput

import org.springframework.jca.cci.core.CciTemplate; //导入方法依赖的package包/类
@Test
public void testTemplateExecuteInputOutput() 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);

	given(connectionFactory.getConnection()).willReturn(connection);
	given(connection.createInteraction()).willReturn(interaction);
	given(interaction.execute(interactionSpec, inputRecord, outputRecord)).willReturn(true);


	CciTemplate ct = new CciTemplate(connectionFactory);
	ct.execute(interactionSpec, inputRecord, outputRecord);

	verify(interaction).execute(interactionSpec, inputRecord, outputRecord);
	verify(interaction).close();
	verify(connection).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:24,代码来源:CciTemplateTests.java

示例2: testTemplateExecuteInputFalse

import org.springframework.jca.cci.core.CciTemplate; //导入方法依赖的package包/类
@Test
public void testTemplateExecuteInputFalse() 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);

	given(connectionFactory.getConnection()).willReturn(connection);
	given(connection.createInteraction()).willReturn(interaction);
	given(interaction.execute(interactionSpec, inputRecord)).willReturn(outputRecord);

	CciTemplate ct = new CciTemplate(connectionFactory);
	ct.execute(interactionSpec, inputRecord);

	verify(interaction).execute(interactionSpec, inputRecord);
	verify(interaction).close();
	verify(connection).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:23,代码来源:CciTemplateTests.java

示例3: testTemplateExecuteInputExtractorFalse

import org.springframework.jca.cci.core.CciTemplate; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testTemplateExecuteInputExtractorFalse()
		throws ResourceException, SQLException {
	ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
	Connection connection = mock(Connection.class);
	Interaction interaction = mock(Interaction.class);
	RecordExtractor<Object> extractor = mock(RecordExtractor.class);

	Record inputRecord = mock(Record.class);
	Record outputRecord = mock(Record.class);

	InteractionSpec interactionSpec = mock(InteractionSpec.class);

	given(connectionFactory.getConnection()).willReturn(connection);
	given(connection.createInteraction()).willReturn(interaction);
	given(interaction.execute(interactionSpec, inputRecord)).willReturn(outputRecord);
	given(extractor.extractData(outputRecord)).willReturn(new Object());

	CciTemplate ct = new CciTemplate(connectionFactory);
	ct.execute(interactionSpec, inputRecord, extractor);

	verify(extractor).extractData(outputRecord);
	verify(interaction).close();
	verify(connection).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:27,代码来源:CciTemplateTests.java

示例4: testTemplateExecuteInputOutputConnectionSpec

import org.springframework.jca.cci.core.CciTemplate; //导入方法依赖的package包/类
@Test
public void testTemplateExecuteInputOutputConnectionSpec() throws ResourceException {
	ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
	ConnectionSpec connectionSpec = mock(ConnectionSpec.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);

	given(connectionFactory.getConnection(connectionSpec)).willReturn(connection);
	given(connection.createInteraction()).willReturn(interaction);
	given(interaction.execute(interactionSpec, inputRecord, outputRecord)).willReturn(true);

	ConnectionSpecConnectionFactoryAdapter adapter = new ConnectionSpecConnectionFactoryAdapter();
	adapter.setTargetConnectionFactory(connectionFactory);
	adapter.setConnectionSpec(connectionSpec);
	CciTemplate ct = new CciTemplate(adapter);
	ct.execute(interactionSpec, inputRecord, outputRecord);

	verify(interaction).execute(interactionSpec, inputRecord, outputRecord);
	verify(interaction).close();
	verify(connection).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:27,代码来源:CciTemplateTests.java

示例5: testTemplateExecuteConnectionCallback

import org.springframework.jca.cci.core.CciTemplate; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testTemplateExecuteConnectionCallback()
		throws ResourceException, SQLException {
	ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
	Connection connection = mock(Connection.class);
	ConnectionCallback<Object> connectionCallback = mock(ConnectionCallback.class);

	given(connectionFactory.getConnection()).willReturn(connection);
	given(connectionCallback.doInConnection(connection, connectionFactory)).willReturn(new Object());

	CciTemplate ct = new CciTemplate(connectionFactory);
	ct.execute(connectionCallback);

	verify(connectionCallback).doInConnection(connection, connectionFactory);
	verify(connection).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:18,代码来源:CciTemplateTests.java

示例6: testTemplateExecuteInteractionCallback

import org.springframework.jca.cci.core.CciTemplate; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testTemplateExecuteInteractionCallback()
		throws ResourceException, SQLException {
	ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
	Connection connection = mock(Connection.class);
	Interaction interaction = mock(Interaction.class);
	InteractionCallback<Object> interactionCallback = mock(InteractionCallback.class);

	given(connectionFactory.getConnection()).willReturn(connection);
	given(connection.createInteraction()).willReturn(interaction);
	given(interactionCallback.doInInteraction(interaction,connectionFactory)).willReturn(new Object());

	CciTemplate ct = new CciTemplate(connectionFactory);
	ct.execute(interactionCallback);

	verify(interactionCallback).doInInteraction(interaction,connectionFactory);
	verify(interaction).close();
	verify(connection).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:21,代码来源:CciTemplateTests.java

示例7: testTemplateExecuteInputTrueTrueWithCreator

import org.springframework.jca.cci.core.CciTemplate; //导入方法依赖的package包/类
@Test
public void testTemplateExecuteInputTrueTrueWithCreator()
		throws ResourceException {
	ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
	Connection connection = mock(Connection.class);
	Interaction interaction = mock(Interaction.class);
	RecordCreator creator = mock(RecordCreator.class);

	Record inputOutputRecord = mock(Record.class);

	InteractionSpec interactionSpec = mock(InteractionSpec.class);

	given(connectionFactory.getConnection()).willReturn(connection);
	given(connection.createInteraction()).willReturn(interaction);
	given(interaction.execute(interactionSpec, inputOutputRecord, inputOutputRecord)).willReturn(true);

	CciTemplate ct = new CciTemplate(connectionFactory);
	ct.setOutputRecordCreator(creator);
	ct.execute(interactionSpec, inputOutputRecord, inputOutputRecord);

	verify(interaction).execute(interactionSpec, inputOutputRecord, inputOutputRecord);
	verify(interaction).close();
	verify(connection).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:25,代码来源:CciTemplateTests.java

示例8: testTemplateExecuteInputTrueTrue

import org.springframework.jca.cci.core.CciTemplate; //导入方法依赖的package包/类
@Test
public void testTemplateExecuteInputTrueTrue() 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);

	given(connectionFactory.getConnection()).willReturn(connection);
	given(connection.createInteraction()).willReturn(interaction);
	given(interaction.execute(interactionSpec, inputOutputRecord, inputOutputRecord)).willReturn(true);

	CciTemplate ct = new CciTemplate(connectionFactory);
	ct.execute(interactionSpec, inputOutputRecord, inputOutputRecord);

	verify(interaction).execute(interactionSpec, inputOutputRecord, inputOutputRecord);
	verify(interaction).close();
	verify(connection).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:20,代码来源:CciTemplateTests.java

示例9: testTemplateExecuteInputFalseTrue

import org.springframework.jca.cci.core.CciTemplate; //导入方法依赖的package包/类
@Test
public void testTemplateExecuteInputFalseTrue() 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);

	given(connectionFactory.getConnection()).willReturn(connection);
	given(connection.createInteraction()).willReturn(interaction);
	given(interaction.execute(interactionSpec, inputOutputRecord)).willReturn(null);

	CciTemplate ct = new CciTemplate(connectionFactory);
	Record tmpOutputRecord = ct.execute(interactionSpec,
			inputOutputRecord);
	assertNull(tmpOutputRecord);

	verify(interaction).execute(interactionSpec, inputOutputRecord);
	verify(interaction).close();
	verify(connection).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:22,代码来源:CciTemplateTests.java

示例10: testTemplateExecuteWithCreatorAndRecordFactoryNotSupported

import org.springframework.jca.cci.core.CciTemplate; //导入方法依赖的package包/类
@Test
public void testTemplateExecuteWithCreatorAndRecordFactoryNotSupported()
		throws ResourceException {
	ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
	Connection connection = mock(Connection.class);
	Interaction interaction = mock(Interaction.class);

	Record inputRecord = mock(Record.class);
	final Record outputRecord = mock(Record.class);

	InteractionSpec interactionSpec = mock(InteractionSpec.class);

	given(connectionFactory.getConnection()).willReturn(connection);
	given(connectionFactory.getRecordFactory()).willThrow(new NotSupportedException("not supported"));
	given(connection.createInteraction()).willReturn(interaction);
	given(interaction.execute(interactionSpec, inputRecord, outputRecord)).willReturn(true);

	CciTemplate ct = new CciTemplate(connectionFactory);
	ct.setOutputRecordCreator(new RecordCreator() {
		@Override
		public Record createRecord(RecordFactory recordFactory) {
			assertTrue(recordFactory instanceof NotSupportedRecordFactory);
			return outputRecord;
		}
	});
	ct.execute(interactionSpec, inputRecord);

	verify(interaction).execute(interactionSpec, inputRecord, outputRecord);
	verify(interaction).close();
	verify(connection).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:32,代码来源:CciTemplateTests.java

示例11: testTemplateExecuteInputTrueWithCreator2

import org.springframework.jca.cci.core.CciTemplate; //导入方法依赖的package包/类
@Test
public void testTemplateExecuteInputTrueWithCreator2()
		throws ResourceException {
	ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
	RecordFactory recordFactory = mock(RecordFactory.class);
	Connection connection = mock(Connection.class);
	Interaction interaction = mock(Interaction.class);
	RecordCreator creator = mock(RecordCreator.class);

	Record inputRecord = mock(Record.class);
	final Record outputRecord = mock(Record.class);

	InteractionSpec interactionSpec = mock(InteractionSpec.class);

	given(connectionFactory.getConnection()).willReturn(connection);
	given(connectionFactory.getRecordFactory()).willReturn(recordFactory);
	given(connection.createInteraction()).willReturn(interaction);
	given(creator.createRecord(recordFactory)).willReturn(outputRecord);
	given(interaction.execute(interactionSpec, inputRecord, outputRecord)).willReturn(true);

	CciTemplate ct = new CciTemplate(connectionFactory);
	ct.setOutputRecordCreator(creator);
	ct.execute(interactionSpec, inputRecord);

	verify(interaction).execute(interactionSpec, inputRecord, outputRecord);
	verify(interaction).close();
	verify(connection).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:29,代码来源:CciTemplateTests.java

示例12: testTemplateExecuteInputExtractorTrueWithCreator

import org.springframework.jca.cci.core.CciTemplate; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testTemplateExecuteInputExtractorTrueWithCreator()
		throws ResourceException, SQLException {
	ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
	RecordFactory recordFactory = mock(RecordFactory.class);
	Connection connection = mock(Connection.class);
	Interaction interaction = mock(Interaction.class);
	RecordExtractor<Object> extractor = mock(RecordExtractor.class);
	RecordCreator creator = mock(RecordCreator.class);

	Record inputRecord = mock(Record.class);
	Record outputRecord = mock(Record.class);

	InteractionSpec interactionSpec = mock(InteractionSpec.class);

	given(connectionFactory.getConnection()).willReturn(connection);
	given(connection.createInteraction()).willReturn(interaction);
	given(connectionFactory.getRecordFactory()).willReturn(recordFactory);
	given(creator.createRecord(recordFactory)).willReturn(outputRecord);
	given(interaction.execute(interactionSpec, inputRecord, outputRecord)).willReturn(true);
	given(extractor.extractData(outputRecord)).willReturn(new Object());

	CciTemplate ct = new CciTemplate(connectionFactory);
	ct.setOutputRecordCreator(creator);
	ct.execute(interactionSpec, inputRecord, extractor);

	verify(extractor).extractData(outputRecord);
	verify(interaction).close();
	verify(connection).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:32,代码来源:CciTemplateTests.java

示例13: testTemplateExecuteInputGeneratorTrueWithCreator

import org.springframework.jca.cci.core.CciTemplate; //导入方法依赖的package包/类
@Test
public void testTemplateExecuteInputGeneratorTrueWithCreator()
		throws ResourceException {
	ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
	RecordFactory recordFactory = mock(RecordFactory.class);
	Connection connection = mock(Connection.class);
	Interaction interaction = mock(Interaction.class);
	RecordCreator generator = mock(RecordCreator.class);
	RecordCreator creator = mock(RecordCreator.class);

	Record inputRecord = mock(Record.class);
	Record outputRecord = mock(Record.class);

	InteractionSpec interactionSpec = mock(InteractionSpec.class);

	given(connectionFactory.getRecordFactory()).willReturn(recordFactory);
	given(generator.createRecord(recordFactory)).willReturn(inputRecord);
	given(connectionFactory.getConnection()).willReturn(connection);
	given(connection.createInteraction()).willReturn(interaction);
	given(creator.createRecord(recordFactory)).willReturn(outputRecord);
	given(connectionFactory.getRecordFactory()).willReturn(recordFactory);
	given(interaction.execute(interactionSpec, inputRecord, outputRecord)).willReturn(true);


	CciTemplate ct = new CciTemplate(connectionFactory);
	ct.setOutputRecordCreator(creator);
	ct.execute(interactionSpec, generator);

	verify(interaction).execute(interactionSpec, inputRecord, outputRecord);
	verify(interaction).close();
	verify(connection).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:33,代码来源:CciTemplateTests.java

示例14: testTemplateExecuteInputGeneratorFalse

import org.springframework.jca.cci.core.CciTemplate; //导入方法依赖的package包/类
@Test
public void testTemplateExecuteInputGeneratorFalse()
		throws ResourceException {
	ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
	RecordFactory recordFactory = mock(RecordFactory.class);
	Connection connection = mock(Connection.class);
	Interaction interaction = mock(Interaction.class);
	RecordCreator generator = mock(RecordCreator.class);

	Record inputRecord = mock(Record.class);
	Record outputRecord = mock(Record.class);

	InteractionSpec interactionSpec = mock(InteractionSpec.class);

	given(connectionFactory.getRecordFactory()).willReturn(recordFactory);
	given(connectionFactory.getConnection()).willReturn(connection);
	given(connection.createInteraction()).willReturn(interaction);
	given(generator.createRecord(recordFactory)).willReturn(inputRecord);
	given(interaction.execute(interactionSpec, inputRecord)).willReturn(outputRecord);

	CciTemplate ct = new CciTemplate(connectionFactory);
	ct.execute(interactionSpec, generator);

	verify(interaction).execute(interactionSpec, inputRecord);
	verify(interaction).close();
	verify(connection).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:28,代码来源:CciTemplateTests.java

示例15: testTemplateExecuteInputGeneratorExtractorFalse

import org.springframework.jca.cci.core.CciTemplate; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void testTemplateExecuteInputGeneratorExtractorFalse()
		throws ResourceException, SQLException {
	ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
	RecordFactory recordFactory = mock(RecordFactory.class);
	Connection connection = mock(Connection.class);
	Interaction interaction = mock(Interaction.class);
	RecordCreator generator = mock(RecordCreator.class);
	RecordExtractor<Object> extractor = mock(RecordExtractor.class);

	Record inputRecord = mock(Record.class);
	Record outputRecord = mock(Record.class);

	InteractionSpec interactionSpec = mock(InteractionSpec.class);

	given(connectionFactory.getRecordFactory()).willReturn(recordFactory);
	given(connectionFactory.getConnection()).willReturn(connection);
	given(connection.createInteraction()).willReturn(interaction);
	given(generator.createRecord(recordFactory)).willReturn(inputRecord);
	given(interaction.execute(interactionSpec, inputRecord)).willReturn(outputRecord);
	given(extractor.extractData(outputRecord)).willReturn(new Object());

	CciTemplate ct = new CciTemplate(connectionFactory);
	ct.execute(interactionSpec, generator, extractor);

	verify(extractor).extractData(outputRecord);
	verify(interaction).close();
	verify(connection).close();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:31,代码来源:CciTemplateTests.java


注:本文中的org.springframework.jca.cci.core.CciTemplate.execute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。