From ebd5dec4984543a11904a3a8ce575e2512201cf4 Mon Sep 17 00:00:00 2001 From: Malte Brunnlieb Date: Wed, 12 Apr 2023 00:16:13 +0200 Subject: [PATCH] generating platform definition based on local plugins build. --- .gitignore | 1 + build.sh | 9 ++ .../cobigen-eclipse-releng/pom.xml | 44 ++++++ .../resources/cobigen-eclipse-releng.target | 29 ++++ .../cobigen-eclipse-test/META-INF/MANIFEST.MF | 30 +++- .../cobigen-eclipse-test/build.properties | 33 ++++- cobigen-eclipse/cobigen-eclipse-test/pom.xml | 135 ++---------------- .../eclipse/test/CobigenJavaWrapperTest.java | 3 - .../eclipse/test/ExceptionHandlingTest.java | 3 - .../test/GenerateFromTextInputTest.java | 3 - .../cobigen/eclipse/test/HealthCheckTest.java | 3 - .../cobigen/eclipse/test/OpenAPITest.java | 3 - .../test/UpgradeMonolithicTemplatesTest.java | 3 - .../eclipse/test/common/SystemTest.java | 3 + .../src/main/targlets/2018-12.target | 29 ++++ .../targlets/2018-12.target | 19 --- .../targlets/mars-4.5.2.target | 25 ---- .../common/tools/ExceptionHandler.java | 10 +- .../generator/java/JavaInputConverter.java | 20 +-- cobigen-eclipse/pom.xml | 1 + 20 files changed, 203 insertions(+), 203 deletions(-) create mode 100644 cobigen-eclipse/cobigen-eclipse-releng/pom.xml create mode 100644 cobigen-eclipse/cobigen-eclipse-releng/src/main/resources/cobigen-eclipse-releng.target create mode 100644 cobigen-eclipse/cobigen-eclipse-test/src/main/targlets/2018-12.target delete mode 100644 cobigen-eclipse/cobigen-eclipse-test/targlets/2018-12.target delete mode 100644 cobigen-eclipse/cobigen-eclipse-test/targlets/mars-4.5.2.target diff --git a/.gitignore b/.gitignore index 978e10ba4f..27ab71f97e 100644 --- a/.gitignore +++ b/.gitignore @@ -49,3 +49,4 @@ cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/TemplateP cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/TemplateProcessingTest/template-sets/downloaded/crud-java-server-app-1.0.0-sources.jar cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/TemplateProcessingTest/template-sets/downloaded/crud-java-server-app-complex-1.0.0.jar cobigen/cobigen-core-systemtest/src/test/resources/testdata/systemtest/TemplateProcessingTest/template-sets/downloaded/crud-java-server-app-complex-1.0.0-sources.jar +cobigen-eclipse/cobigen-eclipse-releng/cobigen-eclipse-releng.target diff --git a/build.sh b/build.sh index d11bfb4998..2c4be6459d 100755 --- a/build.sh +++ b/build.sh @@ -5,6 +5,15 @@ echo "" echo "##########################################" echo "" + +if [[ -f "$(dirname ${0})/cobigen-eclipse/cobigen-eclipse-releng/cobigen-eclipse-releng.target" ]] +then + log_step "Eclipse target platform specification already built" +else + log_step "Building eclipse target platform specification" + doRunCommand "mvn install $MVN_SETTINGS --projects cobigen-eclipse/cobigen-eclipse-releng/ $DEBUG $PARALLELIZED $BATCH_MODE" +fi + if [[ "$NO_CLEAN" = false ]] then log_step "Cleanup Projects" diff --git a/cobigen-eclipse/cobigen-eclipse-releng/pom.xml b/cobigen-eclipse/cobigen-eclipse-releng/pom.xml new file mode 100644 index 0000000000..dff6a566d9 --- /dev/null +++ b/cobigen-eclipse/cobigen-eclipse-releng/pom.xml @@ -0,0 +1,44 @@ + + 4.0.0 + + com.devonfw.cobigen + eclipse-parent + ${revision} + + cobigen-eclipse-releng + eclipse-target-definition + + + ${basedir} + + + + + + org.apache.maven.plugins + maven-resources-plugin + 3.3.1 + + + setup-targlet + initialize + + copy-resources + + + + + ${basedir} + + + src/main/resources + true + + + + + + + \ No newline at end of file diff --git a/cobigen-eclipse/cobigen-eclipse-releng/src/main/resources/cobigen-eclipse-releng.target b/cobigen-eclipse/cobigen-eclipse-releng/src/main/resources/cobigen-eclipse-releng.target new file mode 100644 index 0000000000..3f84425f0b --- /dev/null +++ b/cobigen-eclipse/cobigen-eclipse-releng/src/main/resources/cobigen-eclipse-releng.target @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cobigen-eclipse/cobigen-eclipse-test/META-INF/MANIFEST.MF b/cobigen-eclipse/cobigen-eclipse-test/META-INF/MANIFEST.MF index 2dcd2b2799..dfbae780f7 100644 --- a/cobigen-eclipse/cobigen-eclipse-test/META-INF/MANIFEST.MF +++ b/cobigen-eclipse/cobigen-eclipse-test/META-INF/MANIFEST.MF @@ -1,30 +1,52 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 +Automatic-Module-Name: com.devonfw.cobigen.eclipse.test Bundle-Name: CobiGen Eclipse Plug-In Tests Bundle-SymbolicName: com.devonfw.cobigen.eclipse.test;singleton:=true Bundle-Version: 2021.12.007.qualifier Bundle-Vendor: devonfw Bundle-RequiredExecutionEnvironment: JavaSE-11 Bundle-ActivationPolicy: lazy -Bundle-ClassPath: lib/annotations.jar, +Bundle-ClassPath: ., + lib/annotations.jar, + lib/ant.jar, + lib/ant-nodeps.jar, lib/assertj-core.jar, lib/awaitility.jar, lib/byte-buddy.jar, lib/byte-buddy-agent.jar, lib/checker-qual.jar, + lib/com.devonfw.cobigen.eclipse.jar, + lib/commons-compiler.jar, + lib/commons-compress.jar, + lib/commons-io.jar, + lib/commons-jxpath.jar, lib/commons-lang3.jar, + lib/core.jar, lib/core-api.jar, + lib/core-externalprocess-api.jar, lib/core-test.jar, lib/error_prone_annotations.jar, lib/failureaccess.jar, + lib/gson.jar, lib/guava.jar, lib/hamcrest.jar, lib/hamcrest-core.jar, + lib/istack-commons-runtime.jar, lib/j2objc-annotations.jar, lib/jackson-annotations.jar, lib/jackson-core.jar, lib/jackson-databind.jar, + lib/jakarta.activation.jar, + lib/jakarta.xml.bind-api.jar, + lib/janino.jar, + lib/javaplugin-model.jar, + lib/java-sizeof.jar, + lib/javassist.jar, lib/javax.inject.jar, + lib/jaxb-core.jar, + lib/jaxb-impl.jar, + lib/jaxen.jar, lib/jcl-over-slf4j.jar, lib/jsr305.jar, lib/junit.jar, @@ -36,15 +58,21 @@ Bundle-ClassPath: lib/annotations.jar, lib/log4j-over-slf4j.jar, lib/logback-classic.jar, lib/logback-core.jar, + lib/maven-model.jar, + lib/mmm-base.jar, lib/mockito-core.jar, lib/objenesis.jar, lib/okhttp.jar, + lib/okio.jar, lib/okio-jvm.jar, + lib/orika-core.jar, + lib/paranamer.jar, lib/plexus-cipher.jar, lib/plexus-sec-dispatcher.jar, lib/plexus-utils.jar, lib/slf4j-api.jar, lib/system-lambda.jar, + lib/txw2.jar, lib/xmlunit.jar, lib/zt-exec.jar Require-Bundle: org.eclipse.swtbot.junit4_x;bundle-version="2.4.0", diff --git a/cobigen-eclipse/cobigen-eclipse-test/build.properties b/cobigen-eclipse/cobigen-eclipse-test/build.properties index 89731d4f31..37492256c0 100644 --- a/cobigen-eclipse/cobigen-eclipse-test/build.properties +++ b/cobigen-eclipse/cobigen-eclipse-test/build.properties @@ -1,25 +1,47 @@ -output.. = bin/ -bin.includes = META-INF/,\ +output.. = eclipse-target/classes/ +source.. = src/main/java/ +bin.includes = .,\ + META-INF/,\ plugin.xml,\ lib/annotations.jar,\ + lib/ant.jar,\ + lib/ant-nodeps.jar,\ lib/assertj-core.jar,\ lib/awaitility.jar,\ lib/byte-buddy.jar,\ lib/byte-buddy-agent.jar,\ lib/checker-qual.jar,\ + lib/com.devonfw.cobigen.eclipse.jar,\ + lib/commons-compiler.jar,\ + lib/commons-compress.jar,\ + lib/commons-io.jar,\ + lib/commons-jxpath.jar,\ lib/commons-lang3.jar,\ + lib/core.jar,\ lib/core-api.jar,\ + lib/core-externalprocess-api.jar,\ lib/core-test.jar,\ lib/error_prone_annotations.jar,\ lib/failureaccess.jar,\ + lib/gson.jar,\ lib/guava.jar,\ lib/hamcrest.jar,\ lib/hamcrest-core.jar,\ + lib/istack-commons-runtime.jar,\ lib/j2objc-annotations.jar,\ lib/jackson-annotations.jar,\ lib/jackson-core.jar,\ lib/jackson-databind.jar,\ + lib/jakarta.activation.jar,\ + lib/jakarta.xml.bind-api.jar,\ + lib/janino.jar,\ + lib/javaplugin-model.jar,\ + lib/java-sizeof.jar,\ + lib/javassist.jar,\ lib/javax.inject.jar,\ + lib/jaxb-core.jar,\ + lib/jaxb-impl.jar,\ + lib/jaxen.jar,\ lib/jcl-over-slf4j.jar,\ lib/jsr305.jar,\ lib/junit.jar,\ @@ -31,14 +53,21 @@ bin.includes = META-INF/,\ lib/log4j-over-slf4j.jar,\ lib/logback-classic.jar,\ lib/logback-core.jar,\ + lib/maven-model.jar,\ + lib/mmm-base.jar,\ lib/mockito-core.jar,\ lib/objenesis.jar,\ lib/okhttp.jar,\ + lib/okio.jar,\ lib/okio-jvm.jar,\ + lib/orika-core.jar,\ + lib/paranamer.jar,\ lib/plexus-cipher.jar,\ lib/plexus-sec-dispatcher.jar,\ lib/plexus-utils.jar,\ lib/slf4j-api.jar,\ lib/system-lambda.jar,\ + lib/txw2.jar,\ lib/xmlunit.jar,\ lib/zt-exec.jar + diff --git a/cobigen-eclipse/cobigen-eclipse-test/pom.xml b/cobigen-eclipse/cobigen-eclipse-test/pom.xml index 8fc4f9cf42..909c623f91 100644 --- a/cobigen-eclipse/cobigen-eclipse-test/pom.xml +++ b/cobigen-eclipse/cobigen-eclipse-test/pom.xml @@ -1,4 +1,6 @@ - + 4.0.0 com.devonfw.cobigen.eclipse.test CobiGen - Eclipse Plug-In E2E Test @@ -114,131 +116,18 @@ org.eclipse.tycho target-platform-configuration - - - - p2-installable-unit - org.eclipse.m2e.feature.feature.group - 0.0.0 - - - p2-installable-unit - com.devonfw.cobigen.eclipse.feature.feature.group - 0.0.0 - - - p2-installable-unit - com.devonfw.cobigen.htmlplugin - 0.0.0 - - - p2-installable-unit - com.devonfw.cobigen.javaplugin - 0.0.0 - - - p2-installable-unit - com.devonfw.cobigen.jsonplugin - 0.0.0 - - - p2-installable-unit - com.devonfw.cobigen.propertyplugin - 0.0.0 - - - p2-installable-unit - com.devonfw.cobigen.textmerger - 0.0.0 - - - p2-installable-unit - com.devonfw.cobigen.tsplugin - 0.0.0 - - - p2-installable-unit - com.devonfw.cobigen.xmlplugin - 0.0.0 - - - p2-installable-unit - com.devonfw.cobigen.openapiplugin - 0.0.0 - - - p2-installable-unit - com.devonfw.cobigen.tempeng-freemarker - 0.0.0 - - - p2-installable-unit - com.devonfw.cobigen.tempeng-velocity - 0.0.0 - - - + + + ${project.groupId} + cobigen-eclipse-releng + ${revision} + ../cobigen-eclipse-releng/pom.xml + + - - - swtbot - http://download.eclipse.org/technology/swtbot/releases/latest/ - p2 - - - htmlplugin - file:///${maven.multiModuleProjectDirectory}/cobigen-plugins/cobigen-htmlplugin/target/repository - p2 - - - javaplugin - file:///${maven.multiModuleProjectDirectory}/cobigen-plugins/cobigen-javaplugin-parent/cobigen-javaplugin/target/repository - p2 - - - jsonplugin - file:///${maven.multiModuleProjectDirectory}/cobigen-plugins/cobigen-jsonplugin/target/repository - p2 - - - openapiplugin - file:///${maven.multiModuleProjectDirectory}/cobigen-plugins/cobigen-openapiplugin-parent/cobigen-openapiplugin/target/repository - p2 - - - propertyplugin - file:///${maven.multiModuleProjectDirectory}/cobigen-plugins/cobigen-propertyplugin/target/repository - p2 - - - freemarker - file:///${maven.multiModuleProjectDirectory}/cobigen-plugins/cobigen-templateengines/cobigen-tempeng-freemarker/target/repository - p2 - - - velocity - file:///${maven.multiModuleProjectDirectory}/cobigen-plugins/cobigen-templateengines/cobigen-tempeng-velocity/target/repository - p2 - - - textmerger - file:///${maven.multiModuleProjectDirectory}/cobigen-plugins/cobigen-textmerger/target/repository - p2 - - - tsplugin - file:///${maven.multiModuleProjectDirectory}/cobigen-plugins/cobigen-tsplugin/target/repository - p2 - - - xmlplugin - file:///${maven.multiModuleProjectDirectory}/cobigen-plugins/cobigen-xmlplugin/target/repository - p2 - - - \ No newline at end of file + diff --git a/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/CobigenJavaWrapperTest.java b/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/CobigenJavaWrapperTest.java index 84e97bbc1b..fcab603907 100644 --- a/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/CobigenJavaWrapperTest.java +++ b/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/CobigenJavaWrapperTest.java @@ -12,11 +12,9 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.jdt.ui.JavaUI; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; -import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; import org.junit.BeforeClass; import org.junit.Test; -import org.junit.runner.RunWith; import com.devonfw.cobigen.eclipse.common.constants.external.ResourceConstants; import com.devonfw.cobigen.eclipse.test.common.SystemTest; @@ -27,7 +25,6 @@ /** * General Eclipse Plug-in Tests. */ -@RunWith(SWTBotJunit4ClassRunner.class) public class CobigenJavaWrapperTest extends SystemTest { /** Root path of the Test Resources */ diff --git a/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/ExceptionHandlingTest.java b/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/ExceptionHandlingTest.java index 2afe9f30b4..0b855c93fc 100644 --- a/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/ExceptionHandlingTest.java +++ b/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/ExceptionHandlingTest.java @@ -8,11 +8,9 @@ import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.ui.JavaUI; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; -import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; import org.junit.BeforeClass; import org.junit.Test; -import org.junit.runner.RunWith; import com.devonfw.cobigen.eclipse.common.constants.external.ResourceConstants; import com.devonfw.cobigen.eclipse.test.common.SystemTest; @@ -22,7 +20,6 @@ /** * Test suite for exception handling issues. */ -@RunWith(SWTBotJunit4ClassRunner.class) public class ExceptionHandlingTest extends SystemTest { /** Root path of the Test Resources */ diff --git a/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/GenerateFromTextInputTest.java b/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/GenerateFromTextInputTest.java index 491c90a2a3..eff107233e 100644 --- a/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/GenerateFromTextInputTest.java +++ b/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/GenerateFromTextInputTest.java @@ -12,11 +12,9 @@ import org.eclipse.jdt.ui.JavaUI; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; -import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; import org.junit.BeforeClass; import org.junit.Test; -import org.junit.runner.RunWith; import com.devonfw.cobigen.eclipse.common.constants.external.ResourceConstants; import com.devonfw.cobigen.eclipse.test.common.SystemTest; @@ -27,7 +25,6 @@ /** * Test suite for issues with generation from text selection */ -@RunWith(SWTBotJunit4ClassRunner.class) public class GenerateFromTextInputTest extends SystemTest { /** Root path of the Test Resources */ diff --git a/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/HealthCheckTest.java b/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/HealthCheckTest.java index f885d282ff..439b7b18c1 100644 --- a/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/HealthCheckTest.java +++ b/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/HealthCheckTest.java @@ -3,10 +3,8 @@ import java.io.File; import org.apache.commons.io.FileUtils; -import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.junit.BeforeClass; import org.junit.Test; -import org.junit.runner.RunWith; import com.devonfw.cobigen.eclipse.common.constants.external.ResourceConstants; import com.devonfw.cobigen.eclipse.test.common.SystemTest; @@ -16,7 +14,6 @@ /** * General Eclipse Plug-in Tests. */ -@RunWith(SWTBotJunit4ClassRunner.class) public class HealthCheckTest extends SystemTest { /** Root path of the Test Resources */ diff --git a/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/OpenAPITest.java b/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/OpenAPITest.java index 777640ef6c..a29d7a6484 100644 --- a/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/OpenAPITest.java +++ b/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/OpenAPITest.java @@ -15,11 +15,9 @@ import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.ui.JavaUI; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; -import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; import org.junit.BeforeClass; import org.junit.Test; -import org.junit.runner.RunWith; import com.devonfw.cobigen.eclipse.common.constants.external.ResourceConstants; import com.devonfw.cobigen.eclipse.test.common.SystemTest; @@ -32,7 +30,6 @@ * * TODO: Create a copy of this test class for template sets using a regular generate (without upgrade or postpone) */ -@RunWith(SWTBotJunit4ClassRunner.class) public class OpenAPITest extends SystemTest { /** Root path of the Test Resources */ diff --git a/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/UpgradeMonolithicTemplatesTest.java b/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/UpgradeMonolithicTemplatesTest.java index 255b93282d..6e9809e4fe 100644 --- a/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/UpgradeMonolithicTemplatesTest.java +++ b/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/UpgradeMonolithicTemplatesTest.java @@ -13,12 +13,10 @@ import org.eclipse.jdt.core.IJavaProject; import org.eclipse.jdt.ui.JavaUI; import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView; -import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; import org.junit.BeforeClass; import org.junit.Ignore; import org.junit.Test; -import org.junit.runner.RunWith; import com.devonfw.cobigen.api.constants.ConfigurationConstants; import com.devonfw.cobigen.eclipse.common.constants.external.ResourceConstants; @@ -33,7 +31,6 @@ * */ @Ignore // TODO: re-enable when upgrader was implemented, see: https://github.com/devonfw/cobigen/issues/1595 -@RunWith(SWTBotJunit4ClassRunner.class) public class UpgradeMonolithicTemplatesTest extends SystemTest { /** Root path of the Test Resources */ diff --git a/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/common/SystemTest.java b/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/common/SystemTest.java index bc131f67a5..e13c1378e8 100644 --- a/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/common/SystemTest.java +++ b/cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/common/SystemTest.java @@ -7,6 +7,7 @@ import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotPerspective; import org.eclipse.swtbot.swt.finder.SWTBot; import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; +import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner; import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences; import org.junit.Before; import org.junit.BeforeClass; @@ -15,6 +16,7 @@ import org.junit.rules.TestRule; import org.junit.rules.TestWatcher; import org.junit.runner.Description; +import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -26,6 +28,7 @@ * Abstract test implementation providing the commonly used setup and tear down methods as well as JUnit rules and * resets the SWTBot accordingly. */ +@RunWith(SWTBotJunit4ClassRunner.class) public abstract class SystemTest { /** Logger instance. */ diff --git a/cobigen-eclipse/cobigen-eclipse-test/src/main/targlets/2018-12.target b/cobigen-eclipse/cobigen-eclipse-test/src/main/targlets/2018-12.target new file mode 100644 index 0000000000..3f84425f0b --- /dev/null +++ b/cobigen-eclipse/cobigen-eclipse-test/src/main/targlets/2018-12.target @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/cobigen-eclipse/cobigen-eclipse-test/targlets/2018-12.target b/cobigen-eclipse/cobigen-eclipse-test/targlets/2018-12.target deleted file mode 100644 index f720b3a330..0000000000 --- a/cobigen-eclipse/cobigen-eclipse-test/targlets/2018-12.target +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/cobigen-eclipse/cobigen-eclipse-test/targlets/mars-4.5.2.target b/cobigen-eclipse/cobigen-eclipse-test/targlets/mars-4.5.2.target deleted file mode 100644 index e9f03dc6a0..0000000000 --- a/cobigen-eclipse/cobigen-eclipse-test/targlets/mars-4.5.2.target +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/common/tools/ExceptionHandler.java b/cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/common/tools/ExceptionHandler.java index 1916b7994c..943410e16c 100644 --- a/cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/common/tools/ExceptionHandler.java +++ b/cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/common/tools/ExceptionHandler.java @@ -49,15 +49,16 @@ public static void handle(Throwable e, Shell activeShell) { LOG.error( "The project '{}' containing the configuration and templates is currently not existent. Please create one or check it out from SVN as stated in the user documentation.", ResourceConstants.CONFIG_PROJECT_NAME, e); - MessageDialog.openError(getShell(activeShell), "Generator configuration project not found!", "The project '" - + ResourceConstants.CONFIG_PROJECT_NAME - + "' containing the configuration and templates is currently not existent. Please create one or check it out from SVN as stated in the user documentation."); + PlatformUIUtil.openErrorDialog("The project '" + ResourceConstants.CONFIG_PROJECT_NAME + + "' containing the configuration and templates is currently not existent. Please create one or check it out from SVN as stated in the user documentation.", + e); } else if (GeneratorCreationException.class.isAssignableFrom(e.getClass())) { LOG.error("Could not create an instance of the generator.", e); PlatformUIUtil.openErrorDialog("Could not initialize CobiGen for the given selection: " + e.getMessage(), e); } else if (InvalidInputException.class.isAssignableFrom(e.getClass())) { LOG.info("Invalid input selected for generation: {}", e.getMessage()); - MessageDialog.openInformation(getShell(activeShell), "Invalid selection", e.getMessage()); + PlatformUIUtil.getWorkbench().getDisplay() + .syncExec(() -> MessageDialog.openInformation(getShell(activeShell), "Invalid selection", e.getMessage())); } else if (CobiGenRuntimeException.class.isAssignableFrom(e.getClass())) { LOG.error("CobiGen Exception:\n{}", e.getMessage(), e); PlatformUIUtil.openErrorDialog(e.getMessage(), e); @@ -65,7 +66,6 @@ public static void handle(Throwable e, Shell activeShell) { LOG.error("An unexpected exception occurred!", e); PlatformUIUtil.openErrorDialog("An unexpected exception occurred!", e); } - } /** diff --git a/cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/generator/java/JavaInputConverter.java b/cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/generator/java/JavaInputConverter.java index ca121d5017..594162d4dc 100644 --- a/cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/generator/java/JavaInputConverter.java +++ b/cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/generator/java/JavaInputConverter.java @@ -16,6 +16,7 @@ import com.devonfw.cobigen.api.exception.InputReaderException; import com.devonfw.cobigen.api.exception.MergeException; import com.devonfw.cobigen.eclipse.common.exceptions.GeneratorCreationException; +import com.devonfw.cobigen.eclipse.common.exceptions.InvalidInputException; import com.devonfw.cobigen.eclipse.common.tools.ClassLoaderUtil; import com.google.common.collect.Lists; @@ -33,7 +34,7 @@ public class JavaInputConverter { * @throws GeneratorCreationException if any exception occurred during converting the inputs or creating the generator */ public static List convertInput(List javaElements, InputInterpreter inputInterpreter) - throws GeneratorCreationException { + throws InvalidInputException { List convertedInputs = Lists.newLinkedList(); @@ -49,12 +50,11 @@ public static List convertInput(List javaElements, InputInterpre ClassLoaderUtil.getProjectClassLoader(frag.getJavaProject())); convertedInputs.add(packageFolder); } catch (MalformedURLException e) { - throw new GeneratorCreationException( - "An internal exception occurred while building the project class loader.", e); + throw new InvalidInputException("An internal exception occurred while building the project class loader.", e); } catch (CoreException e) { - throw new GeneratorCreationException("An eclipse internal exception occurred.", e); + throw new InvalidInputException("An eclipse internal exception occurred.", e); } catch (InputReaderException e) { - throw new GeneratorCreationException("Could not read from resource " + elem.toString(), e); + throw new InvalidInputException("Could not read from resource " + elem.toString(), e); } } else if (elem instanceof ICompilationUnit) { // Take first input type as precondition for the input is that all input types are part of the @@ -62,7 +62,7 @@ public static List convertInput(List javaElements, InputInterpre try { IType[] types = ((ICompilationUnit) elem).getTypes(); if (types.length < 1) { - throw new GeneratorCreationException("The input does not declare a class"); + throw new InvalidInputException("The input does not declare a class"); } IType rootType = types[0]; try { @@ -72,17 +72,17 @@ public static List convertInput(List javaElements, InputInterpre StandardCharsets.UTF_8, projectClassLoader); convertedInputs.add(input); } catch (MalformedURLException e) { - throw new GeneratorCreationException( + throw new InvalidInputException( "An internal exception occurred while loading Java class " + rootType.getFullyQualifiedName(), e); } catch (InputReaderException e) { - throw new GeneratorCreationException("Could not read from resource " + elem.toString(), e); + throw new InvalidInputException("Could not read from resource " + elem.toString(), e); } } catch (MergeException e) { - throw new GeneratorCreationException( + throw new InvalidInputException( "Could not parse Java base file: " + ((ICompilationUnit) elem).getElementName() + ":\n" + e.getMessage(), e); } catch (CoreException e) { - throw new GeneratorCreationException("An eclipse internal exception occurred.", e); + throw new InvalidInputException("An eclipse internal exception occurred.", e); } } } diff --git a/cobigen-eclipse/pom.xml b/cobigen-eclipse/pom.xml index 843c8c5424..dc13a6d842 100644 --- a/cobigen-eclipse/pom.xml +++ b/cobigen-eclipse/pom.xml @@ -20,6 +20,7 @@ cobigen-eclipse-test cobigen-eclipse-feature cobigen-eclipse-updatesite + cobigen-eclipse-releng