コード例 #1
0
 public void testCamelContextPropertiesExpression() throws Exception {
   camelContext.getProperties().put("CamelTestKey", "CamelTestValue");
   Expression expression = camelContextPropertyExpression("CamelTestKey");
   assertExpression(expression, exchange, "CamelTestValue");
   expression = camelContextPropertiesExpression();
   Map<?, ?> properties = expression.evaluate(exchange, Map.class);
   assertEquals("Get a wrong properties size", properties.size(), 1);
 }
コード例 #2
0
  public void testOutOptionsFromCamelContext() throws Exception {
    CamelContext context = new DefaultCamelContext();
    Exchange exchange = new DefaultExchange(context);
    // shows how to set the OutputOptions from camelContext
    context
        .getProperties()
        .put(XmlConverter.OUTPUT_PROPERTIES_PREFIX + OutputKeys.ENCODING, "UTF-8");
    context
        .getProperties()
        .put(XmlConverter.OUTPUT_PROPERTIES_PREFIX + OutputKeys.STANDALONE, "no");
    XmlConverter conv = new XmlConverter();

    SAXSource source = conv.toSAXSource("<foo>bar</foo>", exchange);
    DOMSource out = conv.toDOMSource(source);
    assertNotSame(source, out);

    assertEquals(
        "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><foo>bar</foo>",
        conv.toString(out, exchange));
  }
コード例 #3
0
 @Override
 protected CamelContext createCamelContext() throws Exception {
   CamelContext context = super.createCamelContext();
   context.getProperties().put(Exchange.MAXIMUM_ENDPOINT_CACHE_SIZE, "1");
   return context;
 }