Skip to content

Commit

Permalink
Tweaked versioning to be more automatic. (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
rufusfnash authored and pegerto committed Jan 28, 2019
1 parent 997ae17 commit da3edda
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 6 deletions.
21 changes: 18 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.opencredo</groupId>
<artifactId>kafka-connect-venafi-tpp</artifactId>
<version>0.9.1-SNAPSHOT</version>
<version>0.9.2-SNAPSHOT</version>
<name>kafka-connect-venafi-tpp</name>
<description>Kafka connector for Venafi Trust Protection Platform Security Events</description>

<scm>
<url>https://github.com/opencredo/kafka-connect-venafi-tpp.git</url>
<developerConnection>scm:git:https://github.com/opencredo/kafka-connect-venafi-tpp.git</developerConnection>
<tag>HEAD</tag>
</scm>
<properties>
<java.version>1.8</java.version>
<junit-5.version>5.3.2</junit-5.version>
Expand Down Expand Up @@ -89,6 +93,12 @@
</dependencies>

<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down Expand Up @@ -218,6 +228,11 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
package com.opencredo.connect.venafi.tpp.log;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.util.Properties;

public class VersionUtil {
private static final Logger log = LoggerFactory.getLogger(VersionUtil.class);
public static String getVersion() {
return "1.0.0";
final Properties properties = new Properties();
try {
properties.load(VersionUtil.class.getClassLoader().getResourceAsStream("application.properties"));
} catch (IOException e) {
log.error("Unable to load Project version from application.properties.",e);
}
return properties.getProperty("project.version","0.0.1");

}
}
1 change: 1 addition & 0 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
project.version=${project.version}
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public class EventLogSourceTaskTest {

public static final String LOG_API_REGEX_PATH = "/vedsdk/[Ll]og/?";
public static final String AUTHORIZE_API_REGEX_PATH = "/vedsdk/[Aa]uthorize/?";

private static final ZonedDateTime TODAY = ZonedDateTime.now();
private WireMockServer wireMockServer = new WireMockServer(
new WireMockConfiguration().dynamicPort()
Expand Down Expand Up @@ -80,7 +81,7 @@ private void shutdown() {
@Test
public void as_a_task_I_should_return_a_version() {
TppLogSourceTask task = given_a_task_is_setup();
assertEquals("1.0.0", task.version());
assertEquals("test-version", task.version());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ private void shutdown() {
@Test
public void as_a_task_I_should_return_a_version() {
TppLogSourceConnector source = given_a_source();
assertEquals("1.0.0", source.version());
assertEquals("test-version", source.version());
}

@Test
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/application.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
project.version=test-version

0 comments on commit da3edda

Please sign in to comment.