Commit 70c1fbfa authored by Dzmitry_Paulouski (slb)'s avatar Dzmitry_Paulouski (slb)
Browse files

Merge branch 'master' into 'add_node_selector'

Master

See merge request !60
parents 39562851 4ddf5c0c
Pipeline #59615 failed with stage
in 14 seconds
This diff is collapsed.
/*
* Copyright 2021 Google LLC
* Copyright 2021 EPAM Systems, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.opengroup.osdu.crs.api;
import java.io.IOException;
import org.opengroup.osdu.core.common.info.VersionInfoBuilder;
import org.opengroup.osdu.core.common.model.info.VersionInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping
public class InfoApi {
@Autowired
private VersionInfoBuilder versionInfoBuilder;
@GetMapping(value = "/info", produces = MediaType.APPLICATION_JSON_VALUE)
public VersionInfo info() throws IOException {
return versionInfoBuilder.buildVersionInfo();
}
}
\ No newline at end of file
/*
* Copyright 2021 Google LLC
* Copyright 2021 EPAM Systems, Inc
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.opengroup.osdu.crs.api;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
import java.io.IOException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.opengroup.osdu.core.common.info.VersionInfoBuilder;
import org.opengroup.osdu.core.common.model.info.VersionInfo;
@RunWith(MockitoJUnitRunner.class)
public class InfoApiTest {
@InjectMocks
private InfoApi sut;
@Mock
private VersionInfoBuilder versionInfoBuilder;
@Test
public void should_return200_getVersionInfo() throws IOException {
VersionInfo versionInfo = VersionInfo.builder()
.groupId("group")
.artifactId("artifact")
.version("0.1.0")
.buildTime("1000")
.branch("master")
.commitId("7777")
.commitMessage("Merge commit")
.build();
when(versionInfoBuilder.buildVersionInfo()).thenReturn(versionInfo);
VersionInfo response = this.sut.info();
assertEquals(versionInfo, response);
}
}
......@@ -9,7 +9,7 @@
<docker.image.prefix>org.opengroup.osdu</docker.image.prefix>
<powermock.version>2.0.6</powermock.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<os-core-common.version>0.10.0</os-core-common.version>
<os-core-common.version>0.11.0-SNAPSHOT</os-core-common.version>
<snakeyaml.version>1.26</snakeyaml.version>
<nimbus-jose-jwt.version>7.9</nimbus-jose-jwt.version>
</properties>
......@@ -108,10 +108,38 @@
<goal>repackage</goal>
</goals>
</execution>
<execution>
<id>build-info</id>
<goals>
<goal>build-info</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>4.0.5</version>
<executions>
<execution>
<goals>
<goal>revision</goal>
</goals>
</execution>
</executions>
<configuration>
<verbose>true</verbose>
<dateFormat>yyyy-MM-dd'T'HH:mm:ssZ</dateFormat>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>
${project.build.outputDirectory}/git.properties
</generateGitPropertiesFilename>
</configuration>
</plugin>
</plugins>
</build>
</project>
......@@ -57,6 +57,7 @@ public class AuthSecurityConfig extends WebSecurityConfigurerAdapter implements
"/swagger-resources/**",
"/configuration/security",
"/swagger-ui.html",
"/info",
"/webjars/**",
"/csrf",
"/api/crs/catalog/actuator",
......
......@@ -43,6 +43,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter implements Acc
"/configuration/security",
"/swagger",
"/swagger-ui.html",
"/info",
"/webjars/**",
"/csrf"
};
......
......@@ -40,3 +40,4 @@ azure.application-insights.instrumentation-key=${appinsights_key}
logging.transaction.enabled=true
logging.slf4jlogger.enabled=true
logging.mdccontext.enabled=true
logging.ignore.servlet.paths=/swagger-ui.html
......@@ -143,24 +143,24 @@
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.7.201606060606</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
......
......@@ -57,6 +57,7 @@ public class AuthSecurityConfig extends WebSecurityConfigurerAdapter implements
"/swagger-resources/**",
"/configuration/security",
"/swagger-ui.html",
"/info",
"/webjars/**",
"/csrf",
"/api/crs/catalog/actuator",
......
......@@ -45,6 +45,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter implements Acce
"/swagger-resources/**",
"/configuration/security",
"/swagger-ui.html",
"/info",
"/webjars/**",
"/csrf",
"/api/crs/catalog/actuator",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment