org.elasticmq.rest.sqs.SQSRestServerBuilder Java Examples

The following examples show how to use org.elasticmq.rest.sqs.SQSRestServerBuilder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SqsIOTest.java    From beam with Apache License 2.0 6 votes vote down vote up
@Override
protected void before() {
  sqsRestServer = SQSRestServerBuilder.start();

  String endpoint = "http://localhost:9324";
  String region = "elasticmq";
  String accessKey = "x";
  String secretKey = "x";

  client =
      AmazonSQSClientBuilder.standard()
          .withCredentials(
              new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey)))
          .withEndpointConfiguration(
              new AwsClientBuilder.EndpointConfiguration(endpoint, region))
          .build();
  final CreateQueueResult queue = client.createQueue("test");
  queueUrl = queue.getQueueUrl();
}
 
Example #2
Source File: EmbeddedSqsServer.java    From beam with Apache License 2.0 6 votes vote down vote up
static void start() {
  sqsRestServer = SQSRestServerBuilder.withPort(port).start();

  client =
      SqsClient.builder()
          .credentialsProvider(
              StaticCredentialsProvider.create(AwsBasicCredentials.create("x", "x")))
          .endpointOverride(URI.create(endPoint))
          .region(Region.US_WEST_2)
          .build();

  CreateQueueRequest createQueueRequest =
      CreateQueueRequest.builder().queueName(queueName).build();
  final CreateQueueResponse queue = client.createQueue(createQueueRequest);
  queueUrl = queue.queueUrl();
}
 
Example #3
Source File: AmazonSQSRule.java    From zipkin-aws with Apache License 2.0 5 votes vote down vote up
public AmazonSQSRule start(int httpPort) {
  if (server == null) {
    server = SQSRestServerBuilder.withPort(httpPort).withSQSLimits(SQSLimits.Strict()).start();
    server.waitUntilStarted();
  }

  if (client == null) {
    client = AmazonSQSClientBuilder.standard()
        .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("x", "x")))
        .withEndpointConfiguration(new EndpointConfiguration(String.format("http://localhost:%d", httpPort), null))
        .build();
    queueUrl = client.createQueue("zipkin").getQueueUrl();
  }
  return this;
}
 
Example #4
Source File: AWSQueueIT.java    From para with Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void setUpClass() throws InterruptedException {
	System.setProperty("para.aws_sqs_local", "true");
	sqsServer = SQSRestServerBuilder.start();
	Thread.sleep(1000);
	q = new AWSQueue("testq");
}
 
Example #5
Source File: AwsMockSqsServerAutoConfiguration.java    From spring-boot-aws-mock with MIT License 4 votes vote down vote up
private SQSRestServer createMockSqsServer() {
    return SQSRestServerBuilder
            .withInterface(sqsProperties.getHost())
            .withPort(sqsProperties.getPort())
            .start();
}
 
Example #6
Source File: ApplicationTest.java    From examples with Apache License 2.0 4 votes vote down vote up
private void createElasticMQMockServer()
{
  // By default the urls will use http://localhost:9324 as the base URL
  mockServer = SQSRestServerBuilder.start();
}