本文整理汇总了Java中javax.resource.cci.Record类的典型用法代码示例。如果您正苦于以下问题:Java Record类的具体用法?Java Record怎么用?Java Record使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Record类属于javax.resource.cci包,在下文中一共展示了Record类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testSimpleRecordOperation
import javax.resource.cci.Record; //导入依赖的package包/类
@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();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:24,代码来源:EisOperationTests.java
示例2: testSimpleRecordOperationWithExplicitOutputRecord
import javax.resource.cci.Record; //导入依赖的package包/类
@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();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:24,代码来源:EisOperationTests.java
示例3: testSimpleRecordOperationWithInputOutputRecord
import javax.resource.cci.Record; //导入依赖的package包/类
@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();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:23,代码来源:EisOperationTests.java
示例4: testTemplateExecuteInputOutput
import javax.resource.cci.Record; //导入依赖的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
示例5: testTemplateExecuteInputFalse
import javax.resource.cci.Record; //导入依赖的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
示例6: testTemplateExecuteInputExtractorFalse
import javax.resource.cci.Record; //导入依赖的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
示例7: testTemplateExecuteInputOutputConnectionSpec
import javax.resource.cci.Record; //导入依赖的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
示例8: testTemplateExecuteInputTrueTrueWithCreator
import javax.resource.cci.Record; //导入依赖的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
示例9: testTemplateExecuteInputTrueTrue
import javax.resource.cci.Record; //导入依赖的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
示例10: testTemplateExecuteInputFalseTrue
import javax.resource.cci.Record; //导入依赖的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
示例11: execute
import javax.resource.cci.Record; //导入依赖的package包/类
@Override
public boolean execute(InteractionSpec spec, Record inputRec, Record searchRec) throws ResourceException {
if (!(spec instanceof DemoInteractionSpec)) {
throw EISException.invalidInteractionSpecType();
}
if (!(inputRec instanceof DemoMappedRecord) || !(searchRec instanceof DemoMappedRecord)) {
throw EISException.invalidRecordType();
}
DemoInteractionSpec iSpec = (DemoInteractionSpec) spec;
DemoMappedRecord mappedInputRec = (DemoMappedRecord) inputRec;
DemoMappedRecord mappedSearchRec = (DemoMappedRecord) searchRec;
DemoOperation operation = iSpec.getOperation();
String tableName = iSpec.getTable();
if (operation == null) {
throw new ResourceException("operation must be set");
}
if (tableName == null) {
throw new ResourceException("DB name must be set");
}
if (operation != DemoOperation.UPDATE) {
throw new ResourceException("Invalid operation: " + operation);
}
connection.update(iSpec, tableName, mappedSearchRec, mappedInputRec);
return true;
}
开发者ID:rhulha,项目名称:EclipseLinkNoSQLDemoPlugin,代码行数:26,代码来源:DemoInteraction.java
示例12: onMessage
import javax.resource.cci.Record; //导入依赖的package包/类
@Override
public Record onMessage(Record record) {
SynchronousInOutHandler inOutHandler = new SynchronousInOutHandler();
StreamableRecord sourceRecord = StreamableRecord.class.cast(record);
try {
StreamableRecordBindingData bindingData = new StreamableRecordBindingData(sourceRecord);
String operation = _selector != null ? _selector.selectOperation(bindingData).getLocalPart() : null;
Exchange exchange = createExchange(operation, inOutHandler);
exchange.send(_composer.compose(bindingData, exchange));
exchange = inOutHandler.waitForOut(_waitTimeout);
StreamableRecord returnRecord = new StreamableRecord();
returnRecord.setRecordName(_recordName);
returnRecord.setRecordShortDescription(_description);
returnRecord.setRecordShortDescription(_description);
return _composer.decompose(exchange, new StreamableRecordBindingData(returnRecord)).getRecord();
} catch (Exception e) {
throw new SwitchYardException(e);
}
}
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:21,代码来源:MyStreamableRecordCCIEndpoint.java
示例13: testInflowCCIReuseReleasedEndpoint
import javax.resource.cci.Record; //导入依赖的package包/类
@Test
public void testInflowCCIReuseReleasedEndpoint() throws Exception {
_adapter.fireCreateEndpoint();
MappedRecord input1 = _recordFactory.createMappedRecord("testInflowCCIReuseReleasedEndpoint input1");
input1.put("input", "World3");
Record result1 = _adapter.fireDelivery(input1);
Assert.assertTrue(result1 instanceof MappedRecord);
Assert.assertEquals("Hello World3 !", ((MappedRecord)result1).get("input"));
_adapter.fireRelease();
MappedRecord input2 = _recordFactory.createMappedRecord("testInflowCCIReuseReleasedEndpoint input2");
input2.put("input", "World4");
Record result2 = _adapter.fireDelivery(input2);
Assert.assertTrue(result2 instanceof MappedRecord);
Assert.assertEquals("Hello World4 !", ((MappedRecord)result2).get("input"));
}
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:17,代码来源:JCACCIServiceBindingTest.java
示例14: onMessage
import javax.resource.cci.Record; //导入依赖的package包/类
@Override
public Record onMessage(Record record) {
SynchronousInOutHandler inOutHandler = new SynchronousInOutHandler();
MappedRecord sourceRecord = MappedRecord.class.cast(record);
try {
MappedRecordBindingData bindingData = new MappedRecordBindingData(sourceRecord);
String operation = _selector != null ? _selector.selectOperation(bindingData).getLocalPart() : null;
Exchange exchange = createExchange(operation, inOutHandler);
exchange.send(_composer.compose(bindingData, exchange));
exchange = inOutHandler.waitForOut(_waitTimeout);
MappedRecord returnRecord = _recordFactory.createMappedRecord(_recordName);
returnRecord.setRecordShortDescription(_description);
return _composer.decompose(exchange, new MappedRecordBindingData(returnRecord)).getRecord();
} catch (Exception e) {
throw new SwitchYardException(e);
}
}
开发者ID:jboss-switchyard,项目名称:switchyard,代码行数:19,代码来源:CCIEndpoint.java
示例15: execute
import javax.resource.cci.Record; //导入依赖的package包/类
public void execute(final BapiMapping bapiMapping, final Map<String, Object> functionMap) {
Record result;
try {
MappedRecord mappedInputRecord = mapper.mapFunctionMapValuesToMappedRecord(bapiMapping.getBapiName(), recordFactory,
functionMap);
LOG.debug("JCA Execute: " + bapiMapping.getBapiName() + ", arguments= " + functionMap + "\ninputRecord = "
+ mappedInputRecord);
result = connectionProvider.getConnection().createInteraction().execute(null, mappedInputRecord);
LOG.debug("JCA Execute: " + bapiMapping.getBapiName() + ", result = " + result);
final Map<String, Object> resultMap = UnsafeCastHelper.castToMap(result);
mapper.mapRecordToFunctionMap(functionMap, resultMap, bapiMapping);
} catch (final ResourceException e) {
throw new HibersapException("Error executing function module " + bapiMapping.getBapiName(), e);
}
}
开发者ID:hibersap,项目名称:hibersap,代码行数:21,代码来源:JCAConnection.java
示例16: createInputRecord
import javax.resource.cci.Record; //导入依赖的package包/类
@Override
protected final Record createInputRecord(RecordFactory recordFactory, Object inObject) {
try {
return new CommAreaRecord(objectToBytes(inObject));
}
catch (IOException ex) {
throw new DataRetrievalFailureException("I/O exception during bytes conversion", ex);
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:MappingCommAreaOperation.java
示例17: extractOutputData
import javax.resource.cci.Record; //导入依赖的package包/类
@Override
protected final Object extractOutputData(Record record) throws DataAccessException {
CommAreaRecord commAreaRecord = (CommAreaRecord) record;
try {
return bytesToObject(commAreaRecord.toByteArray());
}
catch (IOException ex) {
throw new DataRetrievalFailureException("I/O exception during bytes conversion", ex);
}
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:MappingCommAreaOperation.java
示例18: doExecute
import javax.resource.cci.Record; //导入依赖的package包/类
/**
* Execute the specified interaction on an EIS with CCI.
* All other interaction execution methods go through this.
* @param spec the CCI InteractionSpec instance that defines
* the interaction (connector-specific)
* @param inputRecord the input record
* @param outputRecord output record (can be {@code null})
* @param outputExtractor object to convert the output record to a result object
* @return the output data extracted with the RecordExtractor object
* @throws DataAccessException if there is any problem
*/
protected <T> T doExecute(
final InteractionSpec spec, final Record inputRecord, final Record outputRecord,
final RecordExtractor<T> outputExtractor) throws DataAccessException {
return execute(new InteractionCallback<T>() {
@Override
public T doInInteraction(Interaction interaction, ConnectionFactory connectionFactory)
throws ResourceException, SQLException, DataAccessException {
Record outputRecordToUse = outputRecord;
try {
if (outputRecord != null || getOutputRecordCreator() != null) {
// Use the CCI execute method with output record as parameter.
if (outputRecord == null) {
RecordFactory recordFactory = getRecordFactory(connectionFactory);
outputRecordToUse = getOutputRecordCreator().createRecord(recordFactory);
}
interaction.execute(spec, inputRecord, outputRecordToUse);
}
else {
outputRecordToUse = interaction.execute(spec, inputRecord);
}
return (outputExtractor != null ? outputExtractor.extractData(outputRecordToUse) : null);
}
finally {
if (outputRecordToUse instanceof ResultSet) {
closeResultSet((ResultSet) outputRecordToUse);
}
}
}
});
}
开发者ID:lamsfoundation,项目名称:lams,代码行数:43,代码来源:CciTemplate.java
示例19: testMappingRecordOperation
import javax.resource.cci.Record; //导入依赖的package包/类
@Test
public void testMappingRecordOperation() throws ResourceException {
ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
Connection connection = mock(Connection.class);
Interaction interaction = mock(Interaction.class);
RecordFactory recordFactory = mock(RecordFactory.class);
Record inputRecord = mock(Record.class);
Record outputRecord = mock(Record.class);
InteractionSpec interactionSpec = mock(InteractionSpec.class);
QueryCallDetector callDetector = mock(QueryCallDetector.class);
MappingRecordOperationImpl query = new MappingRecordOperationImpl(connectionFactory, interactionSpec);
query.setCallDetector(callDetector);
Object inObj = new Object();
Object outObj = new Object();
given(connectionFactory.getRecordFactory()).willReturn(recordFactory);
given(callDetector.callCreateInputRecord(recordFactory, inObj)).willReturn(inputRecord);
given(connectionFactory.getConnection()).willReturn(connection);
given(connection.createInteraction()).willReturn(interaction);
given(interaction.execute(interactionSpec, inputRecord)).willReturn(outputRecord);
given(callDetector.callExtractOutputData(outputRecord)).willReturn(outObj);
assertSame(outObj, query.execute(inObj));
verify(interaction).close();
verify(connection).close();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:32,代码来源:EisOperationTests.java
示例20: testMappingRecordOperationWithOutputRecordCreator
import javax.resource.cci.Record; //导入依赖的package包/类
@Test
public void testMappingRecordOperationWithOutputRecordCreator() throws ResourceException {
ConnectionFactory connectionFactory = mock(ConnectionFactory.class);
Connection connection = mock(Connection.class);
Interaction interaction = mock(Interaction.class);
RecordFactory recordFactory = mock(RecordFactory.class);
Record inputRecord = mock(Record.class);
Record outputRecord = mock(Record.class);
RecordCreator outputCreator = mock(RecordCreator.class);
InteractionSpec interactionSpec = mock(InteractionSpec.class);
QueryCallDetector callDetector = mock(QueryCallDetector.class);
MappingRecordOperationImpl query = new MappingRecordOperationImpl(connectionFactory, interactionSpec);
query.setOutputRecordCreator(outputCreator);
query.setCallDetector(callDetector);
Object inObj = new Object();
Object outObj = new Object();
given(connectionFactory.getRecordFactory()).willReturn(recordFactory);
given(callDetector.callCreateInputRecord(recordFactory, inObj)).willReturn(inputRecord);
given(connectionFactory.getConnection()).willReturn(connection);
given(connection.createInteraction()).willReturn(interaction);
given(connectionFactory.getRecordFactory()).willReturn(recordFactory);
given(outputCreator.createRecord(recordFactory)).willReturn(outputRecord);
given(interaction.execute(interactionSpec, inputRecord, outputRecord)).willReturn(true);
given(callDetector.callExtractOutputData(outputRecord)).willReturn(outObj);
assertSame(outObj, query.execute(inObj));
verify(interaction).close();
verify(connection).close();
}
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:37,代码来源:EisOperationTests.java
注:本文中的javax.resource.cci.Record类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论