@Test void resolveDestination_withResourceIdResolver_shouldUseIt() throws Exception { AmazonSQS amazonSqs = mock(AmazonSQS.class); ResourceIdResolver resourceIdResolver = mock(ResourceIdResolver.class); when(resourceIdResolver.resolveToPhysicalResourceId(anyString())) .thenReturn("http: DynamicQueueUrlDestinationResolver dynamicQueueUrlDestinationResolver = new DynamicQueueUrlDestinationResolver( amazonSqs, resourceIdResolver); String physicalResourceId = dynamicQueueUrlDestinationResolver .resolveDestination("testQueue"); assertThat(physicalResourceId).isEqualTo("http: }
@Override public String resolveDestination(String name) throws DestinationResolutionException { String queueName = name; if (this.resourceIdResolver != null) { queueName = this.resourceIdResolver.resolveToPhysicalResourceId(name); } if (isValidQueueUrl(queueName)) { return queueName; } if (this.autoCreate) { CreateQueueResult createQueueResult = this.amazonSqs .createQueue(new CreateQueueRequest(queueName)); return createQueueResult.getQueueUrl(); } else { try { GetQueueUrlResult getQueueUrlResult = this.amazonSqs .getQueueUrl(new GetQueueUrlRequest(queueName)); return getQueueUrlResult.getQueueUrl(); } catch (QueueDoesNotExistException e) { throw toDestinationResolutionException(e); } } }
DynamicQueueUrlDestinationResolver implements DestinationResolver<String> { @Override public String resolveDestination(String name) throws DestinationResolutionException { String queueName = name; if (this.resourceIdResolver != null) { queueName = this.resourceIdResolver.resolveToPhysicalResourceId(name); } if (isValidQueueUrl(queueName)) { return queueName; } if (this.autoCreate) { CreateQueueResult createQueueResult = this.amazonSqs .createQueue(new CreateQueueRequest(queueName)); return createQueueResult.getQueueUrl(); } else { try { GetQueueUrlResult getQueueUrlResult = this.amazonSqs .getQueueUrl(new GetQueueUrlRequest(queueName)); return getQueueUrlResult.getQueueUrl(); } catch (QueueDoesNotExistException e) { throw toDestinationResolutionException(e); } } } }
DynamicQueueUrlDestinationResolver implements DestinationResolver<String> { @Override public String resolveDestination(String name) throws DestinationResolutionException { String queueName = name; if (this.resourceIdResolver != null) { queueName = this.resourceIdResolver.resolveToPhysicalResourceId(name); } if (isValidQueueUrl(queueName)) { return queueName; } if (this.autoCreate) { CreateQueueResult createQueueResult = this.amazonSqs .createQueue(new CreateQueueRequest(queueName)); return createQueueResult.getQueueUrl(); } else { try { GetQueueUrlResult getQueueUrlResult = this.amazonSqs .getQueueUrl(new GetQueueUrlRequest(queueName)); return getQueueUrlResult.getQueueUrl(); } catch (QueueDoesNotExistException e) { throw toDestinationResolutionException(e); } } } DynamicQueueUrlDestinationResolver(AmazonSQS amazonSqs,
			ResourceIdResolver resourceIdResolver);  DynamicQueueUrlDestinationResolver(AmazonSQS amazonSqs); }
DynamicQueueUrlDestinationResolver implements DestinationResolver<String> { @Override public String resolveDestination(String name) throws DestinationResolutionException { String queueName = name; if (this.resourceIdResolver != null) { queueName = this.resourceIdResolver.resolveToPhysicalResourceId(name); } if (isValidQueueUrl(queueName)) { return queueName; } if (this.autoCreate) { CreateQueueResult createQueueResult = this.amazonSqs .createQueue(new CreateQueueRequest(queueName)); return createQueueResult.getQueueUrl(); } else { try { GetQueueUrlResult getQueueUrlResult = this.amazonSqs .getQueueUrl(new GetQueueUrlRequest(queueName)); return getQueueUrlResult.getQueueUrl(); } catch (QueueDoesNotExistException e) { throw toDestinationResolutionException(e); } } } DynamicQueueUrlDestinationResolver(AmazonSQS amazonSqs,
			ResourceIdResolver resourceIdResolver);  DynamicQueueUrlDestinationResolver(AmazonSQS amazonSqs); void setAutoCreate(boolean autoCreate); @Override String resolveDestination(String name); }
DynamicQueueUrlDestinationResolver implements DestinationResolver<String> { @Override public String resolveDestination(String name) throws DestinationResolutionException { String queueName = name; if (this.resourceIdResolver != null) { queueName = this.resourceIdResolver.resolveToPhysicalResourceId(name); } if (isValidQueueUrl(queueName)) { return queueName; } if (this.autoCreate) { CreateQueueResult createQueueResult = this.amazonSqs .createQueue(new CreateQueueRequest(queueName)); return createQueueResult.getQueueUrl(); } else { try { GetQueueUrlResult getQueueUrlResult = this.amazonSqs .getQueueUrl(new GetQueueUrlRequest(queueName)); return getQueueUrlResult.getQueueUrl(); } catch (QueueDoesNotExistException e) { throw toDestinationResolutionException(e); } } } DynamicQueueUrlDestinationResolver(AmazonSQS amazonSqs,
			ResourceIdResolver resourceIdResolver);  DynamicQueueUrlDestinationResolver(AmazonSQS amazonSqs); void setAutoCreate(boolean autoCreate); @Override String resolveDestination(String name);  }