Search in sources :

Example 86 with HashMap

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);
}
Also used : LinkedHashMap(java.util.LinkedHashMap) HashMap(java.util.HashMap) URI(java.net.URI)

Example 87 with HashMap

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;
}
Also used : HashMap(java.util.HashMap) HeaderFilterStrategy(org.apache.camel.spi.HeaderFilterStrategy) ByteBuffer(java.nio.ByteBuffer) MessageAttributeValue(com.amazonaws.services.sqs.model.MessageAttributeValue)

Example 88 with HashMap

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);
}
Also used : AttributeValue(com.amazonaws.services.dynamodbv2.model.AttributeValue) BatchGetItemResult(com.amazonaws.services.dynamodbv2.model.BatchGetItemResult) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) KeysAndAttributes(com.amazonaws.services.dynamodbv2.model.KeysAndAttributes) HashMap(java.util.HashMap) Map(java.util.Map)

Example 89 with HashMap

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"));
}
Also used : AttributeValue(com.amazonaws.services.dynamodbv2.model.AttributeValue) ExpectedAttributeValue(com.amazonaws.services.dynamodbv2.model.ExpectedAttributeValue) HashMap(java.util.HashMap) ExpectedAttributeValue(com.amazonaws.services.dynamodbv2.model.ExpectedAttributeValue) Test(org.junit.Test)

Example 90 with HashMap

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;
}
Also used : WorkflowExecutionDetail(com.amazonaws.services.simpleworkflow.model.WorkflowExecutionDetail) WorkflowExecutionInfo(com.amazonaws.services.simpleworkflow.model.WorkflowExecutionInfo) HashMap(java.util.HashMap) DescribeWorkflowExecutionRequest(com.amazonaws.services.simpleworkflow.model.DescribeWorkflowExecutionRequest) WorkflowExecution(com.amazonaws.services.simpleworkflow.model.WorkflowExecution)

Aggregations

HashMap (java.util.HashMap)24090 ArrayList (java.util.ArrayList)5632 Map (java.util.Map)5586 Test (org.junit.Test)5079 List (java.util.List)2721 HashSet (java.util.HashSet)2103 IOException (java.io.IOException)1780 Set (java.util.Set)1465 File (java.io.File)1206 Iterator (java.util.Iterator)1198 LinkedHashMap (java.util.LinkedHashMap)1138 Test (org.testng.annotations.Test)884 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)680 Date (java.util.Date)545 LinkedList (java.util.LinkedList)494 URI (java.net.URI)415 Properties (java.util.Properties)381 InputStream (java.io.InputStream)343 Collection (java.util.Collection)342 TreeMap (java.util.TreeMap)333