forked from pinpoint-apm/pinpoint
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pinpoint-apm#11745] Apply Version templating to plugin-test module
- Loading branch information
Showing
11 changed files
with
56 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
...est/src/main/java-templates/com/navercorp/pinpoint/test/plugin/Log4j2VersionTemplate.java
This file was deleted.
Oops, something went wrong.
5 changes: 5 additions & 0 deletions
5
...test/src/main/java-templates/com/navercorp/pinpoint/test/plugin/PluginEngineTemplate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.navercorp.pinpoint.test.plugin; | ||
public final class PluginEngineTemplate { | ||
public static final String PROJECT_VERSION = "${project.version}"; | ||
public static final String LOG4J_VERSION = "${log4j2.version}"; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 1 addition & 50 deletions
51
...plugins-test/src/main/java/com/navercorp/pinpoint/test/plugin/util/TestPluginVersion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,9 @@ | ||
package com.navercorp.pinpoint.test.plugin.util; | ||
|
||
import java.io.Closeable; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.util.Properties; | ||
|
||
public final class TestPluginVersion { | ||
private static final String VERSION_PROPERTIES = "testplugin-version.properties"; | ||
|
||
private static final String VERSION_KEY = "PROJECT_VERSION"; | ||
private static final String NOT_COMPILED = "${project.version}"; | ||
|
||
private static final String VERSION; | ||
|
||
static { | ||
InputStream stream = TestPluginVersion.class.getClassLoader().getResourceAsStream(VERSION_PROPERTIES); | ||
Properties properties = loadProperties(stream); | ||
|
||
VERSION = readString(properties, VERSION_KEY); | ||
} | ||
|
||
private static String readString(Properties properties, String key) { | ||
final String projectVersion = properties.getProperty(key); | ||
if (projectVersion == null) { | ||
throw new IllegalStateException(key + " key not found"); | ||
} | ||
if (NOT_COMPILED.equals(projectVersion)) { | ||
throw new IllegalStateException("Install pinpoint-test module( $test> mvn install)"); | ||
} | ||
return projectVersion; | ||
} | ||
|
||
private static void close(Closeable closeable) { | ||
if (closeable != null) { | ||
try { | ||
closeable.close(); | ||
} catch (IOException ignored) { | ||
} | ||
} | ||
} | ||
|
||
private static Properties loadProperties(InputStream stream) { | ||
Properties properties = new Properties(); | ||
try { | ||
properties.load(stream); | ||
return properties; | ||
} catch (IOException e) { | ||
throw new RuntimeException("properties load failed", e); | ||
} finally { | ||
close(stream); | ||
} | ||
} | ||
|
||
public static String getVersion() { | ||
return VERSION; | ||
return VersionUtils.VERSION; | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
...dule/plugins-test/src/main/java/com/navercorp/pinpoint/test/plugin/util/VersionUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package com.navercorp.pinpoint.test.plugin.util; | ||
|
||
import com.navercorp.pinpoint.test.plugin.PluginEngineTemplate; | ||
|
||
public class VersionUtils { | ||
|
||
public static String VERSION = PluginEngineTemplate.PROJECT_VERSION; | ||
} |
1 change: 0 additions & 1 deletion
1
...-module/plugins-test-module/plugins-test/src/main/resources/testplugin-version.properties
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters