KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > izforge > izpack > Bin_Langpacks_InstallerTest


1 /*
2  * IzPack - Copyright 2001-2007 Julien Ponge, All Rights Reserved.
3  *
4  * http://www.izforge.com/izpack/
5  * http://developer.berlios.de/projects/izpack/
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */

19
20 package com.izforge.izpack;
21
22 import java.io.File JavaDoc;
23 import java.io.FileInputStream JavaDoc;
24 import java.util.Iterator JavaDoc;
25
26 import junit.framework.TestCase;
27
28 /**
29  * A JUnit TestCase to check completeness of the all the language packs
30  *
31  * @author Hans Aikema
32  *
33  */

34 public class Bin_Langpacks_InstallerTest extends TestCase
35 {
36     private final static String JavaDoc referencePack = "eng.xml";
37     private final static String JavaDoc basePath= "." + File.separator +
38                                 "bin" + File.separator +
39                                 "langpacks" + File.separator +
40                                 "installer" + File.separator;
41     private static LocaleDatabase reference;
42     private LocaleDatabase check;
43
44     /**
45      * Creates a new 'test all' installer langpack testcase
46      *
47      * @throws Exception Forwarded Exception from LocaleDatabase constructor or FileNotFoundException on allocation of the reference languagepack
48      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
49      */

50     public Bin_Langpacks_InstallerTest() throws Exception JavaDoc
51     {
52         this("");
53     }
54     
55     /**
56      * Creates a new 'single testmethod' installer langpack testcase
57      *
58      * @throws Exception Forwarded Exception from LocaleDatabase constructor or FileNotFoundException on allocation of the reference languagepack
59      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
60      * @see junit.framework.TestCase#TestCase(java.lang.String)
61      */

62     public Bin_Langpacks_InstallerTest(String JavaDoc arg0) throws Exception JavaDoc
63     {
64         super(arg0);
65         Bin_Langpacks_InstallerTest.reference = new LocaleDatabase(new FileInputStream JavaDoc(basePath + referencePack));
66     }
67     
68     private void checkLangpack(String JavaDoc langpack) throws Exception JavaDoc{
69         this.check = new LocaleDatabase(new FileInputStream JavaDoc(basePath + langpack));
70         // all keys in the English langpack should be present in the foreign langpack
71
for (Iterator JavaDoc i = reference.keySet().iterator();i.hasNext();) {
72             // Locale Database uses the id strings as keys
73
String JavaDoc id = (String JavaDoc) i.next();
74             assertTrue("Missing translation for id:"+id,this.check.containsKey(id));
75         }
76         // there should be no keys in the foreign langpack which don't exist in the
77
// english langpack
78
for (Iterator JavaDoc i = this.check.keySet().iterator();i.hasNext();) {
79             // LocaleDatabase uses the id strings as keys
80
String JavaDoc id = (String JavaDoc) i.next();
81             assertTrue("Superfluous translation for id:"+id,reference.containsKey(id));
82         }
83     }
84     /**
85      * Checks the Catalan language pack for missing / superfluous translations
86      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
87      *
88      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
89      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
90      * @see java.util.TreeMap#containsKey(java.lang.Object)
91      */

92     public void testCat() throws Exception JavaDoc{
93         this.checkLangpack("cat.xml");
94     }
95     
96     /**
97      * Checks the Chinese language pack for missing / superfluous translations
98      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
99      *
100      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
101      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
102      * @see java.util.TreeMap#containsKey(java.lang.Object)
103      */

104 public void testChn() throws Exception JavaDoc{
105         this.checkLangpack("chn.xml");
106     }
107
108 /**
109  * Checks the Czech language pack for missing / superfluous translations
110  * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
111  *
112  * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
113  * @see java.io.FileInputStream#FileInputStream(java.lang.String)
114  * @see java.util.TreeMap#containsKey(java.lang.Object)
115  */

116     public void testCze() throws Exception JavaDoc{
117         this.checkLangpack("cze.xml");
118     }
119     
120     /**
121      * Checks the Danish language pack for missing / superfluous translations
122      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
123      *
124      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
125      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
126      * @see java.util.TreeMap#containsKey(java.lang.Object)
127      */

128 public void testDan() throws Exception JavaDoc{
129         this.checkLangpack("dan.xml");
130     }
131 /**
132  * Checks the German language pack for missing / superfluous translations
133  * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
134  *
135  * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
136  * @see java.io.FileInputStream#FileInputStream(java.lang.String)
137  * @see java.util.TreeMap#containsKey(java.lang.Object)
138  */

139 public void testDeu() throws Exception JavaDoc{
140         this.checkLangpack("deu.xml");
141     }
142 /**
143  * Checks the Modern Greek language pack for missing / superfluous translations
144  * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
145  *
146  * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
147  * @see java.io.FileInputStream#FileInputStream(java.lang.String)
148  * @see java.util.TreeMap#containsKey(java.lang.Object)
149  */

150 public void testEll() throws Exception JavaDoc{
151         this.checkLangpack("ell.xml");
152     }
153
154 /**
155  * Checks the English language pack for missing / superfluous translations<br />
156  * <em>This test should always succeed, since the english langpack is the reference pack)</em>
157  * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
158  *
159  * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
160  * @see java.io.FileInputStream#FileInputStream(java.lang.String)
161  * @see java.util.TreeMap#containsKey(java.lang.Object)
162  */

163 public void testEng() throws Exception JavaDoc{
164         this.checkLangpack("eng.xml");
165     }
166 /**
167  * Checks the Finnish language pack for missing / superfluous translations
168  * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
169  *
170  * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
171  * @see java.io.FileInputStream#FileInputStream(java.lang.String)
172  * @see java.util.TreeMap#containsKey(java.lang.Object)
173  */

174     public void testFin() throws Exception JavaDoc{
175         this.checkLangpack("fin.xml");
176     }
177     /**
178      * Checks the French language pack for missing / superfluous translations
179      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
180      *
181      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
182      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
183      * @see java.util.TreeMap#containsKey(java.lang.Object)
184      */

185     public void testFra() throws Exception JavaDoc{
186         this.checkLangpack("fra.xml");
187     }
188     /**
189      * Checks the Hungarian language pack for missing / superfluous translations
190      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
191      *
192      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
193      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
194      * @see java.util.TreeMap#containsKey(java.lang.Object)
195      */

196     public void testHun() throws Exception JavaDoc{
197         this.checkLangpack("hun.xml");
198     }
199     /**
200      * Checks the Indonesian language pack for missing / superfluous translations
201      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
202      *
203      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
204      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
205      * @see java.util.TreeMap#containsKey(java.lang.Object)
206      */

207     public void testInd() throws Exception JavaDoc{
208         this.checkLangpack("ind.xml");
209     }
210     /**
211      * Checks the Italian language pack for missing / superfluous translations
212      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
213      *
214      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
215      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
216      * @see java.util.TreeMap#containsKey(java.lang.Object)
217      */

218     public void testIta() throws Exception JavaDoc{
219         this.checkLangpack("ita.xml");
220     }
221     /**
222      * Checks the Japanese language pack for missing / superfluous translations
223      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
224      *
225      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
226      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
227      * @see java.util.TreeMap#containsKey(java.lang.Object)
228      */

229     public void testJpn() throws Exception JavaDoc{
230         this.checkLangpack("jpn.xml");
231     }
232     /**
233      * Checks the Korean language pack for missing / superfluous translations
234      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
235      *
236      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
237      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
238      * @see java.util.TreeMap#containsKey(java.lang.Object)
239      */

240     public void testKor() throws Exception JavaDoc{
241         this.checkLangpack("kor.xml");
242     }
243     /**
244      * Checks the Malaysian language pack for missing / superfluous translations
245      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
246      *
247      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
248      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
249      * @see java.util.TreeMap#containsKey(java.lang.Object)
250      */

251     public void testMys() throws Exception JavaDoc{
252         this.checkLangpack("mys.xml");
253     }
254     /**
255      * Checks the Dutch language pack for missing / superfluous translations
256      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
257      *
258      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
259      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
260      * @see java.util.TreeMap#containsKey(java.lang.Object)
261      */

262     public void testNed() throws Exception JavaDoc{
263         this.checkLangpack("ned.xml");
264     }
265     /**
266      * Checks the Norwegian language pack for missing / superfluous translations
267      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
268      *
269      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
270      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
271      * @see java.util.TreeMap#containsKey(java.lang.Object)
272      */

273     public void testNor() throws Exception JavaDoc{
274         this.checkLangpack("nor.xml");
275     }
276     /**
277      * Checks the Polish language pack for missing / superfluous translations
278      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
279      *
280      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
281      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
282      * @see java.util.TreeMap#containsKey(java.lang.Object)
283      */

284     public void testPol() throws Exception JavaDoc{
285         this.checkLangpack("pol.xml");
286     }
287     /**
288      * Checks the Portugese language pack for missing / superfluous translations
289      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
290      *
291      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
292      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
293      * @see java.util.TreeMap#containsKey(java.lang.Object)
294      */

295     public void testPor() throws Exception JavaDoc{
296         this.checkLangpack("por.xml");
297     }
298     /**
299      * Checks the Romanian language pack for missing / superfluous translations
300      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
301      *
302      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
303      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
304      * @see java.util.TreeMap#containsKey(java.lang.Object)
305      */

306     public void testRom() throws Exception JavaDoc{
307         this.checkLangpack("rom.xml");
308     }
309     /**
310      * Checks the Russian language pack for missing / superfluous translations
311      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
312      *
313      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
314      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
315      * @see java.util.TreeMap#containsKey(java.lang.Object)
316      */

317     public void testRus() throws Exception JavaDoc{
318         this.checkLangpack("rus.xml");
319     }
320     /**
321      * Checks the Serbia/Montenegro language pack for missing / superfluous translations
322      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
323      *
324      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
325      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
326      * @see java.util.TreeMap#containsKey(java.lang.Object)
327      */

328     public void testScg() throws Exception JavaDoc{
329         this.checkLangpack("scg.xml");
330     }
331     /**
332      * Checks the Spanish language pack for missing / superfluous translations
333      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
334      *
335      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
336      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
337      * @see java.util.TreeMap#containsKey(java.lang.Object)
338      */

339     public void testSpa() throws Exception JavaDoc{
340         this.checkLangpack("spa.xml");
341     }
342     /**
343      * Checks the Slovak language pack for missing / superfluous translations
344      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
345      *
346      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
347      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
348      * @see java.util.TreeMap#containsKey(java.lang.Object)
349      */

350     public void testSvk() throws Exception JavaDoc{
351         this.checkLangpack("svk.xml");
352     }
353     /**
354      * Checks the Swedish language pack for missing / superfluous translations
355      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
356      *
357      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
358      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
359      * @see java.util.TreeMap#containsKey(java.lang.Object)
360      */

361 public void testSwe() throws Exception JavaDoc{
362         this.checkLangpack("swe.xml");
363     }
364 /**
365  * Checks the Turkish language pack for missing / superfluous translations
366  * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
367  *
368  * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
369  * @see java.io.FileInputStream#FileInputStream(java.lang.String)
370  * @see java.util.TreeMap#containsKey(java.lang.Object)
371  */

372     public void testTur() throws Exception JavaDoc{
373         this.checkLangpack("tur.xml");
374     }
375     /**
376      * Checks the Ukranian language pack for missing / superfluous translations
377      * @throws Exception Forwarded Exception for the LocaleDatabase contructor, FileInputStream constructor or TreeMap containsKey method
378      *
379      * @see com.izforge.izpack.LocaleDatabase#LocaleDatabase(java.io.InputStream)
380      * @see java.io.FileInputStream#FileInputStream(java.lang.String)
381      * @see java.util.TreeMap#containsKey(java.lang.Object)
382      */

383     public void testUkr() throws Exception JavaDoc{
384         this.checkLangpack("ukr.xml");
385     }
386 }
387
Popular Tags