Skip to content
Snippets Groups Projects
Commit c1ba102a authored by Rostislav Dublin (EPAM)'s avatar Rostislav Dublin (EPAM)
Browse files

Merge branch 'version-endpoint' into 'master'

Added new version info endpoint (GONRG-2811)

See merge request !67
parents f530d8e1 a4622e38
No related branches found
No related tags found
2 merge requests!68Master,!67Added new version info endpoint (GONRG-2811)
Pipeline #59175 passed with warnings
Showing with 134 additions and 5 deletions
......@@ -67,7 +67,7 @@ The following software have components provided under the terms of this license:
- Google Cloud Storage (from https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-storage)
- Google HTTP Client Library for Java (from https://repo1.maven.org/maven2/com/google/http-client/google-http-client)
- Google OAuth Client Library for Java (from https://repo1.maven.org/maven2/com/google/oauth-client/google-oauth-client)
- Gson (from http://code.google.com/p/google-gson/)
- Gson (from https://repo1.maven.org/maven2/com/google/code/gson/gson)
- Guava InternalFutureFailureAccess and InternalFutures (from https://repo1.maven.org/maven2/com/google/guava/failureaccess)
- Guava: Google Core Libraries for Java (from https://repo1.maven.org/maven2/com/google/guava/guava)
- Guava: Google Core Libraries for Java (from https://repo1.maven.org/maven2/com/google/guava/guava)
......@@ -97,7 +97,7 @@ The following software have components provided under the terms of this license:
- Jackson module: JAXB Annotations (from https://github.com/FasterXML/jackson-modules-base)
- Jackson-annotations (from http://github.com/FasterXML/jackson)
- Jackson-core (from http://wiki.fasterxml.com/JacksonHome)
- Jackson-dataformat-XML (from http://wiki.fasterxml.com/JacksonExtensionXmlDataBinding)
- Jackson-dataformat-XML (from https://github.com/FasterXML/jackson-dataformat-xml)
- Jackson-dataformat-YAML (from https://github.com/FasterXML/jackson-dataformats-text)
- Jackson-datatype-Joda (from http://wiki.fasterxml.com/JacksonModuleJoda)
- Jackson-module-Afterburner (from http://wiki.fasterxml.com/JacksonHome)
......@@ -147,7 +147,6 @@ The following software have components provided under the terms of this license:
- Non-Blocking Reactive Foundation for the JVM (from https://github.com/reactor/reactor-core)
- OAuth 2.0 SDK with OpenID Connect extensions (from https://bitbucket.org/connect2id/oauth-2.0-sdk-with-openid-connect-extensions)
- Objenesis (from http://objenesis.org)
- OkHttp (from https://repo1.maven.org/maven2/com/squareup/okhttp3/okhttp)
- Okio (from https://github.com/square/okio/)
- OpenCensus (from https://github.com/census-instrumentation/opencensus-java)
- OpenCensus (from https://github.com/census-instrumentation/opencensus-java)
......@@ -231,6 +230,7 @@ The following software have components provided under the terms of this license:
- micrometer-core (from https://github.com/micrometer-metrics/micrometer)
- micrometer-registry-azure-monitor (from https://github.com/micrometer-metrics/micrometer)
- mockito-core (from https://github.com/mockito/mockito)
- okhttp (from https://square.github.io/okhttp/)
- okhttp-urlconnection (from https://github.com/square/okhttp)
- org.apiguardian:apiguardian-api (from https://github.com/apiguardian-team/apiguardian)
- org.conscrypt:conscrypt-openjdk-uber (from https://conscrypt.org/)
......@@ -555,7 +555,7 @@ MPL-2.0
The following software have components provided under the terms of this license:
- Javassist (from http://www.javassist.org/)
- OkHttp (from https://repo1.maven.org/maven2/com/squareup/okhttp3/okhttp)
- okhttp (from https://square.github.io/okhttp/)
========================================================================
PHP-3.01
......
/*
* 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("Test commit")
.build();
when(versionInfoBuilder.buildVersionInfo()).thenReturn(versionInfo);
VersionInfo response = this.sut.info();
assertEquals(versionInfo, response);
}
}
......@@ -10,7 +10,7 @@
<powermock.version>2.0.6</powermock.version>
<docker.image.prefix>org.opengroup.osdu</docker.image.prefix>
<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>
</properties>
......@@ -138,9 +138,37 @@
<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>
......@@ -55,6 +55,7 @@ public class AuthSecurityConfig extends WebSecurityConfigurerAdapter implements
"/swagger-resources/**",
"/configuration/security",
"/swagger-ui.html",
"/info",
"/webjars/**",
"/csrf",
"/api/crs/converter/actuator",
......
......@@ -41,6 +41,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter implements Acc
"/configuration/security",
"/swagger",
"/swagger-ui.html",
"/info",
"/webjars/**",
"/swagger.json",
"/csrf"
......
......@@ -57,6 +57,7 @@ public class AuthSecurityConfig extends WebSecurityConfigurerAdapter implements
"/swagger-resources/**",
"/configuration/security",
"/swagger-ui.html",
"/info",
"/webjars/**",
"/csrf",
"/api/crs/converter/actuator",
......
......@@ -56,6 +56,7 @@ public class AuthSecurityConfig extends WebSecurityConfigurerAdapter implements
"/swagger-resources/**",
"/configuration/security",
"/swagger-ui.html",
"/info",
"/webjars/**",
"/csrf",
"/api/crs/converter/actuator",
......
......@@ -47,6 +47,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter implements Acce
"/configuration/security",
"/swagger",
"/swagger-ui.html",
"/info",
"/webjars/**",
"/csrf"
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment