diff --git a/jrcc-access-spring-boot-autoconfigure/src/main/java/ca/gov/bc/open/jrccaccess/autoconfigure/plugins/rabbitmq/RedisStorageService.java b/jrcc-access-spring-boot-autoconfigure/src/main/java/ca/gov/bc/open/jrccaccess/autoconfigure/plugins/rabbitmq/RedisStorageService.java index 95d0c4c6..06f4ae1c 100644 --- a/jrcc-access-spring-boot-autoconfigure/src/main/java/ca/gov/bc/open/jrccaccess/autoconfigure/plugins/rabbitmq/RedisStorageService.java +++ b/jrcc-access-spring-boot-autoconfigure/src/main/java/ca/gov/bc/open/jrccaccess/autoconfigure/plugins/rabbitmq/RedisStorageService.java @@ -7,7 +7,7 @@ import javax.xml.bind.DatatypeConverter; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.cache.Cache.ValueWrapper; import org.springframework.cache.CacheManager; import org.springframework.data.redis.RedisConnectionFailureException; @@ -25,7 +25,7 @@ * */ @Service -@ConditionalOnProperty(name="bcgov.access.output.plugin", havingValue = "rabbitmq") +@ConditionalOnExpression("'${bcgov.access.input.plugin}' == 'rabbitmq' || '${bcgov.access.output.plugin}' == 'rabbitmq'") public class RedisStorageService implements StorageService { CacheManager cacheManager; diff --git a/jrcc-access-spring-boot-autoconfigure/src/test/java/ca/gov/bc/open/jrccaccess/autoconfigure/plugins/rabbitmq/RabbitMqDocumentInputTester.java b/jrcc-access-spring-boot-autoconfigure/src/test/java/ca/gov/bc/open/jrccaccess/autoconfigure/plugins/rabbitmq/RabbitMqDocumentInputTester.java index b6f04732..8d10d525 100644 --- a/jrcc-access-spring-boot-autoconfigure/src/test/java/ca/gov/bc/open/jrccaccess/autoconfigure/plugins/rabbitmq/RabbitMqDocumentInputTester.java +++ b/jrcc-access-spring-boot-autoconfigure/src/test/java/ca/gov/bc/open/jrccaccess/autoconfigure/plugins/rabbitmq/RabbitMqDocumentInputTester.java @@ -56,8 +56,8 @@ public class RabbitMqDocumentInputTester { public void init() throws Exception { MockitoAnnotations.initMocks(this); Mockito.doNothing().when(this.documentReadyService).Publish(Mockito.any()); - Mockito.doNothing().when(documentReadyHandlerMock).Handle(Mockito.anyString(), Mockito.anyString()); - Mockito.doThrow(ServiceUnavailableException.class).when(documentReadyHandlerMock).Handle(Mockito.anyString(), Mockito.eq(SERVICE_UNAVAILABLE_EXCEPTION)); + Mockito.doNothing().when(documentReadyHandlerMock).handle(Mockito.anyString(), Mockito.anyString()); + Mockito.doThrow(ServiceUnavailableException.class).when(documentReadyHandlerMock).handle(Mockito.anyString(), Mockito.eq(SERVICE_UNAVAILABLE_EXCEPTION)); Mockito.when(this.storageService.putString(Mockito.anyString())).thenReturn(new DocumentStorageProperties("key", "A1")); Mockito.when(rabbitMqInputProperties.getRetryCount()).thenReturn(3); @@ -134,7 +134,12 @@ public void testPutAndGetDocumentFromStorage() { TransactionInfo transactionInfo = new TransactionInfo("testfile.txt", "me", LocalDateTime.now()); - this.sutOutput.send(textContent, transactionInfo); + try { + this.sutOutput.send(textContent, transactionInfo); + } catch (ServiceUnavailableException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } sut.receiveMessage(message, null);