You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2009/04/18 17:24:00 UTC
svn commit: r766339 - in /commons/sandbox/runtime/trunk: build.xml
src/main/java/org/apache/commons/runtime/DefaultProperties.properties
src/main/java/org/apache/commons/runtime/Properties.java
src/test/org/apache/commons/runtime/TestProperties.java
Author: mturk
Date: Sat Apr 18 15:23:57 2009
New Revision: 766339
URL: http://svn.apache.org/viewvc?rev=766339&view=rev
Log:
Add VERSION info to the Properties
Modified:
commons/sandbox/runtime/trunk/build.xml
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DefaultProperties.properties
commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Properties.java
commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestProperties.java
Modified: commons/sandbox/runtime/trunk/build.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/build.xml?rev=766339&r1=766338&r2=766339&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/build.xml (original)
+++ commons/sandbox/runtime/trunk/build.xml Sat Apr 18 15:23:57 2009
@@ -139,6 +139,7 @@
<filter token="VERSION_MINOR" value="${version.minor}"/>
<filter token="VERSION_PATCH" value="${version.patch}"/>
<filter token="VERSION_NUMBER" value="${version.number}"/>
+ <filter token="VERSION_PNAME" value="${final.name}"/>
<filter token="VERSION_BUILT" value="${TODAY} ${TSTAMP}"/>
<copy todir="${build.src}/java" filtering="yes">
<fileset dir="${src.dir}/main/java">
@@ -202,6 +203,7 @@
<filter token="VERSION_MINOR" value="${version.minor}"/>
<filter token="VERSION_PATCH" value="${version.patch}"/>
<filter token="VERSION_NUMBER" value="${version.number}"/>
+ <filter token="VERSION_PNAME" value="${final.name}"/>
<filter token="VERSION_BUILT" value="${TODAY} ${TSTAMP}"/>
<copy todir="${build.src}/examples" filtering="yes">
<fileset dir="${src.dir}/examples">
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DefaultProperties.properties
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DefaultProperties.properties?rev=766339&r1=766338&r2=766339&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DefaultProperties.properties (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/DefaultProperties.properties Sat Apr 18 15:23:57 2009
@@ -21,6 +21,13 @@
#
# -----------------------------------------------------------------------------
+# Version info provided at build time
+# Mostly used to determine the jar classpath name
+runtime.version.major = @VERSION_MAJOR@
+runtime.version.minor = @VERSION_MINOR@
+runtime.version.patch = @VERSION_PATCH@
+runtime.version.pname = @VERSION_PNAME@
+
# Indicates the caching policy for lookups on cpu object.
# The TTL is number of milliseconds between two counter lookups.
cpu.cache.ttl = 100
Modified: commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Properties.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Properties.java?rev=766339&r1=766338&r2=766339&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Properties.java (original)
+++ commons/sandbox/runtime/trunk/src/main/java/org/apache/commons/runtime/Properties.java Sat Apr 18 15:23:57 2009
@@ -129,5 +129,18 @@
/** Minimum interval of Cpu data cache.
*/
public static final long CPU_CACHE_TTL_MIN = getLong("cpu.cache.ttl.min", 1L);
+ /** Major version of the runtime library
+ */
+ public static final int VERSION_MAJOR = getInt("runtime.version.major");
+ /** Minor version of the runtime library
+ */
+ public static final int VERSION_MINOR = getInt("runtime.version.minor");
+ /** Patch version of the runtime library
+ */
+ public static final int VERSION_PATCH = getInt("runtime.version.patch");
+
+ /** Patch version of the runtime library
+ */
+ public static final String VERSION_PNAME = get("runtime.version.pname");
}
Modified: commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestProperties.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestProperties.java?rev=766339&r1=766338&r2=766339&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestProperties.java (original)
+++ commons/sandbox/runtime/trunk/src/test/org/apache/commons/runtime/TestProperties.java Sat Apr 18 15:23:57 2009
@@ -62,4 +62,21 @@
assertEquals("Value ", "bar", org.apache.commons.runtime.Properties.get("foo", "bar"));
}
+
+ public void testVersionProperties()
+ throws Exception
+ {
+ int i;
+
+ i = org.apache.commons.runtime.Properties.VERSION_MAJOR;
+ assertEquals("Major", @VERSION_MAJOR@, i);
+ i = org.apache.commons.runtime.Properties.VERSION_MINOR;
+ assertEquals("Minor", @VERSION_MINOR@, i);
+ i = org.apache.commons.runtime.Properties.VERSION_PATCH;
+ assertEquals("Patch", @VERSION_PATCH@, i);
+ String s = org.apache.commons.runtime.Properties.VERSION_PNAME;
+ assertEquals("PName", "@VERSION_PNAME@", s);
+
+ }
+
}