@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getQueueName() == null) ? 0 : getQueueName().hashCode()); hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateQueueRequest == false) return false; CreateQueueRequest other = (CreateQueueRequest) obj; if (other.getQueueName() == null ^ this.getQueueName() == null) return false; if (other.getQueueName() != null && other.getQueueName().equals(this.getQueueName()) == false) return false; if (other.getAttributes() == null ^ this.getAttributes() == null) return false; if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false) return false; return true; }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getQueueName() != null) sb.append("QueueName: ").append(getQueueName()).append(","); if (getAttributes() != null) sb.append("Attributes: ").append(getAttributes()); sb.append("}"); return sb.toString(); }
public Request<CreateQueueRequest> marshall(CreateQueueRequest createQueueRequest) { if (createQueueRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<CreateQueueRequest> request = new DefaultRequest<CreateQueueRequest>(createQueueRequest, "AmazonSQS"); request.addParameter("Action", "CreateQueue"); request.addParameter("Version", "2012-11-05"); request.setHttpMethod(HttpMethodName.POST); if (createQueueRequest.getQueueName() != null) { request.addParameter("QueueName", StringUtils.fromString(createQueueRequest.getQueueName())); } java.util.Map<String, String> attributes = createQueueRequest.getAttributes(); int attributesListIndex = 1; for (Map.Entry<String, String> entry : attributes.entrySet()) { if (entry.getKey() != null) { request.addParameter("Attribute." + attributesListIndex + ".Name", StringUtils.fromString(entry.getKey())); } if (entry.getValue() != null) { request.addParameter("Attribute." + attributesListIndex + ".Value", StringUtils.fromString(entry.getValue())); } attributesListIndex++; } return request; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getQueueName() == null) ? 0 : getQueueName().hashCode()); hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode()); return hashCode; }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getQueueName() != null) sb.append("QueueName: " + getQueueName() + ","); if (getAttributes() != null) sb.append("Attributes: " + getAttributes()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateQueueRequest == false) return false; CreateQueueRequest other = (CreateQueueRequest) obj; if (other.getQueueName() == null ^ this.getQueueName() == null) return false; if (other.getQueueName() != null && other.getQueueName().equals(this.getQueueName()) == false) return false; if (other.getAttributes() == null ^ this.getAttributes() == null) return false; if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false) return false; return true; } }
if (createQueueRequest.getQueueName() != null) { prefix = "QueueName"; String queueName = createQueueRequest.getQueueName(); request.addParameter(prefix, StringUtils.fromString(queueName));
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getQueueName() == null) ? 0 : getQueueName().hashCode()); hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode()); return hashCode; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getQueueName() == null) ? 0 : getQueueName().hashCode()); hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode()); return hashCode; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateQueueRequest == false) return false; CreateQueueRequest other = (CreateQueueRequest) obj; if (other.getQueueName() == null ^ this.getQueueName() == null) return false; if (other.getQueueName() != null && other.getQueueName().equals(this.getQueueName()) == false) return false; if (other.getAttributes() == null ^ this.getAttributes() == null) return false; if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false) return false; return true; }
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getQueueName() != null) sb.append("QueueName: " + getQueueName() + ","); if (getAttributes() != null) sb.append("Attributes: " + getAttributes()); sb.append("}"); return sb.toString(); }
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getQueueName() != null) sb.append("QueueName: ").append(getQueueName()).append(","); if (getAttributes() != null) sb.append("Attributes: ").append(getAttributes()); sb.append("}"); return sb.toString(); }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreateQueueRequest == false) return false; CreateQueueRequest other = (CreateQueueRequest) obj; if (other.getQueueName() == null ^ this.getQueueName() == null) return false; if (other.getQueueName() != null && other.getQueueName().equals(this.getQueueName()) == false) return false; if (other.getAttributes() == null ^ this.getAttributes() == null) return false; if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false) return false; return true; } }
private Callable<Boolean> getCreateQueueTask(CreateQueueRequest createQueueRequest) { return () -> { try { LOG.info("Executing create queue operation: {}", createQueueRequest.getQueueName()); sqs.createQueue(createQueueRequest); } catch (AmazonSQSException e) { if (!e.getErrorCode().equals("QueueAlreadyExists")) { throw e; } } return true; }; }
public Request<CreateQueueRequest> marshall(CreateQueueRequest createQueueRequest) { if (createQueueRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<CreateQueueRequest> request = new DefaultRequest<CreateQueueRequest>(createQueueRequest, "AmazonSQS"); request.addParameter("Action", "CreateQueue"); request.addParameter("Version", "2012-11-05"); request.setHttpMethod(HttpMethodName.POST); if (createQueueRequest.getQueueName() != null) { request.addParameter("QueueName", StringUtils.fromString(createQueueRequest.getQueueName())); } java.util.Map<String, String> attributes = createQueueRequest.getAttributes(); int attributesListIndex = 1; for (Map.Entry<String, String> entry : attributes.entrySet()) { if (entry.getKey() != null) { request.addParameter("Attribute." + attributesListIndex + ".Name", StringUtils.fromString(entry.getKey())); } if (entry.getValue() != null) { request.addParameter("Attribute." + attributesListIndex + ".Value", StringUtils.fromString(entry.getValue())); } attributesListIndex++; } return request; }
if (createQueueRequest.getQueueName() != null) { prefix = "QueueName"; String queueName = createQueueRequest.getQueueName(); request.addParameter(prefix, StringUtils.fromString(queueName));
@Test @SuppressWarnings("unchecked") public void testSqsMessageHandlerWithAutoQueueCreate() { Message<String> message = MessageBuilder.withPayload("message").build(); this.sqsMessageHandlerWithAutoQueueCreate.setQueue("foo"); this.sqsSendChannelWithAutoCreate.send(message); ArgumentCaptor<CreateQueueRequest> createQueueRequestArgumentCaptor = ArgumentCaptor.forClass(CreateQueueRequest.class); verify(this.amazonSqs).createQueue(createQueueRequestArgumentCaptor.capture()); assertThat(createQueueRequestArgumentCaptor.getValue().getQueueName()).isEqualTo("foo"); ArgumentCaptor<SendMessageRequest> sendMessageRequestArgumentCaptor = ArgumentCaptor.forClass(SendMessageRequest.class); verify(this.amazonSqs) .sendMessageAsync(sendMessageRequestArgumentCaptor.capture(), any(AsyncHandler.class)); assertThat(sendMessageRequestArgumentCaptor.getValue().getQueueUrl()) .isEqualTo("http://queue-url.com/foo"); }
@Bean public AmazonSQSAsync amazonSqs() { AmazonSQSAsync amazonSqs = mock(AmazonSQSAsync.class); willAnswer(invocation -> { GetQueueUrlRequest getQueueUrlRequest = (GetQueueUrlRequest) invocation.getArguments()[0]; GetQueueUrlResult queueUrl = new GetQueueUrlResult(); queueUrl.setQueueUrl("http://queue-url.com/" + getQueueUrlRequest.getQueueName()); return queueUrl; }) .given(amazonSqs) .getQueueUrl(any(GetQueueUrlRequest.class)); willAnswer(invocation -> { CreateQueueRequest createQueueRequest = (CreateQueueRequest) invocation.getArguments()[0]; CreateQueueResult queueUrl = new CreateQueueResult(); queueUrl.setQueueUrl("http://queue-url.com/" + createQueueRequest.getQueueName()); return queueUrl; }) .given(amazonSqs) .createQueue(any(CreateQueueRequest.class)); return amazonSqs; }