[cvs] expresso commit by lhamel: remove dup
JCorporate Ltd
jcorp at jcorp2.servlets.net
Fri Nov 12 23:43:25 PST 2004
Log Message:
-----------
remove dup
Removed Files:
-------------
expresso/expresso-web/WEB-INF/src/com/jcorporate/expresso/kernel/util/test:
TestLocatorUtils.java
Revision Data
-------------
--- expresso-web/WEB-INF/src/com/jcorporate/expresso/kernel/util/test/TestLocatorUtils.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/* ====================================================================
- * The Jcorporate Apache Style Software License, Version 1.2 05-07-2002
- *
- * Copyright (c) 1995-2002 Jcorporate Ltd. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by Jcorporate Ltd.
- * (http://www.jcorporate.com/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. "Jcorporate" and product names such as "Expresso" must
- * not be used to endorse or promote products derived from this
- * software without prior written permission. For written permission,
- * please contact info at jcorporate.com.
- *
- * 5. Products derived from this software may not be called "Expresso",
- * or other Jcorporate product names; nor may "Expresso" or other
- * Jcorporate product names appear in their name, without prior
- * written permission of Jcorporate Ltd.
- *
- * 6. No product derived from this software may compete in the same
- * market space, i.e. framework, without prior written permission
- * of Jcorporate Ltd. For written permission, please contact
- * partners at jcorporate.com.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL JCORPORATE LTD OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Jcorporate Ltd. Contributions back
- * to the project(s) are encouraged when you make modifications.
- * Please send them to support at jcorporate.com. For more information
- * on Jcorporate Ltd. and its products, please see
- * <http://www.jcorporate.com/>.
- *
- * Portions of this software are based upon other open source
- * products and are subject to their respective licenses.
- */
-
-package com.jcorporate.expresso.kernel.util.test;
-
-import com.jcorporate.expresso.kernel.Containable;
-import com.jcorporate.expresso.kernel.ExpressoComponent;
-import com.jcorporate.expresso.kernel.RootContainerInterface;
-import com.jcorporate.expresso.kernel.SystemFactory;
-import com.jcorporate.expresso.kernel.digester.ComponentConfig;
-import com.jcorporate.expresso.kernel.exception.ConfigurationException;
-import com.jcorporate.expresso.kernel.metadata.ComponentMetadata;
-import com.jcorporate.expresso.kernel.util.LocatorUtils;
-import com.jcorporate.expresso.services.test.TestSystemInitializer;
-import junit.framework.TestCase;
-
-/** JUnitTest case for class: com.jcorporate.expresso.kernel.util.LocatorUtils */
-public class TestLocatorUtils extends TestCase {
-
- public TestLocatorUtils(String _name) {
- super(_name);
- }
-
- RootContainerInterface globalContainer = null;
-
- /** setUp method for test case */
- protected void setUp() {
- try {
- globalContainer = SystemFactory.buildExpressoComponentSystem(
- this.getClass().getResource("/com/jcorporate/expresso/kernel/management/test/Test1ExpressoServices.xml"),
- this.getClass().getResource("/com/jcorporate/expresso/kernel/management/test/TestLog4jConfig.xml"),
- TestSystemInitializer.getLogDirectory());
- } catch (ConfigurationException ex) {
- ex.printStackTrace();
- fail("Unable to set up test case: " + ex.getMessage());
- }
-
-
- }
-
- /** tearDown method for test case */
- protected void tearDown() {
- globalContainer.destroy();
- globalContainer = null;
- System.gc();
- System.runFinalization();
- }
-
- /** test for method locateComponent(..) */
- public void testLocateComponent() {
- try {
- //
- //Basic tests
- //
- LocatorUtils lu = new LocatorUtils((ExpressoComponent) globalContainer);
- ExpressoComponent test = lu.locateComponent("");
- assertTrue("Root component must not be null", test != null);
- assertTrue("Test should be the same as the global container", test == globalContainer);
-
- test = lu.locateComponent("default");
- assertTrue("Test component must be named default", "default".equals(test.getMetaData().getName()));
- assertTrue("Test component must be a component container", test instanceof Containable);
-
- test = lu.locateComponent("default.TestComponent");
- assertTrue("Test component must be named TestComponent",
- "TestComponent".equals(test.getMetaData().getName()));
-
- //
- //Now test to make sure that LocatorUtils properly finds the root
- //given being dumped anywhere on the tree.
- //
- lu = new LocatorUtils(test);
-
- test = lu.locateComponent("");
- assertTrue("Root component must not be null", test != null);
- assertTrue("Test should be the same as the global container", test == globalContainer);
-
- test = lu.locateComponent("default");
- assertTrue("Test component must be named default", "default".equals(test.getMetaData().getName()));
- assertTrue("Test component must be a component container", test instanceof Containable);
-
- test = lu.locateComponent("default.TestComponent");
- assertTrue("Test component must be named TestComponent",
- "TestComponent".equals(test.getMetaData().getName()));
-
- //
- //Now test bad input
- //
- try {
- test = lu.locateComponent("abcdkefjj");
- fail("Should have thrown an exception upon bad input");
- } catch (IllegalArgumentException ex) {
-
- }
-
- try {
- test = lu.locateComponent("default..TestComponent");
- fail("Should have thrown an exception upon bad input");
- } catch (IllegalArgumentException ex) {
-
- }
-
- try {
- test = lu.locateComponent(".default.TestComponent");
- fail("Should have thrown an exception upon bad input");
- } catch (IllegalArgumentException ex) {
-
- }
-
- try {
- test = lu.locateComponent("default.ancdkiekel/");
- fail("Should have thrown an exception upon bad input");
- } catch (IllegalArgumentException ex) {
-
- }
- } catch (Exception ex) {
- ex.printStackTrace();
- fail("Error locating components " + ex.getMessage());
- }
-
- }
-
- /** test for method locateConfiguration(..) */
- public void testLocateConfiguration() {
- LocatorUtils lu = new LocatorUtils((ExpressoComponent) globalContainer);
- ComponentConfig test = lu.locateConfiguration("");
- assertTrue("Root component must not be null", test != null);
-
- test = lu.locateConfiguration("default");
- assertTrue("Test component must be named default", "default".equals(test.getName()));
-
- test = lu.locateConfiguration("default.TestComponent");
- assertTrue("Test component must be named TestComponent",
- "TestComponent".equals(test.getName()));
-
- //
- //Now test bad input
- //
- try {
- test = lu.locateConfiguration("abcdkefjj");
- fail("Should have thrown an exception upon bad input");
- } catch (IllegalArgumentException ex) {
-
- }
-
- try {
- test = lu.locateConfiguration("default..TestComponent");
- fail("Should have thrown an exception upon bad input");
- } catch (IllegalArgumentException ex) {
-
- }
-
- try {
- test = lu.locateConfiguration(".default.TestComponent");
- fail("Should have thrown an exception upon bad input");
- } catch (IllegalArgumentException ex) {
-
- }
-
- try {
- test = lu.locateConfiguration("default.ancdkiekel/");
- fail("Should have thrown an exception upon bad input");
- } catch (IllegalArgumentException ex) {
-
- }
-
- }
-
- /** test for method locateMetadata(..) */
- public void testLocateMetadata() {
- LocatorUtils lu = new LocatorUtils((ExpressoComponent) globalContainer);
- ComponentMetadata test = lu.locateMetadata("");
- assertTrue("Root component must not be null", test != null);
-
- test = lu.locateMetadata("default");
- assertTrue("Test component must be named default", "default".equals(test.getName()));
-
- test = lu.locateMetadata("default.TestComponent");
- assertTrue("Test component must be named TestComponent",
- "TestComponent".equals(test.getName()));
-
- //
- //Now test bad input
- //
- try {
- test = lu.locateMetadata("abcdkefjj");
- fail("Should have thrown an exception upon bad input");
- } catch (IllegalArgumentException ex) {
-
- }
-
- try {
- test = lu.locateMetadata("default..TestComponent");
- fail("Should have thrown an exception upon bad input");
- } catch (IllegalArgumentException ex) {
-
- }
-
- try {
- test = lu.locateMetadata(".default.TestComponent");
- fail("Should have thrown an exception upon bad input");
- } catch (IllegalArgumentException ex) {
-
- }
-
- try {
- test = lu.locateMetadata("default.ancdkiekel/");
- fail("Should have thrown an exception upon bad input");
- } catch (IllegalArgumentException ex) {
-
- }
-
-
- }
-
- /**
- * Test to make sure components on the tree are getting correct paths
- * back.
- */
- public void testCreatePath() {
- LocatorUtils lu = new LocatorUtils((ExpressoComponent) globalContainer);
- ExpressoComponent test = lu.locateComponent("");
- assertTrue("Root component must not be null", test != null);
- assertTrue("".equals(lu.getPath(test)));
-
- test = lu.locateComponent("default");
- assertTrue("default component must not be null", test != null);
- assertTrue("default".equals(lu.getPath(test)));
-
- test = lu.locateComponent("default.TestComponent");
- assertTrue("default.TestComponent must not be null", test != null);
- assertTrue("default.TestComponent".equals(lu.getPath(test)));
-
- }
-
- /** Executes the test case */
- public static void main(String[] argv) {
- String[] testCaseList = {TestLocatorUtils.class.getName()};
- junit.textui.TestRunner.main(testCaseList);
- }
-}
More information about the cvs
mailing list