krysalis-sandbox/workflow/src/test/org/krysalis/workflow/test WorkFlowManagerTestCase.java,NONE,1.1 WorkFlowManagerTestCase.xtest,NONE,1.1 workflow.xconf,1.2,1.3

[email protected]
Newsgroups gmane.comp.krysalis.sandbox
Message-ID <[email protected]>
Update of /cvsroot/metamorphosis/krysalis-sandbox/workflow/src/test/org/krysalis/workflow/test
In directory sc8-pr-cvs1:/tmp/cvs-serv11380/src/test/org/krysalis/workflow/test

Modified Files:
	workflow.xconf 
Added Files:
	WorkFlowManagerTestCase.java WorkFlowManagerTestCase.xtest 
Log Message:
Managed the first running test case.
Add all avalon libs, which will be needed(incredible many!).


--- NEW FILE: WorkFlowManagerTestCase.java ---
/*****************************************************************************
 * Copyright (C) The Krysalis project. All rights reserved.                  *
 * ------------------------------------------------------------------------- *
 * This software is published under the terms of the Krysalis Patchy         *
 * Software License version 1.1_01, a copy of which has been included        *
 * at the bottom of this file.                                               *
 *****************************************************************************/

package org.krysalis.workflow.test;

import org.apache.avalon.excalibur.testcase.ExcaliburTestCase;
import org.apache.avalon.framework.component.Component;
import org.apache.avalon.framework.component.ComponentException;
import org.krysalis.workflow.*;

/**
 *
 * @author <a href="mailto:[email protected]">Stephan Michels</a>
 * @version CVS $Id$
 */
public class WorkFlowManagerTestCase extends ExcaliburTestCase
{

  /**
   *
   *
   * @param name       
   */
  public WorkFlowManagerTestCase(String name)
  {
    super(name);
  }

  /**
   *
   */
  public void testWorkFlow()
  {
    WorkFlowManager workflow = null;

    try
    {

      workflow = (WorkFlowManager) this.manager.lookup(WorkFlowManager.ROLE);
      assertNotNull("Test lookup of the workflow manager", workflow);

      String resource = "article/test1.xml";

      WorkFlowState state = workflow.lookup(resource);

      assertNotNull("Test lookup of the workflow state", state);
      assertEquals("Test of the workflow state resource", resource,
                   state.getResource());
      assertEquals("Test of the intial workflow state", "authoring",
                   state.getState());
      workflow.release(state);

      resource = "headline/test2.xml";

      state = workflow.lookup(resource);
      assertNotNull("Test lookup of the workflow state", state);
      assertEquals("Test of the workflow state resource", resource,
                   state.getResource());
      assertEquals("Test of the intial workflow state", "authoring",
                   state.getState());
      workflow.release(state);

    }
    catch (ComponentException ce)
    {
      getLogger().error("Could not retrieve  component", ce);
      fail("Could not retrieve component:"+ce.toString());
    }
    finally
    {
      if (workflow!=null)
        this.manager.release(workflow);
    }
  }
}
/*
The Krysalis Patchy Software License, Version 1.1_01
Copyright (c) 2002 Nicola Ken Barozzi.  All rights reserved.

This Licence is compatible with the BSD licence as described and 
approved by http://www.opensource.org/, and is based on the
Apache Software Licence Version 1.1.

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 for project 
       Krysalis (http://www.krysalis.org/)."
   Alternately, this acknowledgment may appear in the software itself,
   if and wherever such third-party acknowledgments normally appear.

4. The names "Krysalis" and "Nicola Ken Barozzi" and
   "Krysalis Metamorphosis" 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 "Krysalis",
   "Krysalis Metamorphosis", nor may "Krysalis" appear in their name,
   without prior written permission of Nicola Ken Barozzi.

6. This software may contain voluntary contributions made by many 
   individuals, who decided to donate the code to this project in
   respect of this licence.

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 KRYSALIS PROJECT 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.
====================================================================*/

--- NEW FILE: WorkFlowManagerTestCase.xtest ---
<?xml version="1.0" ?>
<testcase>
 <annotation>
  Test Cases: WorkFlowManager
 </annotation>

 <logkit>
  <factories>
   <factory type="file" class="org.apache.avalon.excalibur.logger.factory.FileTargetFactory"/>
  </factories>
  <targets>
   <file id="root">
    <filename>workflow.log</filename>
    <format type="extended">
     %7.7{priority} %5.5{time}   [%8.8{category}] (%{context}): %{message}\n%{throwable}
    </format>
   </file>
  </targets>
  <categories>
   <category name="workflow" log-level="DEBUG">
    <log-target id-ref="root"/>
   </category>
  </categories>
 </logkit>

 <context/>

 <roles>
  <role name="org.apache.excalibur.xml.sax.SAXParser"
        shorthand="xml-parser"
        default-class="org.apache.excalibur.xml.impl.JaxpParser"/>

  <role name="org.apache.excalibur.source.SourceFactorySelector"
        shorthand="source-factories"
        default-class="org.apache.avalon.excalibur.component.ExcaliburComponentSelector"/>

  <role name="org.apache.excalibur.source.SourceResolver"
        shorthand="source-resolver"
        default-class="org.apache.excalibur.source.impl.SourceResolverImpl"/>

  <role name="org.krysalis.workflow.WorkFlowManager"
        shorthand="workflow"
        default-class="org.krysalis.workflow.manager.DefaultWorkFlowManager"/>
 </roles>

 <components>
  <xml-parser class="org.apache.excalibur.xml.impl.JaxpParser">
   <parameter name="validate" value="false"/>
   <parameter name="namespace-prefixes" value="false"/>
   <parameter name="stop-on-warning" value="true"/>
   <parameter name="stop-on-recoverable-error" value="true"/>
   <parameter name="reuse-parsers" value="false"/>
  </xml-parser>

  <source-factories>
   <component-instance class="org.apache.excalibur.source.impl.ResourceSourceFactory" name="resource"/>
  </source-factories>

  <source-resolver class="org.apache.excalibur.source.impl.SourceResolverImpl"/>

  <workflow file="resource://org/krysalis/workflow/test/workflow.xconf" logger="workflow"/>
 </components>

</testcase>

Index: workflow.xconf
===================================================================
RCS file: /cvsroot/metamorphosis/krysalis-sandbox/workflow/src/test/org/krysalis/workflow/test/workflow.xconf,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** workflow.xconf	14 Mar 2003 09:17:28 -0000	1.2
--- workflow.xconf	14 Mar 2003 15:06:11 -0000	1.3
***************
*** 1,29 ****
! <?xml version"1.0"?>
  <wf>
  
!  <stores>
    <store name="memory" class="org.krysalis.workflow.store.MemoryStore"/>
   </stores>
  
   <workflows default="standard-article">
!   <workflow id="standard-article">
!     <state id="authoring">
        <transition ref="proof-reading"/>
      </state>
!     <state id="proof-reading">
        <transition ref="authoring"/>
        <transition ref="ready-to-publish"/>
      </state>
!     <state id="ready-to-publish">
        <transition ref="authoring"/>
        <transition ref="proof-reading"/>
        <transition ref="live"/>
      </state>
!     <state id="live">
        <transition ref="authoring"/>
        <transition ref="proof-reading"/>
        <transition ref="archived"/>
      </state>
!     <state id="archived">
        <transition ref="authoring"/>
        <transition ref="proof-reading"/>
--- 1,29 ----
! <?xml version="1.0"?>
  <wf>
  
!  <stores default="memory">
    <store name="memory" class="org.krysalis.workflow.store.MemoryStore"/>
   </stores>
  
   <workflows default="standard-article">
!   <workflow name="standard-article">
!     <state name="authoring">
        <transition ref="proof-reading"/>
      </state>
!     <state name="proof-reading">
        <transition ref="authoring"/>
        <transition ref="ready-to-publish"/>
      </state>
!     <state name="ready-to-publish">
        <transition ref="authoring"/>
        <transition ref="proof-reading"/>
        <transition ref="live"/>
      </state>
!     <state name="live">
        <transition ref="authoring"/>
        <transition ref="proof-reading"/>
        <transition ref="archived"/>
      </state>
!     <state name="archived">
        <transition ref="authoring"/>
        <transition ref="proof-reading"/>
***************
*** 31,53 ****
    </workflow>
  
!   <workflow id="headline">
!     <state id="authoring">
        <transition ref="proof-reading"/>
      </state>
!     <state id="proof-reading">
        <transition ref="authoring"/>
        <transition ref="ready-to-publish"/>
      </state>
!     <state id="ready-to-publish">
        <transition ref="authoring"/>
        <transition ref="proof-reading"/>
        <transition ref="live"/>
      </state>
!     <state id="live">
        <transition ref="authoring"/>
        <transition ref="proof-reading"/>
        <transition ref="archived"/>
      </state>
!     <state id="archived">
        <transition ref="authoring"/>
        <transition ref="proof-reading"/>
--- 31,53 ----
    </workflow>
  
!   <workflow name="headline">
!     <state name="authoring">
        <transition ref="proof-reading"/>
      </state>
!     <state name="proof-reading">
        <transition ref="authoring"/>
        <transition ref="ready-to-publish"/>
      </state>
!     <state name="ready-to-publish">
        <transition ref="authoring"/>
        <transition ref="proof-reading"/>
        <transition ref="live"/>
      </state>
!     <state name="live">
        <transition ref="authoring"/>
        <transition ref="proof-reading"/>
        <transition ref="archived"/>
      </state>
!     <state name="archived">
        <transition ref="authoring"/>
        <transition ref="proof-reading"/>
***************
*** 58,62 ****
   <map> 
    <assign pattern="headline/*" workflow="headline" store="memory"/>
!   <assign pattern="article/*" workflow="standard-article" store="memory/>
   </map>
  
--- 58,62 ----
   <map> 
    <assign pattern="headline/*" workflow="headline" store="memory"/>
!   <assign pattern="article/*" workflow="standard-article" store="memory"/>
   </map>
  




-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open! 
Get cracking and register here for some mind boggling fun and 
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.