diff --git a/extension/spring-boot-starter-camunda-operate/src/main/java/io/camunda/operate/spring/OperateClientConfiguration.java b/extension/spring-boot-starter-camunda-operate/src/main/java/io/camunda/operate/spring/OperateClientConfiguration.java index db8a601..f5054c7 100644 --- a/extension/spring-boot-starter-camunda-operate/src/main/java/io/camunda/operate/spring/OperateClientConfiguration.java +++ b/extension/spring-boot-starter-camunda-operate/src/main/java/io/camunda/operate/spring/OperateClientConfiguration.java @@ -57,7 +57,7 @@ public CloseableHttpClient operateHttpClient() { @Bean @ConditionalOnMissingBean - public Authentication authentication() { + public Authentication operateAuthentication() { if (properties.profile() == null) { throw new IllegalStateException("'operate.client.profile' is required"); } diff --git a/extension/spring-boot-starter-camunda-operate/src/test/java/io/camunda/operate/spring/BeanNameTest.java b/extension/spring-boot-starter-camunda-operate/src/test/java/io/camunda/operate/spring/BeanNameTest.java new file mode 100644 index 0000000..79f11ab --- /dev/null +++ b/extension/spring-boot-starter-camunda-operate/src/test/java/io/camunda/operate/spring/BeanNameTest.java @@ -0,0 +1,34 @@ +package io.camunda.operate.spring; + +import static org.assertj.core.api.Assertions.*; + +import io.camunda.operate.CamundaOperateClient; +import io.camunda.operate.CamundaOperateClientConfiguration; +import io.camunda.operate.auth.Authentication; +import java.util.stream.Stream; +import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; +import org.junit.jupiter.api.DynamicTest; +import org.junit.jupiter.api.TestFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.ApplicationContext; + +@SpringBootTest(properties = "operate.client.profile=simple") +public class BeanNameTest { + @Autowired ApplicationContext applicationContext; + + @TestFactory + Stream shouldHaveBeanName() { + return Stream.of( + applicationContext.getBeanNamesForType(Authentication.class), + applicationContext.getBeanNamesForType(CamundaOperateClient.class), + applicationContext.getBeanNamesForType(CloseableHttpClient.class), + applicationContext.getBeanNamesForType(CamundaOperateClientConfiguration.class)) + .map(s -> DynamicTest.dynamicTest(s[0], () -> testBeanName(s))); + } + + private void testBeanName(String[] beanNames) { + assertThat(beanNames).hasSize(1); + assertThat(beanNames[0]).containsIgnoringCase("operate"); + } +}