neeme       2003/12/01 10:04:15

  Added:       fortress/tools/src/test/org/apache/avalon/fortress/tools
                        FortressBeanTestCase.java
                        FortressBeanTestCase.roles
                        FortressBeanTestCase.xconf
                        FortressBeanTestCase.xlog TestImpl.java
                        TestInterface.java
  Log:
  added FortressBean and a related testcase
  
  Revision  Changes    Path
  1.1                  
avalon/fortress/tools/src/test/org/apache/avalon/fortress/tools/FortressBeanTestCase.java
  
  Index: FortressBeanTestCase.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation. 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 the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * 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 THE APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.avalon.fortress.tools;
  
  import junit.framework.TestCase;
  
  public class FortressBeanTestCase extends TestCase {
  
      private FortressBean bean;
  
      public FortressBeanTestCase(String name) {
          super(name);
      }
  
      /**
       * @see junit.framework.TestCase#setUp()
       */
      protected void setUp() throws Exception {
          this.bean = new FortressBean();
      }
  
      public void test() throws Exception {
          
this.bean.setRoleManagerConfiguration("resource://org/apache/avalon/fortress/tools/FortressBeanTestCase.roles");
          
this.bean.setContainerConfiguration("resource://org/apache/avalon/fortress/tools/FortressBeanTestCase.xconf");
          
this.bean.setLoggerManagerConfiguration("resource://org/apache/avalon/fortress/tools/FortressBeanTestCase.xlog");
          this.bean.setLookupComponentRole(TestInterface.ROLE);
          this.bean.setInvokeMethod("run");
          this.bean.setSystemExitOnDispose(false);
          this.bean.initialize();
          this.bean.run();
          TestInterface ti = (TestInterface) 
this.bean.getServiceManager().lookup(TestInterface.ROLE);
          assertNotNull(ti);
          assertTrue(ti.isRunning());
          this.bean.dispose();
      }
  
  }
  
  
  
  1.1                  
avalon/fortress/tools/src/test/org/apache/avalon/fortress/tools/FortressBeanTestCase.roles
  
  Index: FortressBeanTestCase.roles
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!--
   ====================================================================
   The Apache Software License, Version 1.1
  
   Copyright (c) 2003 The Apache Software Foundation. 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 the
      Apache Software Foundation (http://www.apache.org/)."
      Alternately, this acknowledgment may appear in the software
      itself, if and wherever such third-party acknowledgments
      normally appear.
  
   4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software
      Foundation" must not be used to endorse or promote products derived
      from this software without prior written permission. For written
      permission, please contact [EMAIL PROTECTED]
  
   5. Products derived from this software may not be called "Apache",
      nor may "Apache" appear in their name, without prior written
      permission of the Apache Software Foundation.
  
   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 THE APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation. For more
   information on the Apache Software Foundation, please see
   <http://www.apache.org/>.
  -->
  <fortress-roles logger="system.roles">
    <role name="org.apache.avalon.fortress.tools.TestInterface">
      <component shorthand="test"
                 class="org.apache.avalon.fortress.tools.TestImpl"
                 
handler="org.apache.avalon.fortress.impl.handler.ThreadSafeComponentHandler"/>
    </role>
  </fortress-roles>
  
  
  1.1                  
avalon/fortress/tools/src/test/org/apache/avalon/fortress/tools/FortressBeanTestCase.xconf
  
  Index: FortressBeanTestCase.xconf
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!--
   ====================================================================
   The Apache Software License, Version 1.1
  
   Copyright (c) 2003 The Apache Software Foundation. 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 the
      Apache Software Foundation (http://www.apache.org/)."
      Alternately, this acknowledgment may appear in the software
      itself, if and wherever such third-party acknowledgments
      normally appear.
  
   4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software
      Foundation" must not be used to endorse or promote products derived
      from this software without prior written permission. For written
      permission, please contact [EMAIL PROTECTED]
  
   5. Products derived from this software may not be called "Apache",
      nor may "Apache" appear in their name, without prior written
      permission of the Apache Software Foundation.
  
   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 THE APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation. For more
   information on the Apache Software Foundation, please see
   <http://www.apache.org/>.
  -->
  <fortress>
        <test id="test" logger="test"/>
  </fortress>
  
  
  
  1.1                  
avalon/fortress/tools/src/test/org/apache/avalon/fortress/tools/FortressBeanTestCase.xlog
  
  Index: FortressBeanTestCase.xlog
  ===================================================================
  <?xml version="1.0" encoding="UTF-8"?>
  <!--
   ====================================================================
   The Apache Software License, Version 1.1
  
   Copyright (c) 2003 The Apache Software Foundation. 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 the
      Apache Software Foundation (http://www.apache.org/)."
      Alternately, this acknowledgment may appear in the software
      itself, if and wherever such third-party acknowledgments
      normally appear.
  
   4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software
      Foundation" must not be used to endorse or promote products derived
      from this software without prior written permission. For written
      permission, please contact [EMAIL PROTECTED]
  
   5. Products derived from this software may not be called "Apache",
      nor may "Apache" appear in their name, without prior written
      permission of the Apache Software Foundation.
  
   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 THE APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation. For more
   information on the Apache Software Foundation, please see
   <http://www.apache.org/>.
  -->
  <logkit logger="system.logkit" log-level="INFO">
        <factories>
                <factory type="stream" 
class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/>
        </factories>
        <targets>
                <stream id="console">
                        <stream>System.out</stream>
                        <format type="extended">
                                %7.7{priority} %23.23{time:yyyy-MM-dd HH:mm:ss.SSS} 
[%24.24{category}] (%{context}): %{message}\n%{throwable}
                        </format>
                </stream>
        </targets>
        <categories>
                <category name="" log-level="INFO">
                        <log-target id-ref="console"/>
                </category>
        </categories>
  </logkit>
  
  
  
  1.1                  
avalon/fortress/tools/src/test/org/apache/avalon/fortress/tools/TestImpl.java
  
  Index: TestImpl.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation. 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 the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * 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 THE APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.avalon.fortress.tools;
  
  /**
   * TestInterface implementation for testing FortressBean with FortressBeanTestCase.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">The Avalon Team</a>
   * @version CVS $Revision: 1.1 $ $Date: 2003/12/01 18:04:15 $
   */
  public class TestImpl implements TestInterface {
  
      private boolean isRunning = false;
  
      /**
       * @see org.apache.avalon.fortress.tools.TestInterface#isRunning()
       */
      public boolean isRunning() {
          return this.isRunning;
      }
  
      /**
       * @see org.apache.avalon.fortress.tools.TestInterface#run()
       */
      public void run() {
          this.isRunning = true;
      }
  
  }
  
  
  
  1.1                  
avalon/fortress/tools/src/test/org/apache/avalon/fortress/tools/TestInterface.java
  
  Index: TestInterface.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation. 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 the
   *    Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software
   *    itself, if and wherever such third-party acknowledgments
   *    normally appear.
   *
   * 4. The names "Jakarta", "Avalon", "Excalibur" and "Apache Software
   *    Foundation" must not be used to endorse or promote products derived
   *    from this software without prior written permission. For written
   *    permission, please contact [EMAIL PROTECTED]
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * 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 THE APACHE SOFTWARE FOUNDATION 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 Apache Software Foundation. For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.avalon.fortress.tools;
  
  /**
   * Interface for testing FortressBean with FortressBeanTestCase.
   *
   * @author <a href="mailto:[EMAIL PROTECTED]">The Avalon Team</a>
   * @version CVS $Revision: 1.1 $ $Date: 2003/12/01 18:04:15 $
   */
  public interface TestInterface {
  
      static final String ROLE = TestInterface.class.getName();
  
      void run();
  
      boolean isRunning();
  
  }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to