View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.module.xml.functional;
8   
9   import org.mule.DefaultMuleMessage;
10  import org.mule.api.MuleMessage;
11  import org.mule.api.transformer.Transformer;
12  import org.mule.tck.junit4.FunctionalTestCase;
13  
14  import org.custommonkey.xmlunit.XMLAssert;
15  import org.custommonkey.xmlunit.XMLUnit;
16  import org.junit.Test;
17  
18  import static org.junit.Assert.assertNotNull;
19  
20  public class XsltWithParamsTransformerTestCase extends FunctionalTestCase
21  {
22  
23      @Override
24      protected String getConfigResources()
25      {
26          return "org/mule/module/xml/xml-namespace-test.xml";
27      }
28  
29      @Test
30      public void testTransformWithParameter() throws Exception
31      {
32          Transformer trans = muleContext.getRegistry().lookupTransformer("test1");
33          assertNotNull(trans);
34          MuleMessage message = new DefaultMuleMessage("<testing/>", muleContext);
35          message.setOutboundProperty("Welcome", "hello");
36          Object result = trans.transform(message);
37          assertNotNull(result);
38          XMLUnit.setIgnoreWhitespace(true);
39          XMLAssert.assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?><echo-value xmlns=\"http://test.com\">hello</echo-value>", result);
40      }
41  }