Skip to content

Commit

Permalink
devonfw#1454 added 2nd template set artifact to test
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-vcapgemini committed Mar 14, 2023
1 parent 776aee9 commit a956637
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,14 @@ public void testInstallTemplateSet() throws Exception {
// simulate template-set-list folder for downloaded template-set.xml files to be used in GUI
File artifactCacheFolder = this.tmpFolder.newFolder("UserHome", "template-sets", "template-set-list");

Path templateSetXmlFile = TEST_FILE_ROOT_PATH.resolve("crud-java-server-app-2021.12.007-template-set.xml");
Files.copy(templateSetXmlFile,
Path templateSetXmlFile1 = TEST_FILE_ROOT_PATH.resolve("crud-java-server-app-2021.12.007-template-set.xml");
Files.copy(templateSetXmlFile1,
artifactCacheFolder.toPath().resolve("crud-java-server-app-2021.12.007-template-set.xml"),
StandardCopyOption.REPLACE_EXISTING);
Path templateSetXmlFile2 = TEST_FILE_ROOT_PATH.resolve("crud-openapi-server-app-2021.12.007-template-set.xml");
Files.copy(templateSetXmlFile2,
artifactCacheFolder.toPath().resolve("crud-openapi-server-app-2021.12.007-template-set.xml"),
StandardCopyOption.REPLACE_EXISTING);

withEnvironmentVariable(ConfigurationConstants.CONFIG_ENV_HOME, userHome.getAbsolutePath()).execute(() -> {
List<TemplateSetConfiguration> templateSetConfigurations = ArtifactRetriever.retrieveArtifactsFromCache();
Expand All @@ -77,16 +81,13 @@ public void testInstallTemplateSet() throws Exception {
for (TemplateSetConfiguration configuration : templateSetConfigurations) {
this.templateSetObservableList.addAll(configuration);
}
});

this.searchResultsView.setItems(this.templateSetObservableList);

Button installButton = find("#installButton");
String installButtonText = installButton.getText();
this.searchResultsView.setItems(this.templateSetObservableList);

sleep(1000);
Button installButton = find("#installButton");
String installButtonText = installButton.getText();

withEnvironmentVariable(ConfigurationConstants.CONFIG_ENV_HOME, userHome.getAbsolutePath()).execute(() -> {
sleep(1000);

// clicks on first element of searchResultsView
clickOn(this.searchResultsView.getItems().get(0).getContextConfiguration().getTrigger().get(0).getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<tns:templateSetConfiguration version="6.0" xmlns:tns="http://capgemini.com/devonfw/cobigen/TemplateSetConfiguration" xmlns:cc="http://capgemini.com/devonfw/cobigen/ContextConfiguration" xmlns:tc="http://capgemini.com/devonfw/cobigen/TemplatesConfiguration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://capgemini.com/devonfw/cobigen/TemplateSetConfiguration templateSetConfiguration.xsd ">

<cc:contextConfiguration version="6.0">
<cc:trigger id="valid" type="java">
<cc:trigger id="crud_java_server_app" type="java">
<cc:matcher type="fqn" value="*"></cc:matcher>
</cc:trigger>
<cc:tags>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<tns:templateSetConfiguration version="6.0" xmlns:tns="http://capgemini.com/devonfw/cobigen/TemplateSetConfiguration" xmlns:cc="http://capgemini.com/devonfw/cobigen/ContextConfiguration" xmlns:tc="http://capgemini.com/devonfw/cobigen/TemplatesConfiguration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://capgemini.com/devonfw/cobigen/TemplateSetConfiguration templateSetConfiguration.xsd ">

<cc:contextConfiguration version="6.0">
<cc:trigger id="crud_openapi_server_app" type="java">
<cc:matcher type="fqn" value="*"></cc:matcher>
</cc:trigger>
<cc:tags>
<cc:tag name="bla"/>
</cc:tags>
</cc:contextConfiguration>

<tc:templatesConfiguration version="6.0">
<tc:templates>
<tc:template name="prefix_Foo2Class.java"
destinationPath="src/main/java/foo/Foo2Class${variable}.java" templateFile="templates/foo/Foo2Class.java.ftl"
mergeStrategy="javamerge"/>
<tc:templateExtension ref="prefix2_FooClass.java"
destinationPath="adapted/path/FooClass.java" mergeStrategy="javamerge" targetCharset="ISO-8859-1"/>
<tc:templateExtension ref="prefix2_Foo2Class.java"/>
</tc:templates>

<tc:templateScans>
<tc:templateScan templateNamePrefix="prefix_" templatePath="templates/foo"
destinationPath="src/main/java/foo"/>
<tc:templateScan templateNamePrefix="prefix2_" templatePath="templates/bar"
destinationPath="src/main/java/bar"/>
</tc:templateScans>
<tc:increments>
<tc:increment name="increment1" description="Increment1 description" explanation="Creates necessary interfaces and methods for the SpringData Repository to interact with the database.">
<tc:templateRef ref="${variables.entityName}Repository.java" />
</tc:increment>
<tc:increment name="increment2" description="Increment2 description" explanation="Creates necessary interfaces and methods for the SpringData Repository to interact with the database.">
<tc:templateRef ref="${variables.entityName}Repository.java" />
</tc:increment>
</tc:increments>
</tc:templatesConfiguration>

</tns:templateSetConfiguration>

0 comments on commit a956637

Please sign in to comment.