1 package xdoclet.plugins; 2 3 import java.io.File; 4 import java.io.FileReader; 5 import java.util.Collection; 6 import java.util.Collections; 7 8 import xdoclet.util.FileUtils; 9 import xdoclet.sdk.xgg.XGGPojo; 10 import org.custommonkey.xmlunit.XMLTestCase; 11 import org.custommonkey.xmlunit.XMLUnit; 12 13 import javax.xml.transform.TransformerFactoryConfigurationError; 14 15 /*** 16 * 17 * @author <a href="mailto:aslak.hellesoy at bekk.no">Aslak Hellesøy</a> 18 * @version $Revision: 1.7 $ 19 */ 20 public class BetwixtPluginTest extends XMLTestCase { 21 22 public BetwixtPluginTest( String name ) { 23 super( name ); 24 } 25 26 public void testGenerate() throws Exception { 27 /* 28 File rootDir = FileUtils.getRoot(getClass()).getParentFile().getParentFile(); 29 File destinationDir = new File(rootDir,"target/betwixt"); 30 File destinationFile = new File( destinationDir, "Container.xml"); 31 File expectedFile = new File( rootDir, "src/testdata/betwixt/Container.xml"); 32 33 BetwixtPlugin plugin = new BetwixtPlugin(Container.class) { 34 public void populate( XGGPojo pojo, Collection metadata ) { 35 Container aslak = (Container) pojo; 36 aslak.name = "aslak"; 37 38 Container hellesoy = new Container(); 39 hellesoy.name = "hellesoy"; 40 41 aslak.containers.add( hellesoy ); 42 } 43 44 // Overriding MetadataProvider methods, since there is no containing 45 // XDoclet object to fall back on. 46 public Collection createMetadataCollection() { 47 return Collections.EMPTY_LIST; 48 } 49 }; 50 plugin.setDestinationDir(destinationDir); 51 plugin.setFileName(destinationFile.getName()); 52 53 plugin.execute(); 54 55 try { 56 XMLUnit.setIgnoreWhitespace(true); 57 XMLUnit.setTransformerFactory("org.apache.xalan.processor.TransformerFactoryImpl"); 58 assertXMLEqual( new FileReader(expectedFile), new FileReader(destinationFile) ); 59 } catch (TransformerFactoryConfigurationError e) { 60 if( e.getException() != null ) { 61 e.getException().printStackTrace(); 62 } 63 throw e; 64 } 65 */ 66 } 67 }

This page was automatically generated by Maven