Commit aab244cb authored by Rustam Lotsmanenko (EPAM)'s avatar Rustam Lotsmanenko (EPAM)
Browse files

Revert "Merge branch 'version-endpoint' into 'master'"

This reverts merge request !103
parent e7eb1597
Pipeline #54541 failed with stages
in 5 minutes and 18 seconds
......@@ -37,7 +37,7 @@ The following software have components provided under the terms of this license:
- Jackson dataformat: Smile (from http://github.com/FasterXML/jackson-dataformats-binary)
- Jackson datatype: JSR310 (from https://repo1.maven.org/maven2/com/fasterxml/jackson/datatype/jackson-datatype-jsr310)
- Jackson datatype: jdk8 (from https://repo1.maven.org/maven2/com/fasterxml/jackson/datatype/jackson-datatype-jdk8)
- Jackson-annotations (from http://github.com/FasterXML/jackson)
- Jackson-annotations (from http://wiki.fasterxml.com/JacksonHome)
- Jackson-core (from http://wiki.fasterxml.com/JacksonHome)
- Jackson-dataformat-YAML (from https://github.com/FasterXML/jackson-dataformats-text)
- Jackson-module-parameter-names (from https://repo1.maven.org/maven2/com/fasterxml/jackson/module/jackson-module-parameter-names)
......@@ -70,6 +70,14 @@ The following software have components provided under the terms of this license:
- OpenCensus (from https://github.com/census-instrumentation/opencensus-java)
- OpenCensus (from https://github.com/census-instrumentation/opencensus-java)
- SnakeYAML (from http://code.google.com/p/snakeyaml/)
- Spring Boot (from http://projects.spring.io/spring-boot/)
- Spring Boot AutoConfigure (from http://projects.spring.io/spring-boot/)
- Spring Boot Json Starter (from https://projects.spring.io/spring-boot/#/spring-boot-parent/spring-boot-starters/spring-boot-starter-json)
- Spring Boot Logging Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Tomcat Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Validation Starter (from http://projects.spring.io/spring-boot/)
- Spring Boot Web Starter (from http://projects.spring.io/spring-boot/)
- Spring Commons Logging Bridge (from https://github.com/spring-projects/spring-framework)
- Spring Expression Language (SpEL) (from https://github.com/spring-projects/spring-framework)
- Spring Framework: AOP (from http://www.springframework.org)
......@@ -104,18 +112,10 @@ The following software have components provided under the terms of this license:
- rest-high-level (from https://github.com/elastic/elasticsearch)
- rxjava (from https://github.com/ReactiveX/RxJava)
- server (from https://github.com/elastic/elasticsearch)
- spring-boot (from https://spring.io/projects/spring-boot)
- spring-boot-autoconfigure (from https://spring.io/projects/spring-boot)
- spring-boot-starter (from https://spring.io/projects/spring-boot)
- spring-boot-starter-json (from https://spring.io/projects/spring-boot)
- spring-boot-starter-logging (from https://spring.io/projects/spring-boot)
- spring-boot-starter-tomcat (from https://spring.io/projects/spring-boot)
- spring-boot-starter-validation (from https://spring.io/projects/spring-boot)
- spring-boot-starter-web (from https://spring.io/projects/spring-boot)
- swagger-annotations (from https://repo1.maven.org/maven2/io/swagger/swagger-annotations)
- swagger-jaxrs (from )
- tomcat-embed-core (from http://tomcat.apache.org/)
- tomcat-embed-websocket (from https://tomcat.apache.org/)
- tomcat-embed-websocket (from http://tomcat.apache.org/)
========================================================================
BSD-2-Clause
......
/*
* 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.core.common.info;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
import lombok.extern.slf4j.Slf4j;
import org.opengroup.osdu.core.common.model.info.ConnectedOuterService;
import org.opengroup.osdu.core.common.model.info.VersionInfo;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.stereotype.Component;
@Slf4j
@Component
@ConditionalOnMissingBean(value = VersionInfoBuilder.class)
public class CloudVersionInfoBuilder implements VersionInfoBuilder {
private final Properties buildInfoProperties = new Properties();
private final Properties gitProperties = new Properties();
private final VersionInfoProperties versionInfoProperties;
public CloudVersionInfoBuilder(VersionInfoProperties versionInfoProperties) {
this.versionInfoProperties = versionInfoProperties;
}
public VersionInfo buildVersionInfo() throws IOException {
loadBuildInfoProperties();
loadGitProperties();
List<ConnectedOuterService> connectedOuterServices = loadConnectedOuterServices();
return VersionInfo.builder()
.groupId(buildInfoProperties.getProperty("build.group"))
.artifactId(buildInfoProperties.getProperty("build.artifact"))
.version(buildInfoProperties.getProperty("build.version"))
.buildTime(buildInfoProperties.getProperty("build.time"))
.branch(gitProperties.getProperty("git.branch"))
.commitId(gitProperties.getProperty("git.commit.id"))
.commitMessage(gitProperties.getProperty("git.commit.message.short"))
.connectedOuterServices(connectedOuterServices)
.build();
}
private void loadBuildInfoProperties() throws IOException {
InputStream buildInfoStream =
ClassLoader.getSystemClassLoader()
.getResourceAsStream(versionInfoProperties.getBuildPropertiesPath());
if (buildInfoStream != null) {
buildInfoProperties.load(buildInfoStream);
} else {
log.error(
"Build-info properties file not found by path: {}",
versionInfoProperties.getBuildPropertiesPath());
}
}
private void loadGitProperties() throws IOException {
InputStream gitStream =
ClassLoader.getSystemClassLoader()
.getResourceAsStream(versionInfoProperties.getGitPropertiesPath());
if (gitStream != null) {
gitProperties.load(gitStream);
} else {
log.error(
"Git properties file not found by path: {}",
versionInfoProperties.getGitPropertiesPath());
}
}
protected List<ConnectedOuterService> loadConnectedOuterServices() {
return Collections.emptyList();
}
}
package org.opengroup.osdu.core.common.info;
import lombok.extern.java.Log;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@Log
@ComponentScan("org.opengroup.osdu.core.common.info")
public class VersionInfoAutoconfiguration {}
/*
* 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.core.common.info;
import java.io.IOException;
import org.opengroup.osdu.core.common.model.info.VersionInfo;
public interface VersionInfoBuilder {
VersionInfo buildVersionInfo() throws IOException;
}
/*
* 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.core.common.info;
import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConfigurationProperties(prefix = "osdu.version.info")
@Getter
@Setter
public class VersionInfoProperties {
private String buildPropertiesPath = "META-INF/build-info.properties";
private String gitPropertiesPath = "BOOT-INF/classes/git.properties";
}
package org.opengroup.osdu.core.common.model.info;
import lombok.Builder;
import lombok.Data;
/**
* The node contains service-specific values for all outer services connected to OSDU service.
* The value is optional - basic implementation contains an empty list.
* To define outer services info for OSDU service
* need to override <code>loadConnectedOuterServices</code> method.
*/
@Data
@Builder
public class ConnectedOuterService {
private String name;
private String version;
}
/*
* 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.core.common.model.info;
import java.util.Collections;
import java.util.List;
import lombok.Builder;
import lombok.Data;
@Data
@Builder
public class VersionInfo {
private String groupId;
private String artifactId;
private String version;
private String buildTime;
private String branch;
private String commitId;
private String commitMessage;
private List<ConnectedOuterService> connectedOuterServices;
}
\ No newline at end of file
org.springframework.boot.autoconfigure.EnableAutoConfiguration=org/opengroup/osdu/core/common/info/VersionInfoAutoconfiguration
\ No newline at end of file
package org.opengroup.osdu.core.common.info;
import static org.mockito.Mockito.when;
import java.io.IOException;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.opengroup.osdu.core.common.model.info.VersionInfo;
@RunWith(MockitoJUnitRunner.class)
public class CloudVersionInfoBuilderTest {
private static final String TEST_BUILD_INFO_PATH = "testdata/build-info.properties";
private static final String TEST_GIT_INFO_PATH = "testdata/git-info.properties";
@InjectMocks
private CloudVersionInfoBuilder versionInfoBuilder;
@Mock
private VersionInfoProperties versionInfoProperties;
@Before
public void setUp() {
when(versionInfoProperties.getBuildPropertiesPath()).thenReturn(TEST_BUILD_INFO_PATH);
when(versionInfoProperties.getGitPropertiesPath()).thenReturn(TEST_GIT_INFO_PATH);
}
@Test
public void buildVersionInfo() throws IOException {
VersionInfo versionInfo = versionInfoBuilder.buildVersionInfo();
Assert.assertNotNull(versionInfo.getGroupId());
Assert.assertNotNull(versionInfo.getArtifactId());
Assert.assertNotNull(versionInfo.getVersion());
Assert.assertNotNull(versionInfo.getBuildTime());
Assert.assertNotNull(versionInfo.getBranch());
Assert.assertNotNull(versionInfo.getCommitId());
Assert.assertNotNull(versionInfo.getCommitMessage());
}
}
build.artifact=storage-core
build.group=org.opengroup.osdu
build.name=storage-core
build.time=2021-07-22T14\:31\:10.717Z
build.version=0.10.0-SNAPSHOT
#Generated by Git-Commit-Id-Plugin
git.branch=version-endpoint
git.build.host=EPRUSARW000F
git.build.time=2021-07-22T18\:31\:17+0400
git.build.user.email=7nolikov@gmail.com
git.build.user.name=Dmitriy Novikov
git.build.version=0.10.0-SNAPSHOT
git.closest.tag.commit.count=
git.closest.tag.name=
git.commit.author.time=2021-07-22T16\:39\:53+0400
git.commit.committer.time=2021-07-22T16\:39\:53+0400
git.commit.id=7777
git.commit.id.abbrev=0aff671
git.commit.id.describe=0aff671-dirty
git.commit.id.describe-short=0aff671-dirty
git.commit.message.full=Merge remote-tracking branch 'community/master' into version-endpoint
git.commit.message.short=Merge remote-tracking branch 'community/master' into version-endpoint
git.commit.time=2021-07-22T16\:39\:53+0400
git.commit.user.email=7nolikov@gmail.com
git.commit.user.name=Dmitriy Novikov
git.dirty=true
git.local.branch.ahead=0
git.local.branch.behind=0
git.tags=
git.total.commit.count=1010
Supports Markdown
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