tkobayas commented on code in PR #7186:
URL: https://github.com/apache/incubator-kie/pull/7186#discussion_r4268610690


##########
drools-model/drools-model-codegen/src/test/java/org/drools/model/codegen/execmodel/AlignAnnotationRuntimeTest.java:
##########
@@ -0,0 +1,216 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.drools.model.codegen.execmodel;
+
+import java.util.concurrent.TimeUnit;
+
+import org.drools.core.ClockType;
+import org.drools.core.common.DefaultEventHandle;
+import org.drools.model.codegen.execmodel.domain.AnnotatedEvent;
+import org.drools.model.codegen.execmodel.domain.PropertyChangeSupportFact;
+import org.drools.model.codegen.execmodel.domain.PropertyReactiveFact;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.kie.api.KieServices;
+import org.kie.api.builder.model.KieModuleModel;
+import org.kie.api.conf.EventProcessingOption;
+import org.kie.api.runtime.KieSession;
+import org.kie.api.runtime.conf.ClockTypeOption;
+import org.kie.api.runtime.rule.FactHandle;
+import org.kie.api.time.SessionPseudoClock;
+import org.kie.internal.builder.conf.PropertySpecificOption;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * Verifies that Java annotations preserved through an empty DRL {@code 
declare} block
+ * produce the correct runtime behavior in both classic and executable models.
+ *
+ * @see AlignAnnotationTest
+ * @see <a 
href="https://github.com/apache/incubator-kie/issues/7185";>incubator-kie#7185</a>
+ */
+public class AlignAnnotationRuntimeTest extends BaseModelTest {
+
+    private static KieModuleModel getCepKieModuleModel() {
+        KieModuleModel model = KieServices.get().newKieModuleModel();
+        model.newKieBaseModel("kb")
+                .setDefault(true)
+                .setEventProcessingMode(EventProcessingOption.STREAM)
+                .newKieSessionModel("ks")
+                
.setDefault(true).setClockType(ClockTypeOption.get(ClockType.PSEUDO_CLOCK.getId()));
+        return model;
+    }
+
+    // --- @Role(EVENT): fact should be treated as an event ---
+
+    @ParameterizedTest
+    @MethodSource("parameters")
+    public void testRoleEventRuntimeWithEmptyDeclare(RUN_TYPE runType) {
+        String drl =
+                "import " + AnnotatedEvent.class.getCanonicalName() + ";\n" +
+                "declare AnnotatedEvent end\n" +
+                "rule R when AnnotatedEvent() then end\n";
+
+        KieSession ksession = getKieSession(runType, getCepKieModuleModel(), 
drl);
+        FactHandle handle = ksession.insert(new AnnotatedEvent());
+        assertThat(handle).isInstanceOf(DefaultEventHandle.class);

Review Comment:
   "without dispose" is a usual practice in our test cases, but I will review 
it in https://github.com/apache/incubator-kie/issues/7187



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to