use of com.amazonaws.services.simpledb.model.Attribute in project camel by apache.
the class SdbComponentIntegrationTest method deleteAttributes.
@Test
public void deleteAttributes() {
final List<Attribute> attributes = Arrays.asList(new Attribute[] { new Attribute("NAME1", "VALUE1") });
final UpdateCondition condition = new UpdateCondition("Key1", "Value1", true);
template.send("direct:start", new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.DeleteAttributes);
exchange.getIn().setHeader(SdbConstants.ATTRIBUTES, attributes);
exchange.getIn().setHeader(SdbConstants.ITEM_NAME, "ITEM1");
exchange.getIn().setHeader(SdbConstants.UPDATE_CONDITION, condition);
}
});
}
use of com.amazonaws.services.simpledb.model.Attribute in project camel by apache.
the class SdbComponentSpringTest method getAttributes.
@SuppressWarnings("unchecked")
@Test
public void getAttributes() {
final List<String> attributeNames = Arrays.asList(new String[] { "ATTRIBUTE1" });
Exchange exchange = template.send("direct:start", new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.GetAttributes);
exchange.getIn().setHeader(SdbConstants.ITEM_NAME, "ITEM1");
exchange.getIn().setHeader(SdbConstants.CONSISTENT_READ, Boolean.TRUE);
exchange.getIn().setHeader(SdbConstants.ATTRIBUTE_NAMES, attributeNames);
}
});
assertEquals("TestDomain", amazonSDBClient.getAttributesRequest.getDomainName());
assertEquals("ITEM1", amazonSDBClient.getAttributesRequest.getItemName());
assertEquals(Boolean.TRUE, amazonSDBClient.getAttributesRequest.getConsistentRead());
assertEquals(attributeNames, amazonSDBClient.getAttributesRequest.getAttributeNames());
List<Attribute> attributes = exchange.getIn().getHeader(SdbConstants.ATTRIBUTES, List.class);
assertEquals(2, attributes.size());
assertEquals("AttributeOne", attributes.get(0).getName());
assertEquals("Value One", attributes.get(0).getValue());
assertEquals("AttributeTwo", attributes.get(1).getName());
assertEquals("Value Two", attributes.get(1).getValue());
}
use of com.amazonaws.services.simpledb.model.Attribute in project camel by apache.
the class DeleteAttributesCommandTest method execute.
@Test
public void execute() {
List<Attribute> attributes = new ArrayList<Attribute>();
attributes.add(new Attribute("NAME1", "VALUE1"));
exchange.getIn().setHeader(SdbConstants.ATTRIBUTES, attributes);
exchange.getIn().setHeader(SdbConstants.ITEM_NAME, "ITEM1");
UpdateCondition condition = new UpdateCondition("Key1", "Value1", true);
exchange.getIn().setHeader(SdbConstants.UPDATE_CONDITION, condition);
command.execute();
assertEquals("DOMAIN1", sdbClient.deleteAttributesRequest.getDomainName());
assertEquals("ITEM1", sdbClient.deleteAttributesRequest.getItemName());
assertEquals(condition, sdbClient.deleteAttributesRequest.getExpected());
assertEquals(attributes, sdbClient.deleteAttributesRequest.getAttributes());
}
use of com.amazonaws.services.simpledb.model.Attribute in project camel by apache.
the class DeleteAttributesCommandTest method executeWithoutItemName.
@Test(expected = IllegalArgumentException.class)
public void executeWithoutItemName() {
List<Attribute> attributes = new ArrayList<Attribute>();
attributes.add(new Attribute("NAME1", "VALUE1"));
exchange.getIn().setHeader(SdbConstants.ATTRIBUTES, attributes);
UpdateCondition condition = new UpdateCondition("Key1", "Value1", true);
exchange.getIn().setHeader(SdbConstants.UPDATE_CONDITION, condition);
command.execute();
}
use of com.amazonaws.services.simpledb.model.Attribute in project camel by apache.
the class DeleteAttributesCommandTest method determineAttributes.
@Test
public void determineAttributes() {
assertNull(this.command.determineAttributes());
List<Attribute> attributes = new ArrayList<Attribute>();
attributes.add(new Attribute("NAME1", "VALUE1"));
exchange.getIn().setHeader(SdbConstants.ATTRIBUTES, attributes);
assertEquals(attributes, this.command.determineAttributes());
}
Aggregations