Skip to content

Commit

Permalink
Uplift spring-boot version to 2.7.5 (#210)
Browse files Browse the repository at this point in the history
* Uplift spring-boot version to 2.7.5

* Provided the proper remrem-parent version

* changed the remrem-parent version

---------

Co-authored-by: Vishnu <[email protected]>
  • Loading branch information
vishnu-alapati and Vishnu authored Mar 28, 2023
1 parent 889a10e commit 6d62fe0
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 26 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 2.1.8
- Uplifted eiffel-remrem-parent version to 2.0.10 to inherit the latest spring-boot version.

## 2.1.7
- Degraded the spring-boot-maven-plugin version to 2.7.5
- Updated the eiffel-remrem-parent version to 2.0.9
Expand Down
8 changes: 7 additions & 1 deletion cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<exclusions>
<exclusion>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-cli</groupId>
Expand All @@ -75,7 +81,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.7.5</version>
<version>${springboot.version}</version>
<configuration>
<mainClass>com.ericsson.eiffel.remrem.generate.cli.CLI</mainClass>
<fork>true</fork>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.springframework.boot.Banner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

Expand Down Expand Up @@ -226,7 +227,7 @@ public static void main(String[] args) throws Exception {
application.addInitializers(new SpringLoggingInitializer());
application.setBannerMode(Banner.Mode.OFF);
application.setLogStartupInfo(false);
application.setWebEnvironment(false);
application.setWebApplicationType(WebApplicationType.NONE);
CLIOptions.parse(args);
application.run(args);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class CliUnitTests {

Mockito.when(msgService.generateMsg(
Mockito.anyString(),
Mockito.anyObject()
Mockito.any()
)).thenReturn("{ \"service\":\"msgService\" }");
}

Expand Down
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
<parent>
<groupId>com.github.eiffel-community</groupId>
<artifactId>eiffel-remrem-parent</artifactId>
<version>2.0.9</version>
<version>2.0.10</version>
</parent>

<properties>
<eiffel-remrem-generate.version>2.1.7</eiffel-remrem-generate.version>
<eiffel-remrem-generate.version>2.1.8</eiffel-remrem-generate.version>
<eiffel-remrem-semantics.version>2.2.4</eiffel-remrem-semantics.version>
</properties>
<artifactId>eiffel-remrem-generate</artifactId>
Expand Down Expand Up @@ -46,7 +46,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.7.5</version>
<version>${springboot.version}</version>
<configuration>
<skip>true</skip>
</configuration>
Expand Down
8 changes: 7 additions & 1 deletion service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<exclusions>
<exclusion>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
Expand Down Expand Up @@ -91,7 +97,7 @@
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.7.5</version>
<version>${springboot.version}</version>
<configuration>
<mainClass>com.ericsson.eiffel.remrem.generate.App</mainClass>
<fork>true</fork>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.WebApplicationType;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
Expand All @@ -38,7 +39,7 @@ private static void startService(String[] args) {
SpringApplication application = new SpringApplication(App.class);
application.setBannerMode(Banner.Mode.OFF);
application.setLogStartupInfo(false);
application.setWebEnvironment(true);
application.setWebApplicationType(WebApplicationType.SERVLET);
ApplicationContext ctx = application.run(args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,28 @@

import com.ericsson.eiffel.remrem.generate.constants.RemremGenerateServiceConstants;
import io.swagger.annotations.Api;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

import org.springframework.boot.actuate.autoconfigure.endpoint.web.CorsEndpointProperties;
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointProperties;
import org.springframework.boot.actuate.autoconfigure.web.server.ManagementPortType;
import org.springframework.boot.actuate.endpoint.ExposableEndpoint;
import org.springframework.boot.actuate.endpoint.web.EndpointLinksResolver;
import org.springframework.boot.actuate.endpoint.web.EndpointMapping;
import org.springframework.boot.actuate.endpoint.web.EndpointMediaTypes;
import org.springframework.boot.actuate.endpoint.web.ExposableWebEndpoint;
import org.springframework.boot.actuate.endpoint.web.WebEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.annotation.ControllerEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.annotation.ServletEndpointsSupplier;
import org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
Expand Down Expand Up @@ -48,6 +68,31 @@ public UiConfiguration uiConfig() {
null);
}

@Bean
public WebMvcEndpointHandlerMapping webEndpointServletHandlerMapping(WebEndpointsSupplier webEndpointsSupplier,
ServletEndpointsSupplier servletEndpointsSupplier, ControllerEndpointsSupplier controllerEndpointsSupplier,
EndpointMediaTypes endpointMediaTypes, CorsEndpointProperties corsProperties,
WebEndpointProperties webEndpointProperties, Environment environment) {
List<ExposableEndpoint<?>> allEndpoints = new ArrayList();
Collection<ExposableWebEndpoint> webEndpoints = webEndpointsSupplier.getEndpoints();
allEndpoints.addAll(webEndpoints);
allEndpoints.addAll(servletEndpointsSupplier.getEndpoints());
allEndpoints.addAll(controllerEndpointsSupplier.getEndpoints());
String basePath = webEndpointProperties.getBasePath();
EndpointMapping endpointMapping = new EndpointMapping(basePath);
boolean shouldRegisterLinksMapping = this.shouldRegisterLinksMapping(webEndpointProperties, environment,
basePath);
return new WebMvcEndpointHandlerMapping(endpointMapping, webEndpoints, endpointMediaTypes,
corsProperties.toCorsConfiguration(), new EndpointLinksResolver(allEndpoints, basePath),
shouldRegisterLinksMapping, null);
}

private boolean shouldRegisterLinksMapping(WebEndpointProperties webEndpointProperties, Environment environment,
String basePath) {
return webEndpointProperties.getDiscovery().isEnabled() && (StringUtils.hasText(basePath)
|| ManagementPortType.get(environment).equals(ManagementPortType.DIFFERENT));
}

private ApiInfo metaData() {
final StringBuilder remremDescription = new StringBuilder();
remremDescription.append("REMReM (REST Mailbox for Registered Messages) Generate "
Expand Down
2 changes: 2 additions & 0 deletions service/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ server.port=8080

debug: false

spring.mvc.pathmatch.matching-strategy=ANT_PATH_MATCHER

#Logging configurations

logging.level.root: INFO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class EiffelRemERLookupControllerUnitTest {
@SuppressWarnings("resource")
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
MockitoAnnotations.openMocks(this);
unit.setRestTemplate(restTemplate);

msgServices.add(service);
Expand Down Expand Up @@ -138,37 +138,37 @@ public void setUp() throws Exception {
String erlookupOptionsWithNoneFoundOutput = FileUtils
.readFileToString(new File(TEST_RESOURCES_PATH+"ErlookupOptionsWithNoneFoundOutput.json"), ENCODING);

Mockito.when(service.generateMsg(Mockito.eq("eiffelConfidenceLevelModified"), Mockito.anyObject(), Mockito.anyBoolean()))
Mockito.when(service.generateMsg(Mockito.eq("eiffelConfidenceLevelModified"), Mockito.any(), Mockito.anyBoolean()))
.thenReturn(erlookupOptionsWithNoneFoundOutput);

Mockito.when(service.generateMsg(Mockito.eq("eiffelconfidencelevel"), Mockito.anyObject(), Mockito.anyBoolean()))
Mockito.when(service.generateMsg(Mockito.eq("eiffelconfidencelevel"), Mockito.any(), Mockito.anyBoolean()))
.thenReturn(confidenceLevelOutput);

Mockito.when(service.generateMsg(Mockito.eq("eiffelartifactpublished"), Mockito.anyObject(), Mockito.anyBoolean()))
Mockito.when(service.generateMsg(Mockito.eq("eiffelartifactpublished"), Mockito.any(), Mockito.anyBoolean()))
.thenReturn(artifactPublishedOutput);

Mockito.when(service.generateMsg(Mockito.eq("eiffelcompositiondefined"), Mockito.anyObject(), Mockito.anyBoolean()))
Mockito.when(service.generateMsg(Mockito.eq("eiffelcompositiondefined"), Mockito.any(), Mockito.anyBoolean()))
.thenReturn(compositionDefinedOutput);

Mockito.when(service.generateMsg(Mockito.eq("eiffelCompositionDefined"), Mockito.anyObject(), Mockito.anyBoolean()))
Mockito.when(service.generateMsg(Mockito.eq("eiffelCompositionDefined"), Mockito.any(), Mockito.anyBoolean()))
.thenReturn(compositionDefinedSCCreatedOutput);

Mockito.when(service.generateMsg(Mockito.eq("eiffelCompositionDefinedEvent"), Mockito.anyObject(), Mockito.anyBoolean()))
Mockito.when(service.generateMsg(Mockito.eq("eiffelCompositionDefinedEvent"), Mockito.any(), Mockito.anyBoolean()))
.thenReturn(compositionDefinedSCSubmittedOutput);

Mockito.when(service.generateMsg(Mockito.eq("eiffelSCSubmitted"), Mockito.anyObject(), Mockito.anyBoolean()))
Mockito.when(service.generateMsg(Mockito.eq("eiffelSCSubmitted"), Mockito.any(), Mockito.anyBoolean()))
.thenReturn(SCSubmittedOutput);

Mockito.when(service.generateMsg(Mockito.eq("eiffelEnvironmentDefined"), Mockito.anyObject(), Mockito.anyBoolean()))
Mockito.when(service.generateMsg(Mockito.eq("eiffelEnvironmentDefined"), Mockito.any(), Mockito.anyBoolean()))
.thenReturn(erLookupWithOptionsOutput);

Mockito.when(service.generateMsg(Mockito.eq("eiffelEnvironmentDefinedEvent"), Mockito.anyObject(), Mockito.anyBoolean()))
Mockito.when(service.generateMsg(Mockito.eq("eiffelEnvironmentDefinedEvent"), Mockito.any(), Mockito.anyBoolean()))
.thenReturn(erlookupOptionsWithEmptyResponseOutput);

Mockito.when(service.generateMsg(Mockito.eq("eiffelCompositionDefinedEventt"), Mockito.anyObject(), Mockito.anyBoolean()))
Mockito.when(service.generateMsg(Mockito.eq("eiffelCompositionDefinedEventt"), Mockito.any(), Mockito.anyBoolean()))
.thenReturn(compositionDefinedOutput);

Mockito.when(service.generateMsg(Mockito.eq("eiffelTestCaseStarted"), Mockito.anyObject(), Mockito.anyBoolean()))
Mockito.when(service.generateMsg(Mockito.eq("eiffelTestCaseStarted"), Mockito.any(), Mockito.anyBoolean()))
.thenReturn(ErlookupFailedWithOptionsOutput);

ResponseEntity erresponse = new ResponseEntity(response, HttpStatus.OK);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class EiffelRemremControllerUnitTest {
@SuppressWarnings("resource")
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
MockitoAnnotations.openMocks(this);
msgServices.add(service);
msgServices.add(service2);
Mockito.when(service.getServiceName()).thenReturn("eiffelsemantics");
Expand All @@ -90,23 +90,23 @@ public void setUp() throws Exception {

Mockito.when(service.generateMsg(
Mockito.eq("eiffelactivityfinished"),
Mockito.anyObject(), Mockito.anyBoolean())).thenReturn(successOutput);
Mockito.any(), Mockito.anyBoolean())).thenReturn(successOutput);

Mockito.when(service.generateMsg(
Mockito.eq("EiffelActivityFinished"),
Mockito.anyObject(), Mockito.anyBoolean())).thenReturn(errorOutput);
Mockito.any(), Mockito.anyBoolean())).thenReturn(errorOutput);

Mockito.when(service2.generateMsg(
Mockito.eq("eiffelartifactnew"),
Mockito.anyObject(), Mockito.anyBoolean())).thenReturn(successOutput);
Mockito.any(), Mockito.anyBoolean())).thenReturn(successOutput);

Mockito.when(service2.generateMsg(
Mockito.eq("eiffelartifactnewevent"),
Mockito.anyObject(), Mockito.anyBoolean())).thenReturn(errorOutput);
Mockito.any(), Mockito.anyBoolean())).thenReturn(errorOutput);

Mockito.when(service.generateMsg(
Mockito.eq("EiffelArtifactCreatedEvent"),
Mockito.anyObject(), Mockito.anyBoolean())).thenReturn(lv_successOutput);
Mockito.any(), Mockito.anyBoolean())).thenReturn(lv_successOutput);
}

@Test
Expand Down

0 comments on commit 6d62fe0

Please sign in to comment.