You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by my...@apache.org on 2014/03/26 16:27:11 UTC
svn commit: r1581885 - in /db/derby/code/trunk: build.xml
java/tools/org/apache/derby/impl/tools/sysinfo/Main.java
Author: myrnavl
Date: Wed Mar 26 15:27:10 2014
New Revision: 1581885
URL: http://svn.apache.org/r1581885
Log:
DERBY-6468; Add a version number to derbyTesting.jar
- a new properties file, org/apache/derby/info/tsting.properties, is generated with the required info
- this file is inserted in to derbyTesting.jar
- sysinfo reflects the location of the org.apache.derbyTesting package if an indicative class is found in the classpath
Modified:
db/derby/code/trunk/build.xml
db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java
Modified: db/derby/code/trunk/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/build.xml?rev=1581885&r1=1581884&r2=1581885&view=diff
==============================================================================
--- db/derby/code/trunk/build.xml (original)
+++ db/derby/code/trunk/build.xml Wed Mar 26 15:27:10 2014
@@ -271,6 +271,7 @@
<delete file="${out.dir}/org/apache/derby/info/tools.properties"/>
<delete file="${out.dir}/org/apache/derby/info/net.properties"/>
<delete file="${out.dir}/org/apache/derby/info/dnc.properties"/>
+ <delete file="${out.dir}/org/apache/derby/info/tsting.properties"/>
</target>
<!-- Set the ant variables which identify the compiler classpaths. -->
@@ -654,7 +655,7 @@
<ant dir="${derby.demo.src.dir}" target="compile-vtidemo"/>
</target>
- <target name="testing" depends="buildsource,demo">
+ <target name="testing" depends="buildsource,demo,buildtestinginfo">
<ant dir="${derby.testing.src.dir}"/>
</target>
@@ -1870,8 +1871,16 @@
<!-- - - - - - - - - - - - derby testing jar target - - - - - - - - - - -->
<target name="derbytestingjar" depends="initjars,ckderbytesting" if="derbyTesting.available">
+ <!-- generate tsting info property file -->
+ <antcall target="tstinginfowriter">
+ <param name="info.buildnumber" value="${changenumber}"/>
+ <param name="info.iname" value="tsting"/>
+ <param name="info.productfile" value="derbyTesting.jar"/>
+ <param name="info.file" value="${out.dir}/org/apache/derby/info/tsting.properties"/>
+ </antcall>
+
<zip destfile="${derby.jar.dir}/derbyTesting.jar" filesonly="true" compress="true">
- <fileset dir="${out.dir}" includes="org/apache/derbyTesting/**,SimpleApp*,org/apache/derby/impl/tools/ij/mt*.class,org/apache/derby/impl/tools/ij/SimpleCharStream.class,org/apache/derby/impl/drda/TestProto.class,org/apache/derby/impl/store/access/conglomerate/QualifierUtil.class,org/apache/derby/loc/m*_qq_PP_testOnly*,toursdb/*"/>
+ <fileset dir="${out.dir}" includes="org/apache/derbyTesting/**,SimpleApp*,org/apache/derby/impl/tools/ij/mt*.class,org/apache/derby/impl/tools/ij/SimpleCharStream.class,org/apache/derby/impl/drda/TestProto.class,org/apache/derby/impl/store/access/conglomerate/QualifierUtil.class,org/apache/derby/loc/m*_qq_PP_testOnly*,toursdb/*,org/apache/derby/info/tsting.properties"/>
</zip>
</target>
@@ -1880,6 +1889,29 @@
property="derbyTesting.available"/>
</target>
+ <target name="buildtestinginfo">
+ <antcall target="tstinginfowriter">
+ <param name="info.buildnumber" value="1"/>
+ <param name="info.iname" value="tsting"/>
+ <param name="info.productfile" value="derbyTesting.jar"/>
+ <param name="info.file" value="${out.dir}/org/apache/derby/info/tsting.properties"/>
+ </antcall>
+ </target>
+
+ <target name="tstinginfowriter">
+ <propertyfile file="${info.file}" comment="${copyright.comment}">
+ <entry key="derby.tsting.version.major" value="${major}"/>
+ <entry key="derby.tsting.version.minor" value="${minor}"/>
+ <entry key="derby.tsting.version.maint" value="${maint}"/>
+ <entry key="derby.tsting.build.number" value="${info.buildnumber}"/>
+ <entry key="derby.tsting.technology.name" value="${info.iname}"/>
+ <entry key="derby.tsting.external.name" value="${info.iname}"/>
+ <entry key="derby.version.beta" value="${beta}"/>
+ <entry key="derby.tsting.vendor" value="${vendor}"/>
+ <entry key="derby.product.file" value="${info.productfile}"/>
+ </propertyfile>
+ </target>
+
<!-- - - - - - - - - - - - jar build helper targets - - - - - - - - - -->
<target name="setsanityname" depends="init,setissane,sanitynamesane,sanitynameinsane"/>
Modified: db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java?rev=1581885&r1=1581884&r2=1581885&view=diff
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java (original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/impl/tools/sysinfo/Main.java Wed Mar 26 15:27:10 2014
@@ -152,6 +152,16 @@ public static void getMainInfo (java.io.
aw.println (Main.getTextMessage ("SIF01.Q"));
aw.println (Main.getTextMessage ("SIF01.B"));
}
+
+ // derbyTesting info
+ try {
+ reportTesting(aw);
+ }
+ catch (Exception e) {
+ // ignore locales for the testing jar
+ aw.println("Exception in reporting version of derbyTesting.jar");
+ e.printStackTrace();
+ }
if (pause) {
@@ -519,6 +529,82 @@ public static void getMainInfo (java.io.
} // end of reportLocales
+ /**
+ Writes out information about the derbyTesting classes with the product.
+
+ @param localAW the AppStreamWriter to which the info is written. If this
+ value is null, the info is written to System.out
+
+ */
+ private static void reportTesting (java.io.PrintWriter localAW) {
+
+ String hdr="org.apache.derbyTesting.*:";
+ Properties p = new Properties ();
+ String tstingResource ="/org/apache/derby/info/tsting.properties";
+
+ final Properties finalp = p;
+ final String finalTstingResource = tstingResource;
+ try {
+ InputStream is = AccessController.doPrivileged
+ (new PrivilegedAction<InputStream>() {
+ public InputStream run() {
+ InputStream is =
+ finalp.getClass().getResourceAsStream (finalTstingResource);
+ return is;
+ }
+ });
+ if (is == null) {
+ //localAW.println("resource is null: " + tstingResource);
+ }
+ else {
+ try {
+ p.clear();
+ p.load (is);
+ //Displaying Testing info
+ //String tstingName = p.getProperty("derby.tsting.external.name");
+
+ StringBuffer successes = new StringBuffer(Main.getTextMessage(crLf()));
+ StringBuffer failures = new StringBuffer(crLf() + Main.getTextMessage("SIF08.E") + crLf());
+ tryTstingClasspath(successes, failures);
+ String successString = successes.toString();
+
+ if (successString.isEmpty() || successString.length()<=2)
+ {
+ // if we don't have the BaseTestCase class, assume we don't have any of the
+ // testing classes, and just print nothing
+ // this would be the situation that end-users would likely see.
+ return;
+ }
+
+ // show the path and add brackets like we do for the core classes
+ localAW.println(hdr);
+ localAW.print("\t ");
+ localAW.print("[");
+ localAW.print(formatURL(new URL(successString)));
+ localAW.println("]");
+ // show the version info
+ int major = Integer.parseInt(p.getProperty ("derby.tsting.version.major"));
+ int minor = Integer.parseInt(p.getProperty ("derby.tsting.version.minor"));
+ int maint = Integer.parseInt(p.getProperty ("derby.tsting.version.maint"));
+ String build = p.getProperty ("derby.tsting.build.number");
+ String lv = ProductVersionHolder.fullVersionString(major, minor, maint, false, build);
+ localAW.println (Main.getTextMessage ("SIF01.S", lv));
+ } catch (IOException ioe) {
+ //This case is a bit ugly. If we get an IOException, we return
+ //null. Though this correctly reflects that the product is not
+ //available for use, it may be confusing to users that we swallow
+ //the IO error here.
+ localAW.println("Could not get testing properties from : " + is);
+ }
+ }
+ localAW.println (sep);
+ }
+ catch (Throwable t) {
+ localAW.println ("Could not load resource: " + tstingResource);
+ localAW.println ("Exception: " + t);
+ }
+ } // end of reportTesting
+
/* for arguments, choose from one of:*/
private static final String EMBEDDED = "embedded";
@@ -665,6 +751,10 @@ public static void getMainInfo (java.io.
private static void tryUtilsClasspath(StringBuffer successes, StringBuffer failures) {
tryMyClasspath("org.apache.derby.tools.ij", Main.getTextMessage("SIF08.Q", "derbytools.jar"), successes, failures);
}
+
+ private static void tryTstingClasspath(StringBuffer successes, StringBuffer failures) {
+ tryMyClasspath("org.apache.derbyTesting.junit.BaseTestCase", "", successes, failures);
+ }
private static void tryMyClasspath(String cn, String library, StringBuffer successes, StringBuffer failures) {