Skip to content

Commit

Permalink
devonfw#1509 Fixed-the-bug-when-using-AdaptTemplate-in-eclipse
Browse files Browse the repository at this point in the history
  • Loading branch information
Cedric Betom committed Feb 17, 2023
1 parent 2650c6f commit c64dafc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ public void testBasicOpenAPIGenerationWithAdaptTemplates() throws Exception {
javaClassItem.select();

// execute CobiGen
EclipseCobiGenUtils.processCobiGen(bot, javaClassItem, 25000, "CRUD devon4j Server>CRUD REST services");
EclipseCobiGenUtils.processCobiGenAndPostponeUpgrade(bot, javaClassItem, "CRUD devon4j Server>CRUD REST services");

bot.waitUntil(new AllJobsAreFinished(), 10000);
// increase timeout as the openAPI parser is slow on initialization
EclipseCobiGenUtils.confirmSuccessfullGeneration(bot, 40000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import static org.eclipse.swtbot.swt.finder.waits.Conditions.shellIsActive;
import static org.eclipse.swtbot.swt.finder.waits.Conditions.widgetIsEnabled;

import java.util.concurrent.TimeoutException;

import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
Expand All @@ -18,6 +16,8 @@
import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.eclipse.swtbot.swt.finder.widgets.TimeoutException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.devonfw.cobigen.eclipse.common.constants.external.CobiGenDialogConstants;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import com.devonfw.cobigen.eclipse.common.constants.external.ResourceConstants;
import com.devonfw.cobigen.eclipse.common.exceptions.GeneratorProjectNotExistentException;
import com.devonfw.cobigen.eclipse.updatetemplates.UpdateTemplatesDialog;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jface.dialogs.MessageDialog;
Expand All @@ -24,12 +21,13 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;



import com.devonfw.cobigen.api.TemplateAdapter;
import com.devonfw.cobigen.api.constants.ConfigurationConstants;
import com.devonfw.cobigen.api.util.CobiGenPaths;
import com.devonfw.cobigen.api.util.TemplatesJarUtil;
import com.devonfw.cobigen.eclipse.common.constants.external.ResourceConstants;
import com.devonfw.cobigen.eclipse.common.exceptions.GeneratorProjectNotExistentException;
import com.devonfw.cobigen.eclipse.updatetemplates.UpdateTemplatesDialog;
import com.devonfw.cobigen.impl.CobiGenFactory;
import com.devonfw.cobigen.impl.adapter.TemplateAdapterImpl;

Expand Down Expand Up @@ -261,7 +259,7 @@ public static void processJar(String fileName) throws MalformedURLException, IOE
}

try {
TemplateAdapter templateAdapter = new TemplateAdapterImpl(cobigenFolderPath);
TemplateAdapter templateAdapter = new TemplateAdapterImpl(null);
templateAdapter.adaptMonolithicTemplates(cobigenFolderPath.resolve(ConfigurationConstants.COBIGEN_TEMPLATES),
false);
} catch (Exception e) {
Expand Down Expand Up @@ -298,7 +296,6 @@ public static void startTemplatesUpgrader(Path configurationPath) {

setTemplateSetPathAfterUpgrade(CobiGenFactory.startTemplatesUpgrader(configurationPath));


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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ public static Path getTemplatesFolderPath() {
public static Path getTemplatesFolderPath(Path home) {

Path templatesPath = home.resolve(ConfigurationConstants.TEMPLATES_FOLDER);
return templatesPath;

return createFolder(templatesPath);

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public TemplateAdapterImpl(Path templatesLocation) {
if (templatesLocation == null) {
URI templatesLocationPath = ConfigurationFinder.findTemplatesLocation();
if (Files.exists(Paths.get(templatesLocationPath))) {
this.templatesLocation = Paths.get(templatesLocationPath);
this.templatesLocation = Paths.get(templatesLocationPath).getParent();
}
} else {
this.templatesLocation = templatesLocation;
Expand Down

0 comments on commit c64dafc

Please sign in to comment.