Skip to content

Commit

Permalink
#1519 added possible Log warning places for CLI (#1538)
Browse files Browse the repository at this point in the history
* #1519 added possible Log warning places for CLI

* #1519 Implemented requested changes

* #1519 Deleted unneeded warn messages

* #1519 Clear Tests

* #1519 Fixed Eclipse Plugin Issues

* Revert "#1519 Fixed Eclipse Plugin Issues"

This reverts commit 9d4ca8b.

* #1519 Fix Ignore Tag (changed Order)

* #1519 Fix Import Ignore

* #1519 throw DeprecatedMonolithicTemplatesException
in custom templates, if old templates found.
Ignore CLI custom templates Test

* remove duplicate DeprecatedMonolithicTemplatesException and allow creation with a force parameter which allows the createn of Cobigen with the old folder structure

* remove unnecessary throw

* adapt tests(ignore cli and eclipse since these tests should be adapted subsequently, force everything else)

* #1519 Force Old templates in GenerateMojo to run maven-systemtest
Fixed ConfigurationHolder Logger mismatch name

Co-authored-by: LarsReinken <lars.reinken@capgemini.com>
  • Loading branch information
mdukhan and LarsReinken authored Jun 14, 2022
1 parent 882013e commit 103ed1c
Show file tree
Hide file tree
Showing 28 changed files with 144 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

/**
Expand Down Expand Up @@ -49,6 +50,7 @@ public void createTmpProjectForGenerationOutput() throws IOException {
* @throws Exception test fails
*/
@Test
@Ignore
public void generateFromEntityTest() throws Exception {

File baseProject = this.tmpProject.resolve("maven.project/core/").toFile();
Expand All @@ -72,6 +74,7 @@ public void generateFromEntityTest() throws Exception {
* @throws Exception test fails
*/
@Test
@Ignore
public void generateFromTemplatesJarWithUtilClassDependencyTest() throws Exception {

FileUtils.copyDirectory(new File(testFileRootPath + "templatesproject"), this.tmpProject.toFile());
Expand Down Expand Up @@ -99,6 +102,7 @@ public void generateFromTemplatesJarWithUtilClassDependencyTest() throws Excepti
* @throws Exception test fails
*/
@Test
@Ignore
public void generateFromEntityWithDownloadedTemplatesTest() throws Exception {

File baseProject = this.tmpProject.resolve("maven.project/core/").toFile();
Expand Down Expand Up @@ -149,6 +153,7 @@ public void generateNonJavaFilesFromJavaInputTest() throws Exception {
* @throws Exception test fails
*/
@Test
@Ignore
public void generateFromEntityWithOutputRootPathTest() throws Exception {

File outputRootPath = this.tempFolder.newFolder("outputfolder");
Expand Down Expand Up @@ -202,6 +207,7 @@ public void generateFromOpenApiTest() throws Exception {
* @throws Exception test fails
*/
@Test
@Ignore
public void generateTemplatesFromEntityTest() throws Exception {

File baseProject = this.tmpProject.resolve("maven.project/core/").toFile();
Expand All @@ -223,6 +229,7 @@ public void generateTemplatesFromEntityTest() throws Exception {
* @throws Exception test fails
*/
@Test
@Ignore
public void generateFromMultipleTypeInputTest() throws Exception {

File outputRootFile = this.tempFolder.newFolder("playground2", "rootoutput");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
Expand Down Expand Up @@ -93,10 +94,10 @@ public void testBasicOpenAPIGenerationWithAdaptTemplates() throws Exception {
* @throws Exception test fails
*/
@Test
@Ignore
public void testAdaptTemplates() throws Exception {

File tmpProject = this.tempFolder.newFolder("playground", "project", "templates");

withEnvironmentVariable(ConfigurationConstants.CONFIG_ENV_HOME, tmpProject.getParentFile().getAbsolutePath())
.execute(() -> testBasicOpenAPIGenerationWithAdaptTemplates());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;

Expand Down Expand Up @@ -58,6 +59,7 @@ public static void setupClass() throws Exception {
* @throws Exception Test fails
*/
@Test
@Ignore
public void testPreventClassPathShading() throws Exception {

// create a new temporary java project and copy java class used as an input for CobiGen
Expand Down Expand Up @@ -106,6 +108,7 @@ public void testPreventClassPathShading() throws Exception {
* @throws Exception Test fails
*/
@Test
@Ignore
public void testClassPathResolutionOnInput_dependsOnMavenDependency() throws Exception {

// create a new temporary java project and copy java class used as an input for CobiGen
Expand Down Expand Up @@ -145,6 +148,7 @@ public void testClassPathResolutionOnInput_dependsOnMavenDependency() throws Exc
* @throws Exception Test fails
*/
@Test
@Ignore
public void testClassPathResolutionOnInput_dependsOnMavenProject() throws Exception {

// create a new temporary java project and copy java class used as an input for CobiGen
Expand Down Expand Up @@ -188,6 +192,7 @@ public void testClassPathResolutionOnInput_dependsOnMavenProject() throws Except
* @throws Exception Test fails
*/
@Test
@Ignore
public void testClassloadingOfTemplateDependencies() throws Exception {

// create a new temporary java project and copy java class used as an input for CobiGen
Expand Down Expand Up @@ -222,6 +227,7 @@ public void testClassloadingOfTemplateDependencies() throws Exception {
* @throws Exception Test fails
*/
@Test
@Ignore
public void testDotPathAcception() throws Exception {

// create a new temporary java project and copy java class used as an input for CobiGen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
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;

Expand Down Expand Up @@ -53,6 +54,7 @@ public static void setupClass() throws Exception {
* @throws Exception test fails
*/
@Test
@Ignore
public void testWorkspaceExternalProjectAsInput() throws Exception {

// copy sample project to external location and import it into the workspace
Expand Down Expand Up @@ -86,6 +88,7 @@ public void testWorkspaceExternalProjectAsInput() throws Exception {
* @throws Exception test fails
*/
@Test
@Ignore
public void testPathInvariants() throws Exception {

// copy sample project to external location and import it into the workspace
Expand Down Expand Up @@ -118,6 +121,7 @@ public void testPathInvariants() throws Exception {
* @throws Exception test fails
*/
@Test
@Ignore
public void testPackageAsInputForGeneration() throws Exception {

// copy sample project to external location and import it into the workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import org.apache.commons.io.FileUtils;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;

Expand Down Expand Up @@ -39,6 +40,7 @@ public static void setupClass() throws Exception {
* @throws Exception test fails
*/
@Test
@Ignore
public void testHealthCheckIfTemplateProjecNotCopiedIntoWS() throws Exception {

File tmpFolder = this.tmpFolderRule.newFolder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;

import com.devonfw.cobigen.eclipse.common.constants.external.ResourceConstants;
Expand Down Expand Up @@ -51,6 +52,7 @@ public static void setupClass() throws Exception {
* @throws Exception Test fails
*/
@Test
@Ignore
public void testMutlipleTemplates_differentTrigger_samePath() throws Exception {

// create a new temporary java project and copy java class used as an input for CobiGen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
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;

Expand Down Expand Up @@ -59,6 +60,7 @@ public static void setupClass() throws Exception {
* @throws Exception test fails
*/
@Test
@Ignore
public void testBasicOpenAPIGeneration() throws Exception {

// copy sample project to external location and import it into the workspace
Expand Down Expand Up @@ -139,6 +141,7 @@ public void testBasicOpenAPIGeneration() throws Exception {
* @throws Exception test fails
*/
@Test
@Ignore
public void testServiceBasedOpenAPIGeneration() throws Exception {

// copy sample project to external location and import it into the workspace
Expand Down Expand Up @@ -208,6 +211,7 @@ public void testServiceBasedOpenAPIGeneration() throws Exception {
* @throws Exception test fails
*/
@Test
@Ignore
public void testRegexBasedOpenAPIGeneration() throws Exception {

// copy sample project to external location and import it into the workspace
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;

import com.devonfw.cobigen.eclipse.common.constants.external.ResourceConstants;
Expand Down Expand Up @@ -48,6 +49,7 @@ public static void setupClass() throws Exception {
* @throws Exception test fails
*/
@Test
@Ignore
public void simpleVelocityBasedGeneration() throws Exception {

// create a new temporary java project and copy java class used as an input for CobiGen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ private static CobiGen initializeGenerator() throws InvalidConfigurationExceptio
} catch (Throwable e) {
throw new GeneratorCreationException(
"Configuration source could not be read.\nIf you were updating templates, it may mean"
+ " that you have no internet connection.",
+ " that you have no internet connection," + " or you have an old monolithic Templates.",
e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,13 +158,13 @@ private CobiGen createCobiGenInstance() {

if (this.configurationFolder != null) {
getLog().debug("ConfigurationFolder configured as " + this.configurationFolder.toURI().toString());
cobiGen = CobiGenFactory.create(this.configurationFolder.toURI());
cobiGen = CobiGenFactory.create(this.configurationFolder.toURI(), true);
} else {
final ClassRealm classRealm = this.pluginDescriptor.getClassRealm();
URL contextConfigurationLocation = ConfigurationClassLoaderUtil.getContextConfiguration(classRealm);
URI configFile = URI.create(contextConfigurationLocation.getFile().toString().split("!")[0]);
getLog().debug("Reading configuration from file " + configFile.toString());
cobiGen = CobiGenFactory.create(configFile);
cobiGen = CobiGenFactory.create(configFile, true);
}
return cobiGen;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class AnnotationQueryingTest extends AbstractIntegrationTest {
@Test
public void testAnnotationWithObjectArraysAsValues() throws Exception {

CobiGen cobiGen = CobiGenFactory.create(this.cobigenConfigFolder.toURI());
CobiGen cobiGen = CobiGenFactory.create(this.cobigenConfigFolder.toURI(), true);
File tmpFolderCobiGen = this.tmpFolder.newFolder("cobigen_output");

Object input = cobiGen.read(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class ModelCreationTest extends AbstractIntegrationTest {
@Test
public void testCorrectGenericTypeExtraction() throws Exception {

CobiGen cobiGen = CobiGenFactory.create(this.cobigenConfigFolder.toURI());
CobiGen cobiGen = CobiGenFactory.create(this.cobigenConfigFolder.toURI(), true);
File tmpFolderCobiGen = this.tmpFolder.newFolder("cobigen_output");

Object input = cobiGen.read(
Expand Down Expand Up @@ -83,7 +83,7 @@ public void testCorrectGenericTypeExtraction() throws Exception {
public void testResolveDependencyManagementVersionFromParent() throws Exception {

// given
CobiGen cobiGen = CobiGenFactory.create(this.cobigenConfigFolder.toURI());
CobiGen cobiGen = CobiGenFactory.create(this.cobigenConfigFolder.toURI(), true);

// when
Object input = cobiGen.read(new File(
Expand All @@ -104,7 +104,7 @@ public void testResolveDependencyManagementVersionFromParent() throws Exception
@Test
public void testCorrectAnnotationValueExtraction() throws Exception {

CobiGen cobiGen = CobiGenFactory.create(this.cobigenConfigFolder.toURI());
CobiGen cobiGen = CobiGenFactory.create(this.cobigenConfigFolder.toURI(), true);
File tmpFolderCobiGen = this.tmpFolder.newFolder("cobigen_output");

Object input = cobiGen.read(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class VariablesResolutionTest extends AbstractIntegrationTest {
@Test
public void testSuccessfulPathResolution_variableEqNull() throws Exception {

CobiGen cobiGen = CobiGenFactory.create(this.cobigenConfigFolder.toURI());
CobiGen cobiGen = CobiGenFactory.create(this.cobigenConfigFolder.toURI(), true);
File tmpFolderCobiGen = this.tmpFolder.newFolder("cobigen_output");

Object input = cobiGen.read(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class InputReaderMatcherTest {
@Test
public void testBasicElementMatcher_oneComponent() throws Exception {

CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates").toUri());
CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates").toUri(), true);

Object openApiFile = cobigen.read(Paths.get(testdataRoot, "one-component.yaml"), TestConstants.UTF_8);
assertThat(openApiFile).isNotNull();
Expand All @@ -59,7 +59,7 @@ public void testBasicElementMatcher_oneComponent() throws Exception {
@Test
public void testBasicElementMatcher_twoComponents() throws Exception {

CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates").toUri());
CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates").toUri(), true);

Object openApiFile = cobigen.read(Paths.get(testdataRoot, "two-components.yaml"), TestConstants.UTF_8);
assertThat(openApiFile).isNotNull();
Expand All @@ -76,7 +76,7 @@ public void testBasicElementMatcher_twoComponents() throws Exception {
@Test
public void testBasicElementMatcher_twoComponents_matchRegex() throws Exception {

CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates-regex").toUri());
CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates-regex").toUri(), true);

Object openApiFile = cobigen.read(Paths.get(testdataRoot, "two-components.yaml"), TestConstants.UTF_8);
assertThat(openApiFile).isNotNull();
Expand All @@ -94,7 +94,7 @@ public void testBasicElementMatcher_twoComponents_matchRegex() throws Exception
@Test
public void testBasicElementMatcher_oneComponent_matchRegex() throws Exception {

CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates-regex").toUri());
CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates-regex").toUri(), true);

Object openApiFile = cobigen.read(Paths.get(testdataRoot, "one-component.yaml"), TestConstants.UTF_8);
assertThat(openApiFile).isNotNull();
Expand All @@ -117,7 +117,7 @@ public void testBasicElementMatcher_oneComponent_matchRegex() throws Exception {
@Test
public void testVariableAssignment_propertyName() throws Exception {

CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates").toUri());
CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates").toUri(), true);

Object openApiFile = cobigen.read(Paths.get(testdataRoot, "one-component.yaml"), TestConstants.UTF_8);
List<Object> inputObjects = cobigen.resolveContainers(openApiFile);
Expand All @@ -142,7 +142,7 @@ public void testVariableAssignment_propertyName() throws Exception {
@Test
public void testVariableAssignment_rootPackage() throws Exception {

CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates").toUri());
CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates").toUri(), true);

Object openApiFile = cobigen.read(Paths.get(testdataRoot, "root-package.yaml"), TestConstants.UTF_8);

Expand Down Expand Up @@ -170,7 +170,7 @@ public void testVariableAssignment_rootPackage() throws Exception {
@Test
public void testVariableAssignment_rootComponent() throws Exception {

CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates").toUri());
CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates").toUri(), true);

Object openApiFile = cobigen.read(Paths.get(testdataRoot, "root-package.yaml"), TestConstants.UTF_8);

Expand Down Expand Up @@ -201,7 +201,7 @@ public void testVariableAssignment_rootComponent() throws Exception {
@Test
public void testVariableAssignment_attribute() throws Exception {

CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates").toUri());
CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates").toUri(), true);

Object openApiFile = cobigen.read(Paths.get(testdataRoot, "two-components.yaml"), TestConstants.UTF_8);

Expand Down Expand Up @@ -240,7 +240,7 @@ public void testVariableAssignment_attribute() throws Exception {
@Test
public void testVariableAssignment_noAttributeFound() throws Exception {

CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates").toUri());
CobiGen cobigen = CobiGenFactory.create(Paths.get(testdataRoot, "templates").toUri(), true);

Object openApiFile = cobigen.read(Paths.get(testdataRoot, "two-components-no-attribute.yaml"), TestConstants.UTF_8);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class VelocityTemplateEngineIntegrationTest {
@Test
public void testBasicGeneration() throws Exception {

CobiGen cobigen = CobiGenFactory.create(new File("src/test/resources/systemtest").toURI());
CobiGen cobigen = CobiGenFactory.create(new File("src/test/resources/systemtest").toURI(), true);
Object input = cobigen.read(
new File("src/test/java/com/devonfw/cobigen/tempeng/velocity/systemtest/testobjects/Input.java").toPath(),
Charset.forName("UTF-8"), getClass().getClassLoader());
Expand Down
Loading

0 comments on commit 103ed1c

Please sign in to comment.