Skip to content

Commit 9cc12cb

Browse files
all bean names should refer to operate (#117) (#119)
(cherry picked from commit dde8c81)
1 parent 1b0fcde commit 9cc12cb

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

extension/spring-boot-starter-camunda-operate/src/main/java/io/camunda/operate/spring/OperateClientConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public CloseableHttpClient operateHttpClient() {
5757

5858
@Bean
5959
@ConditionalOnMissingBean
60-
public Authentication authentication() {
60+
public Authentication operateAuthentication() {
6161
if (properties.profile() == null) {
6262
throw new IllegalStateException("'operate.client.profile' is required");
6363
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package io.camunda.operate.spring;
2+
3+
import static org.assertj.core.api.Assertions.*;
4+
5+
import io.camunda.operate.CamundaOperateClient;
6+
import io.camunda.operate.CamundaOperateClientConfiguration;
7+
import io.camunda.operate.auth.Authentication;
8+
import java.util.stream.Stream;
9+
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
10+
import org.junit.jupiter.api.DynamicTest;
11+
import org.junit.jupiter.api.TestFactory;
12+
import org.springframework.beans.factory.annotation.Autowired;
13+
import org.springframework.boot.test.context.SpringBootTest;
14+
import org.springframework.context.ApplicationContext;
15+
16+
@SpringBootTest(properties = "operate.client.profile=simple")
17+
public class BeanNameTest {
18+
@Autowired ApplicationContext applicationContext;
19+
20+
@TestFactory
21+
Stream<DynamicTest> shouldHaveBeanName() {
22+
return Stream.of(
23+
applicationContext.getBeanNamesForType(Authentication.class),
24+
applicationContext.getBeanNamesForType(CamundaOperateClient.class),
25+
applicationContext.getBeanNamesForType(CloseableHttpClient.class),
26+
applicationContext.getBeanNamesForType(CamundaOperateClientConfiguration.class))
27+
.map(s -> DynamicTest.dynamicTest(s[0], () -> testBeanName(s)));
28+
}
29+
30+
private void testBeanName(String[] beanNames) {
31+
assertThat(beanNames).hasSize(1);
32+
assertThat(beanNames[0]).containsIgnoringCase("operate");
33+
}
34+
}

0 commit comments

Comments
 (0)