cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicolas Maisonneuve" <>
Subject Re: tescase avalon component in cocoon
Date Tue, 02 Sep 2003 10:41:33 GMT
i  find a solution 

add this parameters in the testcase configuration file
      <entry name="environment-context" class="org.apache.cocoon.environment.mock.MockContext"/>

Actually i use the context for the getRealPath method
but in MockContext  , this method return the input path parameter.. 

there is a addContext method in Excalibur TestCase, but 
i don't know how it work (i try to use but no success with this sample

    DefaultContext avalonContext = new DefaultContext();
   avalonContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, new MockContext());

   FileInputStream reader = new FileInputStream("d:\\testcase.xml");


the Ideal  will be to  create a MockContext  Object
set The root path ( no possible in this version )

void setRootPath (String root) {

void getRealPath(String path) {
return root+path;

and  use the addContext method Excalibur TestCase

  ----- Original Message ----- 
  From: Ralph Goers 
  To: '' 
  Sent: Tuesday, September 02, 2003 8:59 AM
  Subject: RE: tescase avalon component in cocoon

  Oops. AbstractCompositeTestCase is set up to test generators, transformers and actions.
    -----Original Message-----
    From: Ralph Goers 
    Sent: Monday, September 01, 2003 11:56 PM
    To: ''
    Subject: RE: tescase avalon component in cocoon

    Try extending Cocoon's AbstractCompositeTestCase. It sets up mock objects and is set up
to test generators, transformers and serializers. You can configure basic components and test
them as well.  The only thing I haven't figured out how to test with it is an input module.

      -----Original Message-----
      From: Nicolas Maisonneuve []
      Sent: Monday, September 01, 2003 2:24 PM
      To: cocoon user
      Subject: tescase avalon component in cocoon

      i would like use the Excalibur Testcase for test my avalon component in cocoon 
      but i don't know how do ?

      i tried  with this code but my component use contextualize method  and 
      there is a contextException because the context object is not a cocoon context
      note : i have not experience in TestCase..

      my code : 

      public class TestIndexComponentImpl extends ExcaliburTestCase {

        public TestIndexComponentImpl(String name) {

        protected void setUp() throws Exception {
          FileInputStream reader=new FileInputStream("d://testcase.xml");

        protected void tearDown() throws Exception {

        public void testAnalyzer() {
          try {
            AnalyzerManager manager = (AnalyzerManager)this.lookup(AnalyzerManager.ROLE);
          catch (ComponentException ex) {

View raw message