Skip to content

Commit

Permalink
Merge branch 'template-set-deployables' into 1454-gui-templatesets
Browse files Browse the repository at this point in the history
  • Loading branch information
maybeec authored Jan 4, 2023
2 parents 58d9eed + f73d720 commit f12ac48
Show file tree
Hide file tree
Showing 135 changed files with 478 additions and 616 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/maven-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone Repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- uses: devonfw-actions/java-maven-setup@main
with:
Expand All @@ -44,7 +44,7 @@ jobs:
strategy:
fail-fast: false
matrix:
javaVersion: [8, 11]
javaVersion: [11]
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}

Expand All @@ -65,7 +65,7 @@ jobs:
strategy:
fail-fast: false
matrix:
javaVersion: [8, 11]
javaVersion: [11]
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}

Expand All @@ -87,7 +87,7 @@ jobs:
strategy:
fail-fast: false
matrix:
javaVersion: [8]
javaVersion: [11]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}

Expand All @@ -114,7 +114,7 @@ jobs:
strategy:
fail-fast: false
matrix:
javaVersion: [8, 11]
javaVersion: [11]
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}

Expand All @@ -134,7 +134,7 @@ jobs:
strategy:
fail-fast: false
matrix:
javaVersion: [8, 11]
javaVersion: [11]
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -169,7 +169,7 @@ jobs:
strategy:
fail-fast: false
matrix:
javaVersion: [8, 11]
javaVersion: [11]
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}

Expand Down Expand Up @@ -213,7 +213,7 @@ jobs:
strategy:
fail-fast: false
matrix:
javaVersion: [8, 11]
javaVersion: [11]
os: [windows-latest, ubuntu-latest]
runs-on: ${{ matrix.os }}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: spellcheck
on:
push:
paths:
- '**.asciidoc'
- '**.adoc'
workflow_dispatch:
jobs:
spellchecker:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Path;

import org.apache.commons.io.FileUtils;
Expand Down Expand Up @@ -328,4 +329,68 @@ public void generateFromArgsWithQuote() throws Exception {
assertThat(outputRootPath.resolve("docs")).exists();
}

/**
* Integration test of the generation and validation of the class path cache. The test will execute a generation twice
* this requires some cleanup.A deleted dependencies will be detected by the validating process in MavenUtil and will
* reload the needed dependency and not prevent the second generation
*
* @throws Exception test fails
*/
@Test
public void generateFromEntityTwiceToTestCache() throws Exception {

// prepare
File outputRootFile = this.tempFolder.newFolder("playground2", "rootoutput");
File openApiFile = new File(testFileRootPath + "openAPI.yml");

String args[] = new String[6];
args[0] = "generate";
args[1] = openApiFile.getAbsolutePath();
args[2] = "--out";
args[3] = outputRootFile.getAbsolutePath();
args[4] = "--increments";
args[5] = "ionic_component,OpenAPI_Docs,services";

execute(args, true);

Path rootPath = outputRootFile.toPath();
assertThat(rootPath.resolve("../../devon4ng-ionic-application-template"));

// cleanup for a second execution of generate to test the correct cache usage
File cli_config = this.tempFolder.getRoot().toPath().resolve("cobigen-test-home").toFile();
File bin = cli_config.toPath().resolve("cobigen-test-home/bin").toFile();
if (bin.exists()) {
FileUtils.deleteDirectory(bin);
}
File lib = cli_config.toPath().resolve("cobigen-test-home/lib").toFile();
if (lib.exists()) {
FileUtils.deleteDirectory(lib);
}
File license = cli_config.toPath().resolve("cobigen-test-home/LICENSE.txt").toFile();
if (license.exists()) {
FileUtils.delete(license);
}
File cli = cli_config.toPath().resolve("cli-config").toFile();
// get the saved dependencies in the cache file and delete one
for (File f : cli.listFiles()) {
if (f.getName().startsWith("pom-cp-")) {
String dependenciesFromCache = FileUtils.readFileToString(f, Charset.defaultCharset());
String osName = System.getProperty("os.name");
String[] dependenciesFromCacheArray;
if (osName.contains("Windows")) {
dependenciesFromCacheArray = dependenciesFromCache.split(";");
} else {
dependenciesFromCacheArray = dependenciesFromCache.split(":");
}
for (int i = 0; i >= 0; i--) { // reverse
if (dependenciesFromCacheArray[i].contains("javax.persistence")) {
FileUtils.delete(new File(dependenciesFromCacheArray[i])); // delete a randomly picked dependency
}
}
}
}
FileUtils.delete(cli_config.toPath().resolve("cli.tar.gz").toFile());
execute(args, true);
}

}
4 changes: 2 additions & 2 deletions cobigen-cli/cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>4.6.2</version>
<version>4.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
Expand All @@ -50,7 +50,7 @@
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.6</version>
<version>1.10.0</version>
</dependency>
<dependency>
<groupId>com.google.googlejavaformat</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static ClassLoader registerPlugins() {
Path rootCLIPath = getCliHomePath();
File pomFile = extractArtificialPom();

String pomFileHash = MavenUtil.generatePomFileHash(pomFile.toPath());
String pomFileHash = MavenUtil.generatePomFileHash(pomFile.toPath(), MavenUtil.determineMavenRepositoryPath());

Path cpFile = rootCLIPath.resolve(String.format(MavenConstants.CLASSPATH_CACHE_FILE, pomFileHash));

Expand Down
4 changes: 0 additions & 4 deletions cobigen-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
<version>${revision}</version>
</parent>

<properties>
<java.version>11</java.version>
</properties>

<modules>
<module>cli</module>
<module>cli-systemtest</module>
Expand Down
30 changes: 10 additions & 20 deletions cobigen-eclipse/cobigen-eclipse-test/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,22 @@ 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-1.8
Bundle-RequiredExecutionEnvironment: JavaSE-11
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: .,
lib/assertj-core.jar,
lib/awaitility.jar,
lib/checker-qual.jar,
lib/commons-io.jar,
lib/commons-jxpath.jar,
lib/commons-lang3.jar,
lib/core-api.jar,
lib/core-test.jar,
lib/error_prone_annotations.jar,
lib/failureaccess.jar,
lib/guava.jar,
lib/hamcrest-core.jar,
lib/j2objc-annotations.jar,
lib/jcl-over-slf4j.jar,
lib/jsr305.jar,
lib/junit.jar,
lib/listenablefuture.jar,
lib/log4j-over-slf4j.jar,
lib/system-lambda.jar,
lib/logback-classic.jar,
lib/logback-core.jar,
lib/mockito-core.jar,
lib/objenesis.jar,
lib/slf4j-api.jar,
lib/system-lambda.jar,
lib/xmlunit.jar,
lib/zt-exec.jar,
lib/awaitility.jar,
lib/hamcrest.jar
lib/jcl-over-slf4j.jar,
lib/log4j-over-slf4j.jar
Require-Bundle: org.eclipse.swtbot.junit4_x;bundle-version="2.4.0",
org.junit;bundle-version="4.12.0",
org.eclipse.ui,
Expand All @@ -47,4 +35,6 @@ Require-Bundle: org.eclipse.swtbot.junit4_x;bundle-version="2.4.0",
org.apache.commons.io;bundle-version="2.2.0",
org.eclipse.m2e.core.ui;bundle-version="1.6.0",
org.eclipse.m2e.core;bundle-version="1.6.0",
com.devonfw.cobigen.eclipse
com.devonfw.cobigen.eclipse,
org.eclipse.swtbot.eclipse.junit.headless,
org.eclipse.swtbot.swt.finder
23 changes: 6 additions & 17 deletions cobigen-eclipse/cobigen-eclipse-test/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,15 @@ bin.includes = .,\
META-INF/,\
plugin.xml,\
lib/assertj-core.jar,\
lib/awaitility.jar,\
lib/checker-qual.jar,\
lib/commons-io.jar,\
lib/commons-jxpath.jar,\
lib/commons-lang3.jar,\
lib/core-api.jar,\
lib/core-test.jar,\
lib/error_prone_annotations.jar,\
lib/failureaccess.jar,\
lib/guava.jar,\
lib/j2objc-annotations.jar,\
lib/jcl-over-slf4j.jar,\
lib/jsr305.jar,\
lib/junit.jar,\
lib/listenablefuture.jar,\
lib/log4j-over-slf4j.jar,\
lib/system-lambda.jar,\
lib/logback-classic.jar,\
lib/logback-core.jar,\
lib/mockito-core.jar,\
lib/objenesis.jar,\
lib/slf4j-api.jar,\
lib/system-lambda.jar,\
lib/xmlunit.jar,\
lib/zt-exec.jar,\
lib/awaitility.jar,\
lib/hamcrest.jar
lib/jcl-over-slf4j.jar,\
lib/log4j-over-slf4j.jar
11 changes: 0 additions & 11 deletions cobigen-eclipse/cobigen-eclipse-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -193,16 +193,5 @@
</repository>
</repositories>
</profile>
<!-- see http://download.eclipse.org/tools/orbit/downloads/ for upgrades -->
<profile>
<id>p2-build-photon</id>
<repositories>
<repository>
<id>eclipse-photon-sr2-test</id>
<url>http://download.eclipse.org/tools/orbit/downloads/drops/R20180606145124/repository/</url>
<layout>p2</layout>
</repository>
</repositories>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
import org.hamcrest.Matcher;

import com.google.common.collect.Iterables;

/**
* Provides helper methods to aid in SWTBot testing.
*/
Expand Down Expand Up @@ -227,7 +225,7 @@ public static void waitUntilMenuHasItem(SWTBot bot, Supplier<SWTBotMenu> menuSup
@Override
public boolean test() throws Exception {

return Iterables.any(menuSupplier.get().menuItems(), matcher::matches);
return menuSupplier.get().menuItems().stream().anyMatch(matcher::matches);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@

package com.devonfw.cobigen.eclipse.test.common.utils.swtbot;

import org.assertj.core.api.Assertions;
import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;

import com.google.common.base.Preconditions;

/**
* Used to set the general SWTBot timeout. This class was originally to be thrown away, except that SWTBot doesn't
* support a nice mechanism for temporarily changing the timeout.
Expand Down Expand Up @@ -65,7 +64,7 @@ public static void setTimeout() {
*/
public static void setTimeout(long timeout) {

Preconditions.checkArgument(timeout > 0);
Assertions.assertThat(timeout).isGreaterThan(0);
oldTimeoutSwtPrefs = getSwtBotPrefsTimeoutFieldValue();
setSwtBotPrefsTimeoutFieldValue(timeout);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.Collections;
import java.util.LinkedList;

import org.assertj.core.api.Assertions;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
Expand All @@ -40,9 +41,6 @@
import org.hamcrest.Matcher;
import org.hamcrest.StringDescription;

import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables;

/** Utilities for manipulating trees. */
public class SwtBotTreeUtilities {

Expand Down Expand Up @@ -126,7 +124,7 @@ public boolean test() throws Exception {
parentItem.expand();
children = parentItem.getItems();
}
return Iterables.any(parentItem.getNodes(), childMatcher::matches);
return parentItem.getNodes().stream().anyMatch(childMatcher::matches);
}
});
for (SWTBotTreeItem child : parentItem.getItems()) {
Expand Down Expand Up @@ -215,7 +213,7 @@ public String getFailureMessage() {
*/
public static SWTBotTreeItem select(SWTWorkbenchBot bot, SWTBotTree tree, String... nodeNames) {

Preconditions.checkArgument(nodeNames.length > 0, "no children to navigate");
Assertions.assertThat(nodeNames.length).isGreaterThan(0);
int leafIndex = nodeNames.length - 1;
waitUntilTreeHasItems(bot, tree);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,15 @@
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<filteredResources>
<filter>
<id>1664574669524</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
</projectDescription>
Loading

0 comments on commit f12ac48

Please sign in to comment.