Skip to content

Commit 153ea72

Browse files
devonfw#1622 fixed bug in adaptTemplatesTest on eclipse
1 parent 9053a61 commit 153ea72

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/AdaptTemplatesTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ public void testBasicOpenAPIGenerationWithAdaptTemplates() throws Exception {
8080
javaClassItem.select();
8181

8282
// execute CobiGen
83-
EclipseCobiGenUtils.processCobiGen(bot, javaClassItem, 25000, "CRUD devon4j Server>CRUD REST services");
83+
EclipseCobiGenUtils.processCobiGenAndPostponeUpgrade(bot, javaClassItem, "CRUD devon4j Server>CRUD REST services");
84+
8485
bot.waitUntil(new AllJobsAreFinished(), 10000);
8586
// increase timeout as the openAPI parser is slow on initialization
8687
EclipseCobiGenUtils.confirmSuccessfullGeneration(bot, 40000);

cobigen-eclipse/cobigen-eclipse-test/src/main/java/com/devonfw/cobigen/eclipse/test/common/utils/EclipseCobiGenUtils.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive;
44
import static org.eclipse.swtbot.swt.finder.waits.Conditions.widgetIsEnabled;
55

6-
import java.util.concurrent.TimeoutException;
7-
86
import org.eclipse.core.resources.IncrementalProjectBuilder;
97
import org.eclipse.core.resources.ResourcesPlugin;
108
import org.eclipse.core.runtime.CoreException;
@@ -18,6 +16,8 @@
1816
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
1917
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
2018
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
19+
import org.eclipse.swtbot.swt.finder.widgets.TimeoutException;
20+
import org.slf4j.Logger;
2121
import org.slf4j.LoggerFactory;
2222

2323
import com.devonfw.cobigen.eclipse.common.constants.external.CobiGenDialogConstants;

cobigen-eclipse/cobigen-eclipse/src/com/devonfw/cobigen/eclipse/common/tools/ResourcesPluginUtil.java

+4-7
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
import org.eclipse.core.resources.IResource;
1414
import org.eclipse.core.resources.ResourcesPlugin;
1515
import org.eclipse.core.runtime.CoreException;
16-
import com.devonfw.cobigen.eclipse.common.constants.external.ResourceConstants;
17-
import com.devonfw.cobigen.eclipse.common.exceptions.GeneratorProjectNotExistentException;
18-
import com.devonfw.cobigen.eclipse.updatetemplates.UpdateTemplatesDialog;
1916
import org.eclipse.core.runtime.IPath;
2017
import org.eclipse.core.runtime.NullProgressMonitor;
2118
import org.eclipse.jface.dialogs.MessageDialog;
@@ -24,12 +21,13 @@
2421
import org.slf4j.Logger;
2522
import org.slf4j.LoggerFactory;
2623

27-
28-
2924
import com.devonfw.cobigen.api.TemplateAdapter;
3025
import com.devonfw.cobigen.api.constants.ConfigurationConstants;
3126
import com.devonfw.cobigen.api.util.CobiGenPaths;
3227
import com.devonfw.cobigen.api.util.TemplatesJarUtil;
28+
import com.devonfw.cobigen.eclipse.common.constants.external.ResourceConstants;
29+
import com.devonfw.cobigen.eclipse.common.exceptions.GeneratorProjectNotExistentException;
30+
import com.devonfw.cobigen.eclipse.updatetemplates.UpdateTemplatesDialog;
3331
import com.devonfw.cobigen.impl.CobiGenFactory;
3432
import com.devonfw.cobigen.impl.adapter.TemplateAdapterImpl;
3533

@@ -261,7 +259,7 @@ public static void processJar(String fileName) throws MalformedURLException, IOE
261259
}
262260

263261
try {
264-
TemplateAdapter templateAdapter = new TemplateAdapterImpl(cobigenFolderPath);
262+
TemplateAdapter templateAdapter = new TemplateAdapterImpl(null);
265263
templateAdapter.adaptMonolithicTemplates(cobigenFolderPath.resolve(ConfigurationConstants.COBIGEN_TEMPLATES),
266264
false);
267265
} catch (Exception e) {
@@ -298,7 +296,6 @@ public static void startTemplatesUpgrader(Path configurationPath) {
298296

299297
setTemplateSetPathAfterUpgrade(CobiGenFactory.startTemplatesUpgrader(configurationPath));
300298

301-
302299
// FIXME after the upgrade adapt the new template-set folder. should be done in #1587
303300
}
304301

cobigen/cobigen-core-api/src/main/java/com/devonfw/cobigen/api/util/CobiGenPaths.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ public static Path getTemplatesFolderPath() {
7575
public static Path getTemplatesFolderPath(Path home) {
7676

7777
Path templatesPath = home.resolve(ConfigurationConstants.TEMPLATES_FOLDER);
78-
return templatesPath;
78+
79+
return createFolder(templatesPath);
80+
7981
}
8082

8183
/**

cobigen/cobigen-core/src/main/java/com/devonfw/cobigen/impl/adapter/TemplateAdapterImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public TemplateAdapterImpl(Path templatesLocation) {
6060
if (templatesLocation == null) {
6161
URI templatesLocationPath = ConfigurationFinder.findTemplatesLocation();
6262
if (Files.exists(Paths.get(templatesLocationPath))) {
63-
this.templatesLocation = Paths.get(templatesLocationPath);
63+
this.templatesLocation = Paths.get(templatesLocationPath).getParent();
6464
}
6565
} else {
6666
this.templatesLocation = templatesLocation;

0 commit comments

Comments
 (0)