private boolean doesRequestMatch(Record request) { if(null == expectedRequest) return true; if(null == request) return false; if(request instanceof MappedRecord) { try { MappedRecord mappedRequest = (MappedRecord)request; if(mappedRequest.size() != expectedRequest.size()) return false; for (Object nextKey : mappedRequest.keySet()) { Object actualValue = mappedRequest.get(nextKey); Object expectedValue = expectedRequest.get(nextKey); if (!areObjectsEquals(actualValue, expectedValue)) { return false; } } return true; } catch(Exception exc) { throw new NestedApplicationException(exc); } } return false; }
/** * Retrieves the field value from the record. * This allows for the platform to perform any platform specific translation or conversion. */ public Object getValueFromRecord(String key, MappedRecord record, EISAccessor accessor) { return record.get(key); }
/** * 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); }
/** * {@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); } } }
response.putAll(responseData);
@Override public MappedRecord createMappedRecord(String recordName) throws ResourceException { MappedRecord rec = new MockMappedRecord(); rec.setRecordName(recordName); return rec; }
/** * Retrieves the field value from the record. * This allows for the platform to perform any platform specific translation or conversion. */ public Object getValueFromRecord(String key, MappedRecord record, EISAccessor accessor) { return record.get(key); }
/** * 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); }
response.putAll(responseData);
@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")); } }
/** * Retrieves the field value from the record. * This allows for the platform to perform any platform specific translation or conversion. */ public Object getValueFromRecord(String key, MappedRecord record, EISAccessor accessor) { return record.get(key); }
/** * 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); }
response.putAll(responseData);
@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")); }
@Override protected String extractString(MappedRecordBindingData binding) throws Exception { MappedRecord content = binding.getRecord(); return String.class.cast(content.get(KEY)); }