use of java.util.HashMap in project camel by apache.
the class URISupportTest method testCreateRemaingURI.
public void testCreateRemaingURI() throws Exception {
URI original = new URI("http://camel.apache.org");
Map<String, Object> param = new HashMap<String, Object>();
param.put("foo", "123");
URI newUri = URISupport.createRemainingURI(original, param);
assertNotNull(newUri);
String s = newUri.toString();
assertEquals("http://camel.apache.org?foo=123", s);
}
use of java.util.HashMap in project camel by apache.
the class SqsProducer method translateAttributes.
private Map<String, MessageAttributeValue> translateAttributes(Map<String, Object> headers, Exchange exchange) {
Map<String, MessageAttributeValue> result = new HashMap<String, MessageAttributeValue>();
HeaderFilterStrategy headerFilterStrategy = getEndpoint().getHeaderFilterStrategy();
for (Entry<String, Object> entry : headers.entrySet()) {
// only put the message header which is not filtered into the message attribute
if (!headerFilterStrategy.applyFilterToCamelHeaders(entry.getKey(), entry.getValue(), exchange)) {
Object value = entry.getValue();
if (value instanceof String) {
MessageAttributeValue mav = new MessageAttributeValue();
mav.setDataType("String");
mav.withStringValue((String) value);
result.put(entry.getKey(), mav);
} else if (value instanceof ByteBuffer) {
MessageAttributeValue mav = new MessageAttributeValue();
mav.setDataType("Binary");
mav.withBinaryValue((ByteBuffer) value);
result.put(entry.getKey(), mav);
} else {
// cannot translate the message header to message attribute value
LOG.warn("Cannot put the message header key={}, value={} into Sqs MessageAttribute", entry.getKey(), entry.getValue());
}
}
}
return result;
}
use of java.util.HashMap in project camel by apache.
the class AmazonDDBClientMock method batchGetItem.
@SuppressWarnings("unchecked")
@Override
public BatchGetItemResult batchGetItem(BatchGetItemRequest batchGetItemRequest) {
this.batchGetItemRequest = batchGetItemRequest;
Map<String, List<Map<String, AttributeValue>>> responseMap = new HashMap<String, List<Map<String, AttributeValue>>>();
List<Map<String, AttributeValue>> p = new ArrayList<Map<String, AttributeValue>>();
p.add(getAttributes());
responseMap.put("DOMAIN1", p);
Map<String, AttributeValue> keysMap = new HashMap<String, AttributeValue>();
keysMap.put("1", new AttributeValue("UNPROCESSED_KEY"));
Map<String, KeysAndAttributes> unprocessedKeys = new HashMap<String, KeysAndAttributes>();
unprocessedKeys.put("DOMAIN1", new KeysAndAttributes().withKeys(keysMap));
return new BatchGetItemResult().withResponses(responseMap).withUnprocessedKeys(unprocessedKeys);
}
use of java.util.HashMap in project camel by apache.
the class DeleteItemCommandTest method execute.
@Test
public void execute() {
Map<String, AttributeValue> key = new HashMap<String, AttributeValue>();
key.put("1", new AttributeValue("Key_1"));
exchange.getIn().setHeader(DdbConstants.KEY, key);
Map<String, ExpectedAttributeValue> updateCondition = new HashMap<String, ExpectedAttributeValue>();
updateCondition.put("name", new ExpectedAttributeValue(new AttributeValue("expected value")));
exchange.getIn().setHeader(DdbConstants.UPDATE_CONDITION, updateCondition);
exchange.getIn().setHeader(DdbConstants.RETURN_VALUES, "ALL_OLD");
command.execute();
assertEquals("DOMAIN1", ddbClient.deleteItemRequest.getTableName());
assertEquals(key, ddbClient.deleteItemRequest.getKey());
assertEquals(updateCondition, ddbClient.deleteItemRequest.getExpected());
assertEquals("ALL_OLD", ddbClient.deleteItemRequest.getReturnValues());
assertEquals(new AttributeValue("attrValue"), exchange.getIn().getHeader(DdbConstants.ATTRIBUTES, Map.class).get("attrName"));
}
use of java.util.HashMap in project camel by apache.
the class CamelSWFWorkflowClient method describeWorkflowInstance.
public Map<String, Object> describeWorkflowInstance(String workflowId, String runId) {
DescribeWorkflowExecutionRequest describeRequest = new DescribeWorkflowExecutionRequest();
describeRequest.setDomain(configuration.getDomainName());
describeRequest.setExecution(new WorkflowExecution().withWorkflowId(workflowId).withRunId(runId));
WorkflowExecutionDetail executionDetail = endpoint.getSWClient().describeWorkflowExecution(describeRequest);
WorkflowExecutionInfo instanceMetadata = executionDetail.getExecutionInfo();
Map<String, Object> info = new HashMap<String, Object>();
info.put("closeStatus", instanceMetadata.getCloseStatus());
info.put("closeTimestamp", instanceMetadata.getCloseTimestamp());
info.put("executionStatus", instanceMetadata.getExecutionStatus());
info.put("tagList", instanceMetadata.getTagList());
info.put("executionDetail", executionDetail);
return info;
}
Aggregations