avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/punit PUnit.java PUnitBlock.java PUnitResourceProvider.java PUnitServiceManager.java
Date Fri, 01 Nov 2002 01:33:09 GMT
hammant     2002/10/31 17:33:09

  Added:       src/java/org/apache/avalon/phoenix/tools/punit PUnit.java
                        PUnitBlock.java PUnitResourceProvider.java
                        PUnitServiceManager.java
  Log:
  Start of PUnit
  
  Revision  Changes    Path
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/punit/PUnit.java
  
  Index: PUnit.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.txt file.
   */
  package org.apache.avalon.phoenix.tools.punit;
  
  import org.apache.excalibur.containerkit.lifecycle.LifecycleHelper;
  import org.apache.excalibur.containerkit.lifecycle.LifecycleException;
  import org.apache.avalon.framework.logger.ConsoleLogger;
  import junit.framework.TestCase;
  import java.util.ArrayList;
  
  
  public abstract class PUnit extends TestCase
  {
  
      private LifecycleHelper m_lifecycleHelper = new LifecycleHelper();
      private PUnitResourceProvider m_pUnitResourceProvider;
  
      private ArrayList m_blocks = new ArrayList();
  
      public PUnit(String name)
      {
          super(name);
          m_lifecycleHelper.enableLogging(new ConsoleLogger());
      }
  
      protected void addBlock(String blockName, Object block) {
          PUnitBlock pBlock= new PUnitBlock(blockName, block, null);
          m_blocks.add(pBlock);
      }
  
  
      protected final void startup() throws LifecycleException
      {
  
          m_pUnitResourceProvider = new PUnitResourceProvider();
          for (int i = 0; i < m_blocks.size(); i++)
          {
              PUnitBlock block = (PUnitBlock) m_blocks.get(i);
              m_lifecycleHelper.startup(block.getBlockName(),block.getBlock(),
                      m_pUnitResourceProvider);
  
          }
  
      }
  
      protected final void shutdown() throws LifecycleException
      {
          m_pUnitResourceProvider = new PUnitResourceProvider();
          for (int i = 0; i < m_blocks.size(); i++)
          {
              PUnitBlock block = (PUnitBlock) m_blocks.get(i);
              m_lifecycleHelper.shutdown(block.getBlockName(),block.getBlock());
  
          }
  
      }
  
  
  }
  
  
  
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/punit/PUnitBlock.java
  
  Index: PUnitBlock.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.txt file.
   */
  package org.apache.avalon.phoenix.tools.punit;
  
  import org.apache.avalon.framework.configuration.Configuration;
  
  
  public class PUnitBlock
  {
      private String m_blockName;
      private Object m_block;
      private Configuration m_configuration;
  
      public PUnitBlock(String blockName, Object block, Configuration configuration)
      {
          this.m_blockName = blockName;
          this.m_block = block;
          this.m_configuration = configuration;
          // logger ?
          // context ?
      }
  
      public String getBlockName()
      {
          return m_blockName;
      }
  
      public Object getBlock()
      {
          return m_block;
      }
  
      public Configuration getConfiguration()
      {
          return m_configuration;
      }
  }
  
  
  
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/punit/PUnitResourceProvider.java
  
  Index: PUnitResourceProvider.java
  ===================================================================
  package org.apache.avalon.phoenix.tools.punit;
  
  import org.apache.excalibur.containerkit.lifecycle.ResourceProvider;
  import org.apache.avalon.framework.logger.Logger;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.parameters.Parameters;
  
  public class PUnitResourceProvider implements ResourceProvider
  {
      public Object createObject(Object o) throws Exception
      {
          return null;
      }
  
      public Logger createLogger(Object o) throws Exception
      {
          return null;
      }
  
      public Context createContext(Object o) throws Exception
      {
          return null;
      }
  
      public ComponentManager createComponentManager(Object o) throws Exception
      {
          return null;
      }
  
      public ServiceManager createServiceManager(Object o) throws Exception
      {
          return new PUnitServiceManager();
      }
  
      public Configuration createConfiguration(Object o) throws Exception
      {
          return null;
      }
  
      public Parameters createParameters(Object o) throws Exception
      {
          return null;
      }
  }
  
  
  
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/tools/punit/PUnitServiceManager.java
  
  Index: PUnitServiceManager.java
  ===================================================================
  package org.apache.avalon.phoenix.tools.punit;
  
  import org.apache.avalon.framework.service.ServiceManager;
  import org.apache.avalon.framework.service.ServiceException;
  
  public class PUnitServiceManager implements ServiceManager
  {
      public Object lookup(String s) throws ServiceException
      {
          return null;
      }
  
      public boolean hasService(String s)
      {
          return false;
      }
  
      public void release(Object o)
      {
      }
  }
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message