Package org.milyn

Examples of org.milyn.Smooks.createExecutionContext()


        reset();
        smooks.filterSource(smooks.createExecutionContext(), new StreamSource(new StringReader("<a/>")), null);
        assertTrue(VisitBeforeDOMVisitor.visited);
        assertFalse(VisitAfterDOMVisitor.visited);
        reset();
        smooks.filterSource(smooks.createExecutionContext(), new StreamSource(new StringReader("<a><b/></a>")), null);
        assertTrue(VisitBeforeDOMVisitor.visited);
        assertTrue(VisitAfterDOMVisitor.visited);
        assertEquals("Hi There!", VisitAfterDOMVisitor.staticInjectedParam);
    }
View Full Code Here


        // Test io reader/writer close...
        // We need to +1 this because Xerces always closes input streams/readers and there's no
        // way of turning that off
        TestReader reader = new TestReader("<x/>", expectedCloseCallCount + 1);
        TestWriter writer = new TestWriter(expectedCloseCallCount);
        execContext = smooks.createExecutionContext(profile);
        smooks.filterSource(execContext, new StreamSource(reader), new StreamResult(writer));
    }

    private class TestInputStream extends ByteArrayInputStream {
        private int closeCallCount = 0;
View Full Code Here

        final Smooks smooks = createSmooks();
        smooks.addVisitor(firstMock, "simple:simple/first:sample");
        smooks.addVisitor(secondMock, "simple:simple/second:sample");

        // when
        smooks.filterSource(smooks.createExecutionContext(), createSource(), mock(Result.class));

        // then
        verify(firstMock).visitBefore(
                argThat(isSaxElementWithQName(QNAME_FOR_FIRST_SAMPLE)),
                any(ExecutionContext.class));
View Full Code Here

  @Test ( groups = "unit" )
    public void test_before_full_extended_config() throws ParserConfigurationException, SAXException, IOException   {
    Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-beforeVisit-full-extended-config.xml"));

    ExecutionContext executionContext = smooks.createExecutionContext();

    JavaResult result = new JavaResult();

    smooks.filterSource(executionContext, new StreamSource(getClass().getResourceAsStream("test.xml")), result);
View Full Code Here

    @SuppressWarnings("unchecked")
  public void test_ResultsetRowSelector_01() throws IOException, SAXException, InterruptedException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config.xml"));

        try {
            ExecutionContext execContext = smooks.createExecutionContext();
            BeanContext beanContext = execContext.getBeanContext();

            smooks.filterSource(execContext, new StringSource("<doc/>"), null);
            Map<String, Object> myOrder = (Map<String, Object>) beanContext.getBean("myOrder");
View Full Code Here

    @SuppressWarnings("unchecked")
  public void test_ResultsetRowSelector_02() throws IOException, SAXException, InterruptedException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config-failed-select-01.xml"));

        try {
            ExecutionContext execContext = smooks.createExecutionContext();
            BeanContext beanContext = execContext.getBeanContext();

            smooks.filterSource(execContext, new StringSource("<doc/>"), null);
            Map<String, Object> myOrder = (Map<String, Object>) beanContext.getBean("myOrder");
View Full Code Here

    public void test_ResultsetRowSelector_03() throws IOException, SAXException, InterruptedException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream("smooks-config-failed-select-02.xml"));

        try {
            ExecutionContext execContext = smooks.createExecutionContext();
            BeanContext beanContext = execContext.getBeanContext();
            BeanIdStore beanIdStore =  execContext.getContext().getBeanIdStore();

            BeanId requiredOrderNumId = beanIdStore.register("requiredOrderNum");
View Full Code Here

    {
      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);
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);
View Full Code Here

        JavaSource source = new JavaSource(myBeans);
        source.setEventStreamRequired(false);

        // Create the output writer for the transform and run it...
        StringWriter myTransformResult = new StringWriter();
        smooks.filterSource(smooks.createExecutionContext(), source, new StreamResult(myTransformResult));

        // Check it...
        assertEquals("<mybean>xxxxxxx</mybean>", myTransformResult.toString());
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.