Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#1509 Ignore extractTemplatesWithOldCinfiguration #1536

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import java.nio.file.Path;

import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;

import com.devonfw.cobigen.api.constants.ConfigurationConstants;
Expand Down Expand Up @@ -48,7 +47,6 @@ public void initAdaptTemplatesTest() throws URISyntaxException, IOException {
*
* @throws Exception test fails
*/
@Ignore
@Test
public void adaptTemplatesTest() throws Exception {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;
import java.util.Scanner;

import org.slf4j.Logger;
Expand Down Expand Up @@ -130,7 +131,14 @@ public static void throwNoTriggersMatched(Path inputFile, boolean isJavaInput, b
public static String getUserInput() {

String userInput = "";
userInput = inputReader.nextLine();
try {
userInput = inputReader.nextLine();
mdukhan marked this conversation as resolved.
Show resolved Hide resolved
} catch (NoSuchElementException e) {
// This Case is for the Adapt-templates Command to cover the next line in Test adaptTemplatesTest when no
// UserInput can be scanned
LOG.info("No User Input, By default All found templates will be adapted");
userInput = "0";
}
return userInput;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.io.File;

import org.apache.commons.io.FileUtils;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
Expand All @@ -16,11 +15,11 @@
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;

import com.devonfw.cobigen.api.constants.ConfigurationConstants;
import com.devonfw.cobigen.eclipse.common.constants.external.ResourceConstants;
import com.devonfw.cobigen.eclipse.test.common.SystemTest;
import com.devonfw.cobigen.eclipse.test.common.swtbot.AllJobsAreFinished;
Expand Down Expand Up @@ -52,6 +51,7 @@ public class AdaptTemplatesTest extends SystemTest {
public static void setupClass() throws Exception {

EclipseUtils.cleanWorkspace(bot, true);

}

/**
Expand Down Expand Up @@ -80,31 +80,24 @@ public void testBasicOpenAPIGenerationWithAdaptTemplates() throws Exception {
SWTBotTreeItem javaClassItem = view.bot().tree().expandNode(testProjName, "adapt-templates.yml");
javaClassItem.select();

// execute CobiGen
EclipseCobiGenUtils.processCobiGen(bot, javaClassItem, 25000, "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);

bot.waitUntil(new AllJobsAreFinished(), 10000);
IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(testProjName);
IFile generationResult = proj.getFile(
"src/main/java/com/devonfw/test/sampledatamanagement/service/impl/rest/SampledatamanagementRestServiceImpl.java");
String Cobigen_templates = ConfigurationConstants.COBIGEN_TEMPLATES;
IProject adaptedTemplatesProj = ResourcesPlugin.getWorkspace().getRoot().getProject(Cobigen_templates);
mdukhan marked this conversation as resolved.
Show resolved Hide resolved

assertThat(generationResult.exists()).isTrue();
assertThat(adaptedTemplatesProj.exists()).isTrue();
}

/**
* Test of testBasicOpenAPIGenerationWithAdaptTemplates with custom COBIGEN_HOME environment variable
*
* @throws Exception test fails
*/
@Ignore
@Test
public void testAdaptTemplatesAndGenerate() throws Exception {
public void testAdaptTemplates() throws Exception {

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

File tmpProject = this.tempFolder.newFolder("playground", "project");
withEnvironmentVariable("COBIGEN_HOME", tmpProject.toPath().toString())
withEnvironmentVariable(ConfigurationConstants.CONFIG_ENV_HOME, tmpProject.getParentFile().getAbsolutePath())
.execute(() -> testBasicOpenAPIGenerationWithAdaptTemplates());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,12 @@ public static void runAndCaptureAdaptTemplates(SWTWorkbenchBot bot) throws Excep

takeScreenshot(bot, "Adapt Templates Warning!");
SWTBotShell warningDialog = bot.shell("Warning!");

warningDialog.bot().button("Ok").click();

takeScreenshot(bot, "Create new POM!");
SWTBotShell finishDialog = bot.shell("Create new POM");
finishDialog.bot().button("Finish").click();
mdukhan marked this conversation as resolved.
Show resolved Hide resolved

SWTBotShell informationDialog = bot.shell("Information");
bot.waitUntil(new AnyShellIsActive("Information"), DEFAULT_TIMEOUT);
takeScreenshot(bot, "Adapt Templates Information");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import org.apache.commons.io.FileUtils;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
Expand Down Expand Up @@ -100,6 +101,7 @@ public void extractTemplateSetsTest() throws IOException {
* @throws IOException if an Exception occurs
*/
@Test
@Ignore
mdukhan marked this conversation as resolved.
Show resolved Hide resolved
public void extractTemplatesWithOldConfiguration() throws IOException {

FileUtils.copyDirectory(new File(testFileRootPathMonolithicTemplates),
Expand Down