diff --git a/README.md b/README.md index ea2da2b5a..5de94e33f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,8 @@ | Version | Number | Status | | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------- | -| Spring Bot (Spring Boot V3) | [![Maven Central](https://img.shields.io/maven-central/v/org.finos.springbot/spring-bot)](https://search.maven.org/search?q=org.finos.springbot) | ![build](https://github.com/finos/spring-bot/actions/workflows/build.yml/badge.svg) | +| Spring Bot (Spring Boot V4) | [![Maven Central](https://img.shields.io/maven-central/v/org.finos.springbot/spring-bot)](https://search.maven.org/search?q=org.finos.springbot) | ![build](https://github.com/finos/spring-bot/actions/workflows/build.yml/badge.svg) | +| Spring Bot (Spring Boot V3) | [![Maven Central](https://img.shields.io/maven-central/v/org.finos.springbot/spring-bot?versionPrefix=10)](https://search.maven.org/search?q=org.finos.springbot) | ![build](https://github.com/finos/spring-bot/actions/workflows/build.yml/badge.svg) | | Spring Bot (Spring Boot V2) | [![Maven Central](https://img.shields.io/maven-central/v/org.finos.springbot/spring-bot?versionPrefix=9)](https://search.maven.org/search?q=org.finos.springbot) | ![build](https://github.com/finos/spring-bot/actions/workflows/build.yml/badge.svg) | | Symphony Java Toolkit | [![Maven Central](https://img.shields.io/maven-central/v/org.finos.symphony.toolkit/symphony-java-toolkit)](https://search.maven.org/search?q=org.finos.symphony.toolkit) | ![build](https://github.com/finos/spring-bot/actions/workflows/build.yml/badge.svg?branch=symphony-java-toolkit-master) | @@ -159,6 +160,16 @@ mvn -DskipTests clean test source:jar javadoc:javadoc deploy -P symphony-release mvn versions:set -DnewVersion=..-SNAPSHOT -DartifactId=\* -DgroupId=\* # then PR spring-bot-master branch with the new version number ``` +OR + +``` +#create your version tag and push that tag on spring-bot-master branch +mvn clean test +mvn versions:set -DnewVersion=.. -DartifactId=\* -DgroupId=\* +git tag .. +git push origin .. +mvn versions:set -DnewVersion=..-SNAPSHOT -DartifactId=\* -DgroupId= +``` 3. SECURITY.md diff --git a/demos/claim-bot/pom.xml b/demos/claim-bot/pom.xml index cf2e8764c..ddbf7adb8 100644 --- a/demos/claim-bot/pom.xml +++ b/demos/claim-bot/pom.xml @@ -6,7 +6,7 @@ org.finos.springbot spring-bot - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT ../.. @@ -33,12 +33,12 @@ org.finos.springbot symphony-bdk-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.finos.springbot teams-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.apache.commons diff --git a/demos/custom-help-bot/pom.xml b/demos/custom-help-bot/pom.xml index 9c000afce..d04dba4fd 100644 --- a/demos/custom-help-bot/pom.xml +++ b/demos/custom-help-bot/pom.xml @@ -7,7 +7,7 @@ org.finos.springbot spring-bot - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT ../../pom.xml @@ -29,13 +29,13 @@ org.finos.springbot symphony-bdk-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT compile org.finos.springbot teams-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT compile diff --git a/demos/demo-bot/pom.xml b/demos/demo-bot/pom.xml index 3316b1647..c61db86bf 100644 --- a/demos/demo-bot/pom.xml +++ b/demos/demo-bot/pom.xml @@ -7,7 +7,7 @@ org.finos.springbot spring-bot - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT ../../pom.xml @@ -28,13 +28,13 @@ org.finos.springbot symphony-bdk-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT compile org.finos.springbot teams-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT compile diff --git a/demos/rooms-bot/pom.xml b/demos/rooms-bot/pom.xml index 93d07af8f..8e8dd76e0 100644 --- a/demos/rooms-bot/pom.xml +++ b/demos/rooms-bot/pom.xml @@ -6,7 +6,7 @@ org.finos.springbot spring-bot - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT ../../pom.xml @@ -23,12 +23,12 @@ org.finos.springbot symphony-bdk-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.finos.springbot teams-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT diff --git a/demos/todo-bot/pom.xml b/demos/todo-bot/pom.xml index ec4103c52..5b8e26a44 100644 --- a/demos/todo-bot/pom.xml +++ b/demos/todo-bot/pom.xml @@ -6,7 +6,7 @@ org.finos.springbot spring-bot - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT ../.. @@ -23,12 +23,12 @@ org.finos.springbot symphony-bdk-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.finos.springbot teams-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.apache.commons diff --git a/libs/chat-workflow-coverage/pom.xml b/libs/chat-workflow-coverage/pom.xml index 3b3b31adf..ed19ff536 100644 --- a/libs/chat-workflow-coverage/pom.xml +++ b/libs/chat-workflow-coverage/pom.xml @@ -10,7 +10,7 @@ org.finos.springbot spring-bot - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT ../.. @@ -56,32 +56,32 @@ org.finos.springbot chat-workflow - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.finos.springbot chat-workflow-testing - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.finos.springbot symphony-bdk-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.finos.springbot teams-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.finos.springbot entity-json - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.finos.springbot entities - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT diff --git a/libs/chat-workflow-testing/pom.xml b/libs/chat-workflow-testing/pom.xml index e80a3363a..53e2df74f 100644 --- a/libs/chat-workflow-testing/pom.xml +++ b/libs/chat-workflow-testing/pom.xml @@ -9,7 +9,7 @@ org.finos.springbot spring-bot - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT ../.. @@ -22,7 +22,7 @@ org.finos.springbot chat-workflow - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT diff --git a/libs/chat-workflow-testing/src/test/java/org/finos/springbot/workflow/tables/TestTableEdit.java b/libs/chat-workflow-testing/src/test/java/org/finos/springbot/workflow/tables/TestTableEdit.java index b0e3ae1e6..ac5d66dac 100644 --- a/libs/chat-workflow-testing/src/test/java/org/finos/springbot/workflow/tables/TestTableEdit.java +++ b/libs/chat-workflow-testing/src/test/java/org/finos/springbot/workflow/tables/TestTableEdit.java @@ -27,8 +27,8 @@ import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.validation.Validator; /** @@ -46,7 +46,7 @@ public class TestTableEdit { private TestObjects to; private EntityJson toWrapper; - @MockBean + @MockitoBean Validator v; @Autowired @@ -58,7 +58,7 @@ public class TestTableEdit { @Autowired TableAddRow addRows; - @MockBean + @MockitoBean ResponseHandlers rh; Chat room = null; diff --git a/libs/chat-workflow/pom.xml b/libs/chat-workflow/pom.xml index fae2e6449..04dae3253 100644 --- a/libs/chat-workflow/pom.xml +++ b/libs/chat-workflow/pom.xml @@ -11,7 +11,7 @@ org.finos.springbot spring-bot - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT ../.. @@ -33,7 +33,7 @@ org.finos.springbot entity-json - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.springframework.boot @@ -49,7 +49,15 @@ org.springframework.boot spring-boot-starter-test test - + + + com.fasterxml.jackson.datatype + jackson-datatype-jsr310 + + + org.springframework + spring-web + diff --git a/libs/entity-json/pom.xml b/libs/entity-json/pom.xml index f3d527cd5..7ebaa2aa1 100644 --- a/libs/entity-json/pom.xml +++ b/libs/entity-json/pom.xml @@ -10,7 +10,7 @@ org.finos.springbot spring-bot - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT ../.. diff --git a/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/pom.xml b/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/pom.xml index 8960ec535..445fadb39 100644 --- a/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/pom.xml +++ b/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/pom.xml @@ -9,7 +9,7 @@ org.finos.springbot spring-bot - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT ../../.. @@ -22,12 +22,12 @@ org.finos.springbot chat-workflow - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.finos.springbot entities - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.finos.symphony.bdk @@ -43,7 +43,7 @@ org.finos.springbot chat-workflow-testing - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT test diff --git a/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/symphony/SymphonyMockConfiguration.java b/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/symphony/SymphonyMockConfiguration.java index e436498ee..700e39c47 100644 --- a/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/symphony/SymphonyMockConfiguration.java +++ b/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/symphony/SymphonyMockConfiguration.java @@ -1,6 +1,9 @@ package org.finos.springbot.symphony; -import static org.mockito.Mockito.when; +import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.ArgumentMatchers.anyString; +import static org.mockito.ArgumentMatchers.eq; +import static org.mockito.Mockito.doReturn; import java.util.Arrays; import java.util.Collections; @@ -8,11 +11,9 @@ import org.finos.springbot.tests.controller.AbstractHandlerMappingTest; import org.finos.springbot.tests.controller.OurController; import org.mockito.Mockito; -import org.springframework.beans.factory.InitializingBean; import org.springframework.boot.test.context.TestConfiguration; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.boot.test.mock.mockito.MockReset; import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Primary; import org.springframework.validation.beanvalidation.LocalValidatorFactoryBean; import com.symphony.bdk.core.auth.AuthSession; @@ -31,98 +32,86 @@ @TestConfiguration -public class SymphonyMockConfiguration implements InitializingBean { +public class SymphonyMockConfiguration { - @MockBean(reset = MockReset.NONE) - StreamService streamsApi; - - @MockBean(reset = MockReset.NONE) - UserService usersApi; - - @MockBean(reset = MockReset.NONE) - AuthSession authSession; - - @MockBean - DatafeedLoop datafeedLoop; - - @MockBean - SessionService sessionApi; - - @Bean - public LocalValidatorFactoryBean localValidatorFactoryBean() { - return new LocalValidatorFactoryBean(); - } - - - - @Bean - public OurController ourController() { - return new OurController(); - } - - public void mockSessionApi() { - Mockito.when(sessionApi.getSession()).thenReturn( - new UserV2() - .emailAddress(AbstractHandlerMappingTest.BOT_EMAIL) - .id(AbstractHandlerMappingTest.BOT_ID)); - } - - public void mockStreamsApi() { - Mockito.when(streamsApi.create(Mockito.anyList())) - .thenReturn(new Stream().id(AbstractHandlerMappingTest.CHAT_ID)); - - Mockito.when(streamsApi.getRoomInfo(Mockito.eq(AbstractHandlerMappingTest.CHAT_ID))) - .thenReturn(new V3RoomDetail() - .roomAttributes(new V3RoomAttributes().name(OurController.SOME_ROOM))); - - Mockito.when(streamsApi.listRoomMembers(Mockito.anyString())) - .thenReturn(Arrays.asList( - new MemberInfo().id(AbstractHandlerMappingTest.BOT_ID).owner(false), - new MemberInfo().id(AbstractHandlerMappingTest.ROB_EXAMPLE_ID).owner(true))); - - } - - public void mockUsersApi() { - UserV2 botUser = new UserV2() - .username(AbstractHandlerMappingTest.BOT_NAME) - .displayName(AbstractHandlerMappingTest.BOT_NAME) - .emailAddress(AbstractHandlerMappingTest.BOT_EMAIL) - .id(AbstractHandlerMappingTest.BOT_ID); + // Provide explicit lenient Mockito mocks with unique names and pre-stubbed behavior + @Bean(name = "mockStreamService") + @Primary + public StreamService streamsApi() { + StreamService mock = Mockito.mock(StreamService.class, Mockito.withSettings().lenient()); + // Adjust to if your BDK uses List + doReturn(new Stream().id(AbstractHandlerMappingTest.CHAT_ID)) + .when(mock).create(org.mockito.ArgumentMatchers.anyList()); + doReturn(new V3RoomDetail().roomAttributes(new V3RoomAttributes().name(OurController.SOME_ROOM))) + .when(mock).getRoomInfo(anyString()); + doReturn(Arrays.asList( + new MemberInfo().id(AbstractHandlerMappingTest.BOT_ID).owner(false), + new MemberInfo().id(AbstractHandlerMappingTest.ROB_EXAMPLE_ID).owner(true))) + .when(mock).listRoomMembers(anyString()); + return mock; + } - UserV2 robUser = new UserV2() - .username(AbstractHandlerMappingTest.ROB_NAME) - .displayName(AbstractHandlerMappingTest.ROB_NAME) - .emailAddress(AbstractHandlerMappingTest.ROB_EXAMPLE_EMAIL) - .id(AbstractHandlerMappingTest.ROB_EXAMPLE_ID); - - when(usersApi.listUsersByEmails(Mockito.eq(Collections.singletonList(AbstractHandlerMappingTest.BOT_EMAIL)), Mockito.anyBoolean(), Mockito.anyBoolean())) - .thenReturn(Collections.singletonList(botUser)); - - when(usersApi.listUsersByEmails(Mockito.eq(Collections.singletonList(AbstractHandlerMappingTest.ROB_EXAMPLE_EMAIL)), Mockito.anyBoolean(), Mockito.anyBoolean())) - .thenReturn(Collections.singletonList(robUser)); - - when(usersApi.listUsersByIds(Mockito.eq(Collections.singletonList(AbstractHandlerMappingTest.BOT_ID)), Mockito.anyBoolean(), Mockito.anyBoolean())) - .thenReturn(Collections.singletonList(botUser)); - - when(usersApi.listUsersByIds(Mockito.eq(Collections.singletonList(AbstractHandlerMappingTest.ROB_EXAMPLE_ID)), Mockito.anyBoolean(), Mockito.anyBoolean())) - .thenReturn(Collections.singletonList(robUser)); - - when(usersApi.getUserDetail(Mockito.anyLong())) - .thenReturn(new V2UserDetail() - .userSystemInfo(new UserSystemInfo().id(AbstractHandlerMappingTest.ROB_EXAMPLE_ID)) - .userAttributes(new V2UserAttributes() - .displayName(AbstractHandlerMappingTest.ROB_NAME) - .emailAddress(AbstractHandlerMappingTest.ROB_EXAMPLE_EMAIL))); - - - } + @Bean(name = "mockUserService") + @Primary + public UserService usersApi() { + UserService mock = Mockito.mock(UserService.class, Mockito.withSettings().lenient()); + UserV2 botUser = new UserV2() + .username(AbstractHandlerMappingTest.BOT_NAME) + .displayName(AbstractHandlerMappingTest.BOT_NAME) + .emailAddress(AbstractHandlerMappingTest.BOT_EMAIL) + .id(AbstractHandlerMappingTest.BOT_ID); + UserV2 robUser = new UserV2() + .username(AbstractHandlerMappingTest.ROB_NAME) + .displayName(AbstractHandlerMappingTest.ROB_NAME) + .emailAddress(AbstractHandlerMappingTest.ROB_EXAMPLE_EMAIL) + .id(AbstractHandlerMappingTest.ROB_EXAMPLE_ID); + doReturn(Collections.singletonList(botUser)) + .when(mock).listUsersByEmails(eq(Collections.singletonList(AbstractHandlerMappingTest.BOT_EMAIL)), Mockito.anyBoolean(), Mockito.anyBoolean()); + doReturn(Collections.singletonList(robUser)) + .when(mock).listUsersByEmails(eq(Collections.singletonList(AbstractHandlerMappingTest.ROB_EXAMPLE_EMAIL)), Mockito.anyBoolean(), Mockito.anyBoolean()); + doReturn(Collections.singletonList(botUser)) + .when(mock).listUsersByIds(eq(Collections.singletonList(AbstractHandlerMappingTest.BOT_ID)), Mockito.anyBoolean(), Mockito.anyBoolean()); + doReturn(Collections.singletonList(robUser)) + .when(mock).listUsersByIds(eq(Collections.singletonList(AbstractHandlerMappingTest.ROB_EXAMPLE_ID)), Mockito.anyBoolean(), Mockito.anyBoolean()); + doReturn(new V2UserDetail() + .userSystemInfo(new UserSystemInfo().id(AbstractHandlerMappingTest.ROB_EXAMPLE_ID)) + .userAttributes(new V2UserAttributes() + .displayName(AbstractHandlerMappingTest.ROB_NAME) + .emailAddress(AbstractHandlerMappingTest.ROB_EXAMPLE_EMAIL))) + .when(mock).getUserDetail(anyLong()); + return mock; + } + @Bean(name = "mockSessionService") + @Primary + public SessionService sessionApi() { + SessionService mock = Mockito.mock(SessionService.class, Mockito.withSettings().lenient()); + doReturn(new UserV2() + .emailAddress(AbstractHandlerMappingTest.BOT_EMAIL) + .id(AbstractHandlerMappingTest.BOT_ID)) + .when(mock).getSession(); + return mock; + } - @Override - public void afterPropertiesSet() throws Exception { - mockStreamsApi(); - mockUsersApi(); - mockSessionApi(); - } + @Bean(name = "mockAuthSession") + @Primary + public AuthSession authSession() { + return Mockito.mock(AuthSession.class, Mockito.withSettings().lenient()); + } + @Bean(name = "mockDatafeedLoop") + @Primary + public DatafeedLoop datafeedLoop() { + return Mockito.mock(DatafeedLoop.class, Mockito.withSettings().lenient()); + } + + @Bean + public LocalValidatorFactoryBean localValidatorFactoryBean() { + return new LocalValidatorFactoryBean(); + } + + @Bean + public OurController ourController() { + return new OurController(); + } } \ No newline at end of file diff --git a/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/symphony/controller/SymphonyHandlerMappingTest.java b/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/symphony/controller/SymphonyHandlerMappingTest.java index 901708800..b1e8383e2 100644 --- a/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/symphony/controller/SymphonyHandlerMappingTest.java +++ b/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/symphony/controller/SymphonyHandlerMappingTest.java @@ -31,8 +31,8 @@ import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.util.StreamUtils; import com.fasterxml.jackson.core.JsonProcessingException; @@ -70,7 +70,7 @@ public class SymphonyHandlerMappingTest extends AbstractHandlerMappingTest { @Autowired EntityJsonConverter ejc; - @MockBean + @MockitoBean MessageService messagesApi; @Autowired diff --git a/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/symphony/conversations/SymphonyConversationsTest.java b/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/symphony/conversations/SymphonyConversationsTest.java index 4da818fb6..2a8e9c1c2 100644 --- a/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/symphony/conversations/SymphonyConversationsTest.java +++ b/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/symphony/conversations/SymphonyConversationsTest.java @@ -19,7 +19,6 @@ import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.ActiveProfiles; import com.symphony.bdk.core.service.message.MessageService; @@ -35,6 +34,7 @@ import com.symphony.bdk.gen.api.model.V3RoomAttributes; import com.symphony.bdk.gen.api.model.V3RoomDetail; import com.symphony.bdk.gen.api.model.V3RoomSearchResults; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @SpringBootTest(classes = { SymphonyMockConfiguration.class, @@ -46,10 +46,10 @@ public class SymphonyConversationsTest { @Autowired SymphonyConversationsImpl ruBuilder; - @MockBean + @MockitoBean StreamService streamsApi; - @MockBean + @MockitoBean MessageService messagesApi; @Test diff --git a/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/symphony/history/HistoryTest.java b/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/symphony/history/HistoryTest.java index 416408b57..551f3a528 100644 --- a/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/symphony/history/HistoryTest.java +++ b/libs/symphony-bdk/symphony-bdk-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/symphony/history/HistoryTest.java @@ -15,13 +15,13 @@ import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.test.context.ActiveProfiles; import com.symphony.bdk.core.service.message.MessageService; import com.symphony.bdk.core.service.pagination.model.PaginationAttribute; import com.symphony.bdk.gen.api.model.MessageSearchQuery; import com.symphony.bdk.gen.api.model.V4Message; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @SpringBootTest(classes = { SymphonyMockConfiguration.class, @@ -36,7 +36,7 @@ public class HistoryTest { @Autowired EntityJsonConverter ejc; - @MockBean + @MockitoBean MessageService messagesApi; @Test diff --git a/libs/symphony/entities/pom.xml b/libs/symphony/entities/pom.xml index 8612a8f5e..1e9ec8927 100644 --- a/libs/symphony/entities/pom.xml +++ b/libs/symphony/entities/pom.xml @@ -10,7 +10,7 @@ org.finos.springbot spring-bot - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT ../../.. @@ -23,7 +23,7 @@ org.finos.springbot entity-json - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/pom.xml b/libs/teams/teams-chat-workflow-spring-boot-starter/pom.xml index a50bd5198..ba85a639c 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/pom.xml +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/pom.xml @@ -9,7 +9,7 @@ org.finos.springbot spring-bot - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT ../../.. @@ -20,35 +20,11 @@ - - - io.netty - netty-codec - ${netty-codec.version} - - - - io.netty - netty-codec-http - ${netty-codec-http.version} - - - org.apache.commons - commons-lang3 - ${commons-lang3.version} - - org.finos.springbot chat-workflow - 10.0.4-SNAPSHOT - - - - com.microsoft.azure - msal4j - ${azure-msal4j.version} + 11.0.0-SNAPSHOT @@ -135,7 +111,7 @@ org.finos.springbot chat-workflow-testing - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT test diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/templating/thymeleaf/ThymeleafEngineConfig.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/templating/thymeleaf/ThymeleafEngineConfig.java index 80fb2e171..15213c236 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/templating/thymeleaf/ThymeleafEngineConfig.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/main/java/org/finos/springbot/teams/templating/thymeleaf/ThymeleafEngineConfig.java @@ -2,9 +2,8 @@ import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration; -import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.thymeleaf.autoconfigure.ThymeleafProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/content/TeamsHTMLParserTest.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/content/TeamsHTMLParserTest.java index 927fa4299..a36142461 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/content/TeamsHTMLParserTest.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/content/TeamsHTMLParserTest.java @@ -19,10 +19,10 @@ import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import com.fasterxml.jackson.databind.ObjectMapper; import com.microsoft.bot.schema.Entity; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @SpringBootTest(classes = { TeamsContentConfig.class, @@ -32,7 +32,7 @@ public class TeamsHTMLParserTest { @Autowired TeamsHTMLParser parser; - @MockBean + @MockitoBean TeamsConversations tc; @Test diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/controller/BotControllerTest.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/controller/BotControllerTest.java index 5d12388c1..7b211fbf1 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/controller/BotControllerTest.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/controller/BotControllerTest.java @@ -13,6 +13,7 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; @@ -26,19 +27,19 @@ @SpringBootTest(classes = { MockTeamsConfiguration.class}) @ActiveProfiles("teams") -@ExtendWith(SpringExtension.class) +@ExtendWith(MockitoExtension.class) public class BotControllerTest { @Mock BotFrameworkHttpAdapter adapter; - + @Spy Bot bot; - + @InjectMocks BotController controller; - - + + @SuppressWarnings({ "deprecation" }) @Test public void testIncoming() throws InterruptedException, ExecutionException { @@ -46,12 +47,12 @@ public void testIncoming() throws InterruptedException, ExecutionException { InvokeResponse ir = new InvokeResponse(HttpStatus.OK.value(), "Success"); Mockito.when(adapter.processIncomingActivity("any text", a, bot)).thenReturn(CompletableFuture.completedFuture(ir)); CompletableFuture> future = controller.incoming(a, "any text"); - + ResponseEntity entity = future.get(); - - Assertions.assertEquals(200, entity.getStatusCodeValue()); + + Assertions.assertEquals(200, entity.getStatusCode().value()); Assertions.assertEquals("Success", entity.getBody()); - + } - -} + +} \ No newline at end of file diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/controller/ChannelServiceControllerTest.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/controller/ChannelServiceControllerTest.java index 1b443bcf7..cea7558a8 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/controller/ChannelServiceControllerTest.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/controller/ChannelServiceControllerTest.java @@ -19,6 +19,7 @@ import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.ResponseEntity; import org.springframework.test.context.ActiveProfiles; @@ -37,191 +38,179 @@ @SpringBootTest(classes = { MockTeamsConfiguration.class, TeamsWorkflowConfig.class, DataHandlerConfig.class }) @ActiveProfiles("teams") -@ExtendWith(SpringExtension.class) +@ExtendWith(MockitoExtension.class) public class ChannelServiceControllerTest { - @Mock - ChannelServiceHandler handler; - - @InjectMocks - ChannelServiceController controller = new ChannelServiceController(handler) {};; - - @Mock - TeamsResponseHandler teamsResponseHandler; - - ResourceResponse rr; - - Activity a; - - @BeforeEach - public void setup() { - controller = new ChannelServiceController(handler) {}; - a = Mockito.mock(Activity.class); - TeamsUser tu = new TeamsUser("made", "up", "thing"); - MessageResponse r = new MessageResponse(tu, "Some object"); - rr = Mockito.mock(ResourceResponse.class); - - Mockito.when(teamsResponseHandler.apply(r)).thenReturn(rr); - } - - @SuppressWarnings({ "deprecation" }) - @Test - public void testSendToConversation() throws InterruptedException, ExecutionException { - - Mockito.when(handler.handleSendToConversation("any text","conversation Id", a)).thenReturn(CompletableFuture.completedFuture(rr)); - CompletableFuture> future = controller.sendToConversation("conversation Id", a, "any text"); - ResponseEntity entity = future.get(); - - Assertions.assertEquals(200, entity.getStatusCodeValue()); - } - - @SuppressWarnings({ "deprecation" }) - @Test - public void testReplyToActivity() throws InterruptedException, ExecutionException { - Mockito.when(handler.handleReplyToActivity("any text","conversation Id", "activityId", a)).thenReturn(CompletableFuture.completedFuture(rr)); - CompletableFuture> future = controller.replyToActivity("conversation Id", "activityId", a, "any text"); - ResponseEntity entity = future.get(); - - Assertions.assertEquals(200, entity.getStatusCodeValue()); - } - - @SuppressWarnings({ "deprecation" }) - @Test - public void testUpdateActivity() throws InterruptedException, ExecutionException { - Mockito.when(handler.handleUpdateActivity("any text","conversation Id", "activityId", a)).thenReturn(CompletableFuture.completedFuture(rr)); - CompletableFuture> future = controller.updateActivity("conversation Id", "activityId", a, "any text"); - ResponseEntity entity = future.get(); - - Assertions.assertEquals(200, entity.getStatusCodeValue()); - } - - @SuppressWarnings({ "deprecation" }) - @Test - public void testDeleteActivity() throws InterruptedException, ExecutionException { - - Void vo = Mockito.mock(Void.class); - - Mockito.when(handler.handleDeleteActivity("any text","conversation Id", "activityId")).thenReturn(CompletableFuture.completedFuture(vo)); - CompletableFuture> future = controller.deleteActivity("conversation Id", "activityId", "any text"); - ResponseEntity entity = future.get(); - - Assertions.assertEquals(202, entity.getStatusCodeValue()); - } - - @SuppressWarnings({ "deprecation" }) - @Test - public void testGetActivityMembers() throws InterruptedException, ExecutionException { - - List accounts = Mockito.mock(List.class); - - Mockito.when(handler.handleGetActivityMembers("any text","conversation Id", "activityId")).thenReturn(CompletableFuture.completedFuture(accounts)); - CompletableFuture>> future = controller.getActivityMembers("conversation Id", "activityId", "any text"); - ResponseEntity> entity = future.get(); - - Assertions.assertEquals(200, entity.getStatusCodeValue()); - } - - @SuppressWarnings({ "deprecation" }) - @Test - public void testCreateConversation() throws InterruptedException, ExecutionException { - - ConversationResourceResponse r = Mockito.mock(ConversationResourceResponse.class); - - ConversationParameters parameters = new ConversationParameters(); - - Mockito.when(handler.handleCreateConversation("any text", parameters)).thenReturn(CompletableFuture.completedFuture(r)); - - CompletableFuture> future = controller.createConversation(parameters, "any text"); - ResponseEntity entity = future.get(); - - Assertions.assertEquals(200, entity.getStatusCodeValue()); - } - - @SuppressWarnings({ "deprecation" }) - @Test - public void testGetConversations() throws InterruptedException, ExecutionException { - - ConversationsResult r = Mockito.mock(ConversationsResult.class); - - Mockito.when(handler.handleGetConversations("any text", "conversation Id", "activityId")).thenReturn(CompletableFuture.completedFuture(r)); - - CompletableFuture> future = controller.getConversations("conversation Id", "activityId", "any text"); - ResponseEntity entity = future.get(); - - Assertions.assertEquals(200, entity.getStatusCodeValue()); - } - - @SuppressWarnings({ "deprecation" }) - @Test - public void testGetConversationMembers() throws InterruptedException, ExecutionException { - - List r = Mockito.mock(List.class); - - Mockito.when(handler.handleGetConversationMembers("any text", "conversation Id")).thenReturn(CompletableFuture.completedFuture(r)); - - CompletableFuture>> future = controller.getConversationMembers("conversation Id", "any text"); - ResponseEntity> entity = future.get(); - - Assertions.assertEquals(200, entity.getStatusCodeValue()); - } - - @SuppressWarnings({ "deprecation" }) - @Test - public void testGetConversationPagedMembers() throws InterruptedException, ExecutionException { - - PagedMembersResult r = Mockito.mock(PagedMembersResult.class); - - Mockito.when(handler.handleGetConversationPagedMembers("any text", "conversation Id", 1, "activityId")).thenReturn(CompletableFuture.completedFuture(r)); - - CompletableFuture> future = controller.getConversationPagedMembers("conversation Id", 1, "activityId", "any text"); - ResponseEntity entity = future.get(); - - Assertions.assertEquals(200, entity.getStatusCodeValue()); - } - - @SuppressWarnings({ "deprecation" }) - @Test - public void testDeleteConversationMember() throws InterruptedException, ExecutionException { - - Void r = Mockito.mock(Void.class); - - Mockito.when(handler.handleDeleteConversationMember("any text", "conversation Id", "Member Id")).thenReturn(CompletableFuture.completedFuture(r)); - - CompletableFuture> future = controller.deleteConversationMember("conversation Id", "Member Id", "any text"); - ResponseEntity entity = future.get(); - - Assertions.assertEquals(202, entity.getStatusCodeValue()); - } - - @SuppressWarnings({ "deprecation" }) - @Test - public void testSendConversationHistory() throws InterruptedException, ExecutionException { - - ResourceResponse r = Mockito.mock(ResourceResponse.class); - - Transcript history = new Transcript(); - - Mockito.when(handler.handleSendConversationHistory("any text", "conversation Id", history)).thenReturn(CompletableFuture.completedFuture(r)); - - CompletableFuture> future = controller.sendConversationHistory("conversation Id",history, "any text"); - ResponseEntity entity = future.get(); - - Assertions.assertEquals(200, entity.getStatusCodeValue()); - } - - @SuppressWarnings({ "deprecation" }) - @Test - public void testUploadAttachment() throws InterruptedException, ExecutionException { - - ResourceResponse r = Mockito.mock(ResourceResponse.class); - - AttachmentData attachmentUpload = new AttachmentData(); - - Mockito.when(handler.handleUploadAttachment("any text", "conversation Id", attachmentUpload)).thenReturn(CompletableFuture.completedFuture(r)); - - CompletableFuture> future = controller.uploadAttachment("conversation Id",attachmentUpload, "any text"); - ResponseEntity entity = future.get(); - - Assertions.assertEquals(200, entity.getStatusCodeValue()); - } -} + @Mock + ChannelServiceHandler handler; + + @InjectMocks + ChannelServiceController controller = new ChannelServiceController(handler) {};; + + @Mock + TeamsResponseHandler teamsResponseHandler; + + ResourceResponse rr; + + Activity a; + + @BeforeEach + public void setup() { + controller = new ChannelServiceController(handler) {}; + a = Mockito.mock(Activity.class); + TeamsUser tu = new TeamsUser("made", "up", "thing"); + MessageResponse r = new MessageResponse(tu, "Some object"); + rr = Mockito.mock(ResourceResponse.class); + + //Mockito.when(teamsResponseHandler.apply(r)).thenReturn(rr); + } + + @SuppressWarnings({ "deprecation" }) + @Test + public void testSendToConversation() throws InterruptedException, ExecutionException { + + Mockito.when(handler.handleSendToConversation("any text","conversation Id", a)).thenReturn(CompletableFuture.completedFuture(rr)); + CompletableFuture> future = controller.sendToConversation("conversation Id", a, "any text"); + ResponseEntity entity = future.get(); + + Assertions.assertEquals(200, entity.getStatusCode().value()); } + + @SuppressWarnings({ "deprecation" }) + @Test + public void testReplyToActivity() throws InterruptedException, ExecutionException { + Mockito.when(handler.handleReplyToActivity("any text","conversation Id", "activityId", a)).thenReturn(CompletableFuture.completedFuture(rr)); + CompletableFuture> future = controller.replyToActivity("conversation Id", "activityId", a, "any text"); + ResponseEntity entity = future.get(); + + Assertions.assertEquals(200, entity.getStatusCode().value()); } + + @SuppressWarnings({ "deprecation" }) + @Test + public void testUpdateActivity() throws InterruptedException, ExecutionException { + Mockito.when(handler.handleUpdateActivity("any text","conversation Id", "activityId", a)).thenReturn(CompletableFuture.completedFuture(rr)); + CompletableFuture> future = controller.updateActivity("conversation Id", "activityId", a, "any text"); + ResponseEntity entity = future.get(); + + Assertions.assertEquals(200, entity.getStatusCode().value()); } + + @SuppressWarnings({ "deprecation" }) + @Test + public void testDeleteActivity() throws InterruptedException, ExecutionException { + + Void vo = Mockito.mock(Void.class); + + Mockito.when(handler.handleDeleteActivity("any text","conversation Id", "activityId")).thenReturn(CompletableFuture.completedFuture(vo)); + CompletableFuture> future = controller.deleteActivity("conversation Id", "activityId", "any text"); + ResponseEntity entity = future.get(); + + Assertions.assertEquals(202, entity.getStatusCode().value()); } + + @SuppressWarnings({ "deprecation" }) + @Test + public void testGetActivityMembers() throws InterruptedException, ExecutionException { + + List accounts = Mockito.mock(List.class); + + Mockito.when(handler.handleGetActivityMembers("any text","conversation Id", "activityId")).thenReturn(CompletableFuture.completedFuture(accounts)); + CompletableFuture>> future = controller.getActivityMembers("conversation Id", "activityId", "any text"); + ResponseEntity> entity = future.get(); + + Assertions.assertEquals(200, entity.getStatusCode().value()); } + + @SuppressWarnings({ "deprecation" }) + @Test + public void testCreateConversation() throws InterruptedException, ExecutionException { + + ConversationResourceResponse r = Mockito.mock(ConversationResourceResponse.class); + + ConversationParameters parameters = new ConversationParameters(); + + Mockito.when(handler.handleCreateConversation("any text", parameters)).thenReturn(CompletableFuture.completedFuture(r)); + + CompletableFuture> future = controller.createConversation(parameters, "any text"); + ResponseEntity entity = future.get(); + + Assertions.assertEquals(200, entity.getStatusCode().value()); } + + @SuppressWarnings({ "deprecation" }) + @Test + public void testGetConversations() throws InterruptedException, ExecutionException { + + ConversationsResult r = Mockito.mock(ConversationsResult.class); + + Mockito.when(handler.handleGetConversations("any text", "conversation Id", "activityId")).thenReturn(CompletableFuture.completedFuture(r)); + + CompletableFuture> future = controller.getConversations("conversation Id", "activityId", "any text"); + ResponseEntity entity = future.get(); + + Assertions.assertEquals(200, entity.getStatusCode().value()); } + + @SuppressWarnings({ "deprecation" }) + @Test + public void testGetConversationMembers() throws InterruptedException, ExecutionException { + + List r = Mockito.mock(List.class); + + Mockito.when(handler.handleGetConversationMembers("any text", "conversation Id")).thenReturn(CompletableFuture.completedFuture(r)); + + CompletableFuture>> future = controller.getConversationMembers("conversation Id", "any text"); + ResponseEntity> entity = future.get(); + + Assertions.assertEquals(200, entity.getStatusCode().value()); } + + @SuppressWarnings({ "deprecation" }) + @Test + public void testGetConversationPagedMembers() throws InterruptedException, ExecutionException { + + PagedMembersResult r = Mockito.mock(PagedMembersResult.class); + + Mockito.when(handler.handleGetConversationPagedMembers("any text", "conversation Id", 1, "activityId")).thenReturn(CompletableFuture.completedFuture(r)); + + CompletableFuture> future = controller.getConversationPagedMembers("conversation Id", 1, "activityId", "any text"); + ResponseEntity entity = future.get(); + + Assertions.assertEquals(200, entity.getStatusCode().value()); } + + @SuppressWarnings({ "deprecation" }) + @Test + public void testDeleteConversationMember() throws InterruptedException, ExecutionException { + + Void r = Mockito.mock(Void.class); + + Mockito.when(handler.handleDeleteConversationMember("any text", "conversation Id", "Member Id")).thenReturn(CompletableFuture.completedFuture(r)); + + CompletableFuture> future = controller.deleteConversationMember("conversation Id", "Member Id", "any text"); + ResponseEntity entity = future.get(); + + Assertions.assertEquals(202, entity.getStatusCode().value()); } + + @SuppressWarnings({ "deprecation" }) + @Test + public void testSendConversationHistory() throws InterruptedException, ExecutionException { + + ResourceResponse r = Mockito.mock(ResourceResponse.class); + + Transcript history = new Transcript(); + + Mockito.when(handler.handleSendConversationHistory("any text", "conversation Id", history)).thenReturn(CompletableFuture.completedFuture(r)); + + CompletableFuture> future = controller.sendConversationHistory("conversation Id",history, "any text"); + ResponseEntity entity = future.get(); + + Assertions.assertEquals(200, entity.getStatusCode().value()); } + + @SuppressWarnings({ "deprecation" }) + @Test + public void testUploadAttachment() throws InterruptedException, ExecutionException { + + ResourceResponse r = Mockito.mock(ResourceResponse.class); + + AttachmentData attachmentUpload = new AttachmentData(); + + Mockito.when(handler.handleUploadAttachment("any text", "conversation Id", attachmentUpload)).thenReturn(CompletableFuture.completedFuture(r)); + + CompletableFuture> future = controller.uploadAttachment("conversation Id",attachmentUpload, "any text"); + ResponseEntity entity = future.get(); + + Assertions.assertEquals(200, entity.getStatusCode().value()); } +} \ No newline at end of file diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/controller/TeamsHandlerMappingTest.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/controller/TeamsHandlerMappingTest.java index 45336cf21..fd5e2f040 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/controller/TeamsHandlerMappingTest.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/controller/TeamsHandlerMappingTest.java @@ -34,10 +34,10 @@ import org.finos.springbot.workflow.response.WorkResponse; import org.junit.jupiter.api.Assertions; import org.mockito.ArgumentCaptor; +import org.mockito.Mock; import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.MediaType; import org.springframework.test.context.ActiveProfiles; @@ -58,6 +58,7 @@ import com.microsoft.bot.schema.teams.ChannelInfo; import com.microsoft.bot.schema.teams.FileConsentCard; import com.microsoft.bot.schema.teams.TeamsChannelData; +import org.springframework.test.context.bean.override.mockito.MockitoBean; @SpringBootTest(classes = { @@ -79,10 +80,10 @@ public class TeamsHandlerMappingTest extends AbstractHandlerMappingTest { @Autowired ChatRequestChatHandlerMapping hm; - @MockBean + @MockitoBean TeamsStateStorage th; - - @MockBean + + @MockitoBean TeamsConversations conv; @Autowired diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/handlers/TeamsResponseHandlerTest.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/handlers/TeamsResponseHandlerTest.java index bc9c78090..c641a8519 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/handlers/TeamsResponseHandlerTest.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/handlers/TeamsResponseHandlerTest.java @@ -17,9 +17,9 @@ import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.HttpStatus; import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.context.junit.jupiter.SpringExtension; import com.microsoft.bot.connector.rest.ErrorResponseException; @@ -38,10 +38,10 @@ @ExtendWith(SpringExtension.class) public class TeamsResponseHandlerTest { - @MockBean + @MockitoBean ActivityHandler ah; - @MockBean + @MockitoBean ResponseHandlers eh; @Autowired diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/handlers/retry/InMemoryRetryingActivityHandlerTest.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/handlers/retry/InMemoryRetryingActivityHandlerTest.java index 16a750dd0..ef6211fe3 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/handlers/retry/InMemoryRetryingActivityHandlerTest.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/handlers/retry/InMemoryRetryingActivityHandlerTest.java @@ -13,9 +13,9 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; -import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.http.HttpStatus; import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import org.springframework.test.context.junit.jupiter.SpringExtension; import com.microsoft.bot.connector.rest.ErrorResponseException; @@ -32,7 +32,7 @@ @ExtendWith(SpringExtension.class) public class InMemoryRetryingActivityHandlerTest { - @MockBean + @MockitoBean TeamsConversations conv; int go = 0; diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/handlers/retry/SimpleActivityHandlerTest.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/handlers/retry/SimpleActivityHandlerTest.java index e56f26b4c..a5df0a1f8 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/handlers/retry/SimpleActivityHandlerTest.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/handlers/retry/SimpleActivityHandlerTest.java @@ -5,27 +5,32 @@ import org.finos.springbot.teams.handlers.SimpleActivityHandler; import org.finos.springbot.workflow.data.DataHandlerConfig; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.boot.test.context.SpringBootTest; import com.microsoft.bot.schema.Activity; -@SpringBootTest(classes = { - DataHandlerConfig.class, - }) +import static org.mockito.Mockito.mock; + +@SpringBootTest(classes = { + DataHandlerConfig.class, +}) +@ExtendWith(MockitoExtension.class) public class SimpleActivityHandlerTest { - + @Mock TeamsConversations tc; - + @InjectMocks private SimpleActivityHandler handler = new SimpleActivityHandler(tc); - + @Test public void testHandleActivity() { - Activity activity = Mockito.mock(Activity.class); + Activity activity = mock(Activity.class); handler.handleActivity(activity , new TeamsChannel()); } -} +} \ No newline at end of file diff --git a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/messages/FileActivityHandlerTest.java b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/messages/FileActivityHandlerTest.java index 62fe48c8e..d24b11480 100644 --- a/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/messages/FileActivityHandlerTest.java +++ b/libs/teams/teams-chat-workflow-spring-boot-starter/src/test/java/org/finos/springbot/teams/messages/FileActivityHandlerTest.java @@ -14,6 +14,7 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.InjectMocks; import org.mockito.Mockito; +import org.mockito.junit.jupiter.MockitoExtension; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit.jupiter.SpringExtension; @@ -24,27 +25,27 @@ @SpringBootTest(classes = { MockTeamsConfiguration.class, TeamsWorkflowConfig.class, DataHandlerConfig.class }) @ActiveProfiles("teams") -@ExtendWith(SpringExtension.class) +@ExtendWith(MockitoExtension.class) public class FileActivityHandlerTest { - + @InjectMocks FileActivityHandler handler; - + TurnContext tc; - + @Test public void testOnTeamsFileConsentAccept() throws IOException, InterruptedException, ExecutionException { tc = Mockito.mock(TurnContext.class); - + FileConsentCardResponse f = getFileConsent(); handler.onTeamsFileConsentAccept(tc, f); } - + @Test public void testOnTeamsFileConsentDecline() throws IOException, InterruptedException, ExecutionException { tc = Mockito.mock(TurnContext.class); - + FileConsentCardResponse f = getFileConsent(); handler.onTeamsFileConsentDecline(tc, f); } @@ -52,18 +53,18 @@ public void testOnTeamsFileConsentDecline() throws IOException, InterruptedExcep private FileConsentCardResponse getFileConsent() throws IOException { FileConsentCardResponse fileConsentCardResponse = new FileConsentCardResponse(); Path file = Files.createTempFile("temp-", "sample.json"); - + Map map = new HashMap<>(); String filePath = "file://"+ file.toAbsolutePath().toString(); map.put("filepath", filePath); map.put("filename", "sample.json"); - + fileConsentCardResponse.setContext(map); FileUploadInfo uploadInfo = new FileUploadInfo(); - + uploadInfo.setUploadUrl(filePath); fileConsentCardResponse.setUploadInfo(uploadInfo); return fileConsentCardResponse; } - -} + +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index 3580da4b8..3b46d05e2 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.finos.springbot spring-bot - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT pom Spring Bot @@ -50,7 +50,7 @@ UTF-8 - 3.5.5 + 4.0.1 17 17 17 @@ -65,14 +65,10 @@ 1.16.1 1.18.0 4.5.7 - 1.21.0 1.16 4.5.13 77.1 1.81 - 3.18.0 - 4.1.126.Final - 4.1.126.Final diff --git a/tools/poll-bot/pom.xml b/tools/poll-bot/pom.xml index d4b2210f7..d389f7966 100644 --- a/tools/poll-bot/pom.xml +++ b/tools/poll-bot/pom.xml @@ -6,7 +6,7 @@ org.finos.springbot spring-bot - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT ../.. @@ -23,12 +23,12 @@ org.finos.springbot symphony-bdk-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.finos.springbot teams-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT diff --git a/tools/reminder-bot/pom.xml b/tools/reminder-bot/pom.xml index 14d988a0a..616f535f8 100644 --- a/tools/reminder-bot/pom.xml +++ b/tools/reminder-bot/pom.xml @@ -6,7 +6,7 @@ org.finos.springbot spring-bot - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT ../../pom.xml @@ -26,12 +26,12 @@ org.finos.springbot symphony-bdk-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.finos.springbot teams-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.apache.commons @@ -80,7 +80,7 @@ org.finos.springbot chat-workflow-testing - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT test diff --git a/tools/rss-bot/pom.xml b/tools/rss-bot/pom.xml index 32c5d621c..abda8c1e5 100644 --- a/tools/rss-bot/pom.xml +++ b/tools/rss-bot/pom.xml @@ -6,7 +6,7 @@ org.finos.springbot spring-bot - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT ../.. @@ -23,7 +23,7 @@ org.finos.springbot symphony-bdk-chat-workflow-spring-boot-starter - 10.0.4-SNAPSHOT + 11.0.0-SNAPSHOT org.apache.commons