<commit_before>package org.drools.dialect.mvel;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;

import org.codehaus.jfdi.interpreter.ClassTypeResolver;
import org.codehaus.jfdi.interpreter.TypeResolver;
import org.drools.Cheese;
import org.drools.FactHandle;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.base.ClassFieldExtractor;
import org.drools.base.ClassObjectType;
import org.drools.common.DefaultFactHandle;
import org.drools.common.InternalFactHandle;
import org.drools.lang.descr.EvalDescr;
import org.drools.lang.descr.RuleDescr;
import org.drools.reteoo.ReteTuple;
import org.drools.rule.Column;
import org.drools.rule.ConditionalElement;
import org.drools.rule.Declaration;
import org.drools.rule.EvalCondition;
import org.drools.semantics.java.DeclarationTypeFixer;
import org.drools.semantics.java.JavaExprAnalyzer;
import org.drools.semantics.java.KnowledgeHelperFixer;
import org.drools.semantics.java.builder.BuildContext;
import org.drools.semantics.java.builder.BuildUtils;
import org.drools.spi.DeclarationScopeResolver;
import org.drools.spi.FieldExtractor;
import org.drools.rule.Package;

import junit.framework.TestCase;

public class MVELEvalBuilderTest extends TestCase {

    //private BuildUtils         utils;

    public void setUp() {
        TypeResolver typeResolver = new ClassTypeResolver( new ArrayList(),
                                                           Thread.currentThread().getContextClassLoader() );

        //        this.utils = new BuildUtils( new KnowledgeHelperFixer(),
        //                                     new DeclarationTypeFixer(),
        //                                     new JavaExprAnalyzer(),
        //                                     typeResolver,
        //                                     null,
        //                                     null );        
    }

    public void test1() {
        Package pkg = new Package( "pkg1" );
        RuleDescr ruleDescr = new RuleDescr( "rule 1" );

        InstrumentedBuildContent context = new InstrumentedBuildContent( pkg,
                                                                         ruleDescr );
        InstrumentedDeclarationScopeResolver declarationResolver = new InstrumentedDeclarationScopeResolver();
        final FieldExtractor extractor = new ClassFieldExtractor( Cheese.class,
                                                                  "price" );
        Column column = new Column( 0,
                                    new ClassObjectType( int.class ) );
        Declaration declaration = new Declaration( "a",
                                                   extractor,
                                                   column );
        Map map = new HashMap();
        map.put( "a",
                 declaration );
        declarationResolver.setDeclarations( map );
        context.setDeclarationResolver( declarationResolver );<commit_msg>JBRULES-708 MVEL Integration -integration for the MVELEvalBuilder<commit_after>package org.drools.dialect.mvel;

import java.util.HashMap;
import java.util.Map;

import junit.framework.TestCase;

import org.drools.Cheese;
import org.drools.RuleBase;
import org.drools.RuleBaseFactory;
import org.drools.WorkingMemory;
import org.drools.base.ClassFieldExtractor;
import org.drools.base.ClassObjectType;
import org.drools.common.InternalFactHandle;
import org.drools.lang.descr.EvalDescr;
import org.drools.lang.descr.RuleDescr;
import org.drools.reteoo.ReteTuple;
import org.drools.rule.Column;
import org.drools.rule.Declaration;
import org.drools.rule.EvalCondition;
import org.drools.rule.Package;
import org.drools.semantics.java.builder.BuildContext;
import org.drools.spi.DeclarationScopeResolver;
import org.drools.spi.FieldExtractor;

public class MVELEvalBuilderTest extends TestCase {

    public void setUp() {     
    }

    public void test1() {
        Package pkg = new Package( "pkg1" );
        RuleDescr ruleDescr = new RuleDescr( "rule 1" );

        InstrumentedBuildContent context = new InstrumentedBuildContent( pkg,
                                                                         ruleDescr );
        InstrumentedDeclarationScopeResolver declarationResolver = new InstrumentedDeclarationScopeResolver();
        final FieldExtractor extractor = new ClassFieldExtractor( Cheese.class,
                                                                  "price" );
        Column column = new Column( 0,
                                    new ClassObjectType( int.class ) );
        Declaration declaration = new Declaration( "a",
                                                   extractor,
                                                   column );
        Map map = new HashMap();
        map.put( "a",
                 declaration );
        declarationResolver.setDeclarations( map );
        context.setDeclarationResolver( declarationResolver );
{'fraction_non_alphanumeric': 0.08071570576540756, 'fraction_numerical': 0.002186878727634195, 'mean_word_length': 2.0789473684210527, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 32, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2656588', 'n_tokens_mistral': 1280, 'n_tokens_neox': 1238, 'n_words': 264}