public void testPackageAttributes() throws Exception {
parseResource( "package_attributes.drl" ).compilation_unit();
assertFalse( this.parser.getErrorMessages().toString(),
this.parser.hasErrors() );
PackageDescr pkg = this.parser.getPackageDescr();
AttributeDescr at = (AttributeDescr) pkg.getAttributes().get( 0 );
assertEquals( "agenda-group",
at.getName() );
assertEquals( "x",
at.getValue() );
at = (AttributeDescr) pkg.getAttributes().get( 1 );
assertEquals( "dialect",
at.getName() );
assertEquals( "java",
at.getValue() );
assertEquals( 2,
pkg.getRules().size() );
assertEquals( 2,
pkg.getImports().size() );
RuleDescr rule = (RuleDescr) pkg.getRules().get( 0 );
assertEquals( "bar",
rule.getName() );
at = (AttributeDescr) rule.getAttributes().get( 0 );
assertEquals( "agenda-group",
at.getName() );
assertEquals( "x",
at.getValue() );
at = (AttributeDescr) rule.getAttributes().get( 1 );
assertEquals( "dialect",
at.getName() );
assertEquals( "java",
at.getValue() );
rule = (RuleDescr) pkg.getRules().get( 1 );
assertEquals( "baz",
rule.getName() );
at = (AttributeDescr) rule.getAttributes().get( 0 );
assertEquals( "dialect",
at.getName() );