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 ka...@apache.org on 2007/12/04 20:58:26 UTC
svn commit: r601064 - in /db/derby/code/branches/10.3: build.xml
java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoLocaleTest.java
Author: kahatlen
Date: Tue Dec 4 11:58:26 2007
New Revision: 601064
URL: http://svn.apache.org/viewvc?rev=601064&view=rev
Log:
DERBY-3229: testSysinfoLocale fails if derbytools.jar is first in the classpath
Merged fix from trunk (revisions 598456 and 600456).
Modified:
db/derby/code/branches/10.3/build.xml
db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoLocaleTest.java
Modified: db/derby/code/branches/10.3/build.xml
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/build.xml?rev=601064&r1=601063&r2=601064&view=diff
==============================================================================
--- db/derby/code/branches/10.3/build.xml (original)
+++ db/derby/code/branches/10.3/build.xml Tue Dec 4 11:58:26 2007
@@ -1146,13 +1146,19 @@
</target>
+ <!-- Add localized jars to the classpath -->
+ <target name="make-locale-classpath-manifest">
+ <manifest file="${manifest.file}" mode="${manifest.mode}">
+ <attribute name="Class-Path" value="derbyLocale_cs.jar derbyLocale_de_DE.jar derbyLocale_es.jar derbyLocale_fr.jar derbyLocale_hu.jar derbyLocale_it.jar derbyLocale_ja_JP.jar derbyLocale_ko_KR.jar derbyLocale_pl.jar derbyLocale_pt_BR.jar derbyLocale_ru.jar derbyLocale_zh_CN.jar derbyLocale_zh_TW.jar"/>
+ </manifest>
+ </target>
+
<target name="make-core-derbyjar-manifest">
<manifest file="${manifest.file}">
<attribute name="Bundle-Vendor" value="Apache Software Foundation"/>
<attribute name="Bundle-Name" value="Apache Derby ${major}.${minor}"/>
<attribute name="Bundle-Version" value="${major}.${minor}.${maint}.${changenumber}"/>
- <attribute name="Class-Path" value="derbyLocale_cs.jar derbyLocale_de_DE.jar derbyLocale_es.jar derbyLocale_fr.jar derbyLocale_hu.jar derbyLocale_it.jar derbyLocale_ja_JP.jar derbyLocale_ko_KR.jar derbyLocale_pl.jar derbyLocale_pt_BR.jar derbyLocale_ru.jar derbyLocale_zh_CN.jar derbyLocale_zh_TW.jar"/>
<attribute name="Sealed" value="true"/>
<section name="org/apache/derby/impl/tools/sysinfo/">
@@ -1184,6 +1190,11 @@
</section>
</manifest>
+ <antcall target="make-locale-classpath-manifest">
+ <param name="manifest.file" value="${manifest.file}"/>
+ <param name="manifest.mode" value="update"/>
+ </antcall>
+
</target>
<!-- - - - - - - - - - - - - derbytools.jar target - - - - - - - - - - -->
@@ -1219,6 +1230,10 @@
<!-- copy boilerplate common to derby jar files -->
<antcall target="meta-inf-common"/>
+ <antcall target="make-locale-classpath-manifest">
+ <param name="manifest.file" value="${derby.jar.dir}/lists/smftools.mf"/>
+ <param name="manifest.mode" value="replace"/>
+ </antcall>
<delete file="${derby.jar.dir}/derbytools.jar"/>
<jar destfile="${derby.jar.dir}/derbytools.jar"
@@ -1227,6 +1242,7 @@
compress="true"
filesonly="true"/>
<jar destfile="${derby.jar.dir}/derbytools.jar"
+ manifest="${derby.jar.dir}/lists/smftools.mf"
compress="true"
filesonly="true"
update="true">
Modified: db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoLocaleTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoLocaleTest.java?rev=601064&r1=601063&r2=601064&view=diff
==============================================================================
--- db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoLocaleTest.java (original)
+++ db/derby/code/branches/10.3/java/testing/org/apache/derbyTesting/functionTests/tests/tools/SysinfoLocaleTest.java Tue Dec 4 11:58:26 2007
@@ -53,6 +53,9 @@
*/
private final boolean localizedToGerman;
+ /** Name of the test. */
+ private final String name;
+
/** The default locale before this test started. */
private Locale savedLocale;
@@ -61,11 +64,24 @@
*
* @param defaultLocale the default locale for this test
* @param german true if output is expected to be localized to German
+ * @param info extra information to append to the test name (for debugging)
*/
- private SysinfoLocaleTest(Locale defaultLocale, boolean german) {
+ private SysinfoLocaleTest(Locale defaultLocale, boolean german,
+ String info) {
super("testSysinfoLocale");
this.defaultLocale = defaultLocale;
this.localizedToGerman = german;
+ this.name = super.getName() + ":" + info;
+ }
+
+ /**
+ * Returns the name of the test, which includes the default locale and
+ * derby.ui.locale to aid debugging.
+ *
+ * @return name of the test
+ */
+ public String getName() {
+ return name;
}
/**
@@ -130,7 +146,8 @@
// always set the encoding so that we can reliably read the output
prop.setProperty("derby.ui.codeset", ENCODING);
- Test test = new SysinfoLocaleTest(loc, german);
+ String info = "defaultLocale=" + loc + ",uiLocale=" + ui;
+ Test test = new SysinfoLocaleTest(loc, german, info);
return new SystemPropertyTestSetup(test, prop);
}
@@ -194,20 +211,29 @@
};
/**
+ * Checks that all the expected substrings are part of the output from
+ * sysinfo. Fails if one or more of the substrings are not found.
+ *
+ * @param expectedSubstrings substrings in the expected locale
+ * @param output the output from sysinfo
+ */
+ private void assertContains(String[] expectedSubstrings, String output) {
+ for (int i = 0; i < expectedSubstrings.length; i++) {
+ String s = expectedSubstrings[i];
+ if (output.indexOf(s) == -1) {
+ fail("Substring '" + s + "' not found in output: " + output);
+ }
+ }
+ }
+
+ /**
* Test method which checks that the output from sysinfo is correctly
* localized.
*/
public void testSysinfoLocale() throws Exception {
String output = getSysinfoOutput();
-
- for (int i = 0; i < GERMAN_STRINGS.length; i++) {
- assertEquals(localizedToGerman,
- output.indexOf(GERMAN_STRINGS[i]) != -1);
- }
-
- for (int i = 0; i < ITALIAN_STRINGS.length; i++) {
- assertEquals(localizedToGerman,
- output.indexOf(ITALIAN_STRINGS[i]) == -1);
- }
+ String[] expectedSubstrings =
+ localizedToGerman ? GERMAN_STRINGS : ITALIAN_STRINGS;
+ assertContains(expectedSubstrings, output);
}
}