Skip to content

Commit

Permalink
devonfw#1519 Implemented requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mansour Dukhan committed Jun 2, 2022
1 parent 59ab6df commit 9a860c6
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 3 deletions.
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
@@ -0,0 +1,35 @@
package com.devonfw.cobigen.api.exception;

/**
* Exception that indicates that an old monolithic template structure has been found. For asking if the template
* structure should be upgraded later.
*/
public class DeprecatedMonolithicTemplatesException extends CobiGenRuntimeException {

/**
* Default serial version UID.
*/
private static final long serialVersionUID = 1;

/**
* The constructor.
*
* @param message informative message describing the exception or where it has been occurred
* @param cause originating this exception
*/
public DeprecatedMonolithicTemplatesException(String message, Throwable cause) {

super(message, cause);
}

/**
* The constructor.
*
* Creates a new {@link DeprecatedMonolithicTemplatesException} with a proper notification message
*/
public DeprecatedMonolithicTemplatesException() {

super("You Are using an old Templates Configuration, please consider to upgrade your templates! Thank You!");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import com.devonfw.cobigen.api.constants.ConfigurationConstants;
import com.devonfw.cobigen.api.exception.CobiGenRuntimeException;
import com.devonfw.cobigen.api.exception.DeprecatedMonolithicTemplatesException;

/**
* Utilities related to the cobigen configurations including:
Expand Down Expand Up @@ -70,12 +71,13 @@ public static Path getTemplatesFolderPath() {
*
* @param home cobigen configuration home directory
* @return {@link Path} of the templates home directory
* @throws DeprecatedMonolithicTemplatesException when old monolithic Templates found
*/
public static Path getTemplatesFolderPath(Path home) {
public static Path getTemplatesFolderPath(Path home) throws DeprecatedMonolithicTemplatesException {

Path templatesPath = home.resolve(ConfigurationConstants.TEMPLATES_FOLDER);
if (Files.exists(templatesPath))
LOG.warn("You are using an old templates version, please make sure to upgrade to the newest one!");
throw new DeprecatedMonolithicTemplatesException();
return templatesPath;
}

Expand Down

0 comments on commit 9a860c6

Please sign in to comment.