}
public void testCodeSourceUrl() throws Exception {
final String className = TestEvalExpression.class.getName();
ReteooRuleBase rb = new ReteooRuleBase( "xxx" );
Package pkg = new Package( "org.drools" );
pkg.setClassFieldAccessorCache( new ClassFieldAccessorCache( Thread.currentThread().getContextClassLoader() ) );
JavaDialectRuntimeData data = new JavaDialectRuntimeData();
data.onAdd( pkg.getDialectRuntimeRegistry(), rb.getRootClassLoader() );
pkg.getDialectRuntimeRegistry().setDialectData( "java", data );
rb.addPackage( pkg );
final JavaDialectRuntimeData pcData = ( JavaDialectRuntimeData ) pkg.getDialectRuntimeRegistry().getDialectData( "java" );
final EvalCondition invoker = new EvalCondition(null);
pcData.putInvoker(className, invoker);
final InputStream is = getClass().getClassLoader().getResourceAsStream(className.replace('.', '/') + ".class");
try {
pcData.write(className.replace('.', '/') + ".class", read(is));
} finally {
is.close();
}
pcData.onAdd( pkg.getDialectRuntimeRegistry(), rb.getRootClassLoader() );
pcData.onBeforeExecute();
Class cls = ((InternalRuleBase)rb).getRootClassLoader().loadClass( "org.drools.rule.PackageCompilationDataTest$TestEvalExpression" );
System.out.println( cls );