Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[incubator-kie-drools-6136] Migrate drools kie manve plugin tests to JUnit5 - #6 #6170

Merged
merged 4 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions kie-ci/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@
</dependency>

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

<dependency>
<groupId>org.assertj</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import java.util.List;
import java.util.UUID;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.api.builder.helper.KieModuleDeploymentHelperImpl.KJarResource;

import static org.assertj.core.api.Assertions.assertThat;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@

import org.drools.core.impl.EnvironmentImpl;
import org.drools.core.test.model.Cheese;
import org.junit.After;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.kie.api.builder.KieModule;
import org.kie.api.builder.model.KieBaseModel;
import org.kie.api.conf.EqualityBehaviorOption;
Expand All @@ -49,7 +49,7 @@ public class KieModuleDeploymentHelperTest {

private ZipInputStream zip;

@After
@AfterEach
public void cleanUp() {
if (zip != null) {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import org.drools.base.rule.TypeMetaInfo;
import org.drools.mvel.CommonTestMethodBase;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
import org.kie.api.builder.KieFileSystem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import java.io.InputStream;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.maven.integration.MavenPomModelGenerator;
import org.kie.util.maven.support.PomModel;
import org.kie.util.maven.support.PomModelGenerator;
Expand Down
10 changes: 5 additions & 5 deletions kie-ci/src/test/java/org/kie/scanner/KieModuleBuilderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

import org.drools.compiler.kie.builder.impl.InternalKieModule;
import org.drools.core.util.FileManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
import org.kie.api.builder.KieFileSystem;
Expand All @@ -44,13 +44,13 @@ public class KieModuleBuilderTest extends AbstractKieCiTest {

private FileManager fileManager;

@Before
@BeforeEach
public void setUp() throws Exception {
this.fileManager = new FileManager();
this.fileManager.setUp();
}

@After
@AfterEach
public void tearDown() throws Exception {
this.fileManager.tearDown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.HashMap;

import org.drools.drl.parser.MessageImpl;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
import org.kie.api.builder.KieFileSystem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.drools.compiler.kie.builder.impl.KieRepositoryImpl;
import org.drools.compiler.kie.builder.impl.KieServicesImpl;
import org.drools.mvel.asm.DefaultBeanClassBuilder;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.api.KieBase;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package org.kie.scanner;

import org.junit.Test;
import org.junit.jupiter.api.Test;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
package org.kie.scanner;

import org.drools.compiler.kie.builder.impl.InternalKieModule;
import org.junit.jupiter.api.Test;
import org.drools.base.rule.TypeMetaInfo;
import org.junit.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
import org.kie.api.builder.KieFileSystem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@

import org.drools.compiler.kie.builder.impl.InternalKieModule;
import org.drools.core.util.FileManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.KieModule;
import org.kie.api.builder.ReleaseId;
Expand All @@ -48,21 +48,21 @@
* 3. Note that this test uses 'http://localhost:8081' as nexus target, with the default nexus user name 'admin' and password 'admin123'
*
*/
@Ignore("ignored because it needs a running nexus server")
@Disabled("ignored because it needs a running nexus server")
public class KieRepositoryScannerNexusTest extends AbstractKieCiTest {
private static final Logger LOG = LoggerFactory.getLogger(KieRepositoryScannerNexusTest.class);

private FileManager fileManager;

@Before
@BeforeEach
public void setUp() throws Exception {
System.setProperty("kie.maven.settings.custom", new File("target/test-classes/org/kie/scanner/settings_nexus.xml").getAbsolutePath());
this.fileManager = new FileManager();
this.fileManager.setUp();
ReleaseId releaseId = KieServices.Factory.get().newReleaseId("org.kie", "scanner-test", "1.0-SNAPSHOT");
}

@After
@AfterEach
public void tearDown() throws Exception {
this.fileManager.tearDown();
}
Expand Down
24 changes: 14 additions & 10 deletions kie-ci/src/test/java/org/kie/scanner/KieRepositoryScannerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
import org.drools.compiler.kie.builder.impl.event.KieScannerStatusChangeEventImpl;
import org.drools.compiler.kie.builder.impl.event.KieScannerUpdateResultsEventImpl;
import org.drools.core.util.FileManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
import org.kie.api.builder.KieFileSystem;
Expand Down Expand Up @@ -63,14 +63,14 @@ public class KieRepositoryScannerTest extends AbstractKieCiTest {

private FileManager fileManager;

@Before
@BeforeEach
public void setUp() throws Exception {
this.fileManager = new FileManager();
this.fileManager.setUp();
ReleaseId releaseId = KieServices.Factory.get().newReleaseId("org.kie", "scanner-test", "1.0-SNAPSHOT");
}

@After
@AfterEach
public void tearDown() throws Exception {
this.fileManager.tearDown();
}
Expand Down Expand Up @@ -115,7 +115,8 @@ public void testKScanner() throws Exception {
ks.getRepository().removeKieModule(releaseId);
}

@Test @Ignore("used only for check performances")
@Test
@Disabled("used only for check performances")
public void testKScannerWithDependencies() throws Exception {
KieServices ks = KieServices.Factory.get();
ReleaseId releaseIdNoDep = ks.newReleaseId( "org.kie", "test-no-dep", "1.0-SNAPSHOT" );
Expand All @@ -136,7 +137,8 @@ public void testKScannerWithDependencies() throws Exception {
System.out.println("done in " + (System.nanoTime() - start));
}

@Test @Ignore("avoid use external dependency")
@Test
@Disabled("avoid use external dependency")
public void testKScannerWithTransitiveInclusion() throws Exception {
String pom = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
Expand Down Expand Up @@ -168,7 +170,8 @@ public void testKScannerWithTransitiveInclusion() throws Exception {
}
}

@Test @Ignore("avoid use external dependency")
@Test
@Disabled("avoid use external dependency")
public void testKScannerWithExclusion() throws Exception {
String pom = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
"<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
Expand Down Expand Up @@ -902,7 +905,8 @@ public void testScanIncludedDependency() throws Exception {
ks.getRepository().removeKieModule(includedReleaseId);
}

@Test @Ignore
@Test
@Disabled
public void testScanIncludedAndIncludingDependency() throws Exception {
KieMavenRepository repository = getKieMavenRepository();
KieServices ks = KieServices.Factory.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

import org.drools.compiler.kie.builder.impl.InternalKieModule;
import org.drools.core.util.FileManager;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.KieBuilder;
import org.kie.api.builder.KieFileSystem;
Expand All @@ -46,7 +46,7 @@ public class KieScannerIncrementalCompilationTest extends AbstractKieCiTest {
private FileManager fileManager;
private ReleaseId releaseId;

@Before
@BeforeEach
public void setUp() throws Exception {
this.fileManager = new FileManager();
this.fileManager.setUp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@

import org.drools.compiler.kie.builder.impl.InternalKieModule;
import org.drools.core.util.FileManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.Timeout;
import org.kie.api.KieServices;
import org.kie.api.builder.ReleaseId;
import org.kie.scanner.AbstractKieCiTest;
Expand All @@ -46,20 +47,21 @@ public class ConcurrentBuildTest extends AbstractKieCiTest {

private FileManager fileManager;

@Before
@BeforeEach
public void setUp() throws Exception {
this.fileManager = new FileManager();
this.fileManager.setUp();
ReleaseId releaseId = KieServices.Factory.get().newReleaseId("org.kie", "scanner-test", "1.0-SNAPSHOT");
}

@After
@AfterEach
public void tearDown() throws Exception {
this.fileManager.tearDown();
}

// This is TurtleTest. You can run this test with -PrunTurtleTests
@Test(timeout=600000)
@Test
@Timeout(600000)
public void concurrentBuildWithDependency() throws Exception {
KieServices ks = KieServices.Factory.get();
KieMavenRepository repository = getKieMavenRepository();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

import org.drools.compiler.kie.builder.impl.InternalKieModule;
import org.eclipse.aether.repository.RemoteRepository;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.KieScanner;
import org.kie.api.builder.ReleaseId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
import org.drools.compiler.kie.builder.impl.InternalKieModule;
import org.drools.compiler.kie.builder.impl.InternalKieScanner;
import org.drools.core.util.FileManager;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.kie.api.KieServices;
import org.kie.api.builder.ReleaseId;
import org.kie.api.runtime.KieContainer;
Expand All @@ -43,15 +43,15 @@ public class KieScannerMBeanTest extends AbstractKieCiTest {

private FileManager fileManager;

@Before
@BeforeEach
public void setUp() throws Exception {
MBeanUtils.setMBeanEnabled(true);
System.setProperty(MBeanUtils.MBEANS_PROPERTY, "enabled");
this.fileManager = new FileManager();
this.fileManager.setUp();
}

@After
@AfterEach
public void tearDown() throws Exception {
this.fileManager.tearDown();
System.setProperty(MBeanUtils.MBEANS_PROPERTY, "");
Expand Down
5 changes: 0 additions & 5 deletions kie-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,6 @@
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,13 @@

import java.net.URL;

import org.assertj.core.api.Assertions;
import org.drools.compiler.kie.builder.impl.KieContainerImpl;
import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.kie.api.builder.KieModule;
import org.kie.api.runtime.KieContainer;
import org.kie.api.runtime.KieSession;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;

public class ExecModelParameterTestIT {

Expand All @@ -43,7 +40,7 @@ public class ExecModelParameterTestIT {
public void testWithoutDroolsModelCompilerOnClassPathDoNotRunExecModel() throws Exception {
KieModule kieModule = fireRule();
assertThat(kieModule).isNotNull();
assertFalse(kieModule.getClass().getCanonicalName().equals(CANONICAL_KIE_MODULE));
assertThat(kieModule.getClass().getCanonicalName()).isNotEqualTo(CANONICAL_KIE_MODULE);
}

private KieModule fireRule() throws Exception {
Expand Down
Loading
Loading