JBoss EAP 6.2.0 + Camel + CXF + JSF 2.2.8 Project Summary
Introduction
Tools used
- Oracle's jdk1.8.0_05 with target 7
- JBoss EAP 6.2.0
- Testng 6.8 (instead of JUnit)
- Camel 2.13
- CXF (for calls to external webservices)
- Less (CSS similar a bit to SASS)
- Spring 4.0
- Lombok
- Mockito 1.0
- Hamcrest 1.3
- DBUnit 2.5
- Embedded tomcat 7 for integration tests with maven 3
- Sonar, Confluence, Sourcetree (for Git over SVN)
- Spring-rabbit 1.2 for accessing RabbitMQ
- JSF 2.2.8
- Hibernate 5.1.1
- Hsqldb 2.3
Lessons learned
- My first time use of the Maven plugin dependency which gives warnings of undeclared and used or unused declared dependencies:
mvn dependency:analyze-only
Very handy. You *can't* trust on analyze-only though! In the end you still need to perform a full build to make sure all still works. The plugin can only determine dependencies.
It is possible that some "hidden" non-explicit dependency on an @Entity class creates a FK, which causes the project (with the missing explicit ) hbm.ddl.auto=create not be able to drop a table because it doesn't know about that FK (and thus can't drop that and thus not the table).
Luckily in log (perhaps you need to set the hibernate level to log all queries/statements) you can see what exactly is being dropped and thus can you spot the missing 'drop contraint xyz' line, where xyz is the constraint the current project doesn't know about. Add it as to the project's pom.xml and the statement should appear. Note that mvn dependency:analyze-only will complain about it as 'unused declared dependency'. Probably this FK dependency is an incorrect project setup anyway. - Sonar's //NOSONAR does not seem to ignore code-coverage violations... Only issues (e.g the Blocker, Critical etc rules).
- Camel 2.13: example expression to only have file moved if same file prefix file but with extension .ready already exists:
// Reference: http://camel.apache.org/file-language.html
private static final String FILE_READY_TO_BE_PICKED_UP_EXPRESSION = "doneFileName=$simple{file:name.noext}.ready"; - Parsing in jodatime:
private final DateTimeParser[] parsers = {
DateTimeFormat.forPattern(SOME_DATE_FORMAT).getParser()
};
DateTimeFormatter formatter = new DateTimeFormatterBuilder().append(null, parsers).toFormatter().withZone(DateTimeZone.UTC);
And the other direction:
String nowText = DateTime.now().toString(SOME_DATE_FORMAT); - Suppose you have two maven profiles A and B. When running mvn clean install -PA,B it appeared only the <exclude> of the last profile was being used (as seen when adding the -X parameter when running the mvn command).
Problem was that both profiles had the same <id> in the <execution> part!
Solution: prefix the execution ids to make them unique. E.g:
<id>A-tests</id>
and
<id>B-tests</id> - TestNG (and JUnit vx.y in a bit different way but same mechanism) supports groups to divide tests in for example unit vs integration tests.
But what if you have a combination of previous unittests which don't have that annotation yet, and you don't want to have to update all tests classes?
Because if you have specifiedin your root pom.xml, then the tests w/o the groups attribute in the @Test annotation won't get picked up by the maven-sure-fire plugin.
For that you need this specified with your maven-surefire-plugin configuration:
<plugin>
...
<configuration>
<!-- Need to specify an empty variable. Leaving the tags empty does not make it overrule thedefined in the inmotiv-root/pom.xml -->
<groups>${emptyProperty}</groups>
</configuration>
...
</plugin>
Note the ${emptyProperty} property. It has *no* value set!
Would you remove the ${emptyProperty}, so you have <groups><groups/>, or replace the line with <groups/> you'll see the test class won't get run! My guess is that maven just removes the empty tag, but won't if you put in a variable... - When renaming files by change the casing (uppercase or lowercase) that are already git controlled, use
git mv -f FILE file
otherwise GIT won't see it.
No comments:
Post a Comment