Package org.milyn.container

Examples of org.milyn.container.ExecutionContext


    {
      endpoint.setExpectedMessageCount(1);
      endpoint.expectedBodiesReceived(myBean);

      final Smooks smooks = new Smooks();
        final ExecutionContext execContext = smooks.createExecutionContext();
       
      BeanRouter beanRouter = createBeanRouter(null, BEAN_ID, END_POINT_URI);
      beanRouter.executeExecutionLifecycleInitialize(execContext);
        execContext.getBeanContext().addBean(BEAN_ID, myBean);

        // Force an END event
        execContext.getBeanContext().notifyObservers(new BeanContextLifecycleEvent(execContext,
                null, BeanLifecycle.END_FRAGMENT, execContext.getBeanContext().getBeanId(BEAN_ID), myBean));

      endpoint.assertIsSatisfied();
    }
View Full Code Here


    {
      endpoint.setExpectedMessageCount(1);
      endpoint.expectedHeaderReceived(HEADER_ID, myBean);

      final Smooks smooks = new Smooks();
        final ExecutionContext execContext = smooks.createExecutionContext();
       
      BeanRouter beanRouter = createBeanRouter(null, BEAN_ID, END_POINT_URI);
      beanRouter.executeExecutionLifecycleInitialize(execContext);
        execContext.getBeanContext().addBean(BEAN_ID, myBean);
        execContext.getBeanContext().addBean(HEADER_ID, myBean);

        // Force an END event
        execContext.getBeanContext().notifyObservers(new BeanContextLifecycleEvent(execContext,
                null, BeanLifecycle.END_FRAGMENT, execContext.getBeanContext().getBeanId(BEAN_ID), myBean));

      endpoint.assertIsSatisfied();
    }
View Full Code Here

        SmooksUtil.registerProfileSet(new DefaultProfileSet("shipping-response"), smooks);
        smooks.addConfigurations("trans-request.cdrl", getClass().getResourceAsStream("trans-request.cdrl"));
        smooks.addConfigurations("trans-response.cdrl", getClass().getResourceAsStream("trans-response.cdrl"));
               
        InputStream requestStream = getClass().getResourceAsStream("../request.xml");
        ExecutionContext context = smooks.createExecutionContext("shipping-request");
        String requestResult = SmooksUtil.filterAndSerialize(context, requestStream, smooks);
    CharUtils.assertEquals("Template test failed.", "/org/milyn/templating/soapshipping/request.xml.tran.expected", requestResult);

        InputStream responseStream = getClass().getResourceAsStream("../response.xml");
        context = smooks.createExecutionContext("shipping-response");
View Full Code Here

        testFreeMarkerTrans_bind("test-configs-04-SAX.cdrl");
    }
    public void testFreeMarkerTrans_bind(String config) throws SAXException, IOException {
        Smooks smooks = new Smooks("/org/milyn/templating/freemarker/" + config);
        StringReader input;
        ExecutionContext context;

        context = smooks.createExecutionContext();
        input = new StringReader("<a><b><c x='xvalueonc2' /></b></a>");
        smooks.filterSource(context, new StreamSource(input), null);

        assertEquals("<mybean>xvalueonc2</mybean>",context.getBeanContext().getBean("mybeanTemplate"));

        context = smooks.createExecutionContext();
        input = new StringReader("<c x='xvalueonc1' />");
        smooks.filterSource(context, new StreamSource(input), null);
        assertEquals("<mybean>xvalueonc1</mybean>", context.getBeanContext().getBean("mybeanTemplate"));
    }
View Full Code Here

        smooks.filterSource(new StringSource("<a><e><b x='xvalueonc1' /><c/><d/><b x='xvalueonc2' /></e></a>"), result);
        assertEquals("<mybean>xvalueonc1</mybean><d /><mybean>xvalueonc2</mybean>", result.toString());
    }

    private void test_ftl(Smooks smooks, String input, String expected) throws IOException, SAXException {
        ExecutionContext context = smooks.createExecutionContext();
        test_ftl(smooks, context, input, expected);
    }
View Full Code Here

 
  public void test_java_binding_simple_messages() throws IOException, SAXException {
    Smooks smooks = new Smooks("/org/milyn/smooks/edi/unedifact/smooks-config-jb-01.xml");
    JavaResult jResult = new JavaResult();   
    StringResult sResult = new StringResult();   
    ExecutionContext execCtx = smooks.createExecutionContext();
   
    //execCtx.setEventListener(new HtmlReportGenerator("target/report.html"));
    smooks.filterSource(execCtx, new StreamSource(getClass().getResourceAsStream("unedifact-msg-02.edi")), jResult, sResult);
   
    List<UNEdifactMessage41> messages = (List<UNEdifactMessage41>) jResult.getBean("unEdifactMessages");
View Full Code Here

 
  public void test_java_binding_interchange_01() throws IOException, SAXException {
    Smooks smooks = new Smooks("/org/milyn/smooks/edi/unedifact/smooks-config-jb-02.xml");
    JavaResult jResult = new JavaResult();   
    StringResult sResult = new StringResult();   
    ExecutionContext execCtx = smooks.createExecutionContext();
   
    //execCtx.setEventListener(new HtmlReportGenerator("target/report.html"));
    smooks.filterSource(execCtx, new StreamSource(getClass().getResourceAsStream("unedifact-msg-02.edi")), jResult, sResult);
   
    UNEdifactInterchange41 interchange = jResult.getBean(UNEdifactInterchange41.class);
View Full Code Here

    public void test_java_binding_interchange_02() throws IOException, SAXException {
        Smooks smooks = new Smooks("/org/milyn/smooks/edi/unedifact/smooks-config-jb-02.xml");
        JavaResult jResult = new JavaResult();
        StringResult sResult = new StringResult();
        ExecutionContext execCtx = smooks.createExecutionContext();

        //execCtx.setEventListener(new HtmlReportGenerator("target/report.html"));
        smooks.filterSource(execCtx, new StreamSource(getClass().getResourceAsStream("unedifact-msg-03.edi")), jResult, sResult);

        UNEdifactInterchange41 interchange = jResult.getBean(UNEdifactInterchange41.class);
View Full Code Here

    /* (non-Javadoc)
     * @see org.milyn.javabean.lifecycle.BeanContextLifecycleObserver#onBeanLifecycleEvent(org.milyn.javabean.lifecycle.BeanContextLifecycleEvent)
     */
    public void onBeanLifecycleEvent(BeanContextLifecycleEvent event) {
      if(event.getBeanId() == watchedBean && event.getLifecycle() == BeanLifecycle.CHANGE) {
        ExecutionContext executionContext = event.getExecutionContext();

        // Set the list on the object, via the populator...
        populator.populateAndSetPropertyValue(event.getBean(), executionContext);
        // Remove this observer...
        executionContext.getBeanContext().removeObserver(this);
        arrayToListChangeObserver = null;
      }
    }
View Full Code Here

        decimalFormat.setDecimalFormatSymbols(dfs);
        decimalFormat.setParseBigDecimal(true);
    }

    protected Delimiters getContextDelimiters() {
        ExecutionContext ec = Filter.getCurrentExecutionContext();
        Delimiters delimiters = null;

        if (ec != null) {
            delimiters = ec.getBeanContext().getBean(Delimiters.class);
        }

        return delimiters;
    }
View Full Code Here

TOP

Related Classes of org.milyn.container.ExecutionContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.