@Test public void testDumpDirectoryConfiguration() { File dumpDir = new File("target"); // setting the dump directory using the type safe method config.setOption( DumpDirOption.get( dumpDir ) ); // checking the type safe getOption() method assertEquals( DumpDirOption.get( dumpDir ), config.getOption( DumpDirOption.class ) ); // checking string conversion assertEquals( dumpDir, config.getOption( DumpDirOption.class ).getDirectory() ); // checking the string based getProperty() method assertEquals( dumpDir.toString(), config.getProperty( DumpDirOption.PROPERTY_NAME ) ); // setting the dump dir using the string based setProperty() method dumpDir = new File( System.getProperty( "java.io.tmpdir" ) ); config.setProperty( DumpDirOption.PROPERTY_NAME, System.getProperty( "java.io.tmpdir" ) ); // checking the type safe getOption() method assertEquals( DumpDirOption.get( dumpDir ), config.getOption( DumpDirOption.class ) ); // checking string conversion assertEquals( dumpDir, config.getOption( DumpDirOption.class ).getDirectory() ); // checking the string based getProperty() method assertEquals( dumpDir.toString(), config.getProperty( DumpDirOption.PROPERTY_NAME ) ); }
/** * This is a factory method for this DumpDirectoryOption configuration. * The factory method is a best practice for the case where the * actual object construction is changed in the future. * * @param dir the directory to which drools will dump files * * @return the actual type safe dump directory configuration. */ public static DumpDirOption get( File dir ) { return new DumpDirOption( dir ); }
return org.kie.internal.builder.conf.DumpDirOption.get(legacyOption.getDirectory());