use of com.amazonaws.services.simpledb.model.UpdateCondition in project camel by apache.
the class AbstractSdbCommandTest method determineUpdateCondition.
@Test
public void determineUpdateCondition() {
assertNull(this.command.determineUpdateCondition());
UpdateCondition condition = new UpdateCondition("Key1", "Value1", true);
exchange.getIn().setHeader(SdbConstants.UPDATE_CONDITION, condition);
assertSame(condition, this.command.determineUpdateCondition());
}
use of com.amazonaws.services.simpledb.model.UpdateCondition in project camel by apache.
the class SdbComponentTest method deleteAttributesItemNameIsRequired.
@Test
public void deleteAttributesItemNameIsRequired() {
final List<Attribute> attributes = Arrays.asList(new Attribute[] { new Attribute("NAME1", "VALUE1") });
final UpdateCondition condition = new UpdateCondition("Key1", "Value1", true);
Exchange exchange = 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.UPDATE_CONDITION, condition);
}
});
Exception exception = exchange.getException();
assertTrue(exception instanceof IllegalArgumentException);
}
use of com.amazonaws.services.simpledb.model.UpdateCondition in project camel by apache.
the class SdbComponentSpringTest method deleteAttributesItemNameIsRequired.
@Test
public void deleteAttributesItemNameIsRequired() {
final List<Attribute> attributes = Arrays.asList(new Attribute[] { new Attribute("NAME1", "VALUE1") });
final UpdateCondition condition = new UpdateCondition("Key1", "Value1", true);
Exchange exchange = 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.UPDATE_CONDITION, condition);
}
});
Exception exception = exchange.getException();
assertTrue(exception instanceof IllegalArgumentException);
}
use of com.amazonaws.services.simpledb.model.UpdateCondition in project camel by apache.
the class SdbComponentSpringTest method putAttributes.
@Test
public void putAttributes() {
final List<ReplaceableAttribute> replaceableAttributes = Arrays.asList(new ReplaceableAttribute[] { new ReplaceableAttribute("NAME1", "VALUE1", true) });
final UpdateCondition updateCondition = new UpdateCondition("NAME1", "VALUE1", true);
template.send("direct:start", new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.PutAttributes);
exchange.getIn().setHeader(SdbConstants.ITEM_NAME, "ITEM1");
exchange.getIn().setHeader(SdbConstants.UPDATE_CONDITION, updateCondition);
exchange.getIn().setHeader(SdbConstants.REPLACEABLE_ATTRIBUTES, replaceableAttributes);
}
});
assertEquals("TestDomain", amazonSDBClient.putAttributesRequest.getDomainName());
assertEquals("ITEM1", amazonSDBClient.putAttributesRequest.getItemName());
assertEquals(updateCondition, amazonSDBClient.putAttributesRequest.getExpected());
assertEquals(replaceableAttributes, amazonSDBClient.putAttributesRequest.getAttributes());
}
use of com.amazonaws.services.simpledb.model.UpdateCondition in project camel by apache.
the class SdbComponentTest method putAttributes.
@Test
public void putAttributes() {
final List<ReplaceableAttribute> replaceableAttributes = Arrays.asList(new ReplaceableAttribute[] { new ReplaceableAttribute("NAME1", "VALUE1", true) });
final UpdateCondition updateCondition = new UpdateCondition("NAME1", "VALUE1", true);
template.send("direct:start", new Processor() {
public void process(Exchange exchange) throws Exception {
exchange.getIn().setHeader(SdbConstants.OPERATION, SdbOperations.PutAttributes);
exchange.getIn().setHeader(SdbConstants.ITEM_NAME, "ITEM1");
exchange.getIn().setHeader(SdbConstants.UPDATE_CONDITION, updateCondition);
exchange.getIn().setHeader(SdbConstants.REPLACEABLE_ATTRIBUTES, replaceableAttributes);
}
});
assertEquals("TestDomain", amazonSDBClient.putAttributesRequest.getDomainName());
assertEquals("ITEM1", amazonSDBClient.putAttributesRequest.getItemName());
assertEquals(updateCondition, amazonSDBClient.putAttributesRequest.getExpected());
assertEquals(replaceableAttributes, amazonSDBClient.putAttributesRequest.getAttributes());
}
Aggregations