forked from konveyor/tackle-ui-tests
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WIP] Automate MTA-404 custom rules with source technology
Signed-off-by: Karishma Punwatkar <[email protected]> modified: cypress/e2e/tests/administration/custom-migration-targets/crud.test.ts modified: cypress/fixtures/custom-rules.json new file: cypress/fixtures/xml/corporate-framework-config.windup.xml modified: cypress/e2e/models/administration/custom-migration-targets/custom-migration-target.ts modified: cypress/e2e/tests/administration/custom-migration-targets/crud.test.ts modified: cypress/e2e/views/custom-migration-target.view.ts modified: cypress/fixtures/custom-rules.json new file: cypress/fixtures/xml/corporate-framework-config.windup.xml modified: cypress/e2e/models/administration/custom-migration-targets/custom-migration-target.ts
- Loading branch information
Showing
5 changed files
with
134 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
cypress/fixtures/xml/corporate-framework-config.windup.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?xml version="1.0"?> | ||
<ruleset id="corporate-configuration" | ||
xmlns="http://windup.jboss.org/schema/jboss-ruleset" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://windup.jboss.org/schema/jboss-ruleset http://windup.jboss.org/schema/jboss-ruleset/windup-jboss-ruleset.xsd"> | ||
<metadata> | ||
<description> | ||
This ruleset provides rules related to the corporate configuration frameworks. | ||
</description> | ||
<dependencies> | ||
<addon id="org.jboss.windup.rules,windup-rules-javaee,3.0.0.Final"/> | ||
<addon id="org.jboss.windup.rules,windup-rules-java,3.0.0.Final"/> | ||
</dependencies> | ||
<sourceTechnology id="traditional-corporate-framework"/> | ||
<targetTechnology id="cloud-corporate-framework"/> | ||
<tag>configuration</tag> | ||
</metadata> | ||
<rules> | ||
<rule id="corporate-config-01000" xmlns="http://windup.jboss.org/schema/jboss-ruleset"> | ||
<when> | ||
<javaclass references="io.konveyor.demo.config.ApplicationConfiguration"> | ||
<location>VARIABLE_DECLARATION</location> | ||
</javaclass> | ||
</when> | ||
<perform> | ||
<hint title="Legacy configuration with io.konveyor.demo.config.ApplicationConfiguration" effort="1" category-id="cloud-mandatory"> | ||
<message> | ||
The legacy ApplicationConfiguration class is being used in this application. This is discouraged by the migration | ||
guidelines, and should be replaced by a more standard approach using Spring's @PropertySource annotation and Environment class: | ||
|
||
|
||
```java | ||
@PropertySource("classpath:persistence.properties") | ||
public class PersistenceConfig { | ||
@Autowired | ||
private Environment env; | ||
|
||
@Bean | ||
public DataSource dataSource() { | ||
final DriverManagerDataSource dataSource = new DriverManagerDataSource(); | ||
dataSource.setDriverClassName(env.getProperty("jdbc.driverClassName")); | ||
dataSource.setUrl(env.getProperty("jdbc.url")); | ||
dataSource.setUsername(env.getProperty("jdbc.user")); | ||
dataSource.setPassword(env.getProperty("jdbc.password")); | ||
|
||
return dataSource; | ||
} | ||
} | ||
``` | ||
|
||
|
||
|
||
This allows externalizing the configuration in Kubernetes by injecting it as a ConfigMap or a Secret in the lib directory from the | ||
container running the Tomcat instance. | ||
</message> | ||
<link title="Spring Documentation - PropertySource javadoc" href="https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/context/annotation/PropertySource.html"/> | ||
<link title="Mkyong - Spring @PropertySource example" href="https://mkyong.com/spring/spring-propertysources-example/"/> | ||
<link title="Baeldung - Properties with Spring and Spring Boot" href="https://www.baeldung.com/properties-with-spring" /> | ||
<tag>configuration</tag> | ||
</hint> | ||
</perform> | ||
</rule> | ||
</rules> | ||
</ruleset> |