[jboss-jira] [JBoss JIRA] (DROOLS-1400) Comparison of DRL changes should not consider comments during incremental compilation

Matteo Mortari (JIRA) issues at jboss.org
Thu Jan 5 05:57:00 EST 2017


    [ https://issues.jboss.org/browse/DROOLS-1400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13343566#comment-13343566 ] 

Matteo Mortari commented on DROOLS-1400:
----------------------------------------

Reproducer:


{code:java}
@Test
    public void testKJarUpgradeWithDRLComment() throws Exception {
        // DROOLS-1400
        String drl_Rx_1 = "// Build ID# 001 \n"+ 
                "package org.drools.compiler\n" +
                "rule Rx when\n" +
                "   $m : Message( message == \"Hello World\" )\n" +
                "then\n" +
                "end\n";

        String drl_Rx_2 = "// Build ID# 002 \n"+ 
                "package org.drools.compiler\n" + 
                "rule Rx when\n" +
                "   $m : Message( message == \"Hello World\" )\n" +
                "then\n" +
                "end\n";
        
        String drl_Rnew_2 = "// Build ID# 002 \n"+ 
                "package org.drools.compiler\n" + 
                "rule Rnew when\n" +
                "   $s : String()\n" +
                "then\n" +
                "end\n";

        KieServices ks = KieServices.Factory.get();

        ReleaseId releaseId1 = ks.newReleaseId( "org.kie", "test-upgrade", "1.0.0" );
        KieModule km = createAndDeployJar( ks, releaseId1, drl_Rx_1 );

        KieContainer kc = ks.newKieContainer( km.getReleaseId() );
        KieSession ksession = kc.newKieSession();
        ksession.insert( new Message( "Hello World" ) );
        assertEquals( 1, ksession.fireAllRules() );

        ReleaseId releaseId2 = ks.newReleaseId( "org.kie", "test-upgrade", "1.1.0" );
        km = createAndDeployJar( ks, releaseId2, drl_Rx_2, drl_Rnew_2 );

        kc.updateToVersion( releaseId2 );

        // rule Rx is UNchanged and should NOT fire again
        // rule Rnew is new but there is no match
        assertEquals( 0, ksession.fireAllRules() );
    }
{code}


> Comparison of DRL changes should not consider comments during incremental compilation
> -------------------------------------------------------------------------------------
>
>                 Key: DROOLS-1400
>                 URL: https://issues.jboss.org/browse/DROOLS-1400
>             Project: Drools
>          Issue Type: Bug
>          Components: core engine
>    Affects Versions: 7.0.0.Beta5
>            Reporter: Matteo Mortari
>            Assignee: Matteo Mortari
>            Priority: Minor
>
> Same as [DROOLS-1399] but concerning comments; in full below:
> During incremental compilation the equivalent DRL file contains only a modification +within a comment+. Currently, this triggers the incremental compilation to rebuild all the resources associated in that DRL file anyway. Consequently, a rule in that DRL file might be actually UNchanged; but following the explanation above, it will match and fire again, like it's a new/modified rule.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)


More information about the jboss-jira mailing list