Hi Mike,

I believe it is the same regression problem you mentioned that caused following 2 tests failed on 5.3.x branch?

http://hudson.qa.jboss.com/hudson/job/guvnor-5.3.x/564/

BTW, we started to get those 2 failures around Feb 9, 2012 , if this info helps to find out whom is to blame ;-). Please check http://hudson.qa.jboss.com/hudson/job/guvnor-5.3.x/473/. The build 473 was triggered by a upstream change.

Thanks,
Jervis
On 2012/2/17 21:30, Michael Anstis wrote:
Hi,

There appears to be a regression in TypeDeclarationDescr in 5.3.x branch, as illustrated by the below.

Bean2 is shown as having a super-type of "Object" whereas it should be "Bean1". The fields are correctly listed.

This is causing tests in Guvnor to fail.

Could somebody please take a look?

Thanks,

Mike

package org.drools.ide.common.server.rules;

import java.io.StringReader;
import java.util.List;

import org.drools.compiler.DrlParser;
import org.drools.compiler.DroolsError;
import org.drools.compiler.PackageBuilder;
import org.drools.definition.type.FactField;
import org.drools.lang.descr.PackageDescr;
import org.drools.lang.descr.TypeDeclarationDescr;
import org.junit.Test;

public class RegressionTest {

    @Test
    public void regression() {
        String drl = "package foo \n"
                     + "declare Bean1 \n"
                     + "age: int \n"
                     + "name : String \n"
                     + "end \n"
                     + "declare Bean2 extends Bean1\n"
                     + "cheese : String \n"
                     + "end";

        PackageBuilder builder = new PackageBuilder();
        try {
            DrlParser parser = new DrlParser();
            PackageDescr pkgDescr = parser.parse( drl );
            for ( TypeDeclarationDescr baseType : pkgDescr.getTypeDeclarations() ) {
                String declaredSuperTypeName = baseType.getSuperTypeName();
                System.out.println( baseType.getTypeName() + " extends " + declaredSuperTypeName );
            }

            builder.addPackageFromDrl( new StringReader( drl ) );

            System.out.println("foo.Bean1 fields=");
            List<FactField> fieldsBean1 = builder.getPackage().getFactType( "foo.Bean1" ).getFields();
            for ( FactField field : fieldsBean1 ) {
                System.out.println( field.getName() );
            }

            System.out.println("foo.Bean2 fields=");
            List<FactField> fieldsBean2 = builder.getPackage().getFactType( "foo.Bean2" ).getFields();
            for ( FactField field : fieldsBean2 ) {
                System.out.println( field.getName() );
            }

            if ( builder.hasErrors() ) {
                for ( DroolsError e : builder.getErrors().getErrors() ) {
                    System.out.println( e.getMessage() );
                }
            }
        } catch ( Exception e ) {
            e.printStackTrace();
        }

    }

}



_______________________________________________
rules-dev mailing list
rules-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-dev