Skip to content

Commit 59ebcdb

Browse files
devonfw#1622 reformat to track the next change
1 parent 5f0588b commit 59ebcdb

File tree

1 file changed

+67
-67
lines changed

1 file changed

+67
-67
lines changed

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

+67-67
Original file line numberDiff line numberDiff line change
@@ -31,71 +31,71 @@
3131
*/
3232
public class AdaptTemplatesTest extends SystemTest {
3333

34-
/** Temporary files rule to create temporary folders or files */
35-
@Rule
36-
public TemporaryFolder tempFolder = new TemporaryFolder();
37-
38-
/** Root path of the Test Resources */
39-
private static final String resourcesRootPath = "src/main/resources/OpenAPITest/";
40-
41-
/** Line separator, e.g. for windows '\r\n' */
42-
public static final String LINE_SEPARATOR = java.lang.System.getProperty("line.separator");
43-
44-
/**
45-
* Setup workbench appropriately for tests
46-
*
47-
* @throws Exception test fails
48-
*/
49-
@BeforeClass
50-
public static void setupClass() throws Exception {
51-
52-
EclipseUtils.cleanWorkspace(bot, true);
53-
54-
}
55-
56-
/**
57-
* Test generation with OpenAPI input after adapting templates
58-
*
59-
* @throws Exception test fails
60-
*/
61-
public void testBasicOpenAPIGenerationWithAdaptTemplates() throws Exception {
62-
63-
// copy sample project to external location and import it into the workspace
64-
String testProjName = "ExtTestProj";
65-
IJavaProject project = this.tmpMavenProjectRule.createProject(testProjName);
66-
FileUtils.copyFile(new File(resourcesRootPath + "input/adapt-templates.yml"),
67-
project.getUnderlyingResource().getLocation().append("adapt-templates.yml").toFile());
68-
project.getProject().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
69-
this.tmpMavenProjectRule.updateProject();
70-
71-
EclipseCobiGenUtils.runAndCaptureUpdateTemplates(bot);
72-
EclipseCobiGenUtils.runAndCaptureAdaptTemplates(bot);
73-
EclipseUtils.updateMavenProject(bot, ResourceConstants.CONFIG_PROJECT_NAME);
74-
75-
EclipseUtils.openErrorsTreeInProblemsView(bot);
76-
77-
// expand the new file in the package explorer
78-
SWTBotView view = bot.viewById(JavaUI.ID_PACKAGES);
79-
SWTBotTreeItem javaClassItem = view.bot().tree().expandNode(testProjName, "adapt-templates.yml");
80-
javaClassItem.select();
81-
82-
IProject adaptedTemplatesProj = ResourcesPlugin.getWorkspace().getRoot()
83-
.getProject(ConfigurationConstants.COBIGEN_TEMPLATES);
84-
85-
assertThat(adaptedTemplatesProj.exists()).isTrue();
86-
}
87-
88-
/**
89-
* Test of testBasicOpenAPIGenerationWithAdaptTemplates with custom COBIGEN_HOME
90-
* environment variable
91-
*
92-
* @throws Exception test fails
93-
*/
94-
@Test
95-
public void testAdaptTemplates() throws Exception {
96-
97-
File tmpProject = this.tempFolder.newFolder("playground", "project", "templates");
98-
withEnvironmentVariable(ConfigurationConstants.CONFIG_ENV_HOME, tmpProject.getParentFile().getAbsolutePath())
99-
.execute(() -> testBasicOpenAPIGenerationWithAdaptTemplates());
100-
}
34+
/** Temporary files rule to create temporary folders or files */
35+
@Rule
36+
public TemporaryFolder tempFolder = new TemporaryFolder();
37+
38+
/** Root path of the Test Resources */
39+
private static final String resourcesRootPath = "src/main/resources/OpenAPITest/";
40+
41+
/** Line separator, e.g. for windows '\r\n' */
42+
public static final String LINE_SEPARATOR = java.lang.System.getProperty("line.separator");
43+
44+
/**
45+
* Setup workbench appropriately for tests
46+
*
47+
* @throws Exception test fails
48+
*/
49+
@BeforeClass
50+
public static void setupClass() throws Exception {
51+
52+
EclipseUtils.cleanWorkspace(bot, true);
53+
54+
}
55+
56+
/**
57+
* Test generation with OpenAPI input after adapting templates
58+
*
59+
* @throws Exception test fails
60+
*/
61+
public void testBasicOpenAPIGenerationWithAdaptTemplates() throws Exception {
62+
63+
// copy sample project to external location and import it into the workspace
64+
String testProjName = "ExtTestProj";
65+
IJavaProject project = this.tmpMavenProjectRule.createProject(testProjName);
66+
FileUtils.copyFile(new File(resourcesRootPath + "input/adapt-templates.yml"),
67+
project.getUnderlyingResource().getLocation().append("adapt-templates.yml").toFile());
68+
project.getProject().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
69+
this.tmpMavenProjectRule.updateProject();
70+
71+
EclipseCobiGenUtils.runAndCaptureUpdateTemplates(bot);
72+
EclipseCobiGenUtils.runAndCaptureAdaptTemplates(bot);
73+
EclipseUtils.updateMavenProject(bot, ResourceConstants.CONFIG_PROJECT_NAME);
74+
75+
EclipseUtils.openErrorsTreeInProblemsView(bot);
76+
77+
// expand the new file in the package explorer
78+
SWTBotView view = bot.viewById(JavaUI.ID_PACKAGES);
79+
SWTBotTreeItem javaClassItem = view.bot().tree().expandNode(testProjName, "adapt-templates.yml");
80+
javaClassItem.select();
81+
82+
IProject adaptedTemplatesProj = ResourcesPlugin.getWorkspace().getRoot()
83+
.getProject(ConfigurationConstants.COBIGEN_TEMPLATES);
84+
85+
assertThat(adaptedTemplatesProj.exists()).isTrue();
86+
87+
}
88+
89+
/**
90+
* Test of testBasicOpenAPIGenerationWithAdaptTemplates with custom COBIGEN_HOME environment variable
91+
*
92+
* @throws Exception test fails
93+
*/
94+
@Test
95+
public void testAdaptTemplates() throws Exception {
96+
97+
File tmpProject = this.tempFolder.newFolder("playground", "project", "templates");
98+
withEnvironmentVariable(ConfigurationConstants.CONFIG_ENV_HOME, tmpProject.getParentFile().getAbsolutePath())
99+
.execute(() -> testBasicOpenAPIGenerationWithAdaptTemplates());
100+
}
101101
}

0 commit comments

Comments
 (0)