diff --git a/bom/pom.xml b/bom/pom.xml index 8e7a2c22a6..88728485a4 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -4,7 +4,7 @@ 2.16.2.Final - 2.18.2.Final + 2.19.0.Final 3 diff --git a/config-groovy/tests/pom.xml b/config-groovy/tests/pom.xml index 3fca57df58..4f2a44b420 100644 --- a/config-groovy/tests/pom.xml +++ b/config-groovy/tests/pom.xml @@ -39,14 +39,10 @@ - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + org.jboss.windup + windup-test-harness + ${project.version} + test + diff --git a/config-xml/tests/pom.xml b/config-xml/tests/pom.xml index fe312ae015..b6279f0860 100644 --- a/config-xml/tests/pom.xml +++ b/config-xml/tests/pom.xml @@ -47,15 +47,11 @@ - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + org.jboss.windup + windup-test-harness + ${project.version} + test + diff --git a/config/tests/pom.xml b/config/tests/pom.xml index 180c41471d..ff18bafc50 100644 --- a/config/tests/pom.xml +++ b/config/tests/pom.xml @@ -54,14 +54,10 @@ - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + org.jboss.windup + windup-test-harness + ${project.version} + test + diff --git a/exec/tests/pom.xml b/exec/tests/pom.xml index 4fbca92262..0a53983584 100644 --- a/exec/tests/pom.xml +++ b/exec/tests/pom.xml @@ -37,14 +37,10 @@ - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + org.jboss.windup + windup-test-harness + ${project.version} + test + diff --git a/graph/tests/pom.xml b/graph/tests/pom.xml index 29795edc65..fac0472c8b 100644 --- a/graph/tests/pom.xml +++ b/graph/tests/pom.xml @@ -46,15 +46,11 @@ - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + org.jboss.windup + windup-test-harness + ${project.version} + test + diff --git a/java-ast/tests/pom.xml b/java-ast/tests/pom.xml index 12caf5001c..c5fc159e8b 100644 --- a/java-ast/tests/pom.xml +++ b/java-ast/tests/pom.xml @@ -31,16 +31,12 @@ - - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + + org.jboss.windup + windup-test-harness + ${project.version} + test + org.jboss.windup.exec windup-exec diff --git a/pom.xml b/pom.xml index 542d4bbee5..f1e5d33b89 100644 --- a/pom.xml +++ b/pom.xml @@ -17,7 +17,7 @@ Migration Tools - 2.18.2.Final + 2.19.0.Final 0.5.4 2.5.0 2.3.23 @@ -59,6 +59,7 @@ bom + windup-test-harness forks/fernflower forks/frames forks/procyon diff --git a/reporting/tests/pom.xml b/reporting/tests/pom.xml index d0c77e60fb..71012b98d1 100644 --- a/reporting/tests/pom.xml +++ b/reporting/tests/pom.xml @@ -62,15 +62,11 @@ - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + org.jboss.windup + windup-test-harness + ${project.version} + test + org.jboss.windup.utils windup-utils diff --git a/rexster/tests/pom.xml b/rexster/tests/pom.xml index 6320a6be7e..c07e3b6d19 100644 --- a/rexster/tests/pom.xml +++ b/rexster/tests/pom.xml @@ -34,13 +34,9 @@ - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath + org.jboss.windup + windup-test-harness + ${project.version} test diff --git a/rexster/tests/src/test/java/org/jboss/windup/graph/rexster/test/debug/RexsterDefaultDeploymentDebugTest.java b/rexster/tests/src/test/java/org/jboss/windup/graph/rexster/test/debug/RexsterDefaultDeploymentDebugTest.java new file mode 100644 index 0000000000..80aef201bf --- /dev/null +++ b/rexster/tests/src/test/java/org/jboss/windup/graph/rexster/test/debug/RexsterDefaultDeploymentDebugTest.java @@ -0,0 +1,74 @@ +package org.jboss.windup.graph.rexster.test.debug; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.forge.arquillian.AddonDependencies; +import org.jboss.forge.arquillian.AddonDependency; +import org.jboss.forge.arquillian.archive.AddonArchive; +import org.jboss.forge.furnace.Furnace; +import org.jboss.forge.furnace.services.Imported; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.windup.config.furnace.FurnaceHolder; +import org.jboss.windup.graph.GraphContext; +import org.jboss.windup.graph.GraphContextFactory; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.io.IOException; +import java.net.Socket; + +/** + * Tests that rexster is properly deployed thanks to Arquillian addon + */ +@RunWith(Arquillian.class) +public class RexsterDefaultDeploymentDebugTest +{ + @Deployment + @AddonDependencies({ + @AddonDependency(name = "org.jboss.windup.config:windup-config"), + @AddonDependency(name = "org.jboss.windup.graph:windup-graph"), + @AddonDependency(name = "org.jboss.forge.furnace.container:simple") + }) + public static AddonArchive getDeployment() + { + System.setProperty("maven.surefire.debug", "true"); + final AddonArchive archive = ShrinkWrap.create(AddonArchive.class) + .addAsLocalServices(RexsterDefaultDeploymentDebugTest.class); + + return archive; + } + + @Test + public void testRexsterProperStart() throws IOException, InstantiationException, IllegalAccessException + { + Furnace furnace = FurnaceHolder.getFurnace(); + Imported factory = furnace.getAddonRegistry().getServices(GraphContextFactory.class); + //GraphContext creation will start the rexster + try (GraphContext context = factory.get().create()) + { + Socket s = null; + try + { + s = new Socket("localhost", 8182); + } + catch (Exception e) + { + Assert.fail("Rexster is not listening on localhost:8182"); + } + finally + { + if (s != null) + try + { + s.close(); + } + catch (Exception e) + { + } + } + + } + + } +} \ No newline at end of file diff --git a/rexster/tests/src/test/java/org/jboss/windup/graph/rexster/test/debug/RexsterDefaultDeploymentNoDebugTest.java b/rexster/tests/src/test/java/org/jboss/windup/graph/rexster/test/debug/RexsterDefaultDeploymentNoDebugTest.java new file mode 100644 index 0000000000..3e90efdd5e --- /dev/null +++ b/rexster/tests/src/test/java/org/jboss/windup/graph/rexster/test/debug/RexsterDefaultDeploymentNoDebugTest.java @@ -0,0 +1,70 @@ +package org.jboss.windup.graph.rexster.test.debug; + +import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.junit.Arquillian; +import org.jboss.forge.arquillian.AddonDependencies; +import org.jboss.forge.arquillian.AddonDependency; +import org.jboss.forge.arquillian.archive.AddonArchive; +import org.jboss.forge.furnace.Furnace; +import org.jboss.forge.furnace.services.Imported; +import org.jboss.shrinkwrap.api.ShrinkWrap; +import org.jboss.windup.config.furnace.FurnaceHolder; +import org.jboss.windup.graph.GraphContext; +import org.jboss.windup.graph.GraphContextFactory; +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; + +import java.io.IOException; +import java.net.ConnectException; +import java.net.Socket; + +/** + * Tests that rexster is not deployed by Arquillian addon in case debug mode is OFF. + */ +@RunWith(Arquillian.class) +public class RexsterDefaultDeploymentNoDebugTest +{ + @Deployment + @AddonDependencies({ + @AddonDependency(name = "org.jboss.windup.config:windup-config"), + @AddonDependency(name = "org.jboss.windup.graph:windup-graph"), + @AddonDependency(name = "org.jboss.forge.furnace.container:simple") + }) + public static AddonArchive getDeployment() + { + final AddonArchive archive = ShrinkWrap.create(AddonArchive.class) + .addAsLocalServices(RexsterDefaultDeploymentNoDebugTest.class); + + return archive; + } + + @Test(expected = ConnectException.class) + public void testRexsterProperStart() throws IOException, InstantiationException, IllegalAccessException + { + Furnace furnace = FurnaceHolder.getFurnace(); + Imported factory = furnace.getAddonRegistry().getServices(GraphContextFactory.class); + try (GraphContext context = factory.get().create()) + { + Socket s = null; + try + { + s = new Socket("localhost", 8182); + Assert.fail("Rexster should not be registered when not in debug mode."); + } + finally + { + if (s != null) + try + { + s.close(); + } + catch (Exception e) + { + } + } + + } + + } +} \ No newline at end of file diff --git a/rules-base/tests/pom.xml b/rules-base/tests/pom.xml index c7bd64a033..7e6aecb23d 100644 --- a/rules-base/tests/pom.xml +++ b/rules-base/tests/pom.xml @@ -72,14 +72,10 @@ - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + org.jboss.windup + windup-test-harness + ${project.version} + test + diff --git a/rules-java-archives/tests/pom.xml b/rules-java-archives/tests/pom.xml index 74778f5f28..311b454648 100644 --- a/rules-java-archives/tests/pom.xml +++ b/rules-java-archives/tests/pom.xml @@ -30,15 +30,11 @@ test - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + org.jboss.windup + windup-test-harness + ${project.version} + test + org.jboss.windup.exec windup-exec diff --git a/rules-java-ee/tests/pom.xml b/rules-java-ee/tests/pom.xml index 615a966ad4..80a36b3d95 100644 --- a/rules-java-ee/tests/pom.xml +++ b/rules-java-ee/tests/pom.xml @@ -37,15 +37,11 @@ - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + org.jboss.windup + windup-test-harness + ${project.version} + test + org.jboss.windup.exec windup-exec diff --git a/rules-java-project/tests/pom.xml b/rules-java-project/tests/pom.xml index 8f89c5c3ee..4f0464b415 100644 --- a/rules-java-project/tests/pom.xml +++ b/rules-java-project/tests/pom.xml @@ -60,15 +60,11 @@ - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + org.jboss.windup + windup-test-harness + ${project.version} + test + org.jboss.windup.exec windup-exec diff --git a/rules-java/addon/pom.xml b/rules-java/addon/pom.xml index de737353a7..2ff990308a 100644 --- a/rules-java/addon/pom.xml +++ b/rules-java/addon/pom.xml @@ -110,15 +110,11 @@ - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + org.jboss.windup + windup-test-harness + ${project.version} + test + org.jboss.windup.exec windup-exec diff --git a/rules-java/tests/pom.xml b/rules-java/tests/pom.xml index 4564a2ff8d..8546647391 100644 --- a/rules-java/tests/pom.xml +++ b/rules-java/tests/pom.xml @@ -96,16 +96,12 @@ - - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + + org.jboss.windup + windup-test-harness + ${project.version} + test + org.jboss.windup.exec windup-exec diff --git a/rules-tattletale/addon/pom.xml b/rules-tattletale/addon/pom.xml index 80d1130aeb..cd0f321f69 100644 --- a/rules-tattletale/addon/pom.xml +++ b/rules-tattletale/addon/pom.xml @@ -55,15 +55,11 @@ - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + org.jboss.windup + windup-test-harness + ${project.version} + test + org.jboss.windup.exec windup-exec diff --git a/rules-tattletale/tests/pom.xml b/rules-tattletale/tests/pom.xml index 7b75b54fa5..6636757902 100644 --- a/rules-tattletale/tests/pom.xml +++ b/rules-tattletale/tests/pom.xml @@ -53,16 +53,12 @@ - - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + + org.jboss.windup + windup-test-harness + ${project.version} + test + org.jboss.windup.exec windup-exec diff --git a/rules-xml/tests/pom.xml b/rules-xml/tests/pom.xml index 921dfbf64b..b1c093f3e2 100644 --- a/rules-xml/tests/pom.xml +++ b/rules-xml/tests/pom.xml @@ -80,16 +80,12 @@ - - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + + org.jboss.windup + windup-test-harness + ${project.version} + test + org.jboss.windup.exec windup-exec diff --git a/test-util/pom.xml b/test-util/pom.xml index 853a052378..e18ef4b97f 100644 --- a/test-util/pom.xml +++ b/test-util/pom.xml @@ -39,15 +39,11 @@ test - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + org.jboss.windup + windup-test-harness + ${project.version} + test + diff --git a/tests/pom.xml b/tests/pom.xml index 1eb8da48b5..619e55e5a4 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -94,15 +94,11 @@ test - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + org.jboss.windup + windup-test-harness + ${project.version} + test + diff --git a/tooling/tests/pom.xml b/tooling/tests/pom.xml index 7b61616aa2..39c694d514 100644 --- a/tooling/tests/pom.xml +++ b/tooling/tests/pom.xml @@ -57,14 +57,10 @@ - org.jboss.forge.furnace.test - furnace-test-harness - test - - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - + org.jboss.windup + windup-test-harness + ${project.version} + test + diff --git a/ui/tests/pom.xml b/ui/tests/pom.xml index 75b91bc0a1..39d40bbc7e 100644 --- a/ui/tests/pom.xml +++ b/ui/tests/pom.xml @@ -74,23 +74,17 @@ - org.jboss.forge.furnace.test - furnace-test-harness - test - + org.jboss.windup + windup-test-harness + ${project.version} + test + org.jboss.forge.addon ui-test-harness forge-addon test - - org.jboss.forge.furnace.test - arquillian-furnace-classpath - test - - - diff --git a/windup-test-harness/pom.xml b/windup-test-harness/pom.xml new file mode 100644 index 0000000000..d07a04426f --- /dev/null +++ b/windup-test-harness/pom.xml @@ -0,0 +1,26 @@ + + + 4.0.0 + + org.jboss.windup + windup-parent + 2.3.1-SNAPSHOT + + windup-test-harness + + + Windup Engine - Arquillian extension + Used to register extensions for the furnace arquillian module so that it is possible to deploy additional + addons by default. + + + + org.jboss.forge.furnace.test + furnace-test-harness + + + org.jboss.forge.furnace.test + arquillian-furnace-classpath + + + diff --git a/windup-test-harness/src/main/java/org/jboss/windup/arquillian/WindupFurnaceAddonDeploymentEnhancer.java b/windup-test-harness/src/main/java/org/jboss/windup/arquillian/WindupFurnaceAddonDeploymentEnhancer.java new file mode 100644 index 0000000000..5ff760fd16 --- /dev/null +++ b/windup-test-harness/src/main/java/org/jboss/windup/arquillian/WindupFurnaceAddonDeploymentEnhancer.java @@ -0,0 +1,75 @@ +package org.jboss.windup.arquillian; + +import org.jboss.arquillian.container.spi.client.deployment.DeploymentDescription; +import org.jboss.arquillian.test.spi.TestClass; +import org.jboss.forge.arquillian.archive.AddonDeploymentArchive; +import org.jboss.forge.arquillian.spi.AddonDeploymentScenarioEnhancer; +import org.jboss.forge.furnace.addons.AddonId; +import org.jboss.shrinkwrap.api.ShrinkWrap; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; + +/** + * Deployment service that deploys the rexster addon everytime debugging is on. + * + * @author Matej Briškár + */ +public class WindupFurnaceAddonDeploymentEnhancer implements AddonDeploymentScenarioEnhancer +{ + @Override public List enhance(TestClass testClass, List deployments) + { + if(Boolean.getBoolean("maven.surefire.debug")) { + String version = getWindupVersion(deployments); + if(version != null) { + AddonId id = AddonId.from("org.jboss.windup.rexster:windup-rexster", version); + AddonDeploymentArchive archive = ShrinkWrap.create(AddonDeploymentArchive.class).setAddonId(id); + + archive.setDeploymentTimeoutUnit(TimeUnit.MILLISECONDS); + archive.setDeploymentTimeoutQuantity(10000); + + DeploymentDescription deploymentDescription = new DeploymentDescription(id.toCoordinates(), archive); + deploymentDescription.shouldBeTestable(false); + deployments.add(deploymentDescription); + } + } + return deployments; + } + + /** + * Take the windup-config version and if not found, take the most frequent version of windup addons. + * @param deployments + * @return + */ + private String getWindupVersion(List deployments) { + Map versionOccurences = new HashMap<>(); + for (DeploymentDescription deployment : deployments) + { + + if(deployment.toString().contains("windup")) { + String version = deployment.toString().split(",")[1]; + + if(deployment.toString().contains("windup-config")) { + return version; + } + if(versionOccurences.containsKey(deployment.toString().split(",")[1])) { + versionOccurences.put(version,versionOccurences.get(version) +1); + } else { + versionOccurences.put(version,1); + } + } + } + Map.Entry maxEntry = null; + for (Map.Entry stringIntegerEntry : versionOccurences.entrySet()) + { + if(maxEntry == null || stringIntegerEntry.getValue() > maxEntry.getValue()) { + maxEntry = stringIntegerEntry; + } + } + + return maxEntry == null ? null : maxEntry.getKey(); + + } +} diff --git a/windup-test-harness/src/main/resources/META-INF/services/org.jboss.forge.arquillian.spi.AddonDeploymentScenarioEnhancer b/windup-test-harness/src/main/resources/META-INF/services/org.jboss.forge.arquillian.spi.AddonDeploymentScenarioEnhancer new file mode 100644 index 0000000000..63733e60b0 --- /dev/null +++ b/windup-test-harness/src/main/resources/META-INF/services/org.jboss.forge.arquillian.spi.AddonDeploymentScenarioEnhancer @@ -0,0 +1 @@ +org.jboss.windup.arquillian.WindupFurnaceAddonDeploymentEnhancer \ No newline at end of file