Package org.milyn

Examples of org.milyn.Smooks.createExecutionContext()


      String configFileName = dataLoader.config();

      log.fine("Loading smooks configuration file " + configFileName);
      Smooks smooks = new Smooks(getClass().getResourceAsStream(
          configFileName));
      ExecutionContext executionContext = smooks.createExecutionContext();
      executionContext.getBeanContext().addBean(OFY_HELPER,
          getOfyHelperBean());
      MapDaoRegister<Object> register = MapDaoRegister
          .newInstance(getDAOMap());
View Full Code Here


      String configFileName = dataLoader.config();

      LOGGER.fine("Loading smooks configuration file " + configFileName);
      Smooks smooks = new Smooks(getClass().getResourceAsStream(
        configFileName));
      ExecutionContext executionContext = smooks.createExecutionContext();
      executionContext.getBeanContext().addBean(OFY_HELPER,
        getOfyHelperBean());
      MapDaoRegister<Object> register = MapDaoRegister
        .newInstance(getDAOMap());
View Full Code Here

                smooks = producer.createSmooks(domain, config);
            }
            if (smooks == null) {
                smooks = new Smooks(config);
            }
            smooks.createExecutionContext();
        } catch (Exception e) {
            throw TransformMessages.MESSAGES.failedToCreateSmooksInstance(config, e);
        }

        Transformer transformer;
View Full Code Here

    private void test_exception(String config, boolean expectException) throws IOException, SAXException {
        Smooks smooks = new Smooks("/org/milyn/delivery/" + config);

        if(expectException) {
            try {
                smooks.filterSource(smooks.createExecutionContext(), new StreamSource(new StringReader("<doc/>")), null);
                fail("Expected SmooksException");
            } catch(SmooksException e) {
                assertEquals("Terminate Exception", e.getCause().getMessage());
            }
        } else {
View Full Code Here

                fail("Expected SmooksException");
            } catch(SmooksException e) {
                assertEquals("Terminate Exception", e.getCause().getMessage());
            }
        } else {
            smooks.filterSource(smooks.createExecutionContext(), new StreamSource(new StringReader("<doc/>")), null);
        }
    }
}
View Full Code Here

        }
    }

    private void test(String config, List<Object> sourceObjects, String expected) throws IOException, SAXException {
        Smooks smooks = new Smooks(getClass().getResourceAsStream(config));
        ExecutionContext execContext = smooks.createExecutionContext();
        JavaSource source = new JavaSource(sourceObjects);
        StringWriter result = new StringWriter();

        smooks.filterSource(execContext, source, new StreamResult(result));
        assertEquals(expected, result.toString());
View Full Code Here

    public void test() throws IOException, SAXException {
        Smooks smooks = new Smooks();

        smooks.addConfigurations("expansion-config.xml", getClass().getResourceAsStream("expansion-config.xml"));
        ExecutionContext context = smooks.createExecutionContext();

        DOMContentDeliveryConfig config = (DOMContentDeliveryConfig) context.getDeliveryConfig();
        ContentHandlerConfigMapTable<DOMVisitBefore> assemblyVisitBefores = config.getAssemblyVisitBefores();
        ContentHandlerConfigMapTable<DOMVisitAfter> assemblyVisitAfters = config.getAssemblyVisitAfters();
        ContentHandlerConfigMapTable<DOMVisitBefore> processingVisitBefores = config.getProcessingVisitBefores();
View Full Code Here

        Smooks smooks;
        ExecutionContext execContext;

        SAXAndDOMVisitor.visited = false;
        smooks = new Smooks(getClass().getResourceAsStream("test-config-DOM-01.xml"));
        execContext = smooks.createExecutionContext();
        smooks.filterSource(execContext, new StreamSource(new StringReader("<a/>")), null);
        assertEquals(execContext, TestExecutionContextExpressionEvaluator.context);
        assertTrue(SAXAndDOMVisitor.visited);

        SAXAndDOMVisitor.visited = false;
View Full Code Here

        assertEquals(execContext, TestExecutionContextExpressionEvaluator.context);
        assertTrue(SAXAndDOMVisitor.visited);

        SAXAndDOMVisitor.visited = false;
        smooks = new Smooks(getClass().getResourceAsStream("test-config-DOM-02.xml"));
        execContext = smooks.createExecutionContext();
        smooks.filterSource(execContext, new StreamSource(new StringReader("<a/>")), null);
        assertEquals(execContext, TestExecutionContextExpressionEvaluator.context);
        assertFalse(SAXAndDOMVisitor.visited);
    }
View Full Code Here

        Smooks smooks;
        ExecutionContext execContext;

        SAXAndDOMVisitor.visited = false;
        smooks = new Smooks(getClass().getResourceAsStream("test-config-SAX-01.xml"));
        execContext = smooks.createExecutionContext();
        smooks.filterSource(execContext, new StreamSource(new StringReader("<a/>")), null);
        assertEquals(execContext, TestExecutionContextExpressionEvaluator.context);
        assertTrue(SAXAndDOMVisitor.visited);

        SAXAndDOMVisitor.visited = false;
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.