Skip to content

Commit

Permalink
[incubator-kie-issues#1104] Migrate Junit inside DMN (apache#5883)
Browse files Browse the repository at this point in the history
* [incubator-kie-issues#1104] Moved to junit 6 /jupiter

* [incubator-kie-issues#1104] Fix formatting

* [incubator-kie-issues#1104] Fix formatting

* [incubator-kie-issues#1104] Fix merge. BAn junit 4 from kie-dmn modules

* [incubator-kie-issues#1104] Fix format - attempt

* [incubator-kie-issues#1104] Fix xml format

---------

Co-authored-by: Gabriele-Cardosi <gabriele.cardosi@ibm.com>
  • Loading branch information
2 people authored and rgdoliveira committed May 7, 2024
1 parent f2ded6a commit ecade58
Show file tree
Hide file tree
Showing 376 changed files with 6,281 additions and 4,846 deletions.
1 change: 0 additions & 1 deletion bom/kie-dmn-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@
<version>${project.version}</version>
<classifier>sources</classifier>
</dependency>

</dependencies>
</dependencyManagement>

Expand Down
5 changes: 5 additions & 0 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,11 @@
<artifactId>junit-jupiter-api</artifactId>
<version>${version.org.junit}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${version.org.junit}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand Down
16 changes: 7 additions & 9 deletions kie-dmn/kie-dmn-backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,24 +61,22 @@
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.xmlunit</groupId>
<artifactId>xmlunit-core</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.slf4j</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@

import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;

import javax.xml.XMLConstants;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.dmn.api.marshalling.DMNMarshaller;
import org.kie.dmn.backend.marshalling.v1_1.xstream.extensions.DecisionServicesExtensionRegister;
import org.kie.dmn.backend.marshalling.v1x.DMNMarshallerFactory;
Expand All @@ -37,10 +36,10 @@

import static org.assertj.core.api.Assertions.assertThat;

public class DMNXMLLoaderTest {
class DMNXMLLoaderTest {

@Test
public void testLoadingDefinitions() {
void loadingDefinitions() {
final DMNMarshaller DMNMarshaller = DMNMarshallerFactory.newDefaultMarshaller();

final InputStream is = this.getClass().getResourceAsStream( "0001-input-data-string.dmn" );
Expand Down Expand Up @@ -81,7 +80,7 @@ public void testLoadingDefinitions() {
}

@Test
public void testLoadingDecisionServices() {
void loadingDecisionServices() {
final DMNMarshaller DMNMarshaller = DMNMarshallerFactory.newMarshallerWithExtensions(List.of(new DecisionServicesExtensionRegister()));

final InputStream is = this.getClass().getResourceAsStream("0004-decision-services.dmn");
Expand Down Expand Up @@ -113,7 +112,7 @@ public void testLoadingDecisionServices() {
}

@Test
public void testLoadingWithNoDecisionServices() {
void loadingWithNoDecisionServices() {
final DMNMarshaller DMNMarshaller = DMNMarshallerFactory.newMarshallerWithExtensions(List.of(new DecisionServicesExtensionRegister()));

final InputStream is = this.getClass().getResourceAsStream("0001-input-data-string.dmn");
Expand All @@ -124,7 +123,7 @@ public void testLoadingWithNoDecisionServices() {
}

@Test
public void test0004_multiple_extensions() throws Exception {
void test0004_multiple_extensions() throws Exception {
DMNMarshaller marshaller = DMNMarshallerFactory.newMarshallerWithExtensions(List.of(new DecisionServicesExtensionRegister()));

final InputStream is = this.getClass().getResourceAsStream("0004-decision-services_multiple_extensions.dmn");
Expand All @@ -136,7 +135,7 @@ public void test0004_multiple_extensions() throws Exception {
}

@Test
public void testLoadingExample() {
void loadingExample() {
final DMNMarshaller DMNMarshaller = DMNMarshallerFactory.newDefaultMarshaller();

final InputStream is = this.getClass().getResourceAsStream("ch11example.xml");
Expand All @@ -149,7 +148,7 @@ public void testLoadingExample() {
}

@Test
public void testLoadingDishDecision() {
void loadingDishDecision() {
final DMNMarshaller DMNMarshaller = DMNMarshallerFactory.newDefaultMarshaller();

final InputStream is = this.getClass().getResourceAsStream("dish-decision.xml");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import javax.xml.XMLConstants;
import javax.xml.namespace.QName;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.dmn.backend.marshalling.v1_1.xstream.MarshallingUtils;
import org.kie.dmn.model.api.DMNModelInstrumentedBase;
import org.slf4j.Logger;
Expand All @@ -30,7 +30,7 @@
import static org.assertj.core.api.Assertions.assertThat;


public class MarshallingUtilsTest {
class MarshallingUtilsTest {

protected static final Logger logger = LoggerFactory.getLogger(MarshallingUtilsTest.class);

Expand Down Expand Up @@ -65,32 +65,32 @@ private void checkAndRoundTrip(QName qname, String formatQName) {
}
}

@Test
public void testLocal() throws Exception {
@Test
void local() throws Exception {
QName qname = new QName("local1");
checkAndRoundTrip(qname, "local1");
}

@Test
public void testPrefixLocal() throws Exception {
void prefixLocal() throws Exception {
QName qname = new QName(XMLConstants.NULL_NS_URI, "local2", "prefix");
checkAndRoundTrip(qname, "prefix:local2");
}

@Test
public void testNamespaceLocal() throws Exception {
void namespaceLocal() throws Exception {
QName qname = new QName("http://namespace", "local3");
checkAndRoundTrip(qname, "{http://namespace}local3");
}

@Test
public void testNamespaceLocal_b() throws Exception {
void namespaceLocalB() throws Exception {
QName qname = new QName("http://namespace", "local3", XMLConstants.DEFAULT_NS_PREFIX);
checkAndRoundTrip(qname, "{http://namespace}local3");
}

@Test
public void testNamespacePrefixLocal() throws Exception {
void namespacePrefixLocal() throws Exception {
QName qname = new QName("http://namespace", "local4", "prefix");
checkAndRoundTrip(qname, "prefix:local4");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.kie.dmn.api.marshalling.DMNMarshaller;
import org.kie.dmn.backend.marshalling.v1_1.extensions.MyTestRegister;
import org.kie.dmn.backend.marshalling.v1_1.xstream.extensions.DecisionServicesExtensionRegister;
Expand Down Expand Up @@ -63,99 +63,99 @@ public class UnmarshalMarshalTest {
protected static final Logger LOG = LoggerFactory.getLogger(UnmarshalMarshalTest.class);

@Test
public void test0001() throws Exception {
void test0001() throws Exception {
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "0001-input-data-string.dmn");
}

@Test
public void test0002() throws Exception {
void test0002() throws Exception {
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "0002-input-data-number.dmn");
}

@Test
public void test0003() throws Exception {
void test0003() throws Exception {
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "0003-input-data-string-allowed-values.dmn");
}

@Test
public void test0004() throws Exception {
void test0004() throws Exception {
DMNMarshaller marshaller = DMNMarshallerFactory.newMarshallerWithExtensions(List.of(new DecisionServicesExtensionRegister()));
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "0004-decision-services.dmn", marshaller);
}

@Test
public void test0004_ns_other_location() throws Exception {
void test0004_ns_other_location() throws Exception {
DMNMarshaller marshaller = DMNMarshallerFactory.newMarshallerWithExtensions(List.of(new DecisionServicesExtensionRegister()));
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "0004-decision-services_ns_other_location.dmn", marshaller);
}

@Test
public void test0005_decision_list() throws Exception {
void test0005_decision_list() throws Exception {
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "0005-decision-list.dmn");
}

@Test
public void test_hardcoded_java_max_call() throws Exception {
void hardcoded_java_max_call() throws Exception {
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "hardcoded-java-max-call.dmn");
}

@Test
public void testDish() throws Exception {
void dish() throws Exception {
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "dish-decision.xml");
}

@Ignore("failing to compare over a xsi:type=\"tImport\" attribute, but why content generated 'control' need to explicit it ?")
@Disabled("failing to compare over a xsi:type=\"tImport\" attribute, but why content generated 'control' need to explicit it ?")
@Test
public void testDummyDefinitions() throws Exception {
void dummyDefinitions() throws Exception {
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "dummy-definitions.xml");
}

@Test
public void testDummyRelation() throws Exception {
void dummyRelation() throws Exception {
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "dummy-relation.xml");
}

@Test
public void testCh11() throws Exception {
void ch11() throws Exception {
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "ch11example.xml");
}

@Test
public void testHello_World_semantic_namespace() throws Exception {
void helloWorldSemanticNamespace() throws Exception {
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "Hello_World_semantic_namespace.dmn");
}

@Test
public void testHello_World_semantic_namespace_with_extensions() throws Exception {
void helloWorldSemanticNamespaceWithExtensions() throws Exception {
DMNMarshaller marshaller = DMNMarshallerFactory.newMarshallerWithExtensions(List.of(new MyTestRegister()));
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "Hello_World_semantic_namespace_with_extensions.dmn", marshaller);
}

@Test
public void testHello_World_semantic_namespace_with_extensions_other_ns_location() throws Exception {
void helloWorldSemanticNamespaceWithExtensionsOtherNsLocation() throws Exception {
DMNMarshaller marshaller = DMNMarshallerFactory.newMarshallerWithExtensions(List.of(new MyTestRegister()));
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "Hello_World_semantic_namespace_with_extensions_other_ns_location.dmn", marshaller);
}

@Test
public void testSemanticNamespace() throws Exception {
void semanticNamespace() throws Exception {
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "semantic-namespace.xml");
}

@Ignore("The current file cannot marshal back extension elements because they don't provide converters.")
@Disabled("The current file cannot marshal back extension elements because they don't provide converters.")
@Test
public void test20161014() throws Exception {
void test20161014() throws Exception {
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "test20161014.xml");
}

@Test
public void testQNameSerialization() throws Exception {
void qNameSerialization() throws Exception {
testRoundTrip("org/kie/dmn/backend/marshalling/v1_1/", "hardcoded_function_definition.dmn");
}

@Ignore("A problem with the StaxDriver has still to be resolved.")
@Disabled("A problem with the StaxDriver has still to be resolved.")
@Test
public void testFAILforMissingNamespaces() {
void faiLforMissingNamespaces() {
fail("PERFORM A MANUAL CHECK: does now the Stax driver do output the namespace for 'feel:' ?? ");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
import javax.xml.transform.Source;
import javax.xml.transform.stream.StreamSource;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.dmn.api.marshalling.DMNMarshaller;
import org.kie.dmn.backend.marshalling.v1_2.extensions.MyTestRegister;
import org.kie.dmn.backend.marshalling.v1x.DMNMarshallerFactory;
Expand Down Expand Up @@ -65,49 +65,49 @@ public class UnmarshalMarshalTest {
protected static final Logger LOG = LoggerFactory.getLogger(UnmarshalMarshalTest.class);

@Test
public void testV12_simple() throws Exception {
void v12Simple() throws Exception {
testRoundTripV12("org/kie/dmn/backend/marshalling/v1_2/", "simple.dmn");
}

@Test
public void testV12_ch11example() throws Exception {
void v12Ch11example() throws Exception {
testRoundTripV12("org/kie/dmn/backend/marshalling/v1_2/", "ch11example.dmn");
}

@Test
public void testV12_ImportName() throws Exception {
void v12_ImportName() throws Exception {
testRoundTripV12("org/kie/dmn/backend/marshalling/v1_2/", "ImportName.dmn");
}

@Test
public void testV12_DecisionService20180911v12() throws Exception {
void v12_DecisionService20180911v12() throws Exception {
// DROOLS-2987 DMN v1.2 marshaller failing marshalling DecisionService node and dmndi:DMNDecisionServiceDividerLine
testRoundTripV12("org/kie/dmn/backend/marshalling/v1_2/", "DecisionService20180911v12.dmn");
}

@Test
public void testV12_DiamondWithColors() throws Exception {
void v12_DiamondWithColors() throws Exception {
testRoundTripV12("org/kie/dmn/backend/marshalling/v1_2/", "diamondWithColors.dmn");
}

@Test
public void testV12_DMNDIDiagramElementExtension() throws Exception {
void v12_dmndiDiagramElementExtension() throws Exception {
testRoundTripV12("org/kie/dmn/backend/marshalling/v1_2/", "DMNDIDiagramElementExtension.dmn");
}

@Test
public void testV12_DMNDIDiagramElementExtension_withContent() throws Exception {
void v12_dmndiDiagramElementExtensionWithContent() throws Exception {
DMNMarshaller marshaller = DMNMarshallerFactory.newMarshallerWithExtensions(List.of(new MyTestRegister()));
testRoundTrip("org/kie/dmn/backend/marshalling/v1_2/", "DMNDIDiagramElementExtension_withContent.dmn", marshaller, DMN12_SCHEMA_SOURCE);
}

@Test
public void test_hardcoded_java_max_call() throws Exception {
void hardcoded_java_max_call() throws Exception {
testRoundTripV12("org/kie/dmn/backend/marshalling/v1_2/", "hardcoded-java-max-call.dmn");
}

@Test
public void test_FontSize_sharedStyle() throws Exception {
void font_size_shared_style() throws Exception {
testRoundTripV12("org/kie/dmn/backend/marshalling/v1_2/", "test-FontSize-sharedStyle.dmn");
Definitions definitions = MARSHALLER.unmarshal(new InputStreamReader(this.getClass().getResourceAsStream("test-FontSize-sharedStyle.dmn")));
DMNShape shape0 = (DMNShape) definitions.getDMNDI().getDMNDiagram().get(0).getDMNDiagramElement().get(0);
Expand All @@ -117,12 +117,12 @@ public void test_FontSize_sharedStyle() throws Exception {
}

@Test
public void test_DMNLabel_Text() throws Exception {
void dmnlabel_text() throws Exception {
testRoundTripV12("org/kie/dmn/backend/marshalling/v1_2/", "DMNLabel-Text.dmn");
}

@Test
public void testV12_decision_list() throws Exception {
void v12DecisionList() throws Exception {
testRoundTripV12("org/kie/dmn/backend/marshalling/v1_2/", "decision-list.dmn");
}

Expand Down

0 comments on commit ecade58

Please sign in to comment.