neeme 01/11/02 11:37:03 Added: src/scratchpad/org/apache/avalon/excalibur/i18n/test DefaultBundleMatcherTestCase.java DefaultBundleMatcherTestCase.xtest Log: converted bundlematcher into an interface and provided a default implementation instead Revision Changes Path 1.1 jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/i18n/test/DefaultBundleMatcherTestCase.java Index: DefaultBundleMatcherTestCase.java =================================================================== /* * Copyright (C) The Apache Software Foundation. All rights reserved. * * This software is published under the terms of the Apache Software License * version 1.1, a copy of which has been included with this distribution in * the LICENSE file. */ package org.apache.avalon.excalibur.i18n.test; import java.util.Map; import java.util.HashMap; import java.util.Locale; import org.apache.avalon.framework.configuration.Configuration; import org.apache.avalon.framework.configuration.ConfigurationException; import org.apache.avalon.excalibur.testcase.ExcaliburTestCase; import org.apache.avalon.excalibur.i18n.BundleInfo; import org.apache.avalon.excalibur.i18n.DefaultBundleMatcher; /** * @author <a href="mailto:[EMAIL PROTECTED]">Neeme Praks</a> * @version $Id: DefaultBundleMatcherTestCase.java,v 1.1 2001/11/02 19:37:03 neeme Exp $ */ public class DefaultBundleMatcherTestCase extends ExcaliburTestCase { private DefaultBundleMatcher[] matchers; public DefaultBundleMatcherTestCase(String name) { super(name); } public void configure(Configuration configuration) throws ConfigurationException { Configuration[] confs = configuration.getChildren("matcher"); this.matchers = new DefaultBundleMatcher[confs.length]; for (int i = 0; i < confs.length; i++) { this.matchers[i] = new DefaultBundleMatcher(); this.matchers[i].configure(confs[i]); } } public void setUp() throws Exception { super.setUp(); } public void tearDown() throws Exception { super.tearDown(); } public void testMatching() throws Exception { assertEquals("test1", matchers[0].getType(new BundleInfo("test", new Locale("test-lang", "test-country", "test-variant"), "test-ext"))); assertTrue(null == matchers[0].getType(new BundleInfo("test", new Locale("test-lang", "test-country", "test-variant"), "test"))); assertEquals("test2", matchers[1].getType(new BundleInfo("test", new Locale("test-lang", "test-country", "test-variant")))); assertTrue(null == matchers[1].getType(new BundleInfo("testing", new Locale("test-lang", "test-country", "test-variant")))); assertEquals("test3", matchers[2].getType(new BundleInfo("test", new Locale("test-lang", "test-country")))); assertTrue(null == matchers[2].getType(new BundleInfo("testing", new Locale("test-language", "test-country")))); assertTrue(null == matchers[2].getType(new BundleInfo("testing", new Locale("test-lang", "test-count")))); } public static void main(String[] args) { ExcaliburTestCase test = new DefaultBundleMatcherTestCase("test"); test.run(); } } 1.1 jakarta-avalon-excalibur/src/scratchpad/org/apache/avalon/excalibur/i18n/test/DefaultBundleMatcherTestCase.xtest Index: DefaultBundleMatcherTestCase.xtest =================================================================== <?xml version="1.0" encoding="UTF-8"?> <testcase> <annotation><![CDATA[ <title>DefaultBundleLoader tests</title> <para> Tests the DefaultBundleLoader implementation: loading bundles, mapping correctly, etc. </para> ]]></annotation> <context/> <logkit/> <configuration> <matcher class="org.apache.avalon.excalibur.i18n.DefaultMatcher" type="test1"> <bundle-info name="test" ext="test-ext"> <locale language="test-lang" country="test-country" variant="test-variant"/> </bundle-info> </matcher> <matcher class="org.apache.avalon.excalibur.i18n.DefaultMatcher" type="test2"> <bundle-info name="test"/> </matcher> <matcher class="org.apache.avalon.excalibur.i18n.DefaultMatcher" type="test3"> <bundle-info> <locale language="test-lang" country="test-country"/> </bundle-info> </matcher> </configuration> </testcase>
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>