Search in sources :

Example 1 with XmlDumper

use of org.drools.compiler.compiler.xml.XmlDumper in project drools by kiegroup.

the class DumperTestHelper method XmlFile.

public static void XmlFile(String filename) throws Exception {
    KnowledgeBuilderConfigurationImpl conf = new KnowledgeBuilderConfigurationImpl();
    XmlPackageReader xmlPackageReader = new XmlPackageReader(conf.getSemanticModules());
    xmlPackageReader.getParser().setClassLoader(DumperTestHelper.class.getClassLoader());
    xmlPackageReader.read(new InputStreamReader(DumperTestHelper.class.getResourceAsStream(filename)));
    final PackageDescr pkgOriginal = xmlPackageReader.getPackageDescr();
    final XmlDumper dumper = new XmlDumper();
    final String result = dumper.dump(pkgOriginal);
    String buffer = readFile(filename);
    System.out.println(buffer);
    System.out.println(result);
    Assertions.assertThat(buffer).isEqualToIgnoringWhitespace(result);
    assertNotNull(result);
}
Also used : InputStreamReader(java.io.InputStreamReader) KnowledgeBuilderConfigurationImpl(org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl) PackageDescr(org.drools.compiler.lang.descr.PackageDescr) XmlDumper(org.drools.compiler.compiler.xml.XmlDumper) XmlPackageReader(org.drools.compiler.compiler.xml.XmlPackageReader)

Aggregations

InputStreamReader (java.io.InputStreamReader)1 KnowledgeBuilderConfigurationImpl (org.drools.compiler.builder.impl.KnowledgeBuilderConfigurationImpl)1 XmlDumper (org.drools.compiler.compiler.xml.XmlDumper)1 XmlPackageReader (org.drools.compiler.compiler.xml.XmlPackageReader)1 PackageDescr (org.drools.compiler.lang.descr.PackageDescr)1