target
stringlengths 20
113k
| src_fm
stringlengths 11
86.3k
| src_fm_fc
stringlengths 21
86.4k
| src_fm_fc_co
stringlengths 30
86.4k
| src_fm_fc_ms
stringlengths 42
86.8k
| src_fm_fc_ms_ff
stringlengths 43
86.8k
|
---|---|---|---|---|---|
@Test(expected = BadRequestException.class) public void executeThrowsABadRequestExceptionIfBrokerIsUnknown() { underTest.execute("unknown-broker"); }
|
@ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") public void execute( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).execute(); }
|
ResendScheduledExecutorsResource { @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") public void execute( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).execute(); } }
|
ResendScheduledExecutorsResource { @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") public void execute( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).execute(); } ResendScheduledExecutorsResource(Map<String, ResendScheduledExecutorService> resendScheduledExecutors); }
|
ResendScheduledExecutorsResource { @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") public void execute( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).execute(); } ResendScheduledExecutorsResource(Map<String, ResendScheduledExecutorService> resendScheduledExecutors); @ApiOperation("Start the resend executor for the given broker") @POST @Path("/start") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") void execute(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") void pause(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
ResendScheduledExecutorsResource { @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") public void execute( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).execute(); } ResendScheduledExecutorsResource(Map<String, ResendScheduledExecutorService> resendScheduledExecutors); @ApiOperation("Start the resend executor for the given broker") @POST @Path("/start") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") void execute(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") void pause(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
@Test public void createResendScheduledExecutorServiceBeanDefinition(){ AbstractBeanDefinition abstractBeanDefinition = underTest.create( executorService, "queueBrowserService", 0, 10, SECONDS); assertThat(abstractBeanDefinition.getBeanClass(), typeCompatibleWith(QueueBrowserScheduledExecutorService.class)); ConstructorArgumentValues constructorArgumentValues = abstractBeanDefinition.getConstructorArgumentValues(); assertThat(constructorArgumentValues.getIndexedArgumentValues().size(), is(5)); assertThat(constructorArgumentValues.getArgumentValue(0, ExecutorService.class).getValue(), is(executorService)); assertThat(constructorArgumentValues.getArgumentValue(1, QueueBrowserService.class).getValue(), is(equalTo(new RuntimeBeanReference("queueBrowserService")))); assertThat(constructorArgumentValues.getArgumentValue(2, Long.class).getValue(), is(0L)); assertThat(constructorArgumentValues.getArgumentValue(3, Long.class).getValue(), is(10L)); assertThat(constructorArgumentValues.getArgumentValue(4, TimeUnit.class).getValue(), is(SECONDS)); }
|
public AbstractBeanDefinition create(ScheduledExecutorService executorService, String queueBrowserServiceBeanName, long initialDelay, long executionFrequency, TimeUnit timeUnit) { return genericBeanDefinition(QueueBrowserScheduledExecutorService.class) .addConstructorArgValue(executorService) .addConstructorArgReference(queueBrowserServiceBeanName) .addConstructorArgValue(initialDelay) .addConstructorArgValue(executionFrequency) .addConstructorArgValue(timeUnit) .setInitMethodName("start") .setDestroyMethodName("shutdown") .getBeanDefinition(); }
|
QueueBrowserScheduledExecutorServiceBeanDefinitionFactory { public AbstractBeanDefinition create(ScheduledExecutorService executorService, String queueBrowserServiceBeanName, long initialDelay, long executionFrequency, TimeUnit timeUnit) { return genericBeanDefinition(QueueBrowserScheduledExecutorService.class) .addConstructorArgValue(executorService) .addConstructorArgReference(queueBrowserServiceBeanName) .addConstructorArgValue(initialDelay) .addConstructorArgValue(executionFrequency) .addConstructorArgValue(timeUnit) .setInitMethodName("start") .setDestroyMethodName("shutdown") .getBeanDefinition(); } }
|
QueueBrowserScheduledExecutorServiceBeanDefinitionFactory { public AbstractBeanDefinition create(ScheduledExecutorService executorService, String queueBrowserServiceBeanName, long initialDelay, long executionFrequency, TimeUnit timeUnit) { return genericBeanDefinition(QueueBrowserScheduledExecutorService.class) .addConstructorArgValue(executorService) .addConstructorArgReference(queueBrowserServiceBeanName) .addConstructorArgValue(initialDelay) .addConstructorArgValue(executionFrequency) .addConstructorArgValue(timeUnit) .setInitMethodName("start") .setDestroyMethodName("shutdown") .getBeanDefinition(); } }
|
QueueBrowserScheduledExecutorServiceBeanDefinitionFactory { public AbstractBeanDefinition create(ScheduledExecutorService executorService, String queueBrowserServiceBeanName, long initialDelay, long executionFrequency, TimeUnit timeUnit) { return genericBeanDefinition(QueueBrowserScheduledExecutorService.class) .addConstructorArgValue(executorService) .addConstructorArgReference(queueBrowserServiceBeanName) .addConstructorArgValue(initialDelay) .addConstructorArgValue(executionFrequency) .addConstructorArgValue(timeUnit) .setInitMethodName("start") .setDestroyMethodName("shutdown") .getBeanDefinition(); } AbstractBeanDefinition create(ScheduledExecutorService executorService,
String queueBrowserServiceBeanName,
long initialDelay,
long executionFrequency,
TimeUnit timeUnit); String createBeanName(String brokerName); }
|
QueueBrowserScheduledExecutorServiceBeanDefinitionFactory { public AbstractBeanDefinition create(ScheduledExecutorService executorService, String queueBrowserServiceBeanName, long initialDelay, long executionFrequency, TimeUnit timeUnit) { return genericBeanDefinition(QueueBrowserScheduledExecutorService.class) .addConstructorArgValue(executorService) .addConstructorArgReference(queueBrowserServiceBeanName) .addConstructorArgValue(initialDelay) .addConstructorArgValue(executionFrequency) .addConstructorArgValue(timeUnit) .setInitMethodName("start") .setDestroyMethodName("shutdown") .getBeanDefinition(); } AbstractBeanDefinition create(ScheduledExecutorService executorService,
String queueBrowserServiceBeanName,
long initialDelay,
long executionFrequency,
TimeUnit timeUnit); String createBeanName(String brokerName); static final String QUEUE_BROWSER_SCHEDULED_EXECUTOR_SERVICE_BEAN_NAME_PREFIX; }
|
@Test public void createBeanName() throws Exception { assertThat(underTest.createBeanName(BROKER_NAME), is(equalTo(QUEUE_BROWSER_SCHEDULED_EXECUTOR_SERVICE_BEAN_NAME_PREFIX + BROKER_NAME))); }
|
public String createBeanName(String brokerName) { return QUEUE_BROWSER_SCHEDULED_EXECUTOR_SERVICE_BEAN_NAME_PREFIX + brokerName; }
|
QueueBrowserScheduledExecutorServiceBeanDefinitionFactory { public String createBeanName(String brokerName) { return QUEUE_BROWSER_SCHEDULED_EXECUTOR_SERVICE_BEAN_NAME_PREFIX + brokerName; } }
|
QueueBrowserScheduledExecutorServiceBeanDefinitionFactory { public String createBeanName(String brokerName) { return QUEUE_BROWSER_SCHEDULED_EXECUTOR_SERVICE_BEAN_NAME_PREFIX + brokerName; } }
|
QueueBrowserScheduledExecutorServiceBeanDefinitionFactory { public String createBeanName(String brokerName) { return QUEUE_BROWSER_SCHEDULED_EXECUTOR_SERVICE_BEAN_NAME_PREFIX + brokerName; } AbstractBeanDefinition create(ScheduledExecutorService executorService,
String queueBrowserServiceBeanName,
long initialDelay,
long executionFrequency,
TimeUnit timeUnit); String createBeanName(String brokerName); }
|
QueueBrowserScheduledExecutorServiceBeanDefinitionFactory { public String createBeanName(String brokerName) { return QUEUE_BROWSER_SCHEDULED_EXECUTOR_SERVICE_BEAN_NAME_PREFIX + brokerName; } AbstractBeanDefinition create(ScheduledExecutorService executorService,
String queueBrowserServiceBeanName,
long initialDelay,
long executionFrequency,
TimeUnit timeUnit); String createBeanName(String brokerName); static final String QUEUE_BROWSER_SCHEDULED_EXECUTOR_SERVICE_BEAN_NAME_PREFIX; }
|
@Test(expected = NotFoundException.class) public void startThrowsANotFoundExceptionIfBrokerIsUnknown() { underTest.start("unknown-broker"); }
|
@ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") public void start( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Starting consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).start(); }
|
MessageConsumerManagerResource { @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") public void start( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Starting consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).start(); } }
|
MessageConsumerManagerResource { @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") public void start( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Starting consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).start(); } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); }
|
MessageConsumerManagerResource { @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") public void start( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Starting consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).start(); } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") void stop(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Check the status of DLQ consumption on the given broker") @ApiResponses({ @ApiResponse(code = 200, message = "true - if the listener has been started, false - if the listener has been stopped"), @ApiResponse(code = 404, message = "brokerName not found") }) @GET @Path("/running/{brokerName}") String isRunning(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") void readMessages(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
MessageConsumerManagerResource { @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") public void start( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Starting consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).start(); } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") void stop(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Check the status of DLQ consumption on the given broker") @ApiResponses({ @ApiResponse(code = 200, message = "true - if the listener has been started, false - if the listener has been stopped"), @ApiResponse(code = 404, message = "brokerName not found") }) @GET @Path("/running/{brokerName}") String isRunning(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") void readMessages(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
@Test(expected = NotFoundException.class) public void stopThrowsANotFoundExceptionIfBrokerIsUnknown() { underTest.stop("unknown-broker"); }
|
@ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") public void stop( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Stopping consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).stop(); }
|
MessageConsumerManagerResource { @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") public void stop( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Stopping consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).stop(); } }
|
MessageConsumerManagerResource { @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") public void stop( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Stopping consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).stop(); } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); }
|
MessageConsumerManagerResource { @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") public void stop( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Stopping consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).stop(); } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") void stop(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Check the status of DLQ consumption on the given broker") @ApiResponses({ @ApiResponse(code = 200, message = "true - if the listener has been started, false - if the listener has been stopped"), @ApiResponse(code = 404, message = "brokerName not found") }) @GET @Path("/running/{brokerName}") String isRunning(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") void readMessages(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
MessageConsumerManagerResource { @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") public void stop( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Stopping consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).stop(); } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") void stop(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Check the status of DLQ consumption on the given broker") @ApiResponses({ @ApiResponse(code = 200, message = "true - if the listener has been started, false - if the listener has been stopped"), @ApiResponse(code = 404, message = "brokerName not found") }) @GET @Path("/running/{brokerName}") String isRunning(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") void readMessages(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
@Test public void startDefaultMessageListenerContainer() { underTest.start("internal-broker"); verify(defaultMessageListenerContainer).start(); }
|
@ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") public void start( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Starting consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).start(); }
|
MessageConsumerManagerResource { @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") public void start( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Starting consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).start(); } }
|
MessageConsumerManagerResource { @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") public void start( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Starting consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).start(); } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); }
|
MessageConsumerManagerResource { @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") public void start( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Starting consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).start(); } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") void stop(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Check the status of DLQ consumption on the given broker") @ApiResponses({ @ApiResponse(code = 200, message = "true - if the listener has been started, false - if the listener has been stopped"), @ApiResponse(code = 404, message = "brokerName not found") }) @GET @Path("/running/{brokerName}") String isRunning(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") void readMessages(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
MessageConsumerManagerResource { @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") public void start( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Starting consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).start(); } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") void stop(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Check the status of DLQ consumption on the given broker") @ApiResponses({ @ApiResponse(code = 200, message = "true - if the listener has been started, false - if the listener has been stopped"), @ApiResponse(code = 404, message = "brokerName not found") }) @GET @Path("/running/{brokerName}") String isRunning(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") void readMessages(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
@Test public void stopDefaultMessageListenerContainer() { underTest.stop("internal-broker"); verify(defaultMessageListenerContainer).stop(); }
|
@ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") public void stop( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Stopping consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).stop(); }
|
MessageConsumerManagerResource { @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") public void stop( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Stopping consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).stop(); } }
|
MessageConsumerManagerResource { @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") public void stop( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Stopping consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).stop(); } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); }
|
MessageConsumerManagerResource { @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") public void stop( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Stopping consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).stop(); } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") void stop(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Check the status of DLQ consumption on the given broker") @ApiResponses({ @ApiResponse(code = 200, message = "true - if the listener has been started, false - if the listener has been stopped"), @ApiResponse(code = 404, message = "brokerName not found") }) @GET @Path("/running/{brokerName}") String isRunning(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") void readMessages(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
MessageConsumerManagerResource { @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") public void stop( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { LOGGER.info("Stopping consuming messages of the {} broker", brokerName); getMessageConsumerManager(brokerName).stop(); } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") void stop(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Check the status of DLQ consumption on the given broker") @ApiResponses({ @ApiResponse(code = 200, message = "true - if the listener has been started, false - if the listener has been stopped"), @ApiResponse(code = 404, message = "brokerName not found") }) @GET @Path("/running/{brokerName}") String isRunning(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") void readMessages(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
@Test(expected = NotFoundException.class) public void readMessagesThrowsANotFoundExceptionIfBrokerIsUnknown() { underTest.readMessages("unknown-broker"); }
|
@ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") public void readMessages( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { final Optional<MessageConsumerManager> messageListenerManager = messageConsumerManagerRegistry.get(brokerName); if (messageListenerManager.isPresent()) { messageListenerManager .filter(QueueBrowserScheduledExecutorService.class::isInstance) .map(QueueBrowserScheduledExecutorService.class::cast) .orElseThrow(() -> new ServerErrorException(Response.Status.NOT_IMPLEMENTED)) .execute(); } else { throw new NotFoundException(); } }
|
MessageConsumerManagerResource { @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") public void readMessages( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { final Optional<MessageConsumerManager> messageListenerManager = messageConsumerManagerRegistry.get(brokerName); if (messageListenerManager.isPresent()) { messageListenerManager .filter(QueueBrowserScheduledExecutorService.class::isInstance) .map(QueueBrowserScheduledExecutorService.class::cast) .orElseThrow(() -> new ServerErrorException(Response.Status.NOT_IMPLEMENTED)) .execute(); } else { throw new NotFoundException(); } } }
|
MessageConsumerManagerResource { @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") public void readMessages( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { final Optional<MessageConsumerManager> messageListenerManager = messageConsumerManagerRegistry.get(brokerName); if (messageListenerManager.isPresent()) { messageListenerManager .filter(QueueBrowserScheduledExecutorService.class::isInstance) .map(QueueBrowserScheduledExecutorService.class::cast) .orElseThrow(() -> new ServerErrorException(Response.Status.NOT_IMPLEMENTED)) .execute(); } else { throw new NotFoundException(); } } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); }
|
MessageConsumerManagerResource { @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") public void readMessages( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { final Optional<MessageConsumerManager> messageListenerManager = messageConsumerManagerRegistry.get(brokerName); if (messageListenerManager.isPresent()) { messageListenerManager .filter(QueueBrowserScheduledExecutorService.class::isInstance) .map(QueueBrowserScheduledExecutorService.class::cast) .orElseThrow(() -> new ServerErrorException(Response.Status.NOT_IMPLEMENTED)) .execute(); } else { throw new NotFoundException(); } } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") void stop(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Check the status of DLQ consumption on the given broker") @ApiResponses({ @ApiResponse(code = 200, message = "true - if the listener has been started, false - if the listener has been stopped"), @ApiResponse(code = 404, message = "brokerName not found") }) @GET @Path("/running/{brokerName}") String isRunning(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") void readMessages(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
MessageConsumerManagerResource { @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") public void readMessages( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { final Optional<MessageConsumerManager> messageListenerManager = messageConsumerManagerRegistry.get(brokerName); if (messageListenerManager.isPresent()) { messageListenerManager .filter(QueueBrowserScheduledExecutorService.class::isInstance) .map(QueueBrowserScheduledExecutorService.class::cast) .orElseThrow(() -> new ServerErrorException(Response.Status.NOT_IMPLEMENTED)) .execute(); } else { throw new NotFoundException(); } } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") void stop(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Check the status of DLQ consumption on the given broker") @ApiResponses({ @ApiResponse(code = 200, message = "true - if the listener has been started, false - if the listener has been stopped"), @ApiResponse(code = 404, message = "brokerName not found") }) @GET @Path("/running/{brokerName}") String isRunning(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") void readMessages(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
@Test public void readMessagesThrowsAServerErrorExceptionIfBrokerIsNotReadOnly() { StubRuntimeDelegate.setExpectedStatus(Response.Status.NOT_IMPLEMENTED); expectedException.expect(ServerErrorException.class); expectedException.expectMessage("HTTP 501 Not Implemented"); underTest.readMessages("internal-broker"); }
|
@ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") public void readMessages( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { final Optional<MessageConsumerManager> messageListenerManager = messageConsumerManagerRegistry.get(brokerName); if (messageListenerManager.isPresent()) { messageListenerManager .filter(QueueBrowserScheduledExecutorService.class::isInstance) .map(QueueBrowserScheduledExecutorService.class::cast) .orElseThrow(() -> new ServerErrorException(Response.Status.NOT_IMPLEMENTED)) .execute(); } else { throw new NotFoundException(); } }
|
MessageConsumerManagerResource { @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") public void readMessages( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { final Optional<MessageConsumerManager> messageListenerManager = messageConsumerManagerRegistry.get(brokerName); if (messageListenerManager.isPresent()) { messageListenerManager .filter(QueueBrowserScheduledExecutorService.class::isInstance) .map(QueueBrowserScheduledExecutorService.class::cast) .orElseThrow(() -> new ServerErrorException(Response.Status.NOT_IMPLEMENTED)) .execute(); } else { throw new NotFoundException(); } } }
|
MessageConsumerManagerResource { @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") public void readMessages( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { final Optional<MessageConsumerManager> messageListenerManager = messageConsumerManagerRegistry.get(brokerName); if (messageListenerManager.isPresent()) { messageListenerManager .filter(QueueBrowserScheduledExecutorService.class::isInstance) .map(QueueBrowserScheduledExecutorService.class::cast) .orElseThrow(() -> new ServerErrorException(Response.Status.NOT_IMPLEMENTED)) .execute(); } else { throw new NotFoundException(); } } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); }
|
MessageConsumerManagerResource { @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") public void readMessages( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { final Optional<MessageConsumerManager> messageListenerManager = messageConsumerManagerRegistry.get(brokerName); if (messageListenerManager.isPresent()) { messageListenerManager .filter(QueueBrowserScheduledExecutorService.class::isInstance) .map(QueueBrowserScheduledExecutorService.class::cast) .orElseThrow(() -> new ServerErrorException(Response.Status.NOT_IMPLEMENTED)) .execute(); } else { throw new NotFoundException(); } } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") void stop(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Check the status of DLQ consumption on the given broker") @ApiResponses({ @ApiResponse(code = 200, message = "true - if the listener has been started, false - if the listener has been stopped"), @ApiResponse(code = 404, message = "brokerName not found") }) @GET @Path("/running/{brokerName}") String isRunning(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") void readMessages(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
MessageConsumerManagerResource { @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") public void readMessages( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { final Optional<MessageConsumerManager> messageListenerManager = messageConsumerManagerRegistry.get(brokerName); if (messageListenerManager.isPresent()) { messageListenerManager .filter(QueueBrowserScheduledExecutorService.class::isInstance) .map(QueueBrowserScheduledExecutorService.class::cast) .orElseThrow(() -> new ServerErrorException(Response.Status.NOT_IMPLEMENTED)) .execute(); } else { throw new NotFoundException(); } } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") void stop(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Check the status of DLQ consumption on the given broker") @ApiResponses({ @ApiResponse(code = 200, message = "true - if the listener has been started, false - if the listener has been stopped"), @ApiResponse(code = 404, message = "brokerName not found") }) @GET @Path("/running/{brokerName}") String isRunning(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") void readMessages(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
@Test public void readMessagesForAReadOnlyBroker() { underTest.readMessages("readonly-broker"); verify(queueBrowserScheduledExecutorService).execute(); }
|
@ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") public void readMessages( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { final Optional<MessageConsumerManager> messageListenerManager = messageConsumerManagerRegistry.get(brokerName); if (messageListenerManager.isPresent()) { messageListenerManager .filter(QueueBrowserScheduledExecutorService.class::isInstance) .map(QueueBrowserScheduledExecutorService.class::cast) .orElseThrow(() -> new ServerErrorException(Response.Status.NOT_IMPLEMENTED)) .execute(); } else { throw new NotFoundException(); } }
|
MessageConsumerManagerResource { @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") public void readMessages( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { final Optional<MessageConsumerManager> messageListenerManager = messageConsumerManagerRegistry.get(brokerName); if (messageListenerManager.isPresent()) { messageListenerManager .filter(QueueBrowserScheduledExecutorService.class::isInstance) .map(QueueBrowserScheduledExecutorService.class::cast) .orElseThrow(() -> new ServerErrorException(Response.Status.NOT_IMPLEMENTED)) .execute(); } else { throw new NotFoundException(); } } }
|
MessageConsumerManagerResource { @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") public void readMessages( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { final Optional<MessageConsumerManager> messageListenerManager = messageConsumerManagerRegistry.get(brokerName); if (messageListenerManager.isPresent()) { messageListenerManager .filter(QueueBrowserScheduledExecutorService.class::isInstance) .map(QueueBrowserScheduledExecutorService.class::cast) .orElseThrow(() -> new ServerErrorException(Response.Status.NOT_IMPLEMENTED)) .execute(); } else { throw new NotFoundException(); } } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); }
|
MessageConsumerManagerResource { @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") public void readMessages( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { final Optional<MessageConsumerManager> messageListenerManager = messageConsumerManagerRegistry.get(brokerName); if (messageListenerManager.isPresent()) { messageListenerManager .filter(QueueBrowserScheduledExecutorService.class::isInstance) .map(QueueBrowserScheduledExecutorService.class::cast) .orElseThrow(() -> new ServerErrorException(Response.Status.NOT_IMPLEMENTED)) .execute(); } else { throw new NotFoundException(); } } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") void stop(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Check the status of DLQ consumption on the given broker") @ApiResponses({ @ApiResponse(code = 200, message = "true - if the listener has been started, false - if the listener has been stopped"), @ApiResponse(code = 404, message = "brokerName not found") }) @GET @Path("/running/{brokerName}") String isRunning(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") void readMessages(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
MessageConsumerManagerResource { @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") public void readMessages( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { final Optional<MessageConsumerManager> messageListenerManager = messageConsumerManagerRegistry.get(brokerName); if (messageListenerManager.isPresent()) { messageListenerManager .filter(QueueBrowserScheduledExecutorService.class::isInstance) .map(QueueBrowserScheduledExecutorService.class::cast) .orElseThrow(() -> new ServerErrorException(Response.Status.NOT_IMPLEMENTED)) .execute(); } else { throw new NotFoundException(); } } MessageConsumerManagerResource(MessageConsumerManagerRegistry messageConsumerManagerRegistry); @ApiOperation("Start consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption started successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/start/{brokerName}") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Stop consuming messages from the DLQ on the given broker") @ApiResponses({ @ApiResponse(code = 204, message = "DLQ consumption stopped successfully"), @ApiResponse(code = 404, message = "brokerName not found") }) @POST @Path("/stop/{brokerName}") void stop(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Check the status of DLQ consumption on the given broker") @ApiResponses({ @ApiResponse(code = 200, message = "true - if the listener has been started, false - if the listener has been stopped"), @ApiResponse(code = 404, message = "brokerName not found") }) @GET @Path("/running/{brokerName}") String isRunning(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Read all messages on the DLQ for the given broker. This operation is only supported if the queue on the given broker is in read-only mode") @ApiResponses({ @ApiResponse(code = 204, message = "Queue Browser executed successfully"), @ApiResponse(code = 404, message = "brokerName not found"), @ApiResponse(code = 501, message = "Broker does not support this operation") }) @PUT @Path("/read-messages/{brokerName}") void readMessages(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
@Test public void createABeanDefinitionForActiveMqConnectionFactory() throws Exception { AbstractBeanDefinition abstractBeanDefinition = underTest.create(BROKER_NAME); assertThat(abstractBeanDefinition.getBeanClass(), typeCompatibleWith(ActiveMQConnectionFactoryFactory.class)); assertThat(abstractBeanDefinition.getConstructorArgumentValues().getArgumentValue(0, String.class).getValue(), is(BROKER_NAME)); assertThat(abstractBeanDefinition.getConstructorArgumentValues().getArgumentValue(1, JmsListenerProperties.class, "jmsListenerProperties").getValue(), is(new RuntimeBeanReference("jmsListenerProperties"))); }
|
public AbstractBeanDefinition create(String brokerName) { return genericBeanDefinition(ActiveMQConnectionFactoryFactory.class) .addConstructorArgValue(brokerName) .addConstructorArgReference("jmsListenerProperties") .getBeanDefinition(); }
|
ActiveMQConnectionFactoryFactoryBeanDefinitionFactory { public AbstractBeanDefinition create(String brokerName) { return genericBeanDefinition(ActiveMQConnectionFactoryFactory.class) .addConstructorArgValue(brokerName) .addConstructorArgReference("jmsListenerProperties") .getBeanDefinition(); } }
|
ActiveMQConnectionFactoryFactoryBeanDefinitionFactory { public AbstractBeanDefinition create(String brokerName) { return genericBeanDefinition(ActiveMQConnectionFactoryFactory.class) .addConstructorArgValue(brokerName) .addConstructorArgReference("jmsListenerProperties") .getBeanDefinition(); } }
|
ActiveMQConnectionFactoryFactoryBeanDefinitionFactory { public AbstractBeanDefinition create(String brokerName) { return genericBeanDefinition(ActiveMQConnectionFactoryFactory.class) .addConstructorArgValue(brokerName) .addConstructorArgReference("jmsListenerProperties") .getBeanDefinition(); } AbstractBeanDefinition create(String brokerName); String createBeanName(String brokerName); }
|
ActiveMQConnectionFactoryFactoryBeanDefinitionFactory { public AbstractBeanDefinition create(String brokerName) { return genericBeanDefinition(ActiveMQConnectionFactoryFactory.class) .addConstructorArgValue(brokerName) .addConstructorArgReference("jmsListenerProperties") .getBeanDefinition(); } AbstractBeanDefinition create(String brokerName); String createBeanName(String brokerName); }
|
@Test(expected = BadRequestException.class) public void pauseThrowsABadRequestExceptionIfBrokerIsUnknown() { underTest.pause("unknown-broker"); }
|
@ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") public void pause( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).pause(); }
|
ResendScheduledExecutorsResource { @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") public void pause( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).pause(); } }
|
ResendScheduledExecutorsResource { @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") public void pause( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).pause(); } ResendScheduledExecutorsResource(Map<String, ResendScheduledExecutorService> resendScheduledExecutors); }
|
ResendScheduledExecutorsResource { @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") public void pause( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).pause(); } ResendScheduledExecutorsResource(Map<String, ResendScheduledExecutorService> resendScheduledExecutors); @ApiOperation("Start the resend executor for the given broker") @POST @Path("/start") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") void execute(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") void pause(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
ResendScheduledExecutorsResource { @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") public void pause( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).pause(); } ResendScheduledExecutorsResource(Map<String, ResendScheduledExecutorService> resendScheduledExecutors); @ApiOperation("Start the resend executor for the given broker") @POST @Path("/start") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") void execute(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") void pause(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
@Test public void createBeanName() throws Exception { assertThat(underTest.createBeanName("foo"), is(equalTo(FACTORY_BEAN_NAME_PREFIX + "foo"))); }
|
public String createBeanName(String brokerName) { return FACTORY_BEAN_NAME_PREFIX + brokerName; }
|
ActiveMQConnectionFactoryFactoryBeanDefinitionFactory { public String createBeanName(String brokerName) { return FACTORY_BEAN_NAME_PREFIX + brokerName; } }
|
ActiveMQConnectionFactoryFactoryBeanDefinitionFactory { public String createBeanName(String brokerName) { return FACTORY_BEAN_NAME_PREFIX + brokerName; } }
|
ActiveMQConnectionFactoryFactoryBeanDefinitionFactory { public String createBeanName(String brokerName) { return FACTORY_BEAN_NAME_PREFIX + brokerName; } AbstractBeanDefinition create(String brokerName); String createBeanName(String brokerName); }
|
ActiveMQConnectionFactoryFactoryBeanDefinitionFactory { public String createBeanName(String brokerName) { return FACTORY_BEAN_NAME_PREFIX + brokerName; } AbstractBeanDefinition create(String brokerName); String createBeanName(String brokerName); }
|
@Test public void createFailedMessageListenerBeanDefinition() { AbstractBeanDefinition abstractBeanDefinition = underTest.create(BROKER_NAME); assertThat(abstractBeanDefinition.getBeanClass(), typeCompatibleWith(FailedMessageListener.class)); assertThat(abstractBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().size(), is(2)); assertThat(abstractBeanDefinition.getConstructorArgumentValues().getArgumentValue(0, ActiveMQFailedMessageFactory.class).getValue(), is(activeMQFailedMessageFactory)); assertThat(abstractBeanDefinition.getConstructorArgumentValues().getArgumentValue(1, ActiveMQFailedMessageFactory.class).getValue(), is(equalTo(new RuntimeBeanReference("failedMessageProcessor")))); }
|
public AbstractBeanDefinition create(String brokerName) { return genericBeanDefinition(FailedMessageListener.class) .addConstructorArgValue(activeMQFailedMessageFactoryFactory.apply(brokerName)) .addConstructorArgReference("failedMessageProcessor") .getBeanDefinition(); }
|
FailedMessageListenerBeanDefinitionFactory { public AbstractBeanDefinition create(String brokerName) { return genericBeanDefinition(FailedMessageListener.class) .addConstructorArgValue(activeMQFailedMessageFactoryFactory.apply(brokerName)) .addConstructorArgReference("failedMessageProcessor") .getBeanDefinition(); } }
|
FailedMessageListenerBeanDefinitionFactory { public AbstractBeanDefinition create(String brokerName) { return genericBeanDefinition(FailedMessageListener.class) .addConstructorArgValue(activeMQFailedMessageFactoryFactory.apply(brokerName)) .addConstructorArgReference("failedMessageProcessor") .getBeanDefinition(); } FailedMessageListenerBeanDefinitionFactory(Function<String, ActiveMQFailedMessageFactory> activeMQFailedMessageFactoryFactory); }
|
FailedMessageListenerBeanDefinitionFactory { public AbstractBeanDefinition create(String brokerName) { return genericBeanDefinition(FailedMessageListener.class) .addConstructorArgValue(activeMQFailedMessageFactoryFactory.apply(brokerName)) .addConstructorArgReference("failedMessageProcessor") .getBeanDefinition(); } FailedMessageListenerBeanDefinitionFactory(Function<String, ActiveMQFailedMessageFactory> activeMQFailedMessageFactoryFactory); AbstractBeanDefinition create(String brokerName); String createBeanName(String brokerName); }
|
FailedMessageListenerBeanDefinitionFactory { public AbstractBeanDefinition create(String brokerName) { return genericBeanDefinition(FailedMessageListener.class) .addConstructorArgValue(activeMQFailedMessageFactoryFactory.apply(brokerName)) .addConstructorArgReference("failedMessageProcessor") .getBeanDefinition(); } FailedMessageListenerBeanDefinitionFactory(Function<String, ActiveMQFailedMessageFactory> activeMQFailedMessageFactoryFactory); AbstractBeanDefinition create(String brokerName); String createBeanName(String brokerName); static final String FAILED_MESSAGE_LISTENER_BEAN_NAME_PREFIX; }
|
@Test public void createBeanName() { assertThat(underTest.createBeanName(BROKER_NAME), is(equalTo(FAILED_MESSAGE_LISTENER_BEAN_NAME_PREFIX + BROKER_NAME))); }
|
public String createBeanName(String brokerName) { return FAILED_MESSAGE_LISTENER_BEAN_NAME_PREFIX + brokerName; }
|
FailedMessageListenerBeanDefinitionFactory { public String createBeanName(String brokerName) { return FAILED_MESSAGE_LISTENER_BEAN_NAME_PREFIX + brokerName; } }
|
FailedMessageListenerBeanDefinitionFactory { public String createBeanName(String brokerName) { return FAILED_MESSAGE_LISTENER_BEAN_NAME_PREFIX + brokerName; } FailedMessageListenerBeanDefinitionFactory(Function<String, ActiveMQFailedMessageFactory> activeMQFailedMessageFactoryFactory); }
|
FailedMessageListenerBeanDefinitionFactory { public String createBeanName(String brokerName) { return FAILED_MESSAGE_LISTENER_BEAN_NAME_PREFIX + brokerName; } FailedMessageListenerBeanDefinitionFactory(Function<String, ActiveMQFailedMessageFactory> activeMQFailedMessageFactoryFactory); AbstractBeanDefinition create(String brokerName); String createBeanName(String brokerName); }
|
FailedMessageListenerBeanDefinitionFactory { public String createBeanName(String brokerName) { return FAILED_MESSAGE_LISTENER_BEAN_NAME_PREFIX + brokerName; } FailedMessageListenerBeanDefinitionFactory(Function<String, ActiveMQFailedMessageFactory> activeMQFailedMessageFactoryFactory); AbstractBeanDefinition create(String brokerName); String createBeanName(String brokerName); static final String FAILED_MESSAGE_LISTENER_BEAN_NAME_PREFIX; }
|
@Test public void createBeanDefinitionForDefaultMessageListenerContainer() { AbstractBeanDefinition abstractBeanDefinition = underTest.create( BROKER_NAME, CONNECTION_FACTORY_BEAN_NAME, QUEUE_NAME, FAILED_MESSAGE_LISTENER_BEAN_NAME ); assertThat(abstractBeanDefinition.getBeanClass(), typeCompatibleWith(NamedMessageListenerContainer.class)); assertThat(abstractBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().size(), is(1)); assertThat(abstractBeanDefinition.getConstructorArgumentValues().getArgumentValue(0, String.class).getValue(), is(BROKER_NAME)); MutablePropertyValues propertyValues = abstractBeanDefinition.getPropertyValues(); assertThat(propertyValues.size(), is(3)); assertThat(propertyValues.getPropertyValue("connectionFactory").getValue(), is(equalTo(new RuntimeBeanReference(CONNECTION_FACTORY_BEAN_NAME)))); assertThat(propertyValues.getPropertyValue("destinationName").getValue(), is(QUEUE_NAME)); assertThat(propertyValues.getPropertyValue("messageListener").getValue(), is(equalTo(new RuntimeBeanReference(FAILED_MESSAGE_LISTENER_BEAN_NAME)))); }
|
public AbstractBeanDefinition create(String brokerName, String connectionFactoryBeanName, String queueName, String failedMessageListenerBeanName) { LOGGER.debug("Creating NamedMessageListenerContainer BeanDefinition for {}", brokerName); return genericBeanDefinition(NamedMessageListenerContainer.class) .addConstructorArgValue(brokerName) .addPropertyReference("connectionFactory", connectionFactoryBeanName) .addPropertyValue("destinationName", queueName) .addPropertyReference("messageListener", failedMessageListenerBeanName) .getBeanDefinition(); }
|
NamedMessageListenerContainerBeanDefinitionFactory { public AbstractBeanDefinition create(String brokerName, String connectionFactoryBeanName, String queueName, String failedMessageListenerBeanName) { LOGGER.debug("Creating NamedMessageListenerContainer BeanDefinition for {}", brokerName); return genericBeanDefinition(NamedMessageListenerContainer.class) .addConstructorArgValue(brokerName) .addPropertyReference("connectionFactory", connectionFactoryBeanName) .addPropertyValue("destinationName", queueName) .addPropertyReference("messageListener", failedMessageListenerBeanName) .getBeanDefinition(); } }
|
NamedMessageListenerContainerBeanDefinitionFactory { public AbstractBeanDefinition create(String brokerName, String connectionFactoryBeanName, String queueName, String failedMessageListenerBeanName) { LOGGER.debug("Creating NamedMessageListenerContainer BeanDefinition for {}", brokerName); return genericBeanDefinition(NamedMessageListenerContainer.class) .addConstructorArgValue(brokerName) .addPropertyReference("connectionFactory", connectionFactoryBeanName) .addPropertyValue("destinationName", queueName) .addPropertyReference("messageListener", failedMessageListenerBeanName) .getBeanDefinition(); } }
|
NamedMessageListenerContainerBeanDefinitionFactory { public AbstractBeanDefinition create(String brokerName, String connectionFactoryBeanName, String queueName, String failedMessageListenerBeanName) { LOGGER.debug("Creating NamedMessageListenerContainer BeanDefinition for {}", brokerName); return genericBeanDefinition(NamedMessageListenerContainer.class) .addConstructorArgValue(brokerName) .addPropertyReference("connectionFactory", connectionFactoryBeanName) .addPropertyValue("destinationName", queueName) .addPropertyReference("messageListener", failedMessageListenerBeanName) .getBeanDefinition(); } AbstractBeanDefinition create(String brokerName,
String connectionFactoryBeanName,
String queueName,
String failedMessageListenerBeanName); String createBeanName(String brokerName); }
|
NamedMessageListenerContainerBeanDefinitionFactory { public AbstractBeanDefinition create(String brokerName, String connectionFactoryBeanName, String queueName, String failedMessageListenerBeanName) { LOGGER.debug("Creating NamedMessageListenerContainer BeanDefinition for {}", brokerName); return genericBeanDefinition(NamedMessageListenerContainer.class) .addConstructorArgValue(brokerName) .addPropertyReference("connectionFactory", connectionFactoryBeanName) .addPropertyValue("destinationName", queueName) .addPropertyReference("messageListener", failedMessageListenerBeanName) .getBeanDefinition(); } AbstractBeanDefinition create(String brokerName,
String connectionFactoryBeanName,
String queueName,
String failedMessageListenerBeanName); String createBeanName(String brokerName); static final String NAMED_MESSAGE_LISTENER_CONTAINER_BEAN_NAME_PREFIX; }
|
@Test public void createBeanName() throws Exception { assertThat(underTest.createBeanName("foo"), is(equalTo(NAMED_MESSAGE_LISTENER_CONTAINER_BEAN_NAME_PREFIX + "foo"))); }
|
public String createBeanName(String brokerName) { return NAMED_MESSAGE_LISTENER_CONTAINER_BEAN_NAME_PREFIX + brokerName; }
|
NamedMessageListenerContainerBeanDefinitionFactory { public String createBeanName(String brokerName) { return NAMED_MESSAGE_LISTENER_CONTAINER_BEAN_NAME_PREFIX + brokerName; } }
|
NamedMessageListenerContainerBeanDefinitionFactory { public String createBeanName(String brokerName) { return NAMED_MESSAGE_LISTENER_CONTAINER_BEAN_NAME_PREFIX + brokerName; } }
|
NamedMessageListenerContainerBeanDefinitionFactory { public String createBeanName(String brokerName) { return NAMED_MESSAGE_LISTENER_CONTAINER_BEAN_NAME_PREFIX + brokerName; } AbstractBeanDefinition create(String brokerName,
String connectionFactoryBeanName,
String queueName,
String failedMessageListenerBeanName); String createBeanName(String brokerName); }
|
NamedMessageListenerContainerBeanDefinitionFactory { public String createBeanName(String brokerName) { return NAMED_MESSAGE_LISTENER_CONTAINER_BEAN_NAME_PREFIX + brokerName; } AbstractBeanDefinition create(String brokerName,
String connectionFactoryBeanName,
String queueName,
String failedMessageListenerBeanName); String createBeanName(String brokerName); static final String NAMED_MESSAGE_LISTENER_CONTAINER_BEAN_NAME_PREFIX; }
|
@Test public void ifNoTlsConffigExistsThenCreateVanillaActiveMQConnectionFactory() throws Exception { JmsListenerProperties.BrokerProperties brokerConfig = new JmsListenerProperties.BrokerProperties(); brokerConfig.setName(BROKER_NAME); brokerConfig.setUrl("tcp: JmsListenerProperties testConfig = new JmsListenerProperties(); testConfig.setBrokers(Collections.singletonList(brokerConfig)); ActiveMQConnectionFactoryFactory underTest = new ActiveMQConnectionFactoryFactory(BROKER_NAME, testConfig); ConnectionFactory connectionFactory = underTest.create(); assertThat(connectionFactory, instanceOf(ActiveMQConnectionFactory.class)); }
|
public ConnectionFactory create() { JmsListenerProperties.BrokerProperties brokerConfig = jmsListenerProperties.getBrokerConfigFor(brokerName) .orElseThrow(() -> new RuntimeException("Could not find broker config for broker with name: " + brokerName)); Optional<JmsListenerProperties.BrokerProperties.TlsProperties> tlsConfig = Optional.ofNullable(brokerConfig.getTls()); return tlsConfig.map(tls -> { try { LOGGER.info("Found TLS configuration for broker with name: {}. Creating appropriate ssl connection factory.", brokerName); ActiveMQSslConnectionFactory activeMQSslConnectionFactory = new ActiveMQSslConnectionFactory(brokerConfig.getUrl()); activeMQSslConnectionFactory.setKeyStore(tls.getKeyStoreFilePath()); activeMQSslConnectionFactory.setKeyStorePassword(String.valueOf(tls.getKeyStorePassword())); activeMQSslConnectionFactory.setTrustStore(tls.getTrustStoreFilePath()); activeMQSslConnectionFactory.setTrustStorePassword(String.valueOf(tls.getTrustStorePassword())); return (ConnectionFactory) activeMQSslConnectionFactory; } catch (Exception e) { throw new RuntimeException(e); } }).orElseGet(() -> { LOGGER.info("Creating standard connection factory for broker with name: {}", brokerName); return new ActiveMQConnectionFactory(brokerConfig.getUrl()); }); }
|
ActiveMQConnectionFactoryFactory { public ConnectionFactory create() { JmsListenerProperties.BrokerProperties brokerConfig = jmsListenerProperties.getBrokerConfigFor(brokerName) .orElseThrow(() -> new RuntimeException("Could not find broker config for broker with name: " + brokerName)); Optional<JmsListenerProperties.BrokerProperties.TlsProperties> tlsConfig = Optional.ofNullable(brokerConfig.getTls()); return tlsConfig.map(tls -> { try { LOGGER.info("Found TLS configuration for broker with name: {}. Creating appropriate ssl connection factory.", brokerName); ActiveMQSslConnectionFactory activeMQSslConnectionFactory = new ActiveMQSslConnectionFactory(brokerConfig.getUrl()); activeMQSslConnectionFactory.setKeyStore(tls.getKeyStoreFilePath()); activeMQSslConnectionFactory.setKeyStorePassword(String.valueOf(tls.getKeyStorePassword())); activeMQSslConnectionFactory.setTrustStore(tls.getTrustStoreFilePath()); activeMQSslConnectionFactory.setTrustStorePassword(String.valueOf(tls.getTrustStorePassword())); return (ConnectionFactory) activeMQSslConnectionFactory; } catch (Exception e) { throw new RuntimeException(e); } }).orElseGet(() -> { LOGGER.info("Creating standard connection factory for broker with name: {}", brokerName); return new ActiveMQConnectionFactory(brokerConfig.getUrl()); }); } }
|
ActiveMQConnectionFactoryFactory { public ConnectionFactory create() { JmsListenerProperties.BrokerProperties brokerConfig = jmsListenerProperties.getBrokerConfigFor(brokerName) .orElseThrow(() -> new RuntimeException("Could not find broker config for broker with name: " + brokerName)); Optional<JmsListenerProperties.BrokerProperties.TlsProperties> tlsConfig = Optional.ofNullable(brokerConfig.getTls()); return tlsConfig.map(tls -> { try { LOGGER.info("Found TLS configuration for broker with name: {}. Creating appropriate ssl connection factory.", brokerName); ActiveMQSslConnectionFactory activeMQSslConnectionFactory = new ActiveMQSslConnectionFactory(brokerConfig.getUrl()); activeMQSslConnectionFactory.setKeyStore(tls.getKeyStoreFilePath()); activeMQSslConnectionFactory.setKeyStorePassword(String.valueOf(tls.getKeyStorePassword())); activeMQSslConnectionFactory.setTrustStore(tls.getTrustStoreFilePath()); activeMQSslConnectionFactory.setTrustStorePassword(String.valueOf(tls.getTrustStorePassword())); return (ConnectionFactory) activeMQSslConnectionFactory; } catch (Exception e) { throw new RuntimeException(e); } }).orElseGet(() -> { LOGGER.info("Creating standard connection factory for broker with name: {}", brokerName); return new ActiveMQConnectionFactory(brokerConfig.getUrl()); }); } ActiveMQConnectionFactoryFactory(String brokerName, JmsListenerProperties jmsListenerProperties); }
|
ActiveMQConnectionFactoryFactory { public ConnectionFactory create() { JmsListenerProperties.BrokerProperties brokerConfig = jmsListenerProperties.getBrokerConfigFor(brokerName) .orElseThrow(() -> new RuntimeException("Could not find broker config for broker with name: " + brokerName)); Optional<JmsListenerProperties.BrokerProperties.TlsProperties> tlsConfig = Optional.ofNullable(brokerConfig.getTls()); return tlsConfig.map(tls -> { try { LOGGER.info("Found TLS configuration for broker with name: {}. Creating appropriate ssl connection factory.", brokerName); ActiveMQSslConnectionFactory activeMQSslConnectionFactory = new ActiveMQSslConnectionFactory(brokerConfig.getUrl()); activeMQSslConnectionFactory.setKeyStore(tls.getKeyStoreFilePath()); activeMQSslConnectionFactory.setKeyStorePassword(String.valueOf(tls.getKeyStorePassword())); activeMQSslConnectionFactory.setTrustStore(tls.getTrustStoreFilePath()); activeMQSslConnectionFactory.setTrustStorePassword(String.valueOf(tls.getTrustStorePassword())); return (ConnectionFactory) activeMQSslConnectionFactory; } catch (Exception e) { throw new RuntimeException(e); } }).orElseGet(() -> { LOGGER.info("Creating standard connection factory for broker with name: {}", brokerName); return new ActiveMQConnectionFactory(brokerConfig.getUrl()); }); } ActiveMQConnectionFactoryFactory(String brokerName, JmsListenerProperties jmsListenerProperties); ConnectionFactory create(); }
|
ActiveMQConnectionFactoryFactory { public ConnectionFactory create() { JmsListenerProperties.BrokerProperties brokerConfig = jmsListenerProperties.getBrokerConfigFor(brokerName) .orElseThrow(() -> new RuntimeException("Could not find broker config for broker with name: " + brokerName)); Optional<JmsListenerProperties.BrokerProperties.TlsProperties> tlsConfig = Optional.ofNullable(brokerConfig.getTls()); return tlsConfig.map(tls -> { try { LOGGER.info("Found TLS configuration for broker with name: {}. Creating appropriate ssl connection factory.", brokerName); ActiveMQSslConnectionFactory activeMQSslConnectionFactory = new ActiveMQSslConnectionFactory(brokerConfig.getUrl()); activeMQSslConnectionFactory.setKeyStore(tls.getKeyStoreFilePath()); activeMQSslConnectionFactory.setKeyStorePassword(String.valueOf(tls.getKeyStorePassword())); activeMQSslConnectionFactory.setTrustStore(tls.getTrustStoreFilePath()); activeMQSslConnectionFactory.setTrustStorePassword(String.valueOf(tls.getTrustStorePassword())); return (ConnectionFactory) activeMQSslConnectionFactory; } catch (Exception e) { throw new RuntimeException(e); } }).orElseGet(() -> { LOGGER.info("Creating standard connection factory for broker with name: {}", brokerName); return new ActiveMQConnectionFactory(brokerConfig.getUrl()); }); } ActiveMQConnectionFactoryFactory(String brokerName, JmsListenerProperties jmsListenerProperties); ConnectionFactory create(); }
|
@Test public void ifTlsOptionsAreDefinedInConfigThenSslConnectionFactoryShouldBeCreated() throws Exception { JmsListenerProperties.BrokerProperties.TlsProperties tlsProperties = new JmsListenerProperties.BrokerProperties.TlsProperties(); String expectedKeystoreFilePath = "keystoreFilePath"; String expectedKeyStorePassword = "keystore-password"; String expectedTrustStoreFilePath = "trustStoreFilePath"; String expectedTrustStorePassword = "trustStorePassword"; tlsProperties.setKeyStoreFilePath(expectedKeystoreFilePath); tlsProperties.setKeyStorePassword(expectedKeyStorePassword.toCharArray()); tlsProperties.setTrustStoreFilePath(expectedTrustStoreFilePath); tlsProperties.setTrustStorePassword(expectedTrustStorePassword.toCharArray()); JmsListenerProperties.BrokerProperties brokerConfig = new JmsListenerProperties.BrokerProperties(); brokerConfig.setName(BROKER_NAME); brokerConfig.setUrl("tcp: brokerConfig.setTls(tlsProperties); JmsListenerProperties testConfig = new JmsListenerProperties(); testConfig.setBrokers(Collections.singletonList(brokerConfig)); ActiveMQConnectionFactoryFactory underTest = new ActiveMQConnectionFactoryFactory(BROKER_NAME, testConfig); ConnectionFactory connectionFactory = underTest.create(); assertThat(connectionFactory, instanceOf(ActiveMQSslConnectionFactory.class)); ActiveMQSslConnectionFactory sslConnectionFactory = (ActiveMQSslConnectionFactory) connectionFactory; assertThat(sslConnectionFactory.getKeyStore(), is(expectedKeystoreFilePath)); assertThat(sslConnectionFactory.getKeyStorePassword(), is(expectedKeyStorePassword)); assertThat(sslConnectionFactory.getTrustStore(), is(expectedTrustStoreFilePath)); assertThat(sslConnectionFactory.getTrustStorePassword(), is(expectedTrustStorePassword)); }
|
public ConnectionFactory create() { JmsListenerProperties.BrokerProperties brokerConfig = jmsListenerProperties.getBrokerConfigFor(brokerName) .orElseThrow(() -> new RuntimeException("Could not find broker config for broker with name: " + brokerName)); Optional<JmsListenerProperties.BrokerProperties.TlsProperties> tlsConfig = Optional.ofNullable(brokerConfig.getTls()); return tlsConfig.map(tls -> { try { LOGGER.info("Found TLS configuration for broker with name: {}. Creating appropriate ssl connection factory.", brokerName); ActiveMQSslConnectionFactory activeMQSslConnectionFactory = new ActiveMQSslConnectionFactory(brokerConfig.getUrl()); activeMQSslConnectionFactory.setKeyStore(tls.getKeyStoreFilePath()); activeMQSslConnectionFactory.setKeyStorePassword(String.valueOf(tls.getKeyStorePassword())); activeMQSslConnectionFactory.setTrustStore(tls.getTrustStoreFilePath()); activeMQSslConnectionFactory.setTrustStorePassword(String.valueOf(tls.getTrustStorePassword())); return (ConnectionFactory) activeMQSslConnectionFactory; } catch (Exception e) { throw new RuntimeException(e); } }).orElseGet(() -> { LOGGER.info("Creating standard connection factory for broker with name: {}", brokerName); return new ActiveMQConnectionFactory(brokerConfig.getUrl()); }); }
|
ActiveMQConnectionFactoryFactory { public ConnectionFactory create() { JmsListenerProperties.BrokerProperties brokerConfig = jmsListenerProperties.getBrokerConfigFor(brokerName) .orElseThrow(() -> new RuntimeException("Could not find broker config for broker with name: " + brokerName)); Optional<JmsListenerProperties.BrokerProperties.TlsProperties> tlsConfig = Optional.ofNullable(brokerConfig.getTls()); return tlsConfig.map(tls -> { try { LOGGER.info("Found TLS configuration for broker with name: {}. Creating appropriate ssl connection factory.", brokerName); ActiveMQSslConnectionFactory activeMQSslConnectionFactory = new ActiveMQSslConnectionFactory(brokerConfig.getUrl()); activeMQSslConnectionFactory.setKeyStore(tls.getKeyStoreFilePath()); activeMQSslConnectionFactory.setKeyStorePassword(String.valueOf(tls.getKeyStorePassword())); activeMQSslConnectionFactory.setTrustStore(tls.getTrustStoreFilePath()); activeMQSslConnectionFactory.setTrustStorePassword(String.valueOf(tls.getTrustStorePassword())); return (ConnectionFactory) activeMQSslConnectionFactory; } catch (Exception e) { throw new RuntimeException(e); } }).orElseGet(() -> { LOGGER.info("Creating standard connection factory for broker with name: {}", brokerName); return new ActiveMQConnectionFactory(brokerConfig.getUrl()); }); } }
|
ActiveMQConnectionFactoryFactory { public ConnectionFactory create() { JmsListenerProperties.BrokerProperties brokerConfig = jmsListenerProperties.getBrokerConfigFor(brokerName) .orElseThrow(() -> new RuntimeException("Could not find broker config for broker with name: " + brokerName)); Optional<JmsListenerProperties.BrokerProperties.TlsProperties> tlsConfig = Optional.ofNullable(brokerConfig.getTls()); return tlsConfig.map(tls -> { try { LOGGER.info("Found TLS configuration for broker with name: {}. Creating appropriate ssl connection factory.", brokerName); ActiveMQSslConnectionFactory activeMQSslConnectionFactory = new ActiveMQSslConnectionFactory(brokerConfig.getUrl()); activeMQSslConnectionFactory.setKeyStore(tls.getKeyStoreFilePath()); activeMQSslConnectionFactory.setKeyStorePassword(String.valueOf(tls.getKeyStorePassword())); activeMQSslConnectionFactory.setTrustStore(tls.getTrustStoreFilePath()); activeMQSslConnectionFactory.setTrustStorePassword(String.valueOf(tls.getTrustStorePassword())); return (ConnectionFactory) activeMQSslConnectionFactory; } catch (Exception e) { throw new RuntimeException(e); } }).orElseGet(() -> { LOGGER.info("Creating standard connection factory for broker with name: {}", brokerName); return new ActiveMQConnectionFactory(brokerConfig.getUrl()); }); } ActiveMQConnectionFactoryFactory(String brokerName, JmsListenerProperties jmsListenerProperties); }
|
ActiveMQConnectionFactoryFactory { public ConnectionFactory create() { JmsListenerProperties.BrokerProperties brokerConfig = jmsListenerProperties.getBrokerConfigFor(brokerName) .orElseThrow(() -> new RuntimeException("Could not find broker config for broker with name: " + brokerName)); Optional<JmsListenerProperties.BrokerProperties.TlsProperties> tlsConfig = Optional.ofNullable(brokerConfig.getTls()); return tlsConfig.map(tls -> { try { LOGGER.info("Found TLS configuration for broker with name: {}. Creating appropriate ssl connection factory.", brokerName); ActiveMQSslConnectionFactory activeMQSslConnectionFactory = new ActiveMQSslConnectionFactory(brokerConfig.getUrl()); activeMQSslConnectionFactory.setKeyStore(tls.getKeyStoreFilePath()); activeMQSslConnectionFactory.setKeyStorePassword(String.valueOf(tls.getKeyStorePassword())); activeMQSslConnectionFactory.setTrustStore(tls.getTrustStoreFilePath()); activeMQSslConnectionFactory.setTrustStorePassword(String.valueOf(tls.getTrustStorePassword())); return (ConnectionFactory) activeMQSslConnectionFactory; } catch (Exception e) { throw new RuntimeException(e); } }).orElseGet(() -> { LOGGER.info("Creating standard connection factory for broker with name: {}", brokerName); return new ActiveMQConnectionFactory(brokerConfig.getUrl()); }); } ActiveMQConnectionFactoryFactory(String brokerName, JmsListenerProperties jmsListenerProperties); ConnectionFactory create(); }
|
ActiveMQConnectionFactoryFactory { public ConnectionFactory create() { JmsListenerProperties.BrokerProperties brokerConfig = jmsListenerProperties.getBrokerConfigFor(brokerName) .orElseThrow(() -> new RuntimeException("Could not find broker config for broker with name: " + brokerName)); Optional<JmsListenerProperties.BrokerProperties.TlsProperties> tlsConfig = Optional.ofNullable(brokerConfig.getTls()); return tlsConfig.map(tls -> { try { LOGGER.info("Found TLS configuration for broker with name: {}. Creating appropriate ssl connection factory.", brokerName); ActiveMQSslConnectionFactory activeMQSslConnectionFactory = new ActiveMQSslConnectionFactory(brokerConfig.getUrl()); activeMQSslConnectionFactory.setKeyStore(tls.getKeyStoreFilePath()); activeMQSslConnectionFactory.setKeyStorePassword(String.valueOf(tls.getKeyStorePassword())); activeMQSslConnectionFactory.setTrustStore(tls.getTrustStoreFilePath()); activeMQSslConnectionFactory.setTrustStorePassword(String.valueOf(tls.getTrustStorePassword())); return (ConnectionFactory) activeMQSslConnectionFactory; } catch (Exception e) { throw new RuntimeException(e); } }).orElseGet(() -> { LOGGER.info("Creating standard connection factory for broker with name: {}", brokerName); return new ActiveMQConnectionFactory(brokerConfig.getUrl()); }); } ActiveMQConnectionFactoryFactory(String brokerName, JmsListenerProperties jmsListenerProperties); ConnectionFactory create(); }
|
@Test public void createABeanDefinitionForActiveMqConnectionFactory() throws Exception { AbstractBeanDefinition abstractBeanDefinition = underTest.create(NAME_OF_FACTORY_BEAN); assertThat(abstractBeanDefinition.getBeanClass(), typeCompatibleWith(ActiveMQConnectionFactory.class)); assertThat(abstractBeanDefinition.getFactoryMethodName(), is("create")); assertThat(abstractBeanDefinition.getFactoryBeanName(), is(NAME_OF_FACTORY_BEAN)); }
|
public AbstractBeanDefinition create(String nameOfFactoryBean) { return genericBeanDefinition(ActiveMQConnectionFactory.class) .setFactoryMethodOnBean("create", nameOfFactoryBean) .getBeanDefinition(); }
|
ActiveMQConnectionFactoryBeanDefinitionFactory { public AbstractBeanDefinition create(String nameOfFactoryBean) { return genericBeanDefinition(ActiveMQConnectionFactory.class) .setFactoryMethodOnBean("create", nameOfFactoryBean) .getBeanDefinition(); } }
|
ActiveMQConnectionFactoryBeanDefinitionFactory { public AbstractBeanDefinition create(String nameOfFactoryBean) { return genericBeanDefinition(ActiveMQConnectionFactory.class) .setFactoryMethodOnBean("create", nameOfFactoryBean) .getBeanDefinition(); } }
|
ActiveMQConnectionFactoryBeanDefinitionFactory { public AbstractBeanDefinition create(String nameOfFactoryBean) { return genericBeanDefinition(ActiveMQConnectionFactory.class) .setFactoryMethodOnBean("create", nameOfFactoryBean) .getBeanDefinition(); } AbstractBeanDefinition create(String nameOfFactoryBean); String createBeanName(String brokerName); }
|
ActiveMQConnectionFactoryBeanDefinitionFactory { public AbstractBeanDefinition create(String nameOfFactoryBean) { return genericBeanDefinition(ActiveMQConnectionFactory.class) .setFactoryMethodOnBean("create", nameOfFactoryBean) .getBeanDefinition(); } AbstractBeanDefinition create(String nameOfFactoryBean); String createBeanName(String brokerName); static final String ACTIVE_MQ_CONNECTION_FACTORY_BEAN_NAME_PREFIX; }
|
@Test public void createBeanName() throws Exception { assertThat(underTest.createBeanName("foo"), is(equalTo(ACTIVE_MQ_CONNECTION_FACTORY_BEAN_NAME_PREFIX + "foo"))); }
|
public String createBeanName(String brokerName) { return ACTIVE_MQ_CONNECTION_FACTORY_BEAN_NAME_PREFIX + brokerName; }
|
ActiveMQConnectionFactoryBeanDefinitionFactory { public String createBeanName(String brokerName) { return ACTIVE_MQ_CONNECTION_FACTORY_BEAN_NAME_PREFIX + brokerName; } }
|
ActiveMQConnectionFactoryBeanDefinitionFactory { public String createBeanName(String brokerName) { return ACTIVE_MQ_CONNECTION_FACTORY_BEAN_NAME_PREFIX + brokerName; } }
|
ActiveMQConnectionFactoryBeanDefinitionFactory { public String createBeanName(String brokerName) { return ACTIVE_MQ_CONNECTION_FACTORY_BEAN_NAME_PREFIX + brokerName; } AbstractBeanDefinition create(String nameOfFactoryBean); String createBeanName(String brokerName); }
|
ActiveMQConnectionFactoryBeanDefinitionFactory { public String createBeanName(String brokerName) { return ACTIVE_MQ_CONNECTION_FACTORY_BEAN_NAME_PREFIX + brokerName; } AbstractBeanDefinition create(String nameOfFactoryBean); String createBeanName(String brokerName); static final String ACTIVE_MQ_CONNECTION_FACTORY_BEAN_NAME_PREFIX; }
|
@Test public void testRenderPage() throws Exception { try (ByteArrayOutputStream output = new ByteArrayOutputStream()) { underTest.render(new TestPage(), output); assertThat(output.toString(), containsString("<p>some content</p>")); } }
|
public void render(Page page, OutputStream output) throws IOException { try { final Mustache template = mustacheFactory.compile(page.getTemplate()); try (OutputStreamWriter writer = new OutputStreamWriter(output, UTF_8)) { template.execute(writer, Arrays.asList( page )); } } catch (Throwable e) { throw new RuntimeException("Mustache template error: " + page.getTemplate(), e); } }
|
MustachePageRenderer { public void render(Page page, OutputStream output) throws IOException { try { final Mustache template = mustacheFactory.compile(page.getTemplate()); try (OutputStreamWriter writer = new OutputStreamWriter(output, UTF_8)) { template.execute(writer, Arrays.asList( page )); } } catch (Throwable e) { throw new RuntimeException("Mustache template error: " + page.getTemplate(), e); } } }
|
MustachePageRenderer { public void render(Page page, OutputStream output) throws IOException { try { final Mustache template = mustacheFactory.compile(page.getTemplate()); try (OutputStreamWriter writer = new OutputStreamWriter(output, UTF_8)) { template.execute(writer, Arrays.asList( page )); } } catch (Throwable e) { throw new RuntimeException("Mustache template error: " + page.getTemplate(), e); } } MustachePageRenderer(MustacheFactory mustacheFactory); }
|
MustachePageRenderer { public void render(Page page, OutputStream output) throws IOException { try { final Mustache template = mustacheFactory.compile(page.getTemplate()); try (OutputStreamWriter writer = new OutputStreamWriter(output, UTF_8)) { template.execute(writer, Arrays.asList( page )); } } catch (Throwable e) { throw new RuntimeException("Mustache template error: " + page.getTemplate(), e); } } MustachePageRenderer(MustacheFactory mustacheFactory); void render(Page page, OutputStream output); }
|
MustachePageRenderer { public void render(Page page, OutputStream output) throws IOException { try { final Mustache template = mustacheFactory.compile(page.getTemplate()); try (OutputStreamWriter writer = new OutputStreamWriter(output, UTF_8)) { template.execute(writer, Arrays.asList( page )); } } catch (Throwable e) { throw new RuntimeException("Mustache template error: " + page.getTemplate(), e); } } MustachePageRenderer(MustacheFactory mustacheFactory); void render(Page page, OutputStream output); }
|
@Test public void startResendScheduledExecutorService() { underTest.start("internal-broker"); verify(resendScheduledExecutorService).start(); }
|
@ApiOperation("Start the resend executor for the given broker") @POST @Path("/start") public void start( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).start(); }
|
ResendScheduledExecutorsResource { @ApiOperation("Start the resend executor for the given broker") @POST @Path("/start") public void start( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).start(); } }
|
ResendScheduledExecutorsResource { @ApiOperation("Start the resend executor for the given broker") @POST @Path("/start") public void start( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).start(); } ResendScheduledExecutorsResource(Map<String, ResendScheduledExecutorService> resendScheduledExecutors); }
|
ResendScheduledExecutorsResource { @ApiOperation("Start the resend executor for the given broker") @POST @Path("/start") public void start( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).start(); } ResendScheduledExecutorsResource(Map<String, ResendScheduledExecutorService> resendScheduledExecutors); @ApiOperation("Start the resend executor for the given broker") @POST @Path("/start") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") void execute(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") void pause(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
ResendScheduledExecutorsResource { @ApiOperation("Start the resend executor for the given broker") @POST @Path("/start") public void start( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).start(); } ResendScheduledExecutorsResource(Map<String, ResendScheduledExecutorService> resendScheduledExecutors); @ApiOperation("Start the resend executor for the given broker") @POST @Path("/start") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") void execute(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") void pause(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
@Test public void createFailedMessageListPage() { FailedMessageListPage underTest = new FailedMessageListPage(true); assertTrue(underTest.isPopupRendered()); assertEquals("list.mustache", underTest.getTemplate()); }
|
public boolean isPopupRendered() { return popupRendered; }
|
FailedMessageListPage extends Page { public boolean isPopupRendered() { return popupRendered; } }
|
FailedMessageListPage extends Page { public boolean isPopupRendered() { return popupRendered; } FailedMessageListPage(boolean popupRendered); }
|
FailedMessageListPage extends Page { public boolean isPopupRendered() { return popupRendered; } FailedMessageListPage(boolean popupRendered); boolean isPopupRendered(); }
|
FailedMessageListPage extends Page { public boolean isPopupRendered() { return popupRendered; } FailedMessageListPage(boolean popupRendered); boolean isPopupRendered(); }
|
@Test public void getFailedMessageListPage() { final FailedMessageListPage failedMessages = underTest.getFailedMessages(); assertThat(failedMessages.getTemplate(), is(equalTo("list.mustache"))); assertThat(failedMessages.isPopupRendered(), is(true)); }
|
@GET @Consumes(APPLICATION_JSON) @Produces(TEXT_HTML) public FailedMessageListPage getFailedMessages() { return new FailedMessageListPage(popupRendered); }
|
FailedMessageListController { @GET @Consumes(APPLICATION_JSON) @Produces(TEXT_HTML) public FailedMessageListPage getFailedMessages() { return new FailedMessageListPage(popupRendered); } }
|
FailedMessageListController { @GET @Consumes(APPLICATION_JSON) @Produces(TEXT_HTML) public FailedMessageListPage getFailedMessages() { return new FailedMessageListPage(popupRendered); } FailedMessageListController(boolean popupRendered); }
|
FailedMessageListController { @GET @Consumes(APPLICATION_JSON) @Produces(TEXT_HTML) public FailedMessageListPage getFailedMessages() { return new FailedMessageListPage(popupRendered); } FailedMessageListController(boolean popupRendered); @GET @Consumes(APPLICATION_JSON) @Produces(TEXT_HTML) FailedMessageListPage getFailedMessages(); }
|
FailedMessageListController { @GET @Consumes(APPLICATION_JSON) @Produces(TEXT_HTML) public FailedMessageListPage getFailedMessages() { return new FailedMessageListPage(popupRendered); } FailedMessageListController(boolean popupRendered); @GET @Consumes(APPLICATION_JSON) @Produces(TEXT_HTML) FailedMessageListPage getFailedMessages(); }
|
@Test public void emptyStingReturnsEmptySet() throws Exception { assertThat(underTest.extractLabels(""), is(emptyIterable())); }
|
public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); }
|
LabelExtractor { public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); } }
|
LabelExtractor { public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); } }
|
LabelExtractor { public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); } Set<String> extractLabels(String labels); }
|
LabelExtractor { public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); } Set<String> extractLabels(String labels); }
|
@Test public void stringContainingWhitespaceReturnsEmptySet() throws Exception { assertThat(underTest.extractLabels(" \t"), is(emptyIterable())); }
|
public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); }
|
LabelExtractor { public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); } }
|
LabelExtractor { public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); } }
|
LabelExtractor { public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); } Set<String> extractLabels(String labels); }
|
LabelExtractor { public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); } Set<String> extractLabels(String labels); }
|
@Test public void stringContainingOnlyCommasWhitespaceReturnsEmptySet() throws Exception { assertThat(underTest.extractLabels(" ,,\t,"), is(emptyIterable())); }
|
public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); }
|
LabelExtractor { public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); } }
|
LabelExtractor { public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); } }
|
LabelExtractor { public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); } Set<String> extractLabels(String labels); }
|
LabelExtractor { public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); } Set<String> extractLabels(String labels); }
|
@Test public void leadingAndTrailingWhitespaceIsRemovedFromLabels() { assertThat(underTest.extractLabels(" foo , bar\t"), containsInAnyOrder("foo", "bar")); }
|
public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); }
|
LabelExtractor { public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); } }
|
LabelExtractor { public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); } }
|
LabelExtractor { public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); } Set<String> extractLabels(String labels); }
|
LabelExtractor { public Set<String> extractLabels(String labels) { return Stream.of(split(labels, ",")) .map(String::trim) .filter(label -> !label.isEmpty()) .collect(toSet()); } Set<String> extractLabels(String labels); }
|
@Test public void updateLabels() throws Exception { when(labelExtractor.extractLabels("foo, bar")).thenReturn(labels1); when(labelExtractor.extractLabels("black, white")).thenReturn(labels2); String result = underTest.updateLabelsOnFailedMessages( newLabelRequest() .withChange(newChange().withRecid(FAILED_MESSAGE_1_ID).withLabels("foo, bar")) .withChange(newChange().withRecid(FAILED_MESSAGE_2_ID).withLabels("black, white")) .build() ); assertThat(result, is(equalTo("{ 'status': 'success' }"))); verify(labelFailedMessageClient).setLabels(FAILED_MESSAGE_1_ID, labels1); verify(labelFailedMessageClient).setLabels(FAILED_MESSAGE_2_ID, labels2); }
|
@POST @Path("/labels") public String updateLabelsOnFailedMessages(LabelRequest request) { LOGGER.info("Updating the labels on {} failedMessages", request.getChanges().size()); request.getChanges() .forEach(change -> { LOGGER.info("Setting labels on FailedMessage: {} to '{}'", change.getRecid(), change.getLabels()); labelFailedMessageClient.setLabels( fromString(change.getRecid()), labelExtractor.extractLabels(change.getLabels()) ); }); return "{ 'status': 'success' }"; }
|
FailedMessageChangeResource { @POST @Path("/labels") public String updateLabelsOnFailedMessages(LabelRequest request) { LOGGER.info("Updating the labels on {} failedMessages", request.getChanges().size()); request.getChanges() .forEach(change -> { LOGGER.info("Setting labels on FailedMessage: {} to '{}'", change.getRecid(), change.getLabels()); labelFailedMessageClient.setLabels( fromString(change.getRecid()), labelExtractor.extractLabels(change.getLabels()) ); }); return "{ 'status': 'success' }"; } }
|
FailedMessageChangeResource { @POST @Path("/labels") public String updateLabelsOnFailedMessages(LabelRequest request) { LOGGER.info("Updating the labels on {} failedMessages", request.getChanges().size()); request.getChanges() .forEach(change -> { LOGGER.info("Setting labels on FailedMessage: {} to '{}'", change.getRecid(), change.getLabels()); labelFailedMessageClient.setLabels( fromString(change.getRecid()), labelExtractor.extractLabels(change.getLabels()) ); }); return "{ 'status': 'success' }"; } FailedMessageChangeResource(LabelFailedMessageClient labelFailedMessageClient,
LabelExtractor labelExtractor,
DeleteFailedMessageClient deleteFailedMessageClient); }
|
FailedMessageChangeResource { @POST @Path("/labels") public String updateLabelsOnFailedMessages(LabelRequest request) { LOGGER.info("Updating the labels on {} failedMessages", request.getChanges().size()); request.getChanges() .forEach(change -> { LOGGER.info("Setting labels on FailedMessage: {} to '{}'", change.getRecid(), change.getLabels()); labelFailedMessageClient.setLabels( fromString(change.getRecid()), labelExtractor.extractLabels(change.getLabels()) ); }); return "{ 'status': 'success' }"; } FailedMessageChangeResource(LabelFailedMessageClient labelFailedMessageClient,
LabelExtractor labelExtractor,
DeleteFailedMessageClient deleteFailedMessageClient); @POST @Path("/labels") String updateLabelsOnFailedMessages(LabelRequest request); @POST @Path("/delete") String deleteFailedMessages(DeleteRequest request); }
|
FailedMessageChangeResource { @POST @Path("/labels") public String updateLabelsOnFailedMessages(LabelRequest request) { LOGGER.info("Updating the labels on {} failedMessages", request.getChanges().size()); request.getChanges() .forEach(change -> { LOGGER.info("Setting labels on FailedMessage: {} to '{}'", change.getRecid(), change.getLabels()); labelFailedMessageClient.setLabels( fromString(change.getRecid()), labelExtractor.extractLabels(change.getLabels()) ); }); return "{ 'status': 'success' }"; } FailedMessageChangeResource(LabelFailedMessageClient labelFailedMessageClient,
LabelExtractor labelExtractor,
DeleteFailedMessageClient deleteFailedMessageClient); @POST @Path("/labels") String updateLabelsOnFailedMessages(LabelRequest request); @POST @Path("/delete") String deleteFailedMessages(DeleteRequest request); }
|
@Test public void deleteFailedMessages() { String result = underTest.deleteFailedMessages( newDeleteRequest().withSelectedRecords(FAILED_MESSAGE_1_ID, FAILED_MESSAGE_2_ID).build() ); assertThat(result, is(equalTo("{ 'status': 'success' }"))); verify(deleteFailedMessageClient).deleteFailedMessage(FAILED_MESSAGE_1_ID); verify(deleteFailedMessageClient).deleteFailedMessage(FAILED_MESSAGE_2_ID); }
|
@POST @Path("/delete") public String deleteFailedMessages(DeleteRequest request) { request.getSelected() .forEach(recid -> deleteFailedMessageClient.deleteFailedMessage(fromString(recid))); return "{ 'status': 'success' }"; }
|
FailedMessageChangeResource { @POST @Path("/delete") public String deleteFailedMessages(DeleteRequest request) { request.getSelected() .forEach(recid -> deleteFailedMessageClient.deleteFailedMessage(fromString(recid))); return "{ 'status': 'success' }"; } }
|
FailedMessageChangeResource { @POST @Path("/delete") public String deleteFailedMessages(DeleteRequest request) { request.getSelected() .forEach(recid -> deleteFailedMessageClient.deleteFailedMessage(fromString(recid))); return "{ 'status': 'success' }"; } FailedMessageChangeResource(LabelFailedMessageClient labelFailedMessageClient,
LabelExtractor labelExtractor,
DeleteFailedMessageClient deleteFailedMessageClient); }
|
FailedMessageChangeResource { @POST @Path("/delete") public String deleteFailedMessages(DeleteRequest request) { request.getSelected() .forEach(recid -> deleteFailedMessageClient.deleteFailedMessage(fromString(recid))); return "{ 'status': 'success' }"; } FailedMessageChangeResource(LabelFailedMessageClient labelFailedMessageClient,
LabelExtractor labelExtractor,
DeleteFailedMessageClient deleteFailedMessageClient); @POST @Path("/labels") String updateLabelsOnFailedMessages(LabelRequest request); @POST @Path("/delete") String deleteFailedMessages(DeleteRequest request); }
|
FailedMessageChangeResource { @POST @Path("/delete") public String deleteFailedMessages(DeleteRequest request) { request.getSelected() .forEach(recid -> deleteFailedMessageClient.deleteFailedMessage(fromString(recid))); return "{ 'status': 'success' }"; } FailedMessageChangeResource(LabelFailedMessageClient labelFailedMessageClient,
LabelExtractor labelExtractor,
DeleteFailedMessageClient deleteFailedMessageClient); @POST @Path("/labels") String updateLabelsOnFailedMessages(LabelRequest request); @POST @Path("/delete") String deleteFailedMessages(DeleteRequest request); }
|
@Test public void formatNullInstant() { assertEquals(Optional.empty(), Constants.toIsoDateTimeWithMs(null)); }
|
public static Optional<String> toIsoDateTimeWithMs(Instant instant) { return Optional.ofNullable(instant).map(ISO_DATE_TIME_WITH_MS::format); }
|
Constants { public static Optional<String> toIsoDateTimeWithMs(Instant instant) { return Optional.ofNullable(instant).map(ISO_DATE_TIME_WITH_MS::format); } }
|
Constants { public static Optional<String> toIsoDateTimeWithMs(Instant instant) { return Optional.ofNullable(instant).map(ISO_DATE_TIME_WITH_MS::format); } private Constants(); }
|
Constants { public static Optional<String> toIsoDateTimeWithMs(Instant instant) { return Optional.ofNullable(instant).map(ISO_DATE_TIME_WITH_MS::format); } private Constants(); static Optional<String> toIsoDateTimeWithMs(Instant instant); static Optional<Instant> toInstantFromIsoDateTime(String instantAsString); }
|
Constants { public static Optional<String> toIsoDateTimeWithMs(Instant instant) { return Optional.ofNullable(instant).map(ISO_DATE_TIME_WITH_MS::format); } private Constants(); static Optional<String> toIsoDateTimeWithMs(Instant instant); static Optional<Instant> toInstantFromIsoDateTime(String instantAsString); }
|
@Test public void formatGivenInstant() { assertEquals(Optional.of("1970-01-01T00:00:00.000Z"), Constants.toIsoDateTimeWithMs(Instant.ofEpochMilli(0))); }
|
public static Optional<String> toIsoDateTimeWithMs(Instant instant) { return Optional.ofNullable(instant).map(ISO_DATE_TIME_WITH_MS::format); }
|
Constants { public static Optional<String> toIsoDateTimeWithMs(Instant instant) { return Optional.ofNullable(instant).map(ISO_DATE_TIME_WITH_MS::format); } }
|
Constants { public static Optional<String> toIsoDateTimeWithMs(Instant instant) { return Optional.ofNullable(instant).map(ISO_DATE_TIME_WITH_MS::format); } private Constants(); }
|
Constants { public static Optional<String> toIsoDateTimeWithMs(Instant instant) { return Optional.ofNullable(instant).map(ISO_DATE_TIME_WITH_MS::format); } private Constants(); static Optional<String> toIsoDateTimeWithMs(Instant instant); static Optional<Instant> toInstantFromIsoDateTime(String instantAsString); }
|
Constants { public static Optional<String> toIsoDateTimeWithMs(Instant instant) { return Optional.ofNullable(instant).map(ISO_DATE_TIME_WITH_MS::format); } private Constants(); static Optional<String> toIsoDateTimeWithMs(Instant instant); static Optional<Instant> toInstantFromIsoDateTime(String instantAsString); }
|
@Test public void executeResendScheduledExecutorService() { underTest.execute("internal-broker"); verify(resendScheduledExecutorService).execute(); }
|
@ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") public void execute( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).execute(); }
|
ResendScheduledExecutorsResource { @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") public void execute( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).execute(); } }
|
ResendScheduledExecutorsResource { @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") public void execute( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).execute(); } ResendScheduledExecutorsResource(Map<String, ResendScheduledExecutorService> resendScheduledExecutors); }
|
ResendScheduledExecutorsResource { @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") public void execute( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).execute(); } ResendScheduledExecutorsResource(Map<String, ResendScheduledExecutorService> resendScheduledExecutors); @ApiOperation("Start the resend executor for the given broker") @POST @Path("/start") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") void execute(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") void pause(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
ResendScheduledExecutorsResource { @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") public void execute( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).execute(); } ResendScheduledExecutorsResource(Map<String, ResendScheduledExecutorService> resendScheduledExecutors); @ApiOperation("Start the resend executor for the given broker") @POST @Path("/start") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") void execute(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") void pause(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
@Test public void loginPageIsCreatedSuccessfully() throws Exception { when(httpServletRequest.getSession()).thenReturn(httpSession); when(httpSession.getAttribute(AUTHENTICATION_EXCEPTION)).thenReturn(authenticationException); when(authenticationExceptionAdapter.toErrorMessage(authenticationException)).thenReturn(Optional.of("Error Message")); assertThat(underTest.getLoginPage(httpServletRequest), hasErrorMessage("Error Message")); }
|
@GET public LoginPage getLoginPage(@Context HttpServletRequest request) { Optional<String> errorMessage = authenticationExceptionAdapter .toErrorMessage((AuthenticationException) request.getSession().getAttribute(AUTHENTICATION_EXCEPTION)); return new LoginPage(errorMessage); }
|
LoginController { @GET public LoginPage getLoginPage(@Context HttpServletRequest request) { Optional<String> errorMessage = authenticationExceptionAdapter .toErrorMessage((AuthenticationException) request.getSession().getAttribute(AUTHENTICATION_EXCEPTION)); return new LoginPage(errorMessage); } }
|
LoginController { @GET public LoginPage getLoginPage(@Context HttpServletRequest request) { Optional<String> errorMessage = authenticationExceptionAdapter .toErrorMessage((AuthenticationException) request.getSession().getAttribute(AUTHENTICATION_EXCEPTION)); return new LoginPage(errorMessage); } LoginController(AuthenticationExceptionAdapter authenticationExceptionAdapter); }
|
LoginController { @GET public LoginPage getLoginPage(@Context HttpServletRequest request) { Optional<String> errorMessage = authenticationExceptionAdapter .toErrorMessage((AuthenticationException) request.getSession().getAttribute(AUTHENTICATION_EXCEPTION)); return new LoginPage(errorMessage); } LoginController(AuthenticationExceptionAdapter authenticationExceptionAdapter); @GET LoginPage getLoginPage(@Context HttpServletRequest request); }
|
LoginController { @GET public LoginPage getLoginPage(@Context HttpServletRequest request) { Optional<String> errorMessage = authenticationExceptionAdapter .toErrorMessage((AuthenticationException) request.getSession().getAttribute(AUTHENTICATION_EXCEPTION)); return new LoginPage(errorMessage); } LoginController(AuthenticationExceptionAdapter authenticationExceptionAdapter); @GET LoginPage getLoginPage(@Context HttpServletRequest request); }
|
@Test public void nullExceptionReturnsEmptyString() throws Exception { assertThat(underTest.toErrorMessage(null), is(Optional.empty())); }
|
public Optional<String> toErrorMessage(AuthenticationException authenticationException) { return Optional.ofNullable(authenticationException) .map(exception -> { String message = exception.getMessage(); LOGGER.debug("Translating error message: {}", message); return "Incorrect username/password"; }); }
|
AuthenticationExceptionAdapter { public Optional<String> toErrorMessage(AuthenticationException authenticationException) { return Optional.ofNullable(authenticationException) .map(exception -> { String message = exception.getMessage(); LOGGER.debug("Translating error message: {}", message); return "Incorrect username/password"; }); } }
|
AuthenticationExceptionAdapter { public Optional<String> toErrorMessage(AuthenticationException authenticationException) { return Optional.ofNullable(authenticationException) .map(exception -> { String message = exception.getMessage(); LOGGER.debug("Translating error message: {}", message); return "Incorrect username/password"; }); } }
|
AuthenticationExceptionAdapter { public Optional<String> toErrorMessage(AuthenticationException authenticationException) { return Optional.ofNullable(authenticationException) .map(exception -> { String message = exception.getMessage(); LOGGER.debug("Translating error message: {}", message); return "Incorrect username/password"; }); } Optional<String> toErrorMessage(AuthenticationException authenticationException); }
|
AuthenticationExceptionAdapter { public Optional<String> toErrorMessage(AuthenticationException authenticationException) { return Optional.ofNullable(authenticationException) .map(exception -> { String message = exception.getMessage(); LOGGER.debug("Translating error message: {}", message); return "Incorrect username/password"; }); } Optional<String> toErrorMessage(AuthenticationException authenticationException); }
|
@Test public void anyAuthenticationExceptionReturns() { assertThat(underTest.toErrorMessage(mock(AuthenticationException.class)), is(Optional.of("Incorrect username/password"))); }
|
public Optional<String> toErrorMessage(AuthenticationException authenticationException) { return Optional.ofNullable(authenticationException) .map(exception -> { String message = exception.getMessage(); LOGGER.debug("Translating error message: {}", message); return "Incorrect username/password"; }); }
|
AuthenticationExceptionAdapter { public Optional<String> toErrorMessage(AuthenticationException authenticationException) { return Optional.ofNullable(authenticationException) .map(exception -> { String message = exception.getMessage(); LOGGER.debug("Translating error message: {}", message); return "Incorrect username/password"; }); } }
|
AuthenticationExceptionAdapter { public Optional<String> toErrorMessage(AuthenticationException authenticationException) { return Optional.ofNullable(authenticationException) .map(exception -> { String message = exception.getMessage(); LOGGER.debug("Translating error message: {}", message); return "Incorrect username/password"; }); } }
|
AuthenticationExceptionAdapter { public Optional<String> toErrorMessage(AuthenticationException authenticationException) { return Optional.ofNullable(authenticationException) .map(exception -> { String message = exception.getMessage(); LOGGER.debug("Translating error message: {}", message); return "Incorrect username/password"; }); } Optional<String> toErrorMessage(AuthenticationException authenticationException); }
|
AuthenticationExceptionAdapter { public Optional<String> toErrorMessage(AuthenticationException authenticationException) { return Optional.ofNullable(authenticationException) .map(exception -> { String message = exception.getMessage(); LOGGER.debug("Translating error message: {}", message); return "Incorrect username/password"; }); } Optional<String> toErrorMessage(AuthenticationException authenticationException); }
|
@Test public void searchWithMultipleCriteria() throws Exception { when(searchW2UIRequest.getSearchCriteria()).thenReturn(Arrays.asList( new Criteria(Criteria.Field.BROKER, Criteria.Operator.BEGINS, "Lorem"), new Criteria(Criteria.Field.CONTENT, Criteria.Operator.ENDS, "Ipsum"), new Criteria(Criteria.Field.DESTINATION, Criteria.Operator.CONTAINS, "Dolor") )); SearchFailedMessageRequest request = underTest.adapt(searchW2UIRequest); assertThat(request, aSearchRequestMatchingAnyCriteria() .withBroker("Lorem") .withContent("Ipsum") .withDestination("Dolor")); }
|
public SearchFailedMessageRequest adapt(SearchW2UIRequest request) { SearchFailedMessageRequestBuilder searchFailedMessageRequestBuilder = searchMatchingAnyCriteria(); for (Criteria criteria : request.getSearchCriteria()) { criteria.addToSearchRequest(searchFailedMessageRequestBuilder); } return searchFailedMessageRequestBuilder.build(); }
|
SearchFailedMessageRequestAdapter { public SearchFailedMessageRequest adapt(SearchW2UIRequest request) { SearchFailedMessageRequestBuilder searchFailedMessageRequestBuilder = searchMatchingAnyCriteria(); for (Criteria criteria : request.getSearchCriteria()) { criteria.addToSearchRequest(searchFailedMessageRequestBuilder); } return searchFailedMessageRequestBuilder.build(); } }
|
SearchFailedMessageRequestAdapter { public SearchFailedMessageRequest adapt(SearchW2UIRequest request) { SearchFailedMessageRequestBuilder searchFailedMessageRequestBuilder = searchMatchingAnyCriteria(); for (Criteria criteria : request.getSearchCriteria()) { criteria.addToSearchRequest(searchFailedMessageRequestBuilder); } return searchFailedMessageRequestBuilder.build(); } }
|
SearchFailedMessageRequestAdapter { public SearchFailedMessageRequest adapt(SearchW2UIRequest request) { SearchFailedMessageRequestBuilder searchFailedMessageRequestBuilder = searchMatchingAnyCriteria(); for (Criteria criteria : request.getSearchCriteria()) { criteria.addToSearchRequest(searchFailedMessageRequestBuilder); } return searchFailedMessageRequestBuilder.build(); } SearchFailedMessageRequest adapt(SearchW2UIRequest request); }
|
SearchFailedMessageRequestAdapter { public SearchFailedMessageRequest adapt(SearchW2UIRequest request) { SearchFailedMessageRequestBuilder searchFailedMessageRequestBuilder = searchMatchingAnyCriteria(); for (Criteria criteria : request.getSearchCriteria()) { criteria.addToSearchRequest(searchFailedMessageRequestBuilder); } return searchFailedMessageRequestBuilder.build(); } SearchFailedMessageRequest adapt(SearchW2UIRequest request); }
|
@Test public void searchWithNoCriteria() throws Exception { when(searchW2UIRequest.getSearchCriteria()).thenReturn(Collections.emptyList()); SearchFailedMessageRequest request = underTest.adapt(searchW2UIRequest); assertThat(request, aSearchRequestMatchingAnyCriteria() .withBroker(equalTo(Optional.empty())) .withContent(equalTo(Optional.empty())) .withDestination(equalTo(Optional.empty()))); }
|
public SearchFailedMessageRequest adapt(SearchW2UIRequest request) { SearchFailedMessageRequestBuilder searchFailedMessageRequestBuilder = searchMatchingAnyCriteria(); for (Criteria criteria : request.getSearchCriteria()) { criteria.addToSearchRequest(searchFailedMessageRequestBuilder); } return searchFailedMessageRequestBuilder.build(); }
|
SearchFailedMessageRequestAdapter { public SearchFailedMessageRequest adapt(SearchW2UIRequest request) { SearchFailedMessageRequestBuilder searchFailedMessageRequestBuilder = searchMatchingAnyCriteria(); for (Criteria criteria : request.getSearchCriteria()) { criteria.addToSearchRequest(searchFailedMessageRequestBuilder); } return searchFailedMessageRequestBuilder.build(); } }
|
SearchFailedMessageRequestAdapter { public SearchFailedMessageRequest adapt(SearchW2UIRequest request) { SearchFailedMessageRequestBuilder searchFailedMessageRequestBuilder = searchMatchingAnyCriteria(); for (Criteria criteria : request.getSearchCriteria()) { criteria.addToSearchRequest(searchFailedMessageRequestBuilder); } return searchFailedMessageRequestBuilder.build(); } }
|
SearchFailedMessageRequestAdapter { public SearchFailedMessageRequest adapt(SearchW2UIRequest request) { SearchFailedMessageRequestBuilder searchFailedMessageRequestBuilder = searchMatchingAnyCriteria(); for (Criteria criteria : request.getSearchCriteria()) { criteria.addToSearchRequest(searchFailedMessageRequestBuilder); } return searchFailedMessageRequestBuilder.build(); } SearchFailedMessageRequest adapt(SearchW2UIRequest request); }
|
SearchFailedMessageRequestAdapter { public SearchFailedMessageRequest adapt(SearchW2UIRequest request) { SearchFailedMessageRequestBuilder searchFailedMessageRequestBuilder = searchMatchingAnyCriteria(); for (Criteria criteria : request.getSearchCriteria()) { criteria.addToSearchRequest(searchFailedMessageRequestBuilder); } return searchFailedMessageRequestBuilder.build(); } SearchFailedMessageRequest adapt(SearchW2UIRequest request); }
|
@Test public void pauseResendScheduledExecutorService() { underTest.pause("internal-broker"); verify(resendScheduledExecutorService).pause(); }
|
@ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") public void pause( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).pause(); }
|
ResendScheduledExecutorsResource { @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") public void pause( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).pause(); } }
|
ResendScheduledExecutorsResource { @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") public void pause( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).pause(); } ResendScheduledExecutorsResource(Map<String, ResendScheduledExecutorService> resendScheduledExecutors); }
|
ResendScheduledExecutorsResource { @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") public void pause( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).pause(); } ResendScheduledExecutorsResource(Map<String, ResendScheduledExecutorService> resendScheduledExecutors); @ApiOperation("Start the resend executor for the given broker") @POST @Path("/start") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") void execute(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") void pause(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
ResendScheduledExecutorsResource { @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") public void pause( @ApiParam(value = "name of the broker as defined in application.yml", required = true) @PathParam("brokerName") String brokerName) { getExecutor(brokerName).pause(); } ResendScheduledExecutorsResource(Map<String, ResendScheduledExecutorService> resendScheduledExecutors); @ApiOperation("Start the resend executor for the given broker") @POST @Path("/start") void start(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Synchronously execute the resend job for the given broker") @POST @Path("/execute") void execute(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); @ApiOperation("Pause the resend executor for the given broker") @PUT @Path("/pause") void pause(
@ApiParam(value = "name of the broker as defined in application.yml", required = true)
@PathParam("brokerName") String brokerName); }
|
@Test public void effectiveDateTimeInPastReturnsTrue() throws Exception { when(failedMessage.getStatusHistoryEvent()).thenReturn(statusHistoryEvent); when(statusHistoryEvent.getEffectiveDateTime()).thenReturn(Instant.now().minus(1, MILLIS)); assertThat(underTest.test(failedMessage), is(true)); }
|
@Override public boolean test(FailedMessage failedMessage) { return failedMessage.getStatusHistoryEvent().getEffectiveDateTime().isBefore(Instant.now()); }
|
HistoricStatusPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return failedMessage.getStatusHistoryEvent().getEffectiveDateTime().isBefore(Instant.now()); } }
|
HistoricStatusPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return failedMessage.getStatusHistoryEvent().getEffectiveDateTime().isBefore(Instant.now()); } }
|
HistoricStatusPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return failedMessage.getStatusHistoryEvent().getEffectiveDateTime().isBefore(Instant.now()); } @Override boolean test(FailedMessage failedMessage); }
|
HistoricStatusPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return failedMessage.getStatusHistoryEvent().getEffectiveDateTime().isBefore(Instant.now()); } @Override boolean test(FailedMessage failedMessage); }
|
@Test public void effectiveDateTimeInFutureReturnsFalse() throws Exception { when(failedMessage.getStatusHistoryEvent()).thenReturn(statusHistoryEvent); when(statusHistoryEvent.getEffectiveDateTime()).thenReturn(Instant.now().plus(1, SECONDS)); assertThat(underTest.test(failedMessage), is(false)); }
|
@Override public boolean test(FailedMessage failedMessage) { return failedMessage.getStatusHistoryEvent().getEffectiveDateTime().isBefore(Instant.now()); }
|
HistoricStatusPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return failedMessage.getStatusHistoryEvent().getEffectiveDateTime().isBefore(Instant.now()); } }
|
HistoricStatusPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return failedMessage.getStatusHistoryEvent().getEffectiveDateTime().isBefore(Instant.now()); } }
|
HistoricStatusPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return failedMessage.getStatusHistoryEvent().getEffectiveDateTime().isBefore(Instant.now()); } @Override boolean test(FailedMessage failedMessage); }
|
HistoricStatusPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return failedMessage.getStatusHistoryEvent().getEffectiveDateTime().isBefore(Instant.now()); } @Override boolean test(FailedMessage failedMessage); }
|
@Test public void createFailedMessageSenderBeanDefinition() throws Exception { AbstractBeanDefinition abstractBeanDefinition = underTest.create("messageSenderDelegate"); assertThat(abstractBeanDefinition.getBeanClass(), typeCompatibleWith(FailedMessageSender.class)); assertThat(abstractBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().size(), is(2)); assertThat(abstractBeanDefinition.getConstructorArgumentValues().getArgumentValue(0, MessageSender.class).getValue(), is(equalTo(new RuntimeBeanReference("messageSenderDelegate")))); assertThat(abstractBeanDefinition.getConstructorArgumentValues().getArgumentValue(1, FailedMessageService.class).getValue(), is(equalTo(new RuntimeBeanReference("failedMessageService")))); }
|
public AbstractBeanDefinition create(String messageSenderDelegate) { return genericBeanDefinition(FailedMessageSender.class) .addConstructorArgReference(messageSenderDelegate) .addConstructorArgReference("failedMessageService") .addDependsOn("failedMessageDao") .getBeanDefinition(); }
|
FailedMessageSenderBeanDefinitionFactory { public AbstractBeanDefinition create(String messageSenderDelegate) { return genericBeanDefinition(FailedMessageSender.class) .addConstructorArgReference(messageSenderDelegate) .addConstructorArgReference("failedMessageService") .addDependsOn("failedMessageDao") .getBeanDefinition(); } }
|
FailedMessageSenderBeanDefinitionFactory { public AbstractBeanDefinition create(String messageSenderDelegate) { return genericBeanDefinition(FailedMessageSender.class) .addConstructorArgReference(messageSenderDelegate) .addConstructorArgReference("failedMessageService") .addDependsOn("failedMessageDao") .getBeanDefinition(); } }
|
FailedMessageSenderBeanDefinitionFactory { public AbstractBeanDefinition create(String messageSenderDelegate) { return genericBeanDefinition(FailedMessageSender.class) .addConstructorArgReference(messageSenderDelegate) .addConstructorArgReference("failedMessageService") .addDependsOn("failedMessageDao") .getBeanDefinition(); } AbstractBeanDefinition create(String messageSenderDelegate); String createBeanName(String brokerName); }
|
FailedMessageSenderBeanDefinitionFactory { public AbstractBeanDefinition create(String messageSenderDelegate) { return genericBeanDefinition(FailedMessageSender.class) .addConstructorArgReference(messageSenderDelegate) .addConstructorArgReference("failedMessageService") .addDependsOn("failedMessageDao") .getBeanDefinition(); } AbstractBeanDefinition create(String messageSenderDelegate); String createBeanName(String brokerName); }
|
@Test public void unableToWriteAResponse() throws IOException, ServletException { when(httpServletResponse.getWriter()).thenThrow(IOException.class); underTest.doGet(httpServletRequest, httpServletResponse); verify(httpServletResponse).sendError(500, "An error occurred writing the response"); verifyZeroInteractions(responseWriter); verifyZeroInteractions(httpServletRequest); }
|
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) { try { responseWriter.write(resp.getWriter()); } catch (IOException e) { handleError(resp, e); } }
|
PingServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) { try { responseWriter.write(resp.getWriter()); } catch (IOException e) { handleError(resp, e); } } }
|
PingServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) { try { responseWriter.write(resp.getWriter()); } catch (IOException e) { handleError(resp, e); } } PingServlet(PingResponseWriter responseWriter); }
|
PingServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) { try { responseWriter.write(resp.getWriter()); } catch (IOException e) { handleError(resp, e); } } PingServlet(PingResponseWriter responseWriter); }
|
PingServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) { try { responseWriter.write(resp.getWriter()); } catch (IOException e) { handleError(resp, e); } } PingServlet(PingResponseWriter responseWriter); }
|
@Test public void createBeanName() { assertThat(underTest.createBeanName(BROKER_NAME), is(equalTo(FAILED_MESSAGE_SENDER_BEAN_NAME_PREFIX + BROKER_NAME))); }
|
public String createBeanName(String brokerName) { return FAILED_MESSAGE_SENDER_BEAN_NAME_PREFIX + brokerName; }
|
FailedMessageSenderBeanDefinitionFactory { public String createBeanName(String brokerName) { return FAILED_MESSAGE_SENDER_BEAN_NAME_PREFIX + brokerName; } }
|
FailedMessageSenderBeanDefinitionFactory { public String createBeanName(String brokerName) { return FAILED_MESSAGE_SENDER_BEAN_NAME_PREFIX + brokerName; } }
|
FailedMessageSenderBeanDefinitionFactory { public String createBeanName(String brokerName) { return FAILED_MESSAGE_SENDER_BEAN_NAME_PREFIX + brokerName; } AbstractBeanDefinition create(String messageSenderDelegate); String createBeanName(String brokerName); }
|
FailedMessageSenderBeanDefinitionFactory { public String createBeanName(String brokerName) { return FAILED_MESSAGE_SENDER_BEAN_NAME_PREFIX + brokerName; } AbstractBeanDefinition create(String messageSenderDelegate); String createBeanName(String brokerName); }
|
@Test public void createResendScheduledExecutorServiceBeanDefinition() throws Exception { AbstractBeanDefinition abstractBeanDefinition = underTest.create( executorService, "resendFailedMessageService", 0, 10, SECONDS); assertThat(abstractBeanDefinition.getBeanClass(), typeCompatibleWith(ResendScheduledExecutorService.class)); ConstructorArgumentValues constructorArgumentValues = abstractBeanDefinition.getConstructorArgumentValues(); assertThat(constructorArgumentValues.getIndexedArgumentValues().size(), is(5)); assertThat(constructorArgumentValues.getArgumentValue(0, ExecutorService.class).getValue(), is(executorService)); assertThat(constructorArgumentValues.getArgumentValue(1, ResendFailedMessageService.class).getValue(), is(equalTo(new RuntimeBeanReference("resendFailedMessageService")))); assertThat(constructorArgumentValues.getArgumentValue(2, Long.class).getValue(), is(0L)); assertThat(constructorArgumentValues.getArgumentValue(3, Long.class).getValue(), is(10L)); assertThat(constructorArgumentValues.getArgumentValue(4, TimeUnit.class).getValue(), is(SECONDS)); }
|
public AbstractBeanDefinition create(ScheduledExecutorService executorService, String resendFailedMessageServiceBeanName, long initialDelay, long executionFrequency, TimeUnit timeUnit) { return genericBeanDefinition(ResendScheduledExecutorService.class) .addConstructorArgValue(executorService) .addConstructorArgReference(resendFailedMessageServiceBeanName) .addConstructorArgValue(initialDelay) .addConstructorArgValue(executionFrequency) .addConstructorArgValue(timeUnit) .setInitMethodName("start") .setDestroyMethodName("shutdown") .getBeanDefinition(); }
|
ResendScheduledExecutorServiceBeanDefinitionFactory { public AbstractBeanDefinition create(ScheduledExecutorService executorService, String resendFailedMessageServiceBeanName, long initialDelay, long executionFrequency, TimeUnit timeUnit) { return genericBeanDefinition(ResendScheduledExecutorService.class) .addConstructorArgValue(executorService) .addConstructorArgReference(resendFailedMessageServiceBeanName) .addConstructorArgValue(initialDelay) .addConstructorArgValue(executionFrequency) .addConstructorArgValue(timeUnit) .setInitMethodName("start") .setDestroyMethodName("shutdown") .getBeanDefinition(); } }
|
ResendScheduledExecutorServiceBeanDefinitionFactory { public AbstractBeanDefinition create(ScheduledExecutorService executorService, String resendFailedMessageServiceBeanName, long initialDelay, long executionFrequency, TimeUnit timeUnit) { return genericBeanDefinition(ResendScheduledExecutorService.class) .addConstructorArgValue(executorService) .addConstructorArgReference(resendFailedMessageServiceBeanName) .addConstructorArgValue(initialDelay) .addConstructorArgValue(executionFrequency) .addConstructorArgValue(timeUnit) .setInitMethodName("start") .setDestroyMethodName("shutdown") .getBeanDefinition(); } }
|
ResendScheduledExecutorServiceBeanDefinitionFactory { public AbstractBeanDefinition create(ScheduledExecutorService executorService, String resendFailedMessageServiceBeanName, long initialDelay, long executionFrequency, TimeUnit timeUnit) { return genericBeanDefinition(ResendScheduledExecutorService.class) .addConstructorArgValue(executorService) .addConstructorArgReference(resendFailedMessageServiceBeanName) .addConstructorArgValue(initialDelay) .addConstructorArgValue(executionFrequency) .addConstructorArgValue(timeUnit) .setInitMethodName("start") .setDestroyMethodName("shutdown") .getBeanDefinition(); } AbstractBeanDefinition create(ScheduledExecutorService executorService,
String resendFailedMessageServiceBeanName,
long initialDelay,
long executionFrequency,
TimeUnit timeUnit); String createBeanName(String brokerName); }
|
ResendScheduledExecutorServiceBeanDefinitionFactory { public AbstractBeanDefinition create(ScheduledExecutorService executorService, String resendFailedMessageServiceBeanName, long initialDelay, long executionFrequency, TimeUnit timeUnit) { return genericBeanDefinition(ResendScheduledExecutorService.class) .addConstructorArgValue(executorService) .addConstructorArgReference(resendFailedMessageServiceBeanName) .addConstructorArgValue(initialDelay) .addConstructorArgValue(executionFrequency) .addConstructorArgValue(timeUnit) .setInitMethodName("start") .setDestroyMethodName("shutdown") .getBeanDefinition(); } AbstractBeanDefinition create(ScheduledExecutorService executorService,
String resendFailedMessageServiceBeanName,
long initialDelay,
long executionFrequency,
TimeUnit timeUnit); String createBeanName(String brokerName); }
|
@Test public void createBeanName() throws Exception { assertThat(underTest.createBeanName(BROKER_NAME), is(equalTo(RESEND_SCHEDULED_EXECUTOR_SERVICE_BEAN_NAME_PREFIX + BROKER_NAME))); }
|
public String createBeanName(String brokerName) { return RESEND_SCHEDULED_EXECUTOR_SERVICE_BEAN_NAME_PREFIX + brokerName; }
|
ResendScheduledExecutorServiceBeanDefinitionFactory { public String createBeanName(String brokerName) { return RESEND_SCHEDULED_EXECUTOR_SERVICE_BEAN_NAME_PREFIX + brokerName; } }
|
ResendScheduledExecutorServiceBeanDefinitionFactory { public String createBeanName(String brokerName) { return RESEND_SCHEDULED_EXECUTOR_SERVICE_BEAN_NAME_PREFIX + brokerName; } }
|
ResendScheduledExecutorServiceBeanDefinitionFactory { public String createBeanName(String brokerName) { return RESEND_SCHEDULED_EXECUTOR_SERVICE_BEAN_NAME_PREFIX + brokerName; } AbstractBeanDefinition create(ScheduledExecutorService executorService,
String resendFailedMessageServiceBeanName,
long initialDelay,
long executionFrequency,
TimeUnit timeUnit); String createBeanName(String brokerName); }
|
ResendScheduledExecutorServiceBeanDefinitionFactory { public String createBeanName(String brokerName) { return RESEND_SCHEDULED_EXECUTOR_SERVICE_BEAN_NAME_PREFIX + brokerName; } AbstractBeanDefinition create(ScheduledExecutorService executorService,
String resendFailedMessageServiceBeanName,
long initialDelay,
long executionFrequency,
TimeUnit timeUnit); String createBeanName(String brokerName); }
|
@Test public void createResendFailedMessageServiceBeanDefinition() throws Exception { AbstractBeanDefinition abstractBeanDefinition = underTest.create(BROKER_NAME, "messageSender"); assertThat(abstractBeanDefinition.getBeanClass(), typeCompatibleWith(ResendFailedMessageService.class)); assertThat(abstractBeanDefinition.getConstructorArgumentValues().getIndexedArgumentValues().size(), is(4)); assertThat(abstractBeanDefinition.getConstructorArgumentValues().getArgumentValue(0, String.class).getValue(), is(BROKER_NAME)); assertThat(abstractBeanDefinition.getConstructorArgumentValues().getArgumentValue(1, FailedMessageSearchService.class).getValue(), is(equalTo(new RuntimeBeanReference("failedMessageSearchService")))); assertThat(abstractBeanDefinition.getConstructorArgumentValues().getArgumentValue(2, MessageSender.class).getValue(), is(equalTo(new RuntimeBeanReference("messageSender")))); assertThat(abstractBeanDefinition.getConstructorArgumentValues().getArgumentValue(3, HistoricStatusPredicate.class).getValue(), is(historicStatusPredicate)); }
|
public AbstractBeanDefinition create(String brokerName, String messageSenderBeanName) { return genericBeanDefinition(ResendFailedMessageService.class) .addConstructorArgValue(brokerName) .addConstructorArgReference("failedMessageSearchService") .addConstructorArgReference(messageSenderBeanName) .addConstructorArgValue(historicStatusPredicate) .getBeanDefinition(); }
|
ResendFailedMessageServiceBeanDefinitionFactory { public AbstractBeanDefinition create(String brokerName, String messageSenderBeanName) { return genericBeanDefinition(ResendFailedMessageService.class) .addConstructorArgValue(brokerName) .addConstructorArgReference("failedMessageSearchService") .addConstructorArgReference(messageSenderBeanName) .addConstructorArgValue(historicStatusPredicate) .getBeanDefinition(); } }
|
ResendFailedMessageServiceBeanDefinitionFactory { public AbstractBeanDefinition create(String brokerName, String messageSenderBeanName) { return genericBeanDefinition(ResendFailedMessageService.class) .addConstructorArgValue(brokerName) .addConstructorArgReference("failedMessageSearchService") .addConstructorArgReference(messageSenderBeanName) .addConstructorArgValue(historicStatusPredicate) .getBeanDefinition(); } ResendFailedMessageServiceBeanDefinitionFactory(HistoricStatusPredicate historicStatusPredicate); }
|
ResendFailedMessageServiceBeanDefinitionFactory { public AbstractBeanDefinition create(String brokerName, String messageSenderBeanName) { return genericBeanDefinition(ResendFailedMessageService.class) .addConstructorArgValue(brokerName) .addConstructorArgReference("failedMessageSearchService") .addConstructorArgReference(messageSenderBeanName) .addConstructorArgValue(historicStatusPredicate) .getBeanDefinition(); } ResendFailedMessageServiceBeanDefinitionFactory(HistoricStatusPredicate historicStatusPredicate); AbstractBeanDefinition create(String brokerName, String messageSenderBeanName); String createBeanName(String brokerName); }
|
ResendFailedMessageServiceBeanDefinitionFactory { public AbstractBeanDefinition create(String brokerName, String messageSenderBeanName) { return genericBeanDefinition(ResendFailedMessageService.class) .addConstructorArgValue(brokerName) .addConstructorArgReference("failedMessageSearchService") .addConstructorArgReference(messageSenderBeanName) .addConstructorArgValue(historicStatusPredicate) .getBeanDefinition(); } ResendFailedMessageServiceBeanDefinitionFactory(HistoricStatusPredicate historicStatusPredicate); AbstractBeanDefinition create(String brokerName, String messageSenderBeanName); String createBeanName(String brokerName); }
|
@Test public void createBeanName() throws Exception { assertThat(underTest.createBeanName(BROKER_NAME), is(equalTo(RESEND_FAILED_MESSAGE_SERVICE_BEAN_NAME_PREFIX + BROKER_NAME))); }
|
public String createBeanName(String brokerName) { return RESEND_FAILED_MESSAGE_SERVICE_BEAN_NAME_PREFIX + brokerName; }
|
ResendFailedMessageServiceBeanDefinitionFactory { public String createBeanName(String brokerName) { return RESEND_FAILED_MESSAGE_SERVICE_BEAN_NAME_PREFIX + brokerName; } }
|
ResendFailedMessageServiceBeanDefinitionFactory { public String createBeanName(String brokerName) { return RESEND_FAILED_MESSAGE_SERVICE_BEAN_NAME_PREFIX + brokerName; } ResendFailedMessageServiceBeanDefinitionFactory(HistoricStatusPredicate historicStatusPredicate); }
|
ResendFailedMessageServiceBeanDefinitionFactory { public String createBeanName(String brokerName) { return RESEND_FAILED_MESSAGE_SERVICE_BEAN_NAME_PREFIX + brokerName; } ResendFailedMessageServiceBeanDefinitionFactory(HistoricStatusPredicate historicStatusPredicate); AbstractBeanDefinition create(String brokerName, String messageSenderBeanName); String createBeanName(String brokerName); }
|
ResendFailedMessageServiceBeanDefinitionFactory { public String createBeanName(String brokerName) { return RESEND_FAILED_MESSAGE_SERVICE_BEAN_NAME_PREFIX + brokerName; } ResendFailedMessageServiceBeanDefinitionFactory(HistoricStatusPredicate historicStatusPredicate); AbstractBeanDefinition create(String brokerName, String messageSenderBeanName); String createBeanName(String brokerName); }
|
@Test public void successfullyResendFailedMessages() throws Exception { SearchFailedMessageRequest searchRequest = argThat(new HamcrestArgumentMatcher<>(aSearchRequestMatchingAllCriteria() .withBroker(equalTo(Optional.of(BROKER_NAME))) .withStatusMatcher(contains(RESENDING)))); when(failedMessageSearchService.search(searchRequest)).thenReturn(asList(failedMessage, anotherFailedMessage)); when(historicStatusPredicate.test(failedMessage)).thenReturn(true); when(historicStatusPredicate.test(anotherFailedMessage)).thenReturn(false); underTest.resendMessages(); verify(messageSender).send(failedMessage); verifyNoMoreInteractions(messageSender); }
|
public void resendMessages() { LOGGER.debug("Resending FailedMessages to: {}", brokerName); failedMessageSearchService .search(searchMatchingAllCriteria() .withBroker(brokerName) .withStatus(RESENDING) .build()) .stream() .filter(historicStatusPredicate::test) .forEach(messageSender::send); }
|
ResendFailedMessageService { public void resendMessages() { LOGGER.debug("Resending FailedMessages to: {}", brokerName); failedMessageSearchService .search(searchMatchingAllCriteria() .withBroker(brokerName) .withStatus(RESENDING) .build()) .stream() .filter(historicStatusPredicate::test) .forEach(messageSender::send); } }
|
ResendFailedMessageService { public void resendMessages() { LOGGER.debug("Resending FailedMessages to: {}", brokerName); failedMessageSearchService .search(searchMatchingAllCriteria() .withBroker(brokerName) .withStatus(RESENDING) .build()) .stream() .filter(historicStatusPredicate::test) .forEach(messageSender::send); } ResendFailedMessageService(String brokerName,
FailedMessageSearchService failedMessageSearchService,
MessageSender messageSender,
HistoricStatusPredicate historicStatusPredicate); }
|
ResendFailedMessageService { public void resendMessages() { LOGGER.debug("Resending FailedMessages to: {}", brokerName); failedMessageSearchService .search(searchMatchingAllCriteria() .withBroker(brokerName) .withStatus(RESENDING) .build()) .stream() .filter(historicStatusPredicate::test) .forEach(messageSender::send); } ResendFailedMessageService(String brokerName,
FailedMessageSearchService failedMessageSearchService,
MessageSender messageSender,
HistoricStatusPredicate historicStatusPredicate); void resendMessages(); String getBrokerName(); }
|
ResendFailedMessageService { public void resendMessages() { LOGGER.debug("Resending FailedMessages to: {}", brokerName); failedMessageSearchService .search(searchMatchingAllCriteria() .withBroker(brokerName) .withStatus(RESENDING) .build()) .stream() .filter(historicStatusPredicate::test) .forEach(messageSender::send); } ResendFailedMessageService(String brokerName,
FailedMessageSearchService failedMessageSearchService,
MessageSender messageSender,
HistoricStatusPredicate historicStatusPredicate); void resendMessages(); String getBrokerName(); }
|
@Test public void throwsExceptionWhenTokenFileNotFound() throws Exception { VaultProperties vaultProperties = createVaultPropertiesWithTokenFileAt(FILE_LOCATION_THAT_DOES_NOT_EXIST); expectedException.expect(VaultException.class); expectedException.expectCause(isA(NoSuchFileException.class)); expectedException.expectMessage(is("java.nio.file.NoSuchFileException: /tmp/file-does-not-exist")); underTest.createVaultAPI(vaultProperties); }
|
Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); }
|
VaultApiFactory { Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); } }
|
VaultApiFactory { Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); } }
|
VaultApiFactory { Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); } }
|
VaultApiFactory { Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); } }
|
@Test public void readsTokenFileWhenItExists() throws Exception { String tokenFileLocation = ensureTokenFileExists(); VaultProperties vaultProperties = createVaultPropertiesWithTokenFileAt(tokenFileLocation); Vault vaultAPI = underTest.createVaultAPI(vaultProperties); assertThat(new File(tokenFileLocation).exists(), is(true)); assertThat(vaultAPI, is(notNullValue())); }
|
Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); }
|
VaultApiFactory { Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); } }
|
VaultApiFactory { Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); } }
|
VaultApiFactory { Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); } }
|
VaultApiFactory { Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); } }
|
@Test public void readsTokenFileWhenItIsAFileUri() throws Exception { String tokenFileLocation = ensureTokenFileExists(); VaultProperties vaultProperties = createVaultPropertiesWithTokenFileAt("file:" + tokenFileLocation); Vault vaultAPI = underTest.createVaultAPI(vaultProperties); assertThat(vaultAPI, is(notNullValue())); }
|
Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); }
|
VaultApiFactory { Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); } }
|
VaultApiFactory { Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); } }
|
VaultApiFactory { Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); } }
|
VaultApiFactory { Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); } }
|
@Test public void readsTokenFileWhenItIsAClasspathFile() throws Exception { VaultProperties vaultProperties = createVaultPropertiesWithTokenFileAt("classpath:test-token-value-file"); Vault vaultAPI = underTest.createVaultAPI(vaultProperties); assertThat(vaultAPI, is(notNullValue())); }
|
Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); }
|
VaultApiFactory { Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); } }
|
VaultApiFactory { Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); } }
|
VaultApiFactory { Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); } }
|
VaultApiFactory { Vault createVaultAPI(VaultProperties vaultProperties) throws VaultException { return new Vault(buildConfiguration(vaultProperties)); } }
|
@Test public void equalsTest() { assertFalse(FAILED_MESSAGE_ID.equals(null)); assertFalse(FailedMessageId.fromUUID(A_UUID).equals(A_UUID)); assertFalse(FailedMessageId.newFailedMessageId().equals(FAILED_MESSAGE_ID)); assertTrue(FAILED_MESSAGE_ID.equals(FAILED_MESSAGE_ID)); assertTrue(FailedMessageId.fromUUID(A_UUID).equals(FailedMessageId.fromUUID(A_UUID))); }
|
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; return id.equals(((FailedMessageId) o).id); }
|
FailedMessageId implements Id { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; return id.equals(((FailedMessageId) o).id); } }
|
FailedMessageId implements Id { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; return id.equals(((FailedMessageId) o).id); } private FailedMessageId(UUID id); }
|
FailedMessageId implements Id { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; return id.equals(((FailedMessageId) o).id); } private FailedMessageId(UUID id); static FailedMessageId newFailedMessageId(); static FailedMessageId fromUUID(UUID uuid); @JsonCreator static FailedMessageId fromString(String uuid); @Override UUID getId(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); }
|
FailedMessageId implements Id { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; return id.equals(((FailedMessageId) o).id); } private FailedMessageId(UUID id); static FailedMessageId newFailedMessageId(); static FailedMessageId fromUUID(UUID uuid); @JsonCreator static FailedMessageId fromString(String uuid); @Override UUID getId(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); static final String FAILED_MESSAGE_ID; }
|
@Test public void matchesWhenConfiguredAndCorrectPath() throws Exception { assertThat(underTest.matches(MATCHING_PATH), is(true)); }
|
@Override public boolean matches(String secret) { return isVaultEnabledAndPatternMatches(secret); }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public boolean matches(String secret) { return isVaultEnabledAndPatternMatches(secret); } }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public boolean matches(String secret) { return isVaultEnabledAndPatternMatches(secret); } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public boolean matches(String secret) { return isVaultEnabledAndPatternMatches(secret); } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); @Override boolean matches(String secret); @Override DecryptedValue retrieveSecret(String secretPath); }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public boolean matches(String secret) { return isVaultEnabledAndPatternMatches(secret); } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); @Override boolean matches(String secret); @Override DecryptedValue retrieveSecret(String secretPath); }
|
@Test public void secretPathDoesNotMatch() throws Exception { assertThat(underTest.matches(NON_MATCHING_PATH), is(false)); }
|
@Override public boolean matches(String secret) { return isVaultEnabledAndPatternMatches(secret); }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public boolean matches(String secret) { return isVaultEnabledAndPatternMatches(secret); } }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public boolean matches(String secret) { return isVaultEnabledAndPatternMatches(secret); } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public boolean matches(String secret) { return isVaultEnabledAndPatternMatches(secret); } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); @Override boolean matches(String secret); @Override DecryptedValue retrieveSecret(String secretPath); }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public boolean matches(String secret) { return isVaultEnabledAndPatternMatches(secret); } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); @Override boolean matches(String secret); @Override DecryptedValue retrieveSecret(String secretPath); }
|
@Test public void unableToRetrieveIfNotAVaultSecretPath() throws Exception { expectedException.expect(IllegalStateException.class); underTest.retrieveSecret(NON_MATCHING_PATH); }
|
@Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } } }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); @Override boolean matches(String secret); @Override DecryptedValue retrieveSecret(String secretPath); }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); @Override boolean matches(String secret); @Override DecryptedValue retrieveSecret(String secretPath); }
|
@Test public void readsSecretFromVault() throws Exception { DecryptedValue decryptedPassword = underTest.retrieveSecret(MATCHING_PATH); assertThat(decryptedPassword.getClearText(), is(SECRET_VALUE.toCharArray())); }
|
@Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } } }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); @Override boolean matches(String secret); @Override DecryptedValue retrieveSecret(String secretPath); }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); @Override boolean matches(String secret); @Override DecryptedValue retrieveSecret(String secretPath); }
|
@Test public void wrapsVaultException() throws Exception { doAnswer(invocation -> { throw new VaultException("expected"); }).when(vault).logical(); expectedException.expect(RuntimeException.class); expectedException.expectMessage("Unable to connect to vault at:'null', looking up the path 'VAULT(/some/secret/path)'"); underTest.retrieveSecret(MATCHING_PATH); }
|
@Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } } }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); @Override boolean matches(String secret); @Override DecryptedValue retrieveSecret(String secretPath); }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); @Override boolean matches(String secret); @Override DecryptedValue retrieveSecret(String secretPath); }
|
@Test public void ensureThatARuntimeExceptionIsThrownWhenVaultKeyIsNotFound() throws Exception { expectedException.expect(RuntimeException.class); expectedException.expectMessage(is("Connected to '" + VAULT_PROPERTIES.getAddress() + "': unable to read secret at path '" + MATCHING_PATH + "'")); Logical logical = mock(Logical.class); when(vault.logical()).thenReturn(logical); when(logical.read(SOME_PATH)).thenThrow(new VaultException("Oops", 404)); underTest.retrieveSecret(MATCHING_PATH); }
|
@Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } } }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); @Override boolean matches(String secret); @Override DecryptedValue retrieveSecret(String secretPath); }
|
SingleValueVaultLookupStrategy implements SensitiveConfigValueLookupStrategy { @Override public DecryptedValue retrieveSecret(String secretPath) { Matcher matcher = PATTERN.matcher(secretPath); if (matcher.matches()) { String vaultPath = matcher.group(1); try { String value = vaultAPI().logical().read(vaultPath).getData().get(VALUE_KEY); return new DecryptedValue(value.toCharArray()); } catch (VaultException e) { int httpStatusCode = e.getHttpStatusCode(); switch (httpStatusCode) { case 0: throw new RuntimeException("Unable to connect to vault at:'" + vaultProperties.getAddress() + "', looking up the path '" + secretPath + "'", e); case 404: case 403: throw new RuntimeException("Connected to '" + vaultProperties.getAddress() + "': unable to read secret at path '" + secretPath + "'", e); default: throw new RuntimeException("HTTP status " + httpStatusCode + ". Could not retrieve from Vault '" + vaultProperties.getAddress() + "': the path '" + secretPath + "'", e); } } } else { throw new IllegalStateException("Secret: '" + secretPath + "' did not match pattern did you call matches(secret) first?"); } } SingleValueVaultLookupStrategy(VaultProperties vaultProperties, VaultApiFactory vaultApiFactory); @Override boolean matches(String secret); @Override DecryptedValue retrieveSecret(String secretPath); }
|
@Test public void ensureThatIfNoResolutionStrategyForAVaultKeyCanBeFound_thenThrowAnIllegalArgumentException() throws Exception { SensitiveConfigValueLookupRegistry registry = new SensitiveConfigValueLookupRegistry(emptyList()); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage(is("No relevant strategy could be found to resolve vault path for: bogus/path")); registry.retrieveSecret("bogus/path"); }
|
public DecryptedValue retrieveSecret(String secretPath) { return resolutionStrategies .stream() .filter(service -> service.matches(secretPath)) .findFirst() .map(service -> service.retrieveSecret(secretPath)) .orElseThrow(() -> new IllegalArgumentException("No relevant strategy could be found to resolve vault path for: " + secretPath)); }
|
SensitiveConfigValueLookupRegistry { public DecryptedValue retrieveSecret(String secretPath) { return resolutionStrategies .stream() .filter(service -> service.matches(secretPath)) .findFirst() .map(service -> service.retrieveSecret(secretPath)) .orElseThrow(() -> new IllegalArgumentException("No relevant strategy could be found to resolve vault path for: " + secretPath)); } }
|
SensitiveConfigValueLookupRegistry { public DecryptedValue retrieveSecret(String secretPath) { return resolutionStrategies .stream() .filter(service -> service.matches(secretPath)) .findFirst() .map(service -> service.retrieveSecret(secretPath)) .orElseThrow(() -> new IllegalArgumentException("No relevant strategy could be found to resolve vault path for: " + secretPath)); } SensitiveConfigValueLookupRegistry(List<SensitiveConfigValueLookupStrategy> resolutionStrategies); }
|
SensitiveConfigValueLookupRegistry { public DecryptedValue retrieveSecret(String secretPath) { return resolutionStrategies .stream() .filter(service -> service.matches(secretPath)) .findFirst() .map(service -> service.retrieveSecret(secretPath)) .orElseThrow(() -> new IllegalArgumentException("No relevant strategy could be found to resolve vault path for: " + secretPath)); } SensitiveConfigValueLookupRegistry(List<SensitiveConfigValueLookupStrategy> resolutionStrategies); DecryptedValue retrieveSecret(String secretPath); }
|
SensitiveConfigValueLookupRegistry { public DecryptedValue retrieveSecret(String secretPath) { return resolutionStrategies .stream() .filter(service -> service.matches(secretPath)) .findFirst() .map(service -> service.retrieveSecret(secretPath)) .orElseThrow(() -> new IllegalArgumentException("No relevant strategy could be found to resolve vault path for: " + secretPath)); } SensitiveConfigValueLookupRegistry(List<SensitiveConfigValueLookupStrategy> resolutionStrategies); DecryptedValue retrieveSecret(String secretPath); }
|
@Test public void ensureThatIfResolutionStrategyIsFoundButItReturnsNull_thenThrowAnIllegalArgumentException() throws Exception { List<SensitiveConfigValueLookupStrategy> listOfStrategies = new ArrayList<>(); listOfStrategies.add(new SensitiveConfigValueLookupStrategy() { @Override public DecryptedValue retrieveSecret(String secret) { return null; } @Override public boolean matches(String secret) { return true; } }); SensitiveConfigValueLookupRegistry registry = new SensitiveConfigValueLookupRegistry(listOfStrategies); expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage(is("No relevant strategy could be found to resolve vault path for: bogus/path")); registry.retrieveSecret("bogus/path"); }
|
public DecryptedValue retrieveSecret(String secretPath) { return resolutionStrategies .stream() .filter(service -> service.matches(secretPath)) .findFirst() .map(service -> service.retrieveSecret(secretPath)) .orElseThrow(() -> new IllegalArgumentException("No relevant strategy could be found to resolve vault path for: " + secretPath)); }
|
SensitiveConfigValueLookupRegistry { public DecryptedValue retrieveSecret(String secretPath) { return resolutionStrategies .stream() .filter(service -> service.matches(secretPath)) .findFirst() .map(service -> service.retrieveSecret(secretPath)) .orElseThrow(() -> new IllegalArgumentException("No relevant strategy could be found to resolve vault path for: " + secretPath)); } }
|
SensitiveConfigValueLookupRegistry { public DecryptedValue retrieveSecret(String secretPath) { return resolutionStrategies .stream() .filter(service -> service.matches(secretPath)) .findFirst() .map(service -> service.retrieveSecret(secretPath)) .orElseThrow(() -> new IllegalArgumentException("No relevant strategy could be found to resolve vault path for: " + secretPath)); } SensitiveConfigValueLookupRegistry(List<SensitiveConfigValueLookupStrategy> resolutionStrategies); }
|
SensitiveConfigValueLookupRegistry { public DecryptedValue retrieveSecret(String secretPath) { return resolutionStrategies .stream() .filter(service -> service.matches(secretPath)) .findFirst() .map(service -> service.retrieveSecret(secretPath)) .orElseThrow(() -> new IllegalArgumentException("No relevant strategy could be found to resolve vault path for: " + secretPath)); } SensitiveConfigValueLookupRegistry(List<SensitiveConfigValueLookupStrategy> resolutionStrategies); DecryptedValue retrieveSecret(String secretPath); }
|
SensitiveConfigValueLookupRegistry { public DecryptedValue retrieveSecret(String secretPath) { return resolutionStrategies .stream() .filter(service -> service.matches(secretPath)) .findFirst() .map(service -> service.retrieveSecret(secretPath)) .orElseThrow(() -> new IllegalArgumentException("No relevant strategy could be found to resolve vault path for: " + secretPath)); } SensitiveConfigValueLookupRegistry(List<SensitiveConfigValueLookupStrategy> resolutionStrategies); DecryptedValue retrieveSecret(String secretPath); }
|
@Test public void ensureThatPropertyKeyThatRequiresResolutionFromVault_isDelegatedToTheUnderlyingRegistry() throws Exception { Map<String, Object> mapOfKeys = new HashMap<>(); String expectedTestKey = "expected.test.key"; String vaultConfigValue = "VAULT(my/secret/path)"; char[] expectedResolvedValue = new char[]{'p', 'a', 's', 's'}; mapOfKeys.put(expectedTestKey, vaultConfigValue); when(registry.retrieveSecret(vaultConfigValue)).thenReturn(new DecryptedValue(expectedResolvedValue)); VaultPropertySource vaultPropertySource = new VaultPropertySource(mapOfKeys, registry); char[] actualResolverKey = vaultPropertySource.getProperty(expectedTestKey); assertTrue(Arrays.equals(actualResolverKey, expectedResolvedValue)); }
|
@Override public char[] getProperty(String name) { if (containsProperty(name)) { LOGGER.trace("Attempting to lookup property key = {}", name); return sensitiveConfigValueLookupRegistry.retrieveSecret(super.getProperty(name).toString()).getClearText(); } return null; }
|
VaultPropertySource extends MapPropertySource { @Override public char[] getProperty(String name) { if (containsProperty(name)) { LOGGER.trace("Attempting to lookup property key = {}", name); return sensitiveConfigValueLookupRegistry.retrieveSecret(super.getProperty(name).toString()).getClearText(); } return null; } }
|
VaultPropertySource extends MapPropertySource { @Override public char[] getProperty(String name) { if (containsProperty(name)) { LOGGER.trace("Attempting to lookup property key = {}", name); return sensitiveConfigValueLookupRegistry.retrieveSecret(super.getProperty(name).toString()).getClearText(); } return null; } VaultPropertySource(Map<String, Object> source, SensitiveConfigValueLookupRegistry registry); }
|
VaultPropertySource extends MapPropertySource { @Override public char[] getProperty(String name) { if (containsProperty(name)) { LOGGER.trace("Attempting to lookup property key = {}", name); return sensitiveConfigValueLookupRegistry.retrieveSecret(super.getProperty(name).toString()).getClearText(); } return null; } VaultPropertySource(Map<String, Object> source, SensitiveConfigValueLookupRegistry registry); @Override char[] getProperty(String name); }
|
VaultPropertySource extends MapPropertySource { @Override public char[] getProperty(String name) { if (containsProperty(name)) { LOGGER.trace("Attempting to lookup property key = {}", name); return sensitiveConfigValueLookupRegistry.retrieveSecret(super.getProperty(name).toString()).getClearText(); } return null; } VaultPropertySource(Map<String, Object> source, SensitiveConfigValueLookupRegistry registry); @Override char[] getProperty(String name); }
|
@Test public void ensureThatIfAttemptingToRetriveAKeyThatIsNotInTheListOfResovableKeys_thenReturnNull() throws Exception { VaultPropertySource vaultPropertySource = new VaultPropertySource(new HashMap<>(), registry); char[] property = vaultPropertySource.getProperty("non-existent-key"); assertNull(property); verifyZeroInteractions(registry); }
|
@Override public char[] getProperty(String name) { if (containsProperty(name)) { LOGGER.trace("Attempting to lookup property key = {}", name); return sensitiveConfigValueLookupRegistry.retrieveSecret(super.getProperty(name).toString()).getClearText(); } return null; }
|
VaultPropertySource extends MapPropertySource { @Override public char[] getProperty(String name) { if (containsProperty(name)) { LOGGER.trace("Attempting to lookup property key = {}", name); return sensitiveConfigValueLookupRegistry.retrieveSecret(super.getProperty(name).toString()).getClearText(); } return null; } }
|
VaultPropertySource extends MapPropertySource { @Override public char[] getProperty(String name) { if (containsProperty(name)) { LOGGER.trace("Attempting to lookup property key = {}", name); return sensitiveConfigValueLookupRegistry.retrieveSecret(super.getProperty(name).toString()).getClearText(); } return null; } VaultPropertySource(Map<String, Object> source, SensitiveConfigValueLookupRegistry registry); }
|
VaultPropertySource extends MapPropertySource { @Override public char[] getProperty(String name) { if (containsProperty(name)) { LOGGER.trace("Attempting to lookup property key = {}", name); return sensitiveConfigValueLookupRegistry.retrieveSecret(super.getProperty(name).toString()).getClearText(); } return null; } VaultPropertySource(Map<String, Object> source, SensitiveConfigValueLookupRegistry registry); @Override char[] getProperty(String name); }
|
VaultPropertySource extends MapPropertySource { @Override public char[] getProperty(String name) { if (containsProperty(name)) { LOGGER.trace("Attempting to lookup property key = {}", name); return sensitiveConfigValueLookupRegistry.retrieveSecret(super.getProperty(name).toString()).getClearText(); } return null; } VaultPropertySource(Map<String, Object> source, SensitiveConfigValueLookupRegistry registry); @Override char[] getProperty(String name); }
|
@Test public void hashCodeTest() { assertNotEquals(FAILED_MESSAGE_ID.hashCode(), FailedMessageId.newFailedMessageId().hashCode()); assertEquals(FAILED_MESSAGE_ID.getId().hashCode(), FAILED_MESSAGE_ID.hashCode()); }
|
@Override public int hashCode() { return id.hashCode(); }
|
FailedMessageId implements Id { @Override public int hashCode() { return id.hashCode(); } }
|
FailedMessageId implements Id { @Override public int hashCode() { return id.hashCode(); } private FailedMessageId(UUID id); }
|
FailedMessageId implements Id { @Override public int hashCode() { return id.hashCode(); } private FailedMessageId(UUID id); static FailedMessageId newFailedMessageId(); static FailedMessageId fromUUID(UUID uuid); @JsonCreator static FailedMessageId fromString(String uuid); @Override UUID getId(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); }
|
FailedMessageId implements Id { @Override public int hashCode() { return id.hashCode(); } private FailedMessageId(UUID id); static FailedMessageId newFailedMessageId(); static FailedMessageId fromUUID(UUID uuid); @JsonCreator static FailedMessageId fromString(String uuid); @Override UUID getId(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); static final String FAILED_MESSAGE_ID; }
|
@Test public void failedMessageNotFoundExceptionThrownWhenFailedMessageEmpty() { expectedException.expect(FailedMessageNotFoundException.class); expectedException.expectMessage("Failed Message: " + FAILED_MESSAGE_ID + " not found"); when(failedMessageDao.findById(FAILED_MESSAGE_ID)).thenReturn(Optional.empty()); underTest.create(FAILED_MESSAGE_ID); verifyZeroInteractions(failedMessageBuilder); }
|
public FailedMessageBuilder create(FailedMessageId failedMessageId) { return failedMessageDao.findById(failedMessageId) .filter(IS_DELETED.negate()) .map(createFailedMessageBuilder()) .orElseThrow(failedMessageNotFound(failedMessageId)) .withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry); }
|
FailedMessageBuilderFactory { public FailedMessageBuilder create(FailedMessageId failedMessageId) { return failedMessageDao.findById(failedMessageId) .filter(IS_DELETED.negate()) .map(createFailedMessageBuilder()) .orElseThrow(failedMessageNotFound(failedMessageId)) .withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry); } }
|
FailedMessageBuilderFactory { public FailedMessageBuilder create(FailedMessageId failedMessageId) { return failedMessageDao.findById(failedMessageId) .filter(IS_DELETED.negate()) .map(createFailedMessageBuilder()) .orElseThrow(failedMessageNotFound(failedMessageId)) .withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry); } FailedMessageBuilderFactory(UpdateRequestAdapterRegistry updateRequestAdapterRegistry,
FailedMessageDao failedMessageDao); }
|
FailedMessageBuilderFactory { public FailedMessageBuilder create(FailedMessageId failedMessageId) { return failedMessageDao.findById(failedMessageId) .filter(IS_DELETED.negate()) .map(createFailedMessageBuilder()) .orElseThrow(failedMessageNotFound(failedMessageId)) .withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry); } FailedMessageBuilderFactory(UpdateRequestAdapterRegistry updateRequestAdapterRegistry,
FailedMessageDao failedMessageDao); FailedMessageBuilder create(FailedMessageId failedMessageId); }
|
FailedMessageBuilderFactory { public FailedMessageBuilder create(FailedMessageId failedMessageId) { return failedMessageDao.findById(failedMessageId) .filter(IS_DELETED.negate()) .map(createFailedMessageBuilder()) .orElseThrow(failedMessageNotFound(failedMessageId)) .withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry); } FailedMessageBuilderFactory(UpdateRequestAdapterRegistry updateRequestAdapterRegistry,
FailedMessageDao failedMessageDao); FailedMessageBuilder create(FailedMessageId failedMessageId); }
|
@Test public void failedMessageNotFoundExceptionThrownIfStatusIsDeleted() { expectedException.expect(FailedMessageNotFoundException.class); expectedException.expectMessage("Failed Message: " + FAILED_MESSAGE_ID + " not found"); when(failedMessageDao.findById(FAILED_MESSAGE_ID)).thenReturn(Optional.of(failedMessage)); when(failedMessage.getStatus()).thenReturn(DELETED); underTest.create(FAILED_MESSAGE_ID); verifyZeroInteractions(failedMessageBuilder); }
|
public FailedMessageBuilder create(FailedMessageId failedMessageId) { return failedMessageDao.findById(failedMessageId) .filter(IS_DELETED.negate()) .map(createFailedMessageBuilder()) .orElseThrow(failedMessageNotFound(failedMessageId)) .withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry); }
|
FailedMessageBuilderFactory { public FailedMessageBuilder create(FailedMessageId failedMessageId) { return failedMessageDao.findById(failedMessageId) .filter(IS_DELETED.negate()) .map(createFailedMessageBuilder()) .orElseThrow(failedMessageNotFound(failedMessageId)) .withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry); } }
|
FailedMessageBuilderFactory { public FailedMessageBuilder create(FailedMessageId failedMessageId) { return failedMessageDao.findById(failedMessageId) .filter(IS_DELETED.negate()) .map(createFailedMessageBuilder()) .orElseThrow(failedMessageNotFound(failedMessageId)) .withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry); } FailedMessageBuilderFactory(UpdateRequestAdapterRegistry updateRequestAdapterRegistry,
FailedMessageDao failedMessageDao); }
|
FailedMessageBuilderFactory { public FailedMessageBuilder create(FailedMessageId failedMessageId) { return failedMessageDao.findById(failedMessageId) .filter(IS_DELETED.negate()) .map(createFailedMessageBuilder()) .orElseThrow(failedMessageNotFound(failedMessageId)) .withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry); } FailedMessageBuilderFactory(UpdateRequestAdapterRegistry updateRequestAdapterRegistry,
FailedMessageDao failedMessageDao); FailedMessageBuilder create(FailedMessageId failedMessageId); }
|
FailedMessageBuilderFactory { public FailedMessageBuilder create(FailedMessageId failedMessageId) { return failedMessageDao.findById(failedMessageId) .filter(IS_DELETED.negate()) .map(createFailedMessageBuilder()) .orElseThrow(failedMessageNotFound(failedMessageId)) .withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry); } FailedMessageBuilderFactory(UpdateRequestAdapterRegistry updateRequestAdapterRegistry,
FailedMessageDao failedMessageDao); FailedMessageBuilder create(FailedMessageId failedMessageId); }
|
@Test public void successfullyCreateAFailedMessageBuilder() { when(failedMessageDao.findById(FAILED_MESSAGE_ID)).thenReturn(Optional.of(failedMessage)); when(failedMessage.getStatus()).thenReturn(FAILED); when(failedMessageBuilder.withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry)).thenReturn(failedMessageBuilder); assertThat(underTest.create(FAILED_MESSAGE_ID), is(failedMessageBuilder)); verify(failedMessageBuilder).withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry); }
|
public FailedMessageBuilder create(FailedMessageId failedMessageId) { return failedMessageDao.findById(failedMessageId) .filter(IS_DELETED.negate()) .map(createFailedMessageBuilder()) .orElseThrow(failedMessageNotFound(failedMessageId)) .withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry); }
|
FailedMessageBuilderFactory { public FailedMessageBuilder create(FailedMessageId failedMessageId) { return failedMessageDao.findById(failedMessageId) .filter(IS_DELETED.negate()) .map(createFailedMessageBuilder()) .orElseThrow(failedMessageNotFound(failedMessageId)) .withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry); } }
|
FailedMessageBuilderFactory { public FailedMessageBuilder create(FailedMessageId failedMessageId) { return failedMessageDao.findById(failedMessageId) .filter(IS_DELETED.negate()) .map(createFailedMessageBuilder()) .orElseThrow(failedMessageNotFound(failedMessageId)) .withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry); } FailedMessageBuilderFactory(UpdateRequestAdapterRegistry updateRequestAdapterRegistry,
FailedMessageDao failedMessageDao); }
|
FailedMessageBuilderFactory { public FailedMessageBuilder create(FailedMessageId failedMessageId) { return failedMessageDao.findById(failedMessageId) .filter(IS_DELETED.negate()) .map(createFailedMessageBuilder()) .orElseThrow(failedMessageNotFound(failedMessageId)) .withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry); } FailedMessageBuilderFactory(UpdateRequestAdapterRegistry updateRequestAdapterRegistry,
FailedMessageDao failedMessageDao); FailedMessageBuilder create(FailedMessageId failedMessageId); }
|
FailedMessageBuilderFactory { public FailedMessageBuilder create(FailedMessageId failedMessageId) { return failedMessageDao.findById(failedMessageId) .filter(IS_DELETED.negate()) .map(createFailedMessageBuilder()) .orElseThrow(failedMessageNotFound(failedMessageId)) .withUpdateRequestAdapterRegistry(updateRequestAdapterRegistry); } FailedMessageBuilderFactory(UpdateRequestAdapterRegistry updateRequestAdapterRegistry,
FailedMessageDao failedMessageDao); FailedMessageBuilder create(FailedMessageId failedMessageId); }
|
@Test public void addLabelDelegatesToDao() throws Exception { underTest.addLabel(FAILED_MESSAGE_ID, LABEL); verify(failedMessageDao).addLabel(FAILED_MESSAGE_ID, LABEL); }
|
public void addLabel(FailedMessageId failedMessageId, String label) { LOGGER.debug("Adding label '{}' to FailedMessage: {}", label, failedMessageId); failedMessageDao.addLabel(failedMessageId, label); }
|
FailedMessageLabelService { public void addLabel(FailedMessageId failedMessageId, String label) { LOGGER.debug("Adding label '{}' to FailedMessage: {}", label, failedMessageId); failedMessageDao.addLabel(failedMessageId, label); } }
|
FailedMessageLabelService { public void addLabel(FailedMessageId failedMessageId, String label) { LOGGER.debug("Adding label '{}' to FailedMessage: {}", label, failedMessageId); failedMessageDao.addLabel(failedMessageId, label); } FailedMessageLabelService(FailedMessageDao failedMessageDao); }
|
FailedMessageLabelService { public void addLabel(FailedMessageId failedMessageId, String label) { LOGGER.debug("Adding label '{}' to FailedMessage: {}", label, failedMessageId); failedMessageDao.addLabel(failedMessageId, label); } FailedMessageLabelService(FailedMessageDao failedMessageDao); void addLabel(FailedMessageId failedMessageId, String label); void removeLabel(FailedMessageId failedMessageId, String label); void setLabels(FailedMessageId failedMessageId, Set<String> labels); }
|
FailedMessageLabelService { public void addLabel(FailedMessageId failedMessageId, String label) { LOGGER.debug("Adding label '{}' to FailedMessage: {}", label, failedMessageId); failedMessageDao.addLabel(failedMessageId, label); } FailedMessageLabelService(FailedMessageDao failedMessageDao); void addLabel(FailedMessageId failedMessageId, String label); void removeLabel(FailedMessageId failedMessageId, String label); void setLabels(FailedMessageId failedMessageId, Set<String> labels); }
|
@Test public void removeLabelDelegatesToDao() throws Exception { underTest.removeLabel(FAILED_MESSAGE_ID, LABEL); verify(failedMessageDao).removeLabel(FAILED_MESSAGE_ID, LABEL); }
|
public void removeLabel(FailedMessageId failedMessageId, String label) { LOGGER.debug("Removing label '{}' from FailedMessage: {}", label, failedMessageId); failedMessageDao.removeLabel(failedMessageId, label); }
|
FailedMessageLabelService { public void removeLabel(FailedMessageId failedMessageId, String label) { LOGGER.debug("Removing label '{}' from FailedMessage: {}", label, failedMessageId); failedMessageDao.removeLabel(failedMessageId, label); } }
|
FailedMessageLabelService { public void removeLabel(FailedMessageId failedMessageId, String label) { LOGGER.debug("Removing label '{}' from FailedMessage: {}", label, failedMessageId); failedMessageDao.removeLabel(failedMessageId, label); } FailedMessageLabelService(FailedMessageDao failedMessageDao); }
|
FailedMessageLabelService { public void removeLabel(FailedMessageId failedMessageId, String label) { LOGGER.debug("Removing label '{}' from FailedMessage: {}", label, failedMessageId); failedMessageDao.removeLabel(failedMessageId, label); } FailedMessageLabelService(FailedMessageDao failedMessageDao); void addLabel(FailedMessageId failedMessageId, String label); void removeLabel(FailedMessageId failedMessageId, String label); void setLabels(FailedMessageId failedMessageId, Set<String> labels); }
|
FailedMessageLabelService { public void removeLabel(FailedMessageId failedMessageId, String label) { LOGGER.debug("Removing label '{}' from FailedMessage: {}", label, failedMessageId); failedMessageDao.removeLabel(failedMessageId, label); } FailedMessageLabelService(FailedMessageDao failedMessageDao); void addLabel(FailedMessageId failedMessageId, String label); void removeLabel(FailedMessageId failedMessageId, String label); void setLabels(FailedMessageId failedMessageId, Set<String> labels); }
|
@Test public void setLabelsDelegatesToDao() { underTest.setLabels(FAILED_MESSAGE_ID, singleton(LABEL)); verify(failedMessageDao).setLabels(FAILED_MESSAGE_ID, singleton(LABEL)); }
|
public void setLabels(FailedMessageId failedMessageId, Set<String> labels) { LOGGER.debug("Replacing all labels on FailedMessage: {}", failedMessageId); failedMessageDao.setLabels(failedMessageId, labels); }
|
FailedMessageLabelService { public void setLabels(FailedMessageId failedMessageId, Set<String> labels) { LOGGER.debug("Replacing all labels on FailedMessage: {}", failedMessageId); failedMessageDao.setLabels(failedMessageId, labels); } }
|
FailedMessageLabelService { public void setLabels(FailedMessageId failedMessageId, Set<String> labels) { LOGGER.debug("Replacing all labels on FailedMessage: {}", failedMessageId); failedMessageDao.setLabels(failedMessageId, labels); } FailedMessageLabelService(FailedMessageDao failedMessageDao); }
|
FailedMessageLabelService { public void setLabels(FailedMessageId failedMessageId, Set<String> labels) { LOGGER.debug("Replacing all labels on FailedMessage: {}", failedMessageId); failedMessageDao.setLabels(failedMessageId, labels); } FailedMessageLabelService(FailedMessageDao failedMessageDao); void addLabel(FailedMessageId failedMessageId, String label); void removeLabel(FailedMessageId failedMessageId, String label); void setLabels(FailedMessageId failedMessageId, Set<String> labels); }
|
FailedMessageLabelService { public void setLabels(FailedMessageId failedMessageId, Set<String> labels) { LOGGER.debug("Replacing all labels on FailedMessage: {}", failedMessageId); failedMessageDao.setLabels(failedMessageId, labels); } FailedMessageLabelService(FailedMessageDao failedMessageDao); void addLabel(FailedMessageId failedMessageId, String label); void removeLabel(FailedMessageId failedMessageId, String label); void setLabels(FailedMessageId failedMessageId, Set<String> labels); }
|
@Test public void createFailedMessageDelegatesToDao() { underTest.create(failedMessage); Mockito.verify(failedMessageDao).insert(failedMessage); }
|
public void create(FailedMessage failedMessage) { failedMessageDao.insert(failedMessage); }
|
FailedMessageService { public void create(FailedMessage failedMessage) { failedMessageDao.insert(failedMessage); } }
|
FailedMessageService { public void create(FailedMessage failedMessage) { failedMessageDao.insert(failedMessage); } FailedMessageService(FailedMessageDao failedMessageDao,
FailedMessageBuilderFactory failedMessageBuilderFactory); }
|
FailedMessageService { public void create(FailedMessage failedMessage) { failedMessageDao.insert(failedMessage); } FailedMessageService(FailedMessageDao failedMessageDao,
FailedMessageBuilderFactory failedMessageBuilderFactory); void create(FailedMessage failedMessage); void delete(FailedMessageId failedMessageId); void update(FailedMessageId failedMessageId, T updateRequest); void update(FailedMessageId failedMessageId, List<? extends UpdateRequest> updateRequests); }
|
FailedMessageService { public void create(FailedMessage failedMessage) { failedMessageDao.insert(failedMessage); } FailedMessageService(FailedMessageDao failedMessageDao,
FailedMessageBuilderFactory failedMessageBuilderFactory); void create(FailedMessage failedMessage); void delete(FailedMessageId failedMessageId); void update(FailedMessageId failedMessageId, T updateRequest); void update(FailedMessageId failedMessageId, List<? extends UpdateRequest> updateRequests); }
|
@Test public void noUpdatesArePerformedIfTheUpdateRequestListIsEmpty() { underTest.update(FAILED_MESSAGE_ID, Collections.emptyList()); verifyZeroInteractions(failedMessageDao); verifyZeroInteractions(failedMessageBuilderFactory); }
|
public <T extends UpdateRequest> void update(FailedMessageId failedMessageId, T updateRequest) { update(failedMessageId, Collections.singletonList(updateRequest)); }
|
FailedMessageService { public <T extends UpdateRequest> void update(FailedMessageId failedMessageId, T updateRequest) { update(failedMessageId, Collections.singletonList(updateRequest)); } }
|
FailedMessageService { public <T extends UpdateRequest> void update(FailedMessageId failedMessageId, T updateRequest) { update(failedMessageId, Collections.singletonList(updateRequest)); } FailedMessageService(FailedMessageDao failedMessageDao,
FailedMessageBuilderFactory failedMessageBuilderFactory); }
|
FailedMessageService { public <T extends UpdateRequest> void update(FailedMessageId failedMessageId, T updateRequest) { update(failedMessageId, Collections.singletonList(updateRequest)); } FailedMessageService(FailedMessageDao failedMessageDao,
FailedMessageBuilderFactory failedMessageBuilderFactory); void create(FailedMessage failedMessage); void delete(FailedMessageId failedMessageId); void update(FailedMessageId failedMessageId, T updateRequest); void update(FailedMessageId failedMessageId, List<? extends UpdateRequest> updateRequests); }
|
FailedMessageService { public <T extends UpdateRequest> void update(FailedMessageId failedMessageId, T updateRequest) { update(failedMessageId, Collections.singletonList(updateRequest)); } FailedMessageService(FailedMessageDao failedMessageDao,
FailedMessageBuilderFactory failedMessageBuilderFactory); void create(FailedMessage failedMessage); void delete(FailedMessageId failedMessageId); void update(FailedMessageId failedMessageId, T updateRequest); void update(FailedMessageId failedMessageId, List<? extends UpdateRequest> updateRequests); }
|
@Test public void messageIsADuplicate() { duplicate = true; underTest.process(failedMessage); verify(duplicateFailedMessageProcessor).process(failedMessage); verifyZeroInteractions(newFailedMessageProcessor); }
|
@Override public void process(FailedMessage failedMessage) { if (predicate.test(failedMessage)) { positiveOutcomeFailedMessageProcessor.process(failedMessage); } else { negativeOutcomeFailedMessageProcessor.process(failedMessage); } }
|
PredicateOutcomeFailedMessageProcessor implements FailedMessageProcessor { @Override public void process(FailedMessage failedMessage) { if (predicate.test(failedMessage)) { positiveOutcomeFailedMessageProcessor.process(failedMessage); } else { negativeOutcomeFailedMessageProcessor.process(failedMessage); } } }
|
PredicateOutcomeFailedMessageProcessor implements FailedMessageProcessor { @Override public void process(FailedMessage failedMessage) { if (predicate.test(failedMessage)) { positiveOutcomeFailedMessageProcessor.process(failedMessage); } else { negativeOutcomeFailedMessageProcessor.process(failedMessage); } } PredicateOutcomeFailedMessageProcessor(Predicate<FailedMessage> predicate,
FailedMessageProcessor positiveOutcomeFailedMessageProcessor,
FailedMessageProcessor negativeOutcomeFailedMessageProcessor); }
|
PredicateOutcomeFailedMessageProcessor implements FailedMessageProcessor { @Override public void process(FailedMessage failedMessage) { if (predicate.test(failedMessage)) { positiveOutcomeFailedMessageProcessor.process(failedMessage); } else { negativeOutcomeFailedMessageProcessor.process(failedMessage); } } PredicateOutcomeFailedMessageProcessor(Predicate<FailedMessage> predicate,
FailedMessageProcessor positiveOutcomeFailedMessageProcessor,
FailedMessageProcessor negativeOutcomeFailedMessageProcessor); @Override void process(FailedMessage failedMessage); }
|
PredicateOutcomeFailedMessageProcessor implements FailedMessageProcessor { @Override public void process(FailedMessage failedMessage) { if (predicate.test(failedMessage)) { positiveOutcomeFailedMessageProcessor.process(failedMessage); } else { negativeOutcomeFailedMessageProcessor.process(failedMessage); } } PredicateOutcomeFailedMessageProcessor(Predicate<FailedMessage> predicate,
FailedMessageProcessor positiveOutcomeFailedMessageProcessor,
FailedMessageProcessor negativeOutcomeFailedMessageProcessor); @Override void process(FailedMessage failedMessage); }
|
@Test public void messageIsNotADuplicate() { duplicate = false; underTest.process(failedMessage); verify(newFailedMessageProcessor).process(failedMessage); verifyZeroInteractions(duplicateFailedMessageProcessor); }
|
@Override public void process(FailedMessage failedMessage) { if (predicate.test(failedMessage)) { positiveOutcomeFailedMessageProcessor.process(failedMessage); } else { negativeOutcomeFailedMessageProcessor.process(failedMessage); } }
|
PredicateOutcomeFailedMessageProcessor implements FailedMessageProcessor { @Override public void process(FailedMessage failedMessage) { if (predicate.test(failedMessage)) { positiveOutcomeFailedMessageProcessor.process(failedMessage); } else { negativeOutcomeFailedMessageProcessor.process(failedMessage); } } }
|
PredicateOutcomeFailedMessageProcessor implements FailedMessageProcessor { @Override public void process(FailedMessage failedMessage) { if (predicate.test(failedMessage)) { positiveOutcomeFailedMessageProcessor.process(failedMessage); } else { negativeOutcomeFailedMessageProcessor.process(failedMessage); } } PredicateOutcomeFailedMessageProcessor(Predicate<FailedMessage> predicate,
FailedMessageProcessor positiveOutcomeFailedMessageProcessor,
FailedMessageProcessor negativeOutcomeFailedMessageProcessor); }
|
PredicateOutcomeFailedMessageProcessor implements FailedMessageProcessor { @Override public void process(FailedMessage failedMessage) { if (predicate.test(failedMessage)) { positiveOutcomeFailedMessageProcessor.process(failedMessage); } else { negativeOutcomeFailedMessageProcessor.process(failedMessage); } } PredicateOutcomeFailedMessageProcessor(Predicate<FailedMessage> predicate,
FailedMessageProcessor positiveOutcomeFailedMessageProcessor,
FailedMessageProcessor negativeOutcomeFailedMessageProcessor); @Override void process(FailedMessage failedMessage); }
|
PredicateOutcomeFailedMessageProcessor implements FailedMessageProcessor { @Override public void process(FailedMessage failedMessage) { if (predicate.test(failedMessage)) { positiveOutcomeFailedMessageProcessor.process(failedMessage); } else { negativeOutcomeFailedMessageProcessor.process(failedMessage); } } PredicateOutcomeFailedMessageProcessor(Predicate<FailedMessage> predicate,
FailedMessageProcessor positiveOutcomeFailedMessageProcessor,
FailedMessageProcessor negativeOutcomeFailedMessageProcessor); @Override void process(FailedMessage failedMessage); }
|
@Test public void toStringTest() { assertEquals(FAILED_MESSAGE_ID.getId().toString(), FAILED_MESSAGE_ID.toString()); }
|
@Override public String toString() { return id.toString(); }
|
FailedMessageId implements Id { @Override public String toString() { return id.toString(); } }
|
FailedMessageId implements Id { @Override public String toString() { return id.toString(); } private FailedMessageId(UUID id); }
|
FailedMessageId implements Id { @Override public String toString() { return id.toString(); } private FailedMessageId(UUID id); static FailedMessageId newFailedMessageId(); static FailedMessageId fromUUID(UUID uuid); @JsonCreator static FailedMessageId fromString(String uuid); @Override UUID getId(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); }
|
FailedMessageId implements Id { @Override public String toString() { return id.toString(); } private FailedMessageId(UUID id); static FailedMessageId newFailedMessageId(); static FailedMessageId fromUUID(UUID uuid); @JsonCreator static FailedMessageId fromString(String uuid); @Override UUID getId(); @Override int hashCode(); @Override boolean equals(Object o); @Override String toString(); static final String FAILED_MESSAGE_ID; }
|
@Test public void delegatesToFailedMessageService() { underTest.process(failedMessage); }
|
@Override public void process(FailedMessage failedMessage) { failedMessageService.create(failedMessage); }
|
NewFailedMessageProcessor implements FailedMessageProcessor { @Override public void process(FailedMessage failedMessage) { failedMessageService.create(failedMessage); } }
|
NewFailedMessageProcessor implements FailedMessageProcessor { @Override public void process(FailedMessage failedMessage) { failedMessageService.create(failedMessage); } NewFailedMessageProcessor(FailedMessageService failedMessageService); }
|
NewFailedMessageProcessor implements FailedMessageProcessor { @Override public void process(FailedMessage failedMessage) { failedMessageService.create(failedMessage); } NewFailedMessageProcessor(FailedMessageService failedMessageService); @Override void process(FailedMessage failedMessage); }
|
NewFailedMessageProcessor implements FailedMessageProcessor { @Override public void process(FailedMessage failedMessage) { failedMessageService.create(failedMessage); } NewFailedMessageProcessor(FailedMessageService failedMessageService); @Override void process(FailedMessage failedMessage); }
|
@Test public void predicateReturnsTrueWhenFailedMesageWithIdDoesNotExist() { when(failedMessage.getFailedMessageId()).thenReturn(FAILED_MESSAGE_ID); when(failedMessageDao.findById(FAILED_MESSAGE_ID)).thenReturn(Optional.empty()); assertThat(underTest.test(failedMessage), is(true)); }
|
@Override public boolean test(FailedMessage failedMessage) { return !failedMessageDao.findById(failedMessage.getFailedMessageId()).isPresent(); }
|
UniqueFailedMessageIdPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return !failedMessageDao.findById(failedMessage.getFailedMessageId()).isPresent(); } }
|
UniqueFailedMessageIdPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return !failedMessageDao.findById(failedMessage.getFailedMessageId()).isPresent(); } UniqueFailedMessageIdPredicate(FailedMessageDao failedMessageDao); }
|
UniqueFailedMessageIdPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return !failedMessageDao.findById(failedMessage.getFailedMessageId()).isPresent(); } UniqueFailedMessageIdPredicate(FailedMessageDao failedMessageDao); @Override boolean test(FailedMessage failedMessage); }
|
UniqueFailedMessageIdPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return !failedMessageDao.findById(failedMessage.getFailedMessageId()).isPresent(); } UniqueFailedMessageIdPredicate(FailedMessageDao failedMessageDao); @Override boolean test(FailedMessage failedMessage); }
|
@Test public void predicateReturnsFalseWhenFailedMessageWithIdExists() { when(failedMessage.getFailedMessageId()).thenReturn(FAILED_MESSAGE_ID); when(failedMessageDao.findById(FAILED_MESSAGE_ID)).thenReturn(Optional.of(failedMessage)); assertThat(underTest.test(failedMessage), is(false)); }
|
@Override public boolean test(FailedMessage failedMessage) { return !failedMessageDao.findById(failedMessage.getFailedMessageId()).isPresent(); }
|
UniqueFailedMessageIdPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return !failedMessageDao.findById(failedMessage.getFailedMessageId()).isPresent(); } }
|
UniqueFailedMessageIdPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return !failedMessageDao.findById(failedMessage.getFailedMessageId()).isPresent(); } UniqueFailedMessageIdPredicate(FailedMessageDao failedMessageDao); }
|
UniqueFailedMessageIdPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return !failedMessageDao.findById(failedMessage.getFailedMessageId()).isPresent(); } UniqueFailedMessageIdPredicate(FailedMessageDao failedMessageDao); @Override boolean test(FailedMessage failedMessage); }
|
UniqueFailedMessageIdPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return !failedMessageDao.findById(failedMessage.getFailedMessageId()).isPresent(); } UniqueFailedMessageIdPredicate(FailedMessageDao failedMessageDao); @Override boolean test(FailedMessage failedMessage); }
|
@Test public void successfullyProcessExistingFailedMessage() { underTest.process(failedMessage); verify(failedMessageDao).update(failedMessage); }
|
@Override public void process(FailedMessage failedMessage) { failedMessageDao.update(failedMessage); }
|
ExistingFailedMessageProcessor implements FailedMessageProcessor { @Override public void process(FailedMessage failedMessage) { failedMessageDao.update(failedMessage); } }
|
ExistingFailedMessageProcessor implements FailedMessageProcessor { @Override public void process(FailedMessage failedMessage) { failedMessageDao.update(failedMessage); } ExistingFailedMessageProcessor(FailedMessageDao failedMessageDao); }
|
ExistingFailedMessageProcessor implements FailedMessageProcessor { @Override public void process(FailedMessage failedMessage) { failedMessageDao.update(failedMessage); } ExistingFailedMessageProcessor(FailedMessageDao failedMessageDao); @Override void process(FailedMessage failedMessage); }
|
ExistingFailedMessageProcessor implements FailedMessageProcessor { @Override public void process(FailedMessage failedMessage) { failedMessageDao.update(failedMessage); } ExistingFailedMessageProcessor(FailedMessageDao failedMessageDao); @Override void process(FailedMessage failedMessage); }
|
@Test public void predicateReturnsTrueIfSearchFindsAResult() { when(destination.getBrokerName()).thenReturn(BROKER_NAME); when(failedMessage.getDestination()).thenReturn(destination); when(failedMessage.getJmsMessageId()).thenReturn(JMS_MESSAGE_ID); when(failedMessageSearchService.search(any(SearchFailedMessageRequest.class))).thenReturn(Collections.emptySet()); assertThat(underTest.test(failedMessage), is(true)); verify(failedMessageSearchService).search(argThat(aSearchRequestMatchingAllCriteria() .withBroker(BROKER_NAME) .withJmsMessageId(JMS_MESSAGE_ID))); }
|
@Override public boolean test(FailedMessage failedMessage) { return failedMessageSearchService.search(searchMatchingAllCriteria() .withBroker(failedMessage.getDestination().getBrokerName()) .withJmsMessageId(failedMessage.getJmsMessageId()) .build() ).isEmpty(); }
|
UniqueJmsMessageIdPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return failedMessageSearchService.search(searchMatchingAllCriteria() .withBroker(failedMessage.getDestination().getBrokerName()) .withJmsMessageId(failedMessage.getJmsMessageId()) .build() ).isEmpty(); } }
|
UniqueJmsMessageIdPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return failedMessageSearchService.search(searchMatchingAllCriteria() .withBroker(failedMessage.getDestination().getBrokerName()) .withJmsMessageId(failedMessage.getJmsMessageId()) .build() ).isEmpty(); } UniqueJmsMessageIdPredicate(FailedMessageSearchService failedMessageSearchService); }
|
UniqueJmsMessageIdPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return failedMessageSearchService.search(searchMatchingAllCriteria() .withBroker(failedMessage.getDestination().getBrokerName()) .withJmsMessageId(failedMessage.getJmsMessageId()) .build() ).isEmpty(); } UniqueJmsMessageIdPredicate(FailedMessageSearchService failedMessageSearchService); @Override boolean test(FailedMessage failedMessage); }
|
UniqueJmsMessageIdPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return failedMessageSearchService.search(searchMatchingAllCriteria() .withBroker(failedMessage.getDestination().getBrokerName()) .withJmsMessageId(failedMessage.getJmsMessageId()) .build() ).isEmpty(); } UniqueJmsMessageIdPredicate(FailedMessageSearchService failedMessageSearchService); @Override boolean test(FailedMessage failedMessage); }
|
@Test public void predicateReturnsFalseIfSearchFindsAResult() { when(destination.getBrokerName()).thenReturn(BROKER_NAME); when(failedMessage.getDestination()).thenReturn(destination); when(failedMessage.getJmsMessageId()).thenReturn(JMS_MESSAGE_ID); when(failedMessageSearchService.search(any(SearchFailedMessageRequest.class))).thenReturn(singleton(mock(FailedMessage.class))); assertThat(underTest.test(failedMessage), is(false)); verify(failedMessageSearchService).search(argThat(aSearchRequestMatchingAllCriteria() .withBroker(BROKER_NAME) .withJmsMessageId(JMS_MESSAGE_ID))); }
|
@Override public boolean test(FailedMessage failedMessage) { return failedMessageSearchService.search(searchMatchingAllCriteria() .withBroker(failedMessage.getDestination().getBrokerName()) .withJmsMessageId(failedMessage.getJmsMessageId()) .build() ).isEmpty(); }
|
UniqueJmsMessageIdPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return failedMessageSearchService.search(searchMatchingAllCriteria() .withBroker(failedMessage.getDestination().getBrokerName()) .withJmsMessageId(failedMessage.getJmsMessageId()) .build() ).isEmpty(); } }
|
UniqueJmsMessageIdPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return failedMessageSearchService.search(searchMatchingAllCriteria() .withBroker(failedMessage.getDestination().getBrokerName()) .withJmsMessageId(failedMessage.getJmsMessageId()) .build() ).isEmpty(); } UniqueJmsMessageIdPredicate(FailedMessageSearchService failedMessageSearchService); }
|
UniqueJmsMessageIdPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return failedMessageSearchService.search(searchMatchingAllCriteria() .withBroker(failedMessage.getDestination().getBrokerName()) .withJmsMessageId(failedMessage.getJmsMessageId()) .build() ).isEmpty(); } UniqueJmsMessageIdPredicate(FailedMessageSearchService failedMessageSearchService); @Override boolean test(FailedMessage failedMessage); }
|
UniqueJmsMessageIdPredicate implements Predicate<FailedMessage> { @Override public boolean test(FailedMessage failedMessage) { return failedMessageSearchService.search(searchMatchingAllCriteria() .withBroker(failedMessage.getDestination().getBrokerName()) .withJmsMessageId(failedMessage.getJmsMessageId()) .build() ).isEmpty(); } UniqueJmsMessageIdPredicate(FailedMessageSearchService failedMessageSearchService); @Override boolean test(FailedMessage failedMessage); }
|
@Test public void nullPropertiesReturnsANewHashMap() { assertThat(underTest.convertToObject(null), is(equalTo(new HashMap<>()))); }
|
@Override public Map<String, Object> convertToObject(String value) { if (value == null) { return Collections.emptyMap(); } try { return objectMapper.readValue(value, new TypeReference<Map<String, Object>>() {}); } catch (IOException e) { LOGGER.error("Could read the following properties: " + value, e); } return Collections.emptyMap(); }
|
PropertiesConverter implements ObjectConverter<Map<String, Object>, String> { @Override public Map<String, Object> convertToObject(String value) { if (value == null) { return Collections.emptyMap(); } try { return objectMapper.readValue(value, new TypeReference<Map<String, Object>>() {}); } catch (IOException e) { LOGGER.error("Could read the following properties: " + value, e); } return Collections.emptyMap(); } }
|
PropertiesConverter implements ObjectConverter<Map<String, Object>, String> { @Override public Map<String, Object> convertToObject(String value) { if (value == null) { return Collections.emptyMap(); } try { return objectMapper.readValue(value, new TypeReference<Map<String, Object>>() {}); } catch (IOException e) { LOGGER.error("Could read the following properties: " + value, e); } return Collections.emptyMap(); } PropertiesConverter(ObjectMapper objectMapper); }
|
PropertiesConverter implements ObjectConverter<Map<String, Object>, String> { @Override public Map<String, Object> convertToObject(String value) { if (value == null) { return Collections.emptyMap(); } try { return objectMapper.readValue(value, new TypeReference<Map<String, Object>>() {}); } catch (IOException e) { LOGGER.error("Could read the following properties: " + value, e); } return Collections.emptyMap(); } PropertiesConverter(ObjectMapper objectMapper); @Override Map<String, Object> convertToObject(String value); @Override String convertFromObject(Map<String, Object> item); }
|
PropertiesConverter implements ObjectConverter<Map<String, Object>, String> { @Override public Map<String, Object> convertToObject(String value) { if (value == null) { return Collections.emptyMap(); } try { return objectMapper.readValue(value, new TypeReference<Map<String, Object>>() {}); } catch (IOException e) { LOGGER.error("Could read the following properties: " + value, e); } return Collections.emptyMap(); } PropertiesConverter(ObjectMapper objectMapper); @Override Map<String, Object> convertToObject(String value); @Override String convertFromObject(Map<String, Object> item); }
|
@Test public void convertingNullMapToStringReturnsNull() { assertThat(underTest.convertFromObject(null), is(nullValue())); }
|
@Override public String convertFromObject(Map<String, Object> item) { if (item == null) { return null; } try { return objectMapper.writeValueAsString(item); } catch (JsonProcessingException e) { LOGGER.error("Could not convert the following Map: " + item, e); } return null; }
|
PropertiesConverter implements ObjectConverter<Map<String, Object>, String> { @Override public String convertFromObject(Map<String, Object> item) { if (item == null) { return null; } try { return objectMapper.writeValueAsString(item); } catch (JsonProcessingException e) { LOGGER.error("Could not convert the following Map: " + item, e); } return null; } }
|
PropertiesConverter implements ObjectConverter<Map<String, Object>, String> { @Override public String convertFromObject(Map<String, Object> item) { if (item == null) { return null; } try { return objectMapper.writeValueAsString(item); } catch (JsonProcessingException e) { LOGGER.error("Could not convert the following Map: " + item, e); } return null; } PropertiesConverter(ObjectMapper objectMapper); }
|
PropertiesConverter implements ObjectConverter<Map<String, Object>, String> { @Override public String convertFromObject(Map<String, Object> item) { if (item == null) { return null; } try { return objectMapper.writeValueAsString(item); } catch (JsonProcessingException e) { LOGGER.error("Could not convert the following Map: " + item, e); } return null; } PropertiesConverter(ObjectMapper objectMapper); @Override Map<String, Object> convertToObject(String value); @Override String convertFromObject(Map<String, Object> item); }
|
PropertiesConverter implements ObjectConverter<Map<String, Object>, String> { @Override public String convertFromObject(Map<String, Object> item) { if (item == null) { return null; } try { return objectMapper.writeValueAsString(item); } catch (JsonProcessingException e) { LOGGER.error("Could not convert the following Map: " + item, e); } return null; } PropertiesConverter(ObjectMapper objectMapper); @Override Map<String, Object> convertToObject(String value); @Override String convertFromObject(Map<String, Object> item); }
|
@Test public void nullValueIsReturnedIfTheJsonCannotBeRead() throws IOException { when(objectMapper.readValue(any(String.class), any(TypeReference.class))).thenThrow(IOException.class); assertThat(new PropertiesConverter(objectMapper).convertToObject("foo"), is(Collections.emptyMap())); }
|
@Override public Map<String, Object> convertToObject(String value) { if (value == null) { return Collections.emptyMap(); } try { return objectMapper.readValue(value, new TypeReference<Map<String, Object>>() {}); } catch (IOException e) { LOGGER.error("Could read the following properties: " + value, e); } return Collections.emptyMap(); }
|
PropertiesConverter implements ObjectConverter<Map<String, Object>, String> { @Override public Map<String, Object> convertToObject(String value) { if (value == null) { return Collections.emptyMap(); } try { return objectMapper.readValue(value, new TypeReference<Map<String, Object>>() {}); } catch (IOException e) { LOGGER.error("Could read the following properties: " + value, e); } return Collections.emptyMap(); } }
|
PropertiesConverter implements ObjectConverter<Map<String, Object>, String> { @Override public Map<String, Object> convertToObject(String value) { if (value == null) { return Collections.emptyMap(); } try { return objectMapper.readValue(value, new TypeReference<Map<String, Object>>() {}); } catch (IOException e) { LOGGER.error("Could read the following properties: " + value, e); } return Collections.emptyMap(); } PropertiesConverter(ObjectMapper objectMapper); }
|
PropertiesConverter implements ObjectConverter<Map<String, Object>, String> { @Override public Map<String, Object> convertToObject(String value) { if (value == null) { return Collections.emptyMap(); } try { return objectMapper.readValue(value, new TypeReference<Map<String, Object>>() {}); } catch (IOException e) { LOGGER.error("Could read the following properties: " + value, e); } return Collections.emptyMap(); } PropertiesConverter(ObjectMapper objectMapper); @Override Map<String, Object> convertToObject(String value); @Override String convertFromObject(Map<String, Object> item); }
|
PropertiesConverter implements ObjectConverter<Map<String, Object>, String> { @Override public Map<String, Object> convertToObject(String value) { if (value == null) { return Collections.emptyMap(); } try { return objectMapper.readValue(value, new TypeReference<Map<String, Object>>() {}); } catch (IOException e) { LOGGER.error("Could read the following properties: " + value, e); } return Collections.emptyMap(); } PropertiesConverter(ObjectMapper objectMapper); @Override Map<String, Object> convertToObject(String value); @Override String convertFromObject(Map<String, Object> item); }
|
@Test public void nullValueIsReturnedIfTheMapCannotBeParsed() throws Exception { when(objectMapper.writeValueAsString(singletonMap("foo", "bar"))).thenThrow(JsonProcessingException.class); assertThat(new PropertiesConverter(objectMapper).convertFromObject(singletonMap("foo", "bar")), is(nullValue())); }
|
@Override public String convertFromObject(Map<String, Object> item) { if (item == null) { return null; } try { return objectMapper.writeValueAsString(item); } catch (JsonProcessingException e) { LOGGER.error("Could not convert the following Map: " + item, e); } return null; }
|
PropertiesConverter implements ObjectConverter<Map<String, Object>, String> { @Override public String convertFromObject(Map<String, Object> item) { if (item == null) { return null; } try { return objectMapper.writeValueAsString(item); } catch (JsonProcessingException e) { LOGGER.error("Could not convert the following Map: " + item, e); } return null; } }
|
PropertiesConverter implements ObjectConverter<Map<String, Object>, String> { @Override public String convertFromObject(Map<String, Object> item) { if (item == null) { return null; } try { return objectMapper.writeValueAsString(item); } catch (JsonProcessingException e) { LOGGER.error("Could not convert the following Map: " + item, e); } return null; } PropertiesConverter(ObjectMapper objectMapper); }
|
PropertiesConverter implements ObjectConverter<Map<String, Object>, String> { @Override public String convertFromObject(Map<String, Object> item) { if (item == null) { return null; } try { return objectMapper.writeValueAsString(item); } catch (JsonProcessingException e) { LOGGER.error("Could not convert the following Map: " + item, e); } return null; } PropertiesConverter(ObjectMapper objectMapper); @Override Map<String, Object> convertToObject(String value); @Override String convertFromObject(Map<String, Object> item); }
|
PropertiesConverter implements ObjectConverter<Map<String, Object>, String> { @Override public String convertFromObject(Map<String, Object> item) { if (item == null) { return null; } try { return objectMapper.writeValueAsString(item); } catch (JsonProcessingException e) { LOGGER.error("Could not convert the following Map: " + item, e); } return null; } PropertiesConverter(ObjectMapper objectMapper); @Override Map<String, Object> convertToObject(String value); @Override String convertFromObject(Map<String, Object> item); }
|
@Test public void encode() { underTest.encode(bsonWriter, AN_INSTANT, encoderContext); verify(bsonWriter).writeDateTime(EPOCH_MILLI); }
|
@Override public void encode(BsonWriter writer, Instant value, EncoderContext encoderContext) { writer.writeDateTime(value.toEpochMilli()); }
|
InstantAsDateTimeCodec implements Codec<Instant> { @Override public void encode(BsonWriter writer, Instant value, EncoderContext encoderContext) { writer.writeDateTime(value.toEpochMilli()); } }
|
InstantAsDateTimeCodec implements Codec<Instant> { @Override public void encode(BsonWriter writer, Instant value, EncoderContext encoderContext) { writer.writeDateTime(value.toEpochMilli()); } }
|
InstantAsDateTimeCodec implements Codec<Instant> { @Override public void encode(BsonWriter writer, Instant value, EncoderContext encoderContext) { writer.writeDateTime(value.toEpochMilli()); } @Override void encode(BsonWriter writer, Instant value, EncoderContext encoderContext); @Override Instant decode(BsonReader reader, DecoderContext decoderContext); @Override Class<Instant> getEncoderClass(); }
|
InstantAsDateTimeCodec implements Codec<Instant> { @Override public void encode(BsonWriter writer, Instant value, EncoderContext encoderContext) { writer.writeDateTime(value.toEpochMilli()); } @Override void encode(BsonWriter writer, Instant value, EncoderContext encoderContext); @Override Instant decode(BsonReader reader, DecoderContext decoderContext); @Override Class<Instant> getEncoderClass(); }
|
@Test public void statusHistoryResponseTest() { assertThat(underTest, is(statusHistoryResponse().withStatus(FAILED).withEffectiveDateTime(NOW))); }
|
public StatusHistoryResponse(@JsonProperty("status") FailedMessageStatus status, @JsonProperty("effectiveDateTime") Instant effectiveDateTime) { this.status = status; this.effectiveDateTime = effectiveDateTime; }
|
StatusHistoryResponse { public StatusHistoryResponse(@JsonProperty("status") FailedMessageStatus status, @JsonProperty("effectiveDateTime") Instant effectiveDateTime) { this.status = status; this.effectiveDateTime = effectiveDateTime; } }
|
StatusHistoryResponse { public StatusHistoryResponse(@JsonProperty("status") FailedMessageStatus status, @JsonProperty("effectiveDateTime") Instant effectiveDateTime) { this.status = status; this.effectiveDateTime = effectiveDateTime; } StatusHistoryResponse(@JsonProperty("status") FailedMessageStatus status,
@JsonProperty("effectiveDateTime") Instant effectiveDateTime); }
|
StatusHistoryResponse { public StatusHistoryResponse(@JsonProperty("status") FailedMessageStatus status, @JsonProperty("effectiveDateTime") Instant effectiveDateTime) { this.status = status; this.effectiveDateTime = effectiveDateTime; } StatusHistoryResponse(@JsonProperty("status") FailedMessageStatus status,
@JsonProperty("effectiveDateTime") Instant effectiveDateTime); FailedMessageStatus getStatus(); Instant getEffectiveDateTime(); @Override String toString(); }
|
StatusHistoryResponse { public StatusHistoryResponse(@JsonProperty("status") FailedMessageStatus status, @JsonProperty("effectiveDateTime") Instant effectiveDateTime) { this.status = status; this.effectiveDateTime = effectiveDateTime; } StatusHistoryResponse(@JsonProperty("status") FailedMessageStatus status,
@JsonProperty("effectiveDateTime") Instant effectiveDateTime); FailedMessageStatus getStatus(); Instant getEffectiveDateTime(); @Override String toString(); }
|
@Test public void serialiseAndDeserialiseObject() throws IOException { final String json = OBJECT_MAPPER.writeValueAsString(underTest); assertThat(OBJECT_MAPPER.readValue(json, StatusHistoryResponse.class), is(statusHistoryResponse().withStatus(FAILED).withEffectiveDateTime(NOW))); }
|
public StatusHistoryResponse(@JsonProperty("status") FailedMessageStatus status, @JsonProperty("effectiveDateTime") Instant effectiveDateTime) { this.status = status; this.effectiveDateTime = effectiveDateTime; }
|
StatusHistoryResponse { public StatusHistoryResponse(@JsonProperty("status") FailedMessageStatus status, @JsonProperty("effectiveDateTime") Instant effectiveDateTime) { this.status = status; this.effectiveDateTime = effectiveDateTime; } }
|
StatusHistoryResponse { public StatusHistoryResponse(@JsonProperty("status") FailedMessageStatus status, @JsonProperty("effectiveDateTime") Instant effectiveDateTime) { this.status = status; this.effectiveDateTime = effectiveDateTime; } StatusHistoryResponse(@JsonProperty("status") FailedMessageStatus status,
@JsonProperty("effectiveDateTime") Instant effectiveDateTime); }
|
StatusHistoryResponse { public StatusHistoryResponse(@JsonProperty("status") FailedMessageStatus status, @JsonProperty("effectiveDateTime") Instant effectiveDateTime) { this.status = status; this.effectiveDateTime = effectiveDateTime; } StatusHistoryResponse(@JsonProperty("status") FailedMessageStatus status,
@JsonProperty("effectiveDateTime") Instant effectiveDateTime); FailedMessageStatus getStatus(); Instant getEffectiveDateTime(); @Override String toString(); }
|
StatusHistoryResponse { public StatusHistoryResponse(@JsonProperty("status") FailedMessageStatus status, @JsonProperty("effectiveDateTime") Instant effectiveDateTime) { this.status = status; this.effectiveDateTime = effectiveDateTime; } StatusHistoryResponse(@JsonProperty("status") FailedMessageStatus status,
@JsonProperty("effectiveDateTime") Instant effectiveDateTime); FailedMessageStatus getStatus(); Instant getEffectiveDateTime(); @Override String toString(); }
|
@Test public void attemptingToSetNullPropertiesCreatesAnEmptyMap() { final CreateFailedMessageRequest createFailedMessageRequest = createFailedMessageRequestBuilder .withProperties(null) .build(); assertThat(createFailedMessageRequest, is(createFailedMessageRequest().withProperties(equalTo(emptyMap())))); }
|
CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; }
|
CreateFailedMessageRequest { CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; } }
|
CreateFailedMessageRequest { CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; } CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId,
@JsonProperty("brokerName") String brokerName,
@JsonProperty("destinationName") String destination,
@JsonProperty("sentAt") Instant sentAt,
@JsonProperty("failedAt") Instant failedAt,
@JsonProperty("content") String content,
@JsonProperty("properties") Map<String, Object> properties,
@JsonProperty("labels") Set<String> labels); }
|
CreateFailedMessageRequest { CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; } CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId,
@JsonProperty("brokerName") String brokerName,
@JsonProperty("destinationName") String destination,
@JsonProperty("sentAt") Instant sentAt,
@JsonProperty("failedAt") Instant failedAt,
@JsonProperty("content") String content,
@JsonProperty("properties") Map<String, Object> properties,
@JsonProperty("labels") Set<String> labels); static CreateFailedMessageRequestBuilder newCreateFailedMessageRequest(); FailedMessageId getFailedMessageId(); String getBrokerName(); String getDestinationName(); Instant getSentAt(); Instant getFailedAt(); String getContent(); Map<String, Object> getProperties(); Set<String> getLabels(); }
|
CreateFailedMessageRequest { CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; } CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId,
@JsonProperty("brokerName") String brokerName,
@JsonProperty("destinationName") String destination,
@JsonProperty("sentAt") Instant sentAt,
@JsonProperty("failedAt") Instant failedAt,
@JsonProperty("content") String content,
@JsonProperty("properties") Map<String, Object> properties,
@JsonProperty("labels") Set<String> labels); static CreateFailedMessageRequestBuilder newCreateFailedMessageRequest(); FailedMessageId getFailedMessageId(); String getBrokerName(); String getDestinationName(); Instant getSentAt(); Instant getFailedAt(); String getContent(); Map<String, Object> getProperties(); Set<String> getLabels(); }
|
@Test public void attemptingToSetNullLabelsCreatesAnEmptySet() { final CreateFailedMessageRequest createFailedMessageRequest = createFailedMessageRequestBuilder .withLabels(null) .build(); assertThat(createFailedMessageRequest, is(createFailedMessageRequest().withLabels(emptyIterable()))); }
|
CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; }
|
CreateFailedMessageRequest { CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; } }
|
CreateFailedMessageRequest { CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; } CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId,
@JsonProperty("brokerName") String brokerName,
@JsonProperty("destinationName") String destination,
@JsonProperty("sentAt") Instant sentAt,
@JsonProperty("failedAt") Instant failedAt,
@JsonProperty("content") String content,
@JsonProperty("properties") Map<String, Object> properties,
@JsonProperty("labels") Set<String> labels); }
|
CreateFailedMessageRequest { CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; } CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId,
@JsonProperty("brokerName") String brokerName,
@JsonProperty("destinationName") String destination,
@JsonProperty("sentAt") Instant sentAt,
@JsonProperty("failedAt") Instant failedAt,
@JsonProperty("content") String content,
@JsonProperty("properties") Map<String, Object> properties,
@JsonProperty("labels") Set<String> labels); static CreateFailedMessageRequestBuilder newCreateFailedMessageRequest(); FailedMessageId getFailedMessageId(); String getBrokerName(); String getDestinationName(); Instant getSentAt(); Instant getFailedAt(); String getContent(); Map<String, Object> getProperties(); Set<String> getLabels(); }
|
CreateFailedMessageRequest { CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; } CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId,
@JsonProperty("brokerName") String brokerName,
@JsonProperty("destinationName") String destination,
@JsonProperty("sentAt") Instant sentAt,
@JsonProperty("failedAt") Instant failedAt,
@JsonProperty("content") String content,
@JsonProperty("properties") Map<String, Object> properties,
@JsonProperty("labels") Set<String> labels); static CreateFailedMessageRequestBuilder newCreateFailedMessageRequest(); FailedMessageId getFailedMessageId(); String getBrokerName(); String getDestinationName(); Instant getSentAt(); Instant getFailedAt(); String getContent(); Map<String, Object> getProperties(); Set<String> getLabels(); }
|
@Test public void addProperties() { final CreateFailedMessageRequest createFailedMessageRequest = createFailedMessageRequestBuilder .withProperties(Collections.singletonMap("foo", "bar")) .withProperty("ham", "eggs") .build(); assertThat(createFailedMessageRequest, is(createFailedMessageRequest() .withProperties(allOf(Matchers.hasEntry("foo", "bar"), Matchers.hasEntry("ham", "eggs"))))); }
|
CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; }
|
CreateFailedMessageRequest { CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; } }
|
CreateFailedMessageRequest { CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; } CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId,
@JsonProperty("brokerName") String brokerName,
@JsonProperty("destinationName") String destination,
@JsonProperty("sentAt") Instant sentAt,
@JsonProperty("failedAt") Instant failedAt,
@JsonProperty("content") String content,
@JsonProperty("properties") Map<String, Object> properties,
@JsonProperty("labels") Set<String> labels); }
|
CreateFailedMessageRequest { CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; } CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId,
@JsonProperty("brokerName") String brokerName,
@JsonProperty("destinationName") String destination,
@JsonProperty("sentAt") Instant sentAt,
@JsonProperty("failedAt") Instant failedAt,
@JsonProperty("content") String content,
@JsonProperty("properties") Map<String, Object> properties,
@JsonProperty("labels") Set<String> labels); static CreateFailedMessageRequestBuilder newCreateFailedMessageRequest(); FailedMessageId getFailedMessageId(); String getBrokerName(); String getDestinationName(); Instant getSentAt(); Instant getFailedAt(); String getContent(); Map<String, Object> getProperties(); Set<String> getLabels(); }
|
CreateFailedMessageRequest { CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; } CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId,
@JsonProperty("brokerName") String brokerName,
@JsonProperty("destinationName") String destination,
@JsonProperty("sentAt") Instant sentAt,
@JsonProperty("failedAt") Instant failedAt,
@JsonProperty("content") String content,
@JsonProperty("properties") Map<String, Object> properties,
@JsonProperty("labels") Set<String> labels); static CreateFailedMessageRequestBuilder newCreateFailedMessageRequest(); FailedMessageId getFailedMessageId(); String getBrokerName(); String getDestinationName(); Instant getSentAt(); Instant getFailedAt(); String getContent(); Map<String, Object> getProperties(); Set<String> getLabels(); }
|
@Test public void addLabels() { final CreateFailedMessageRequest createFailedMessageRequest = createFailedMessageRequestBuilder .withLabels(Collections.singleton("foo")) .withLabel("bar") .build(); assertThat(createFailedMessageRequest, is(createFailedMessageRequest() .withLabels(containsInAnyOrder("foo", "bar")))); }
|
CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; }
|
CreateFailedMessageRequest { CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; } }
|
CreateFailedMessageRequest { CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; } CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId,
@JsonProperty("brokerName") String brokerName,
@JsonProperty("destinationName") String destination,
@JsonProperty("sentAt") Instant sentAt,
@JsonProperty("failedAt") Instant failedAt,
@JsonProperty("content") String content,
@JsonProperty("properties") Map<String, Object> properties,
@JsonProperty("labels") Set<String> labels); }
|
CreateFailedMessageRequest { CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; } CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId,
@JsonProperty("brokerName") String brokerName,
@JsonProperty("destinationName") String destination,
@JsonProperty("sentAt") Instant sentAt,
@JsonProperty("failedAt") Instant failedAt,
@JsonProperty("content") String content,
@JsonProperty("properties") Map<String, Object> properties,
@JsonProperty("labels") Set<String> labels); static CreateFailedMessageRequestBuilder newCreateFailedMessageRequest(); FailedMessageId getFailedMessageId(); String getBrokerName(); String getDestinationName(); Instant getSentAt(); Instant getFailedAt(); String getContent(); Map<String, Object> getProperties(); Set<String> getLabels(); }
|
CreateFailedMessageRequest { CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId, @JsonProperty("brokerName") String brokerName, @JsonProperty("destinationName") String destination, @JsonProperty("sentAt") Instant sentAt, @JsonProperty("failedAt") Instant failedAt, @JsonProperty("content") String content, @JsonProperty("properties") Map<String, Object> properties, @JsonProperty("labels") Set<String> labels) { this.failedMessageId = failedMessageId; this.brokerName = brokerName; this.destination = destination; this.sentAt = sentAt; this.failedAt = failedAt; this.content = content; this.properties = properties; this.labels = labels; } CreateFailedMessageRequest(@JsonProperty("failedMessageId") FailedMessageId failedMessageId,
@JsonProperty("brokerName") String brokerName,
@JsonProperty("destinationName") String destination,
@JsonProperty("sentAt") Instant sentAt,
@JsonProperty("failedAt") Instant failedAt,
@JsonProperty("content") String content,
@JsonProperty("properties") Map<String, Object> properties,
@JsonProperty("labels") Set<String> labels); static CreateFailedMessageRequestBuilder newCreateFailedMessageRequest(); FailedMessageId getFailedMessageId(); String getBrokerName(); String getDestinationName(); Instant getSentAt(); Instant getFailedAt(); String getContent(); Map<String, Object> getProperties(); Set<String> getLabels(); }
|
@Test public void serialiseAndDeserialiseWithOptionalFieldsMissing() throws Exception { String json = OBJECT_MAPPER.writeValueAsString( SearchFailedMessageRequest.searchMatchingAllCriteria() .withStatus(FAILED) .build()); assertThat(OBJECT_MAPPER.readValue(json, SearchFailedMessageRequest.class), is( aSearchRequestMatchingAllCriteria() .withBroker(equalTo(Optional.empty())) .withDestination(equalTo(Optional.empty())) .withStatusMatcher(contains(FAILED)) .withNoJmsMessageId() )); }
|
public static SearchFailedMessageRequestBuilder searchMatchingAllCriteria() { return new SearchFailedMessageRequestBuilder(AND); }
|
SearchFailedMessageRequest { public static SearchFailedMessageRequestBuilder searchMatchingAllCriteria() { return new SearchFailedMessageRequestBuilder(AND); } }
|
SearchFailedMessageRequest { public static SearchFailedMessageRequestBuilder searchMatchingAllCriteria() { return new SearchFailedMessageRequestBuilder(AND); } private SearchFailedMessageRequest(@JsonProperty("broker") Optional<String> broker,
@JsonProperty("destination") Optional<String> destination,
@JsonProperty("statuses") Set<FailedMessageStatus> statuses,
@JsonProperty("content") Optional<String> content,
@JsonProperty("jmsMessageId") Optional<String> jmsMessageId,
@JsonProperty("operator") Operator operator); }
|
SearchFailedMessageRequest { public static SearchFailedMessageRequestBuilder searchMatchingAllCriteria() { return new SearchFailedMessageRequestBuilder(AND); } private SearchFailedMessageRequest(@JsonProperty("broker") Optional<String> broker,
@JsonProperty("destination") Optional<String> destination,
@JsonProperty("statuses") Set<FailedMessageStatus> statuses,
@JsonProperty("content") Optional<String> content,
@JsonProperty("jmsMessageId") Optional<String> jmsMessageId,
@JsonProperty("operator") Operator operator); static SearchFailedMessageRequestBuilder searchMatchingAllCriteria(); static SearchFailedMessageRequestBuilder searchMatchingAnyCriteria(); Optional<String> getBroker(); Optional<String> getDestination(); Set<FailedMessageStatus> getStatuses(); Optional<String> getContent(); Optional<String> getJmsMessageId(); Operator getOperator(); @Override String toString(); }
|
SearchFailedMessageRequest { public static SearchFailedMessageRequestBuilder searchMatchingAllCriteria() { return new SearchFailedMessageRequestBuilder(AND); } private SearchFailedMessageRequest(@JsonProperty("broker") Optional<String> broker,
@JsonProperty("destination") Optional<String> destination,
@JsonProperty("statuses") Set<FailedMessageStatus> statuses,
@JsonProperty("content") Optional<String> content,
@JsonProperty("jmsMessageId") Optional<String> jmsMessageId,
@JsonProperty("operator") Operator operator); static SearchFailedMessageRequestBuilder searchMatchingAllCriteria(); static SearchFailedMessageRequestBuilder searchMatchingAnyCriteria(); Optional<String> getBroker(); Optional<String> getDestination(); Set<FailedMessageStatus> getStatuses(); Optional<String> getContent(); Optional<String> getJmsMessageId(); Operator getOperator(); @Override String toString(); }
|
@Test public void serialiseAndDeserialiseWithAllFieldsPopulated() throws Exception { String json = OBJECT_MAPPER.writeValueAsString( SearchFailedMessageRequest.searchMatchingAllCriteria() .withBroker("broker") .withDestination("queue") .withStatus(FAILED) .withJmsMessageId("ID:localhost.localdomain-46765-1518703251379-5:1:1:1:1") .build()); assertThat(OBJECT_MAPPER.readValue(json, SearchFailedMessageRequest.class), is( aSearchRequestMatchingAllCriteria() .withBroker(equalTo(Optional.of("broker"))) .withDestination(equalTo(Optional.of("queue"))) .withStatusMatcher(contains(FAILED)) .withJmsMessageId("ID:localhost.localdomain-46765-1518703251379-5:1:1:1:1") )); }
|
public static SearchFailedMessageRequestBuilder searchMatchingAllCriteria() { return new SearchFailedMessageRequestBuilder(AND); }
|
SearchFailedMessageRequest { public static SearchFailedMessageRequestBuilder searchMatchingAllCriteria() { return new SearchFailedMessageRequestBuilder(AND); } }
|
SearchFailedMessageRequest { public static SearchFailedMessageRequestBuilder searchMatchingAllCriteria() { return new SearchFailedMessageRequestBuilder(AND); } private SearchFailedMessageRequest(@JsonProperty("broker") Optional<String> broker,
@JsonProperty("destination") Optional<String> destination,
@JsonProperty("statuses") Set<FailedMessageStatus> statuses,
@JsonProperty("content") Optional<String> content,
@JsonProperty("jmsMessageId") Optional<String> jmsMessageId,
@JsonProperty("operator") Operator operator); }
|
SearchFailedMessageRequest { public static SearchFailedMessageRequestBuilder searchMatchingAllCriteria() { return new SearchFailedMessageRequestBuilder(AND); } private SearchFailedMessageRequest(@JsonProperty("broker") Optional<String> broker,
@JsonProperty("destination") Optional<String> destination,
@JsonProperty("statuses") Set<FailedMessageStatus> statuses,
@JsonProperty("content") Optional<String> content,
@JsonProperty("jmsMessageId") Optional<String> jmsMessageId,
@JsonProperty("operator") Operator operator); static SearchFailedMessageRequestBuilder searchMatchingAllCriteria(); static SearchFailedMessageRequestBuilder searchMatchingAnyCriteria(); Optional<String> getBroker(); Optional<String> getDestination(); Set<FailedMessageStatus> getStatuses(); Optional<String> getContent(); Optional<String> getJmsMessageId(); Operator getOperator(); @Override String toString(); }
|
SearchFailedMessageRequest { public static SearchFailedMessageRequestBuilder searchMatchingAllCriteria() { return new SearchFailedMessageRequestBuilder(AND); } private SearchFailedMessageRequest(@JsonProperty("broker") Optional<String> broker,
@JsonProperty("destination") Optional<String> destination,
@JsonProperty("statuses") Set<FailedMessageStatus> statuses,
@JsonProperty("content") Optional<String> content,
@JsonProperty("jmsMessageId") Optional<String> jmsMessageId,
@JsonProperty("operator") Operator operator); static SearchFailedMessageRequestBuilder searchMatchingAllCriteria(); static SearchFailedMessageRequestBuilder searchMatchingAnyCriteria(); Optional<String> getBroker(); Optional<String> getDestination(); Set<FailedMessageStatus> getStatuses(); Optional<String> getContent(); Optional<String> getJmsMessageId(); Operator getOperator(); @Override String toString(); }
|
@Test public void removeDelegatesToTheDao() { when(failedMessageDao.removeFailedMessages()).thenReturn(NUMBER_OF_MESSAGES_REMOVED); underTest.removeFailedMessages(); verify(failedMessageDao).removeFailedMessages(); }
|
public void removeFailedMessages() { try { logger.info("Attempting to remove FailedMessages"); final long count = failedMessageDao.removeFailedMessages(); logger.info("Successfully removed {} messages", count); } catch (Exception e) { logger.error("Could not remove messages", e); } }
|
RemoveFailedMessageService { public void removeFailedMessages() { try { logger.info("Attempting to remove FailedMessages"); final long count = failedMessageDao.removeFailedMessages(); logger.info("Successfully removed {} messages", count); } catch (Exception e) { logger.error("Could not remove messages", e); } } }
|
RemoveFailedMessageService { public void removeFailedMessages() { try { logger.info("Attempting to remove FailedMessages"); final long count = failedMessageDao.removeFailedMessages(); logger.info("Successfully removed {} messages", count); } catch (Exception e) { logger.error("Could not remove messages", e); } } RemoveFailedMessageService(FailedMessageDao failedMessageDao); RemoveFailedMessageService(FailedMessageDao failedMessageDao, Logger logger); }
|
RemoveFailedMessageService { public void removeFailedMessages() { try { logger.info("Attempting to remove FailedMessages"); final long count = failedMessageDao.removeFailedMessages(); logger.info("Successfully removed {} messages", count); } catch (Exception e) { logger.error("Could not remove messages", e); } } RemoveFailedMessageService(FailedMessageDao failedMessageDao); RemoveFailedMessageService(FailedMessageDao failedMessageDao, Logger logger); void removeFailedMessages(); }
|
RemoveFailedMessageService { public void removeFailedMessages() { try { logger.info("Attempting to remove FailedMessages"); final long count = failedMessageDao.removeFailedMessages(); logger.info("Successfully removed {} messages", count); } catch (Exception e) { logger.error("Could not remove messages", e); } } RemoveFailedMessageService(FailedMessageDao failedMessageDao); RemoveFailedMessageService(FailedMessageDao failedMessageDao, Logger logger); void removeFailedMessages(); }
|
@Test public void exceptionsAreSwallowedAndLogged() { when(failedMessageDao.removeFailedMessages()).thenThrow(exception); underTest.removeFailedMessages(); verify(logger).error("Could not remove messages", exception); }
|
public void removeFailedMessages() { try { logger.info("Attempting to remove FailedMessages"); final long count = failedMessageDao.removeFailedMessages(); logger.info("Successfully removed {} messages", count); } catch (Exception e) { logger.error("Could not remove messages", e); } }
|
RemoveFailedMessageService { public void removeFailedMessages() { try { logger.info("Attempting to remove FailedMessages"); final long count = failedMessageDao.removeFailedMessages(); logger.info("Successfully removed {} messages", count); } catch (Exception e) { logger.error("Could not remove messages", e); } } }
|
RemoveFailedMessageService { public void removeFailedMessages() { try { logger.info("Attempting to remove FailedMessages"); final long count = failedMessageDao.removeFailedMessages(); logger.info("Successfully removed {} messages", count); } catch (Exception e) { logger.error("Could not remove messages", e); } } RemoveFailedMessageService(FailedMessageDao failedMessageDao); RemoveFailedMessageService(FailedMessageDao failedMessageDao, Logger logger); }
|
RemoveFailedMessageService { public void removeFailedMessages() { try { logger.info("Attempting to remove FailedMessages"); final long count = failedMessageDao.removeFailedMessages(); logger.info("Successfully removed {} messages", count); } catch (Exception e) { logger.error("Could not remove messages", e); } } RemoveFailedMessageService(FailedMessageDao failedMessageDao); RemoveFailedMessageService(FailedMessageDao failedMessageDao, Logger logger); void removeFailedMessages(); }
|
RemoveFailedMessageService { public void removeFailedMessages() { try { logger.info("Attempting to remove FailedMessages"); final long count = failedMessageDao.removeFailedMessages(); logger.info("Successfully removed {} messages", count); } catch (Exception e) { logger.error("Could not remove messages", e); } } RemoveFailedMessageService(FailedMessageDao failedMessageDao); RemoveFailedMessageService(FailedMessageDao failedMessageDao, Logger logger); void removeFailedMessages(); }
|
@Test public void decode() { when(bsonReader.readDateTime()).thenReturn(EPOCH_MILLI); assertThat(underTest.decode(bsonReader, decoderContext), equalTo(AN_INSTANT)); }
|
@Override public Instant decode(BsonReader reader, DecoderContext decoderContext) { return Instant.ofEpochMilli(reader.readDateTime()); }
|
InstantAsDateTimeCodec implements Codec<Instant> { @Override public Instant decode(BsonReader reader, DecoderContext decoderContext) { return Instant.ofEpochMilli(reader.readDateTime()); } }
|
InstantAsDateTimeCodec implements Codec<Instant> { @Override public Instant decode(BsonReader reader, DecoderContext decoderContext) { return Instant.ofEpochMilli(reader.readDateTime()); } }
|
InstantAsDateTimeCodec implements Codec<Instant> { @Override public Instant decode(BsonReader reader, DecoderContext decoderContext) { return Instant.ofEpochMilli(reader.readDateTime()); } @Override void encode(BsonWriter writer, Instant value, EncoderContext encoderContext); @Override Instant decode(BsonReader reader, DecoderContext decoderContext); @Override Class<Instant> getEncoderClass(); }
|
InstantAsDateTimeCodec implements Codec<Instant> { @Override public Instant decode(BsonReader reader, DecoderContext decoderContext) { return Instant.ofEpochMilli(reader.readDateTime()); } @Override void encode(BsonWriter writer, Instant value, EncoderContext encoderContext); @Override Instant decode(BsonReader reader, DecoderContext decoderContext); @Override Class<Instant> getEncoderClass(); }
|
@Test public void successfullyMarkAMessageForResending() { underTest.resendFailedMessage(FAILED_MESSAGE_ID); verify(failedMessageService).update(eq(FAILED_MESSAGE_ID), statusUpdateRequest.capture()); assertThat(statusUpdateRequest.getValue(), aStatusUpdateRequest(RESEND)); }
|
@Override public void resendFailedMessage(FailedMessageId failedMessageId) { failedMessageService.update(failedMessageId, statusUpdateRequest(RESEND)); }
|
ResendFailedMessageResource implements ResendFailedMessageClient { @Override public void resendFailedMessage(FailedMessageId failedMessageId) { failedMessageService.update(failedMessageId, statusUpdateRequest(RESEND)); } }
|
ResendFailedMessageResource implements ResendFailedMessageClient { @Override public void resendFailedMessage(FailedMessageId failedMessageId) { failedMessageService.update(failedMessageId, statusUpdateRequest(RESEND)); } ResendFailedMessageResource(FailedMessageService failedMessageService,
Clock clock); }
|
ResendFailedMessageResource implements ResendFailedMessageClient { @Override public void resendFailedMessage(FailedMessageId failedMessageId) { failedMessageService.update(failedMessageId, statusUpdateRequest(RESEND)); } ResendFailedMessageResource(FailedMessageService failedMessageService,
Clock clock); @Override void resendFailedMessage(FailedMessageId failedMessageId); @Override void resendFailedMessageWithDelay(FailedMessageId failedMessageId, Duration duration); }
|
ResendFailedMessageResource implements ResendFailedMessageClient { @Override public void resendFailedMessage(FailedMessageId failedMessageId) { failedMessageService.update(failedMessageId, statusUpdateRequest(RESEND)); } ResendFailedMessageResource(FailedMessageService failedMessageService,
Clock clock); @Override void resendFailedMessage(FailedMessageId failedMessageId); @Override void resendFailedMessageWithDelay(FailedMessageId failedMessageId, Duration duration); }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.