cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From step...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/javascript JavaScriptFlowTestCase.java
Date Mon, 14 Jun 2004 14:53:57 GMT
stephan     2004/06/14 07:53:57

  Modified:    src/blocks/javaflow/java/org/apache/cocoon/components/flow/java
                        ContinuationClassLoader.java JavaInterpreter.java
               src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test
                        ExtendedContinuable.java SimpleContinuable.java
                        SimpleFlow.java WrapperContinuable.java
               src/blocks/javaflow/test/org/apache/cocoon/components/flow/javascript
                        JavaScriptFlowTestCase.java
  Added:       src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test
                        FooException.java JavaFlowTestCase.java
                        JavaFlowTestCase.xtest
  Removed:     src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test
                        FlowTest.java InheritanceFlowTest.java
  Log:
  Fixing bug, which occur in some combinations of long/double and SWAP.
  Refactor the flow tests using some higher grad test routines.
  
  Revision  Changes    Path
  1.9       +27 -7     cocoon-2.1/src/blocks/javaflow/java/org/apache/cocoon/components/flow/java/ContinuationClassLoader.java
  
  Index: ContinuationClassLoader.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/javaflow/java/org/apache/cocoon/components/flow/java/ContinuationClassLoader.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ContinuationClassLoader.java	3 Jun 2004 14:30:39 -0000	1.8
  +++ ContinuationClassLoader.java	14 Jun 2004 14:53:56 -0000	1.9
  @@ -168,7 +168,7 @@
               }
           }
           
  -        /*byte[] changed = clazz.getJavaClass().getBytes();
  +        byte[] changed = clazz.getJavaClass().getBytes();
           try {
               java.io.FileOutputStream out = new java.io.FileOutputStream(clazz.getClassName()
+ ".rewritten.class");
               out.write(changed);
  @@ -176,7 +176,7 @@
               out.close();
           } catch (java.io.IOException ioe) {
               ioe.printStackTrace();
  -        }*/
  +        }
           
           clazz.addInterface(CONTINUATIONCAPABLE_CLASS);
           return clazz.getJavaClass().getBytes();
  @@ -459,13 +459,23 @@
           // pop all arguments for the constructor from the stack
           for (int i = arguments.length - 1; i >= 0; i--) {
               Type type = arguments[i];
  -            insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
  -            insList.append(new SWAP());
  +            // check for types with two words on stack
  +            if (type.equals(Type.LONG) || type.equals(Type.DOUBLE)) {
  +                insList.append(new ACONST_NULL()); // create dummy stack entry
  +                insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
  +                insList.append(new DUP2_X2()); // swap ContinuationStack object and long/float
  +                insList.append(new POP2());
  +            } else {
  +                insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
  +                insList.append(new SWAP());
  +            }
               if (type instanceof BasicType) {
                   if (type.getSize() < 2 && !type.equals(Type.FLOAT)) {
                       type = Type.INT;
                   }
                   insList.append(insFactory.createInvoke(STACK_CLASS, getPushMethod(type),
Type.VOID, new Type[]{type}, Constants.INVOKEVIRTUAL));
  +                if (type.equals(Type.LONG) || type.equals(Type.DOUBLE))
  +                    insList.append(new POP()); // remove dummy stack entry
               } else if (type instanceof ReferenceType) {
                   insList.append(insFactory.createInvoke(STACK_CLASS, getPushMethod(Type.OBJECT),
Type.VOID, new Type[]{Type.OBJECT}, Constants.INVOKEVIRTUAL));
               }
  @@ -538,9 +548,19 @@
                   if (type.getSize() < 2 && !type.equals(Type.FLOAT)) {
                       type = Type.INT;
                   }
  -                insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
  -                insList.append(new SWAP()); // TODO: check for types with two words on
stack
  +                // check for types with two words on stack
  +                if (type.equals(Type.LONG) || type.equals(Type.DOUBLE)) {
  +                    insList.append(new ACONST_NULL()); // create dummy stack entry
  +                    insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
  +                    insList.append(new DUP2_X2()); // swap ContinuationStack object and
long/float
  +                    insList.append(new POP2());
  +                } else {
  +                    insList.append(InstructionFactory.createLoad(STACK_TYPE, method.getMaxLocals()+1));
  +                    insList.append(new SWAP());
  +                }
                   insList.append(insFactory.createInvoke(STACK_CLASS, getPushMethod(type),
Type.VOID, new Type[]{type}, Constants.INVOKEVIRTUAL));
  +                if (type.equals(Type.LONG) || type.equals(Type.DOUBLE))
  +                    insList.append(new POP()); // remove dummy stack entry
               } else if (type.equals(Type.NULL)) {
                   insList.append(InstructionConstants.POP);
               } else if (type instanceof UninitializedObjectType) {
  
  
  
  1.8       +4 -4      cocoon-2.1/src/blocks/javaflow/java/org/apache/cocoon/components/flow/java/JavaInterpreter.java
  
  Index: JavaInterpreter.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/javaflow/java/org/apache/cocoon/components/flow/java/JavaInterpreter.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- JavaInterpreter.java	4 Jun 2004 14:02:38 -0000	1.7
  +++ JavaInterpreter.java	14 Jun 2004 14:53:56 -0000	1.8
  @@ -68,7 +68,7 @@
   
       public void configure(Configuration config) throws ConfigurationException {
           super.configure(config);
  -
  +        
           javascriptclassloader = new JavaScriptCompilingClassLoader(Thread.currentThread().getContextClassLoader());
           try {
               javascriptclassloader.service(this.manager);
  @@ -86,9 +86,9 @@
           int prefixLen = ACTION_METHOD_PREFIX.length();
           return name.substring(prefixLen, prefixLen + 1).toLowerCase() + name.substring(prefixLen
+ 1);
       }
  -
  +    
       public void initialize() throws Exception {
  -
  +        
           if (getLogger().isDebugEnabled())
               getLogger().debug("initialize java flow interpreter");
   
  
  
  
  1.2       +2 -2      cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/ExtendedContinuable.java
  
  Index: ExtendedContinuable.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/ExtendedContinuable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExtendedContinuable.java	16 Apr 2004 09:39:57 -0000	1.1
  +++ ExtendedContinuable.java	14 Jun 2004 14:53:56 -0000	1.2
  @@ -18,7 +18,7 @@
   
   public class ExtendedContinuable extends SimpleContinuable {
   
  -    public void test() {
  -        super.suspend();
  +    public void doExtendedTest() {
  +        super.doSuspendTest();
       }
   }
  
  
  
  1.2       +1 -1      cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/SimpleContinuable.java
  
  Index: SimpleContinuable.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/SimpleContinuable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleContinuable.java	16 Apr 2004 09:39:57 -0000	1.1
  +++ SimpleContinuable.java	14 Jun 2004 14:53:56 -0000	1.2
  @@ -18,7 +18,7 @@
   import org.apache.cocoon.components.flow.java.*;
   
   public class SimpleContinuable implements Continuable {
  -	public void suspend() {
  +	public void doSuspendTest() {
   		System.out.println("suspending");
   		Continuation.suspend();
   		System.out.println("continuing");
  
  
  
  1.5       +18 -8     cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/SimpleFlow.java
  
  Index: SimpleFlow.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/SimpleFlow.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SimpleFlow.java	3 Jun 2004 14:30:39 -0000	1.4
  +++ SimpleFlow.java	14 Jun 2004 14:53:56 -0000	1.5
  @@ -26,12 +26,12 @@
   public class SimpleFlow extends AbstractSimpleFlow {
   
       public SimpleFlow() {
  -        if (Continuation.currentContinuation() != null)
  -            throw new RuntimeException("Conitnuation should not exist");
  +        /*if (Continuation.currentContinuation() != null)
  +            throw new RuntimeException("Conitnuation should not exist");*/
           //sendPageAndWait("should not stop");
       }
   
  -    /*public boolean run() {
  +    public boolean doSimpleTest() {
           System.out.println("start of flow");
           float a = 1;
           sendPageAndWait("getNumberA");
  @@ -40,13 +40,14 @@
           sendPage("result", new VarMap().add("result", a + 1));
           System.out.println("end of flow");
           return true;
  -    }*/
  +    }
   				
  -    public void testNew(Locale locale) {
  +    public void doNewTest() {
  +        Locale locale = null;
           FormContext formContext = new FormContext(getRequest(), locale);
       }
   
  -    public void testCatch() {
  +    public void doCatchTest() {
           try {
               sendPageAndWait("getNumberA");
               float a = Float.parseFloat(getRequest().getParameter("a"));
  @@ -69,11 +70,11 @@
           //nothing
       }
   
  -    public void testAbstract() {
  +    public void doAbstractTest() {
           super.parent();
       }
   
  -    public void testDelegate() {
  +    public void doDelegateTest() {
           CalculatorFlow flow = new CalculatorFlow();
           flow.run();
       }
  @@ -113,6 +114,15 @@
               hits = searcher.search(query);
           }
       }*/
  +    
  +    public void doExceptionTest() throws Exception {
  +        
  +         while(true) {
  +            
  +             this.sendPageAndWait("test.jxt");
  +             throw new FooException("test", 123);
  +         }
  +     }
   }
   
   class FooInner {
  
  
  
  1.2       +2 -2      cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/WrapperContinuable.java
  
  Index: WrapperContinuable.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/WrapperContinuable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WrapperContinuable.java	16 Apr 2004 09:39:57 -0000	1.1
  +++ WrapperContinuable.java	14 Jun 2004 14:53:56 -0000	1.2
  @@ -25,8 +25,8 @@
           simple = new SimpleContinuable();
       }
   
  -    public void test() {
  -        simple.suspend();
  +    public void doWrapperTest() {
  +        simple.doSuspendTest();
       }
   
   }
  
  
  
  1.1                  cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/FooException.java
  
  Index: FooException.java
  ===================================================================
  /*
   * Copyright 1999-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License"); you may not
   * use this file except in compliance with the License. You may obtain a copy of
   * the License at
   * 
   * http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
   * License for the specific language governing permissions and limitations under
   * the License.
   */
  
  package org.apache.cocoon.components.flow.java.test;
  
  public class FooException extends java.lang.Exception {
     
      private long id = 0;
  
      public FooException() {
      }
  
      public FooException(String msg) {
          super(msg);
      }
     
      public FooException(String msg, long id) {
         super(msg);
         this.id = id;
      }
  }
  
  
  1.1                  cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/JavaFlowTestCase.java
  
  Index: JavaFlowTestCase.java
  ===================================================================
  /*
   * Copyright 1999-2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  package org.apache.cocoon.components.flow.java.test;
  
  import java.util.ArrayList;
  
  import org.apache.cocoon.SitemapComponentTestCase;
  import org.apache.cocoon.components.flow.java.VarMap;
  import org.apache.commons.jxpath.JXPathContext;
  
  /**
   *
   *
   * @author <a href="mailto:stephan@apache.org">Stephan Michels </a>
   * @version CVS $Id: JavaFlowTestCase.java,v 1.1 2004/06/14 14:53:56 stephan Exp $
   */
  public class JavaFlowTestCase extends SitemapComponentTestCase {
  
      public JavaFlowTestCase(String name) {
          super(name);
      }
      
      public void testSimple() throws Exception {
          String source = "org.apache.cocoon.components.flow.java.test.SimpleFlow";
          String id = callFunction("java", source, "simpleTest", new ArrayList());
          
          getRequest().addParameter("a", "2.3");
          getRedirector().reset();
          
          callContinuation("java", source, id, new ArrayList());
  
          VarMap map = (VarMap)getFlowContextObject();
          
          assertEquals(((Float)map.getMap().get("result")).floatValue(), 3.3f, 0.1f);
  
          JXPathContext jxcontext = JXPathContext.newContext(getFlowContextObject());
          Float result = (Float)jxcontext.getValue("result");
  
          assertEquals(result.floatValue(), 3.3f, 0.1f);
      }
      
      public void testNew() throws Exception {
          String source = "org.apache.cocoon.components.flow.java.test.SimpleFlow";
          String id = callFunction("java", source, "newTest", new ArrayList());
      }
      
      public void testCatch() throws Exception {
          
          String source = "org.apache.cocoon.components.flow.java.test.SimpleFlow";
          String id = callFunction("java", source, "catchTest", new ArrayList());
          
          assertEquals(getRedirector().getRedirect(), "cocoon:/getNumberA");
          
          getRequest().addParameter("a", "bla");
          getRedirector().reset();
          
          id = callContinuation("java", source, id, new ArrayList());
          
          assertEquals(getRedirector().getRedirect(), "cocoon:/error");
          
          getRedirector().reset();
          
          id = callContinuation("java", source, id, new ArrayList());
          
          assertEquals(getRedirector().getRedirect(), "cocoon:/result");
          
      }
      
      public void testAbstract() throws Exception {
          
          String source = "org.apache.cocoon.components.flow.java.test.SimpleFlow";
          String id = callFunction("java", source, "abstractTest", new ArrayList());
  
          assertEquals(getRedirector().getRedirect(), "cocoon:/parent");
      }
      
      public void testDelegate() throws Exception {
  
          String source = "org.apache.cocoon.components.flow.java.test.SimpleFlow";
          String id = callFunction("java", source, "delegateTest", new ArrayList());
  
          assertEquals(getRedirector().getRedirect(), "cocoon:/page/getNumberA");
  
          getRequest().addParameter("a", "2");
          getRedirector().reset();
  
          id = callContinuation("java", source, id, new ArrayList());
          
          assertEquals(getRedirector().getRedirect(), "cocoon:/page/getNumberB");
  
          getRequest().addParameter("b", "2");
          getRedirector().reset();
          
          id = callContinuation("java", source, id, new ArrayList());
  
          assertEquals(getRedirector().getRedirect(), "cocoon:/page/getOperator");
          
          getRequest().addParameter("operator", "plus");
          getRedirector().reset();
          
          id = callContinuation("java", source, id, new ArrayList());
  
          assertEquals(getRedirector().getRedirect(), "cocoon:/page/displayResult");
      }
  
      public void testException() throws Exception {
          String source = "org.apache.cocoon.components.flow.java.test.SimpleFlow";
          String id = callFunction("java", source, "exceptionTest", new ArrayList());
          
          assertEquals(getRedirector().getRedirect(), "cocoon:/test.jxt");
          
          try {
              callContinuation("java", source, id, new ArrayList());
              fail("Excepting a FooException");
          } catch (FooException e) {}
      }
      
      public void testSimpleContinuable() throws Exception {
          String source = "org.apache.cocoon.components.flow.java.test.SimpleContinuable";
          String id = callFunction("java", source, "suspendTest", new ArrayList());
          
          id = callContinuation("java", source, id, new ArrayList());
      }
  
      public void testWrapperContinuable() throws Exception {
          String source = "org.apache.cocoon.components.flow.java.test.WrapperContinuable";
          String id = callFunction("java", source, "wrapperTest", new ArrayList());
          
          id = callContinuation("java", source, id, new ArrayList());
      }
  
      public void testExtendedContinuable() throws Exception {
          String source = "org.apache.cocoon.components.flow.java.test.ExtendedContinuable";
          String id = callFunction("java", source, "extendedTest", new ArrayList());
          
          id = callContinuation("java", source, id, new ArrayList());
      }
  }
  
  
  
  1.1                  cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/java/test/JavaFlowTestCase.xtest
  
  Index: JavaFlowTestCase.xtest
  ===================================================================
  <?xml version="1.0" ?>
  <!--
    Copyright 1999-2004 The Apache Software Foundation
  
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
  
        http://www.apache.org/licenses/LICENSE-2.0
  
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
  -->
  <testcase>
   <annotation>
    Test Cases: JavaScriptFlowTestCase
   </annotation>
  
   <logkit>
    <factories>
     <factory type="stream" class="org.apache.avalon.excalibur.logger.factory.StreamTargetFactory"/>
    </factories>
    <targets>
     <stream id="root">
      <stream>System.out</stream>
      <format type="extended">
       %7.7{priority} %5.5{time}   [%9.9{category}] (%{context}): %{message}\n%{throwable}
      </format>
     </stream>
    </targets>
    <categories>
     <category name="test" log-level="DEBUG">
      <log-target id-ref="root"/>
     </category>
    </categories>
   </logkit>
  
   <context>
    <entry name="org.apache.excalibur.event.Queue" 
    	     class="org.apache.excalibur.event.impl.DefaultQueue"/>
    <entry name="environment-context" 
    	     class="org.apache.cocoon.environment.mock.MockContext"/>  	     
   </context>
   
  
   <roles>
    <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.apache.cocoon.acting.ActionSelector"
          shorthand="actions"
          default-class="org.apache.cocoon.components.ExtendedComponentSelector"/>
  
    <role name="org.apache.cocoon.components.flow.Interpreter"
          shorthand="flow-interpreters"
          default-class="org.apache.cocoon.components.flow.InterpreterSelector"/>
  
    <role name="org.apache.cocoon.components.flow.ContinuationsManager"
          shorthand="continuations-manager"
          default-class="org.apache.cocoon.components.flow.ContinuationsManagerImpl"/>
  
   </roles>
  
   <components>
    <source-factories>
     <component-instance class="org.apache.excalibur.source.impl.ResourceSourceFactory"
name="resource"/>
     <component-instance class="org.apache.excalibur.source.impl.URLSourceFactory" name="*"/>
    </source-factories>
  
    <source-resolver class="org.apache.excalibur.source.impl.SourceResolverImpl"/>
  
    <flow-interpreters default="java">
      <component-instance class="org.apache.cocoon.components.flow.java.JavaInterpreter"
name="java"/>
    </flow-interpreters>
  
    <continuations-manager time-to-live="3600000">
      <expirations-check type="periodic">
        <offset>180000</offset>
        <period>180000</period>
      </expirations-check>
    </continuations-manager>
   </components>
  
  </testcase>
  
  
  
  1.2       +3 -84     cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/javascript/JavaScriptFlowTestCase.java
  
  Index: JavaScriptFlowTestCase.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/javaflow/test/org/apache/cocoon/components/flow/javascript/JavaScriptFlowTestCase.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JavaScriptFlowTestCase.java	4 Jun 2004 14:02:38 -0000	1.1
  +++ JavaScriptFlowTestCase.java	14 Jun 2004 14:53:57 -0000	1.2
  @@ -16,16 +16,7 @@
   
   package org.apache.cocoon.components.flow.javascript;
   
  -import java.util.*;
  -
  -import org.apache.avalon.framework.component.*;
  -import org.apache.avalon.framework.container.ContainerUtil;
  -import org.apache.avalon.framework.logger.Logger;
   import org.apache.cocoon.SitemapComponentTestCase;
  -import org.apache.cocoon.components.flow.*;
  -import org.apache.excalibur.event.Queue;
  -import org.apache.excalibur.event.command.CommandManager;
  -import org.apache.excalibur.source.SourceResolver;
   
   /**
    *
  @@ -39,80 +30,8 @@
           super(name);
       }
       
  -    /*public void setUp() {
  -        CommandManager commands = new CommandManager();
  -        ContainerUtil.enableLogging(commands, (Logger) getLogger());
  -        //this.threads.register(this.commands);
  -        
  -        getContext(). put(Queue.ROLE, commands.getCommandSink());
  -    }*/
  -
       public void testCalculator() throws Exception {
  -        String source = "resource://org/apache/cocoon/components/flow/javascript/calc.js";
  -        callFunction("java", source, "calculator", new ArrayList());
  -    }
  -
  -    public void callFunction(String type, String source, String function, List params)
throws Exception {
  -        
  -        ComponentSelector selector = null;
  -        Interpreter interpreter = null;
  -        SourceResolver resolver = null;
  -
  -        try {
  -            selector = (ComponentSelector) this.manager.lookup(Interpreter.ROLE);
  -            assertNotNull("Test lookup of interpreter selector", selector);
  -
  -            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
  -            assertNotNull("Test lookup of source resolver", resolver);
  -
  -            assertNotNull("Test if interpreter name is not null", type);
  -            interpreter = (Interpreter) selector.select(type);
  -            assertNotNull("Test lookup of interpreter", interpreter);
  -
  -            ((AbstractInterpreter)interpreter).register(source);
  -            interpreter.callFunction(function, params, getRedirector());
  -
  -        } catch (ComponentException ce) {
  -            getLogger().error("Could not retrieve interpeter", ce);
  -            fail("Could not retrieve interpreter: " + ce.toString());
  -        } finally {
  -            if (interpreter != null) {
  -                selector.release((Component) interpreter);
  -            }
  -            this.manager.release(selector);
  -            this.manager.release(resolver);
  -        }
  -    }
  -    
  -    public void handleContinuation(String type, String source, String id, List params)
throws Exception {
  -        
  -        ComponentSelector selector = null;
  -        Interpreter interpreter = null;
  -        SourceResolver resolver = null;
  -
  -        try {
  -            selector = (ComponentSelector) this.manager.lookup(Interpreter.ROLE);
  -            assertNotNull("Test lookup of interpreter selector", selector);
  -
  -            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);
  -            assertNotNull("Test lookup of source resolver", resolver);
  -
  -            assertNotNull("Test if interpreter name is not null", type);
  -            interpreter = (Interpreter) selector.select(type);
  -            assertNotNull("Test lookup of interpreter", interpreter);
  -
  -            ((AbstractInterpreter)interpreter).register(source);
  -            interpreter.handleContinuation(id, params, getRedirector());
  -
  -        } catch (ComponentException ce) {
  -            getLogger().error("Could not retrieve interpreter", ce);
  -            fail("Could not retrieve interpreter: " + ce.toString());
  -        } finally {
  -            if (interpreter != null) {
  -                selector.release((Component) interpreter);
  -            }
  -            this.manager.release(selector);
  -            this.manager.release(resolver);
  -        }
  +        /*String source = "resource://org/apache/cocoon/components/flow/javascript/calc.js";
  +        callFunction("java", source, "calculator", new ArrayList());*/
       }
   }
  
  
  

Mime
View raw message