/** * Mongo does not support all Java types. * Convert unsupported types to string. */ @Override public void setValueInRecord(String key, Object value, MappedRecord record, EISAccessor accessor) { Object recordValue = value; if ((value instanceof BigDecimal) || (value instanceof BigInteger)) { recordValue = getConversionManager().convertObject(value, ClassConstants.STRING); } record.put(key, recordValue); }
/** * Stores the field value into the record. * This allows for the platform to perform any platform specific translation or conversion. */ public void setValueInRecord(String key, Object value, MappedRecord record, EISAccessor accessor) { Object recordValue = value; if (shouldConvertDataToStrings() && !(value instanceof Record) && !(value instanceof Collection)) { recordValue = getConversionManager().convertObject(value, ClassConstants.STRING); } record.put(key, recordValue); }
/** * Stores the field value into the record. * This allows for the platform to perform any platform specific translation or conversion. */ public void setValueInRecord(String key, Object value, MappedRecord record, EISAccessor accessor) { Object recordValue = value; if (shouldConvertDataToStrings() && !(value instanceof Record) && !(value instanceof Collection)) { recordValue = getConversionManager().convertObject(value, ClassConstants.STRING); } record.put(key, recordValue); }
public Record onExecute(InteractionSpec spec, Record input) { MappedRecord mapped = (MappedRecord) input; mapped.put("name", "Hello, " + mapped.get("name") + "!"); return mapped; } public boolean onExecute(InteractionSpec spec, Record input, Record output) {return true;}
/** * Stores the field value into the record. * This allows for the platform to perform any platform specific translation or conversion. */ public void setValueInRecord(String key, Object value, MappedRecord record, EISAccessor accessor) { Object recordValue = value; if (shouldConvertDataToStrings()) { recordValue = getConversionManager().convertObject(value, ClassConstants.STRING); } record.put(key, recordValue); }
/** * {@inheritDoc} */ @SuppressWarnings("unchecked") @Override public void mapTo(Context context, MappedRecordBindingData target) throws Exception { MappedRecord record = target.getRecord(); for (Property property : context.getProperties()) { String name = property.getName(); Object value = property.getValue(); if (value == null) { continue; } if (name.equals(JCAConstants.CCI_RECORD_NAME_KEY)) { record.setRecordName(value.toString()); } else if (name.equals(JCAConstants.CCI_RECORD_SHORT_DESC_KEY)) { record.setRecordShortDescription(value.toString()); } else if (matches(name)) { record.put(name, value); } } }
@Test(expected = RuntimeException.class) public void testInflowCCIErrorMultipleDelivery() throws Exception { _adapter.fireCreateEndpoint(); _adapter.fireBeforeDelivery(); MappedRecord input1 = _recordFactory.createMappedRecord("testInflowCCIErrorMultipleDelivery input1"); input1.put("input", "World5"); MappedRecord input2 = _recordFactory.createMappedRecord("testInflowCCIErrorMultipleDelivery input2"); input2.put("input", "World6"); Record result1 = _adapter.fireDelivery(input1); Record result2 = _adapter.fireDelivery(input2); }
@Test(expected = RuntimeException.class) public void testInflowCCIErrorAfterDeliveryWithoutBefore() throws Exception { _adapter.fireCreateEndpoint(); MappedRecord input1 = _recordFactory.createMappedRecord("testInflowCCIErrorAfterDeliveryWithoutBefore input1"); input1.put("input", "World7"); Record result1 = _adapter.fireDelivery(input1); _adapter.fireAfterDelivery(); }
@Test public void testOutboundCCI() throws Exception { _adapter.fireCreateEndpoint(); MappedRecord input = _recordFactory.createMappedRecord("testOutboundCCI input"); input.put("name", "Uragasumi"); Record result = _adapter.fireDelivery(input); _adapter.fireRelease(); Assert.assertTrue(result instanceof MappedRecord); Assert.assertEquals("Hello, Uragasumi!", MappedRecord.class.cast(result).get("name")); } }
@Test(expected = RuntimeException.class) public void testInflowCCIErrorBeforeDeliveryWithoutPreviousAfter() throws Exception { _adapter.fireCreateEndpoint(); _adapter.fireBeforeDelivery(); MappedRecord input1 = _recordFactory.createMappedRecord("testInflowCCIErrorBeforeDeliveryWithoutPreviousAfter input1"); input1.put("input", "World8"); Record result1 = _adapter.fireDelivery(input1); _adapter.fireBeforeDelivery(); } }
@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")); }
@Test public void testInflowCCI() throws Exception { _adapter.fireCreateEndpoint(); MappedRecord input = _recordFactory.createMappedRecord("testInflowCCI input"); input.put("input", "World"); Record result = _adapter.fireDelivery(input); _adapter.fireRelease(); Assert.assertTrue(result instanceof MappedRecord); Assert.assertEquals("Hello World !", ((MappedRecord)result).get("input")); }
@Test public void testInflowCCIWithBeforeAfterDelivery() throws Exception { _adapter.fireCreateEndpoint(); _adapter.fireBeforeDelivery(); MappedRecord input1 = _recordFactory.createMappedRecord("testInflowCCIWithBeforeAfterDelivery input1"); input1.put("input", "World2"); Record result1 = _adapter.fireDelivery(input1); _adapter.fireAfterDelivery(); Assert.assertTrue(result1 instanceof MappedRecord); Assert.assertEquals("Hello World2 !", ((MappedRecord)result1).get("input")); }