Author: markt
Date: Mon Feb  4 14:20:26 2019
New Revision: 1852919

URL: http://svn.apache.org/viewvc?rev=1852919&view=rev
Log:
Fix https://bz.apache.org/bugzilla/show_bug.cgi?id=63141
Add test case to check manager response strings moving forwards.

Added:
    
tomcat/trunk/test/org/apache/tomcat/buildutil/translate/TestFixedStrings.java   
(with props)
Modified:
    tomcat/trunk/webapps/docs/changelog.xml

Added: 
tomcat/trunk/test/org/apache/tomcat/buildutil/translate/TestFixedStrings.java
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/buildutil/translate/TestFixedStrings.java?rev=1852919&view=auto
==============================================================================
--- 
tomcat/trunk/test/org/apache/tomcat/buildutil/translate/TestFixedStrings.java 
(added)
+++ 
tomcat/trunk/test/org/apache/tomcat/buildutil/translate/TestFixedStrings.java 
Mon Feb  4 14:20:26 2019
@@ -0,0 +1,65 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+package org.apache.tomcat.buildutil.translate;
+
+import java.io.File;
+import java.util.Properties;
+
+import org.junit.Assert;
+import org.junit.Test;
+
+public class TestFixedStrings {
+
+    @Test
+    public void testManagerApps() {
+        doTestStartsWith("org.apache.catalina.manager", "OK -");
+        doTestStartsWith("org.apache.catalina.manager.host", "OK -");
+    }
+
+
+    private void doTestStartsWith(String packageName, String text) {
+        File dir = new File("java/" + packageName.replace('.',  '/'));
+
+        // English
+        File fileEn = new File(dir, Constants.L10N_PREFIX + 
Constants.L10N_SUFFIX);
+        Properties propsEn = Utils.load(fileEn);
+
+        for (File file : dir.listFiles()) {
+            String fileName = file.getName();
+            if (fileName.startsWith(Constants.L10N_PREFIX)) {
+                if (Utils.getLanguage(fileName) != "en") {
+                    doTestStartsFile(file, propsEn, text);
+                }
+            }
+        }
+    }
+
+
+    private void doTestStartsFile(File fileTranslated, Properties propsEn, 
String text) {
+        Properties propsTranslated = Utils.load(fileTranslated);
+
+        for (Object key : propsEn.keySet()) {
+            String value = (String) propsEn.get(key);
+            if (value != null && value.startsWith(text)) {
+                String valueTranslated = (String) propsTranslated.get(key);
+                if (valueTranslated != null && 
!valueTranslated.startsWith(text)) {
+                    Assert.fail(fileTranslated.getPath() + " : " + key);
+                }
+            }
+        }
+    }
+}

Propchange: 
tomcat/trunk/test/org/apache/tomcat/buildutil/translate/TestFixedStrings.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: tomcat/trunk/webapps/docs/changelog.xml
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1852919&r1=1852918&r2=1852919&view=diff
==============================================================================
--- tomcat/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/trunk/webapps/docs/changelog.xml Mon Feb  4 14:20:26 2019
@@ -45,13 +45,6 @@
   issues do not "pop up" wrt. others).
 -->
 <section name="Tomcat 9.0.16 (markt)" rtext="in development">
-  <subsection name="Tribes">
-    <changelog>
-      <fix>
-        Remove unnecessary shutdown for executor. (kfujino)
-      </fix>
-    </changelog>
-  </subsection>
   <subsection name="Web applications">
     <changelog>
       <fix>
@@ -60,6 +53,18 @@
         client's language preference was not respected in Manager and
         Host Manager web applications. (kkolinko)
       </fix>
+      <fix>
+        <bug>63141</bug>: Ensure that translated manager response strings still
+        start with <code>OK -</code> where expected by the associated Ant 
tasks.
+        (markt)
+      </fix>
+    </changelog>
+  </subsection>
+  <subsection name="Tribes">
+    <changelog>
+      <fix>
+        Remove unnecessary shutdown for executor. (kfujino)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Other">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to