1   /*
2    * $Id: DomXmlTransformersTestCase.java 7976 2007-08-21 14:26:13Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.transformers.xml;
12  
13  import org.mule.umo.transformer.UMOTransformer;
14  import org.mule.util.IOUtils;
15  
16  import org.dom4j.DocumentHelper;
17  import org.dom4j.io.DOMWriter;
18  import org.w3c.dom.Document;
19  
20  public class DomXmlTransformersTestCase extends AbstractXmlTransformerTestCase
21  {
22  
23      private String srcData;
24      private Document resultData;
25  
26      // @Override
27      protected void doSetUp() throws Exception
28      {
29          srcData = IOUtils.getResourceAsString("cdcatalog.xml", getClass());
30          org.dom4j.Document dom4jDoc = DocumentHelper.parseText(srcData);
31          resultData = new DOMWriter().write(dom4jDoc);
32      }
33  
34      public UMOTransformer getTransformer() throws Exception
35      {
36          return new XmlToDomDocument();
37      }
38  
39      public UMOTransformer getRoundTripTransformer() throws Exception
40      {
41          return new DomDocumentToXml();
42      }
43  
44      public Object getTestData()
45      {
46          return srcData;
47      }
48  
49      public Object getResultData()
50      {
51          return resultData;
52      }
53  
54  }