Why I love Vaadin

Java, Vaadin, Web
We have chosen Vaadin from 3 years ago while we evaluated the web framework which can help us more productive in UI development. As the usual process, Vaadin is the best against the list of several popular web frameworks: Wicket GWT ZK JSF Vaadin is a winner after the evaluation list of license, ease of use, support, performance, etc. However, the first year of using Vaadin is not the very sweet memory. We used Vaadin 6, and it does not support multi tabs without using some tricks, the theme is not easy to customize and looks not good, the output HTML has a lot of redundant div elements. We have doubted our decision of using Vaadin. (more…)

Integration testing with DbUnit and Spring framework

Database, Java, Spring framework, Testing
In the previous post, I gave a short example how to run the integration test with Spring framework. In this post, I share the example how to do the database testing with DbUnit. The primary principle of the unit test is separating data in the each test case, and DbUnit helps us keep data in every integration testing in a known state. We enhance JUnit, Spring framework to add the rule of running DbUnit at the beginning and during every test case. (more…)

Integrating Testing with Spring framework

Java, Maven, Spring framework, Testing
This post is the first in the three posts series of testing in Java, and what we have done while we developed the MyCollab product. The content of these three parts are: Part 1: Unit test with Spring framework (This post) Part 2: Database Testing with DbUnit Part 3: Mock testing with Mockito in the real examples of testing scheduler job and email sender I have the knowledge graph links among these parts. Let us start with the first part, set up the new testing environment in the Spring project (more…)

How to keep your Amazon Cloud account safety

Cloud, Security
While we support our customers about the hosting issue such as deploying the new site to their host or configuring the database on the cloud. The most popular cloud service is Amazon, which is also the service I am using for my works for four years. We have no problem with Amazon services but most of our clients have, the most critical issue is they were careless of their account such as: The weak password, the password is shared easily to among the group users. In almost case, the shared account has the administration right. The API keys in the application have the broad permission. For instance, they only need the API key to access the S3 service, but this API key can add/remove EC2 instances, and do a lot more. The server instances are out-of-date. The server administrator ha

The most usage Maven commands

Java, Maven, Tools
Maven is our most use built tool besides the Gradle. There are a lot Maven commands to help developers build, run tests or create a new distribution. Except the default commands such as clean install I found that there are only a few commands I always use them in my jobs, and this blog post demonstrate how I use these Maven commands. You can add your commands later in the comment. (more…)

Embedding Jetty in your application

Java, Jetty, Web
The era of deploying the application to the web server is over. There are many disadvantages by using the war file to an application server, and microservices is the term to help the enterprises can manage its services more efficiency. When designing the MyCollab product, we have several separated services, and we may add more in the future: Web application API endpoints Billing Integration Scheduler Caching Reporting Application monitoring These services could plug into the system, but their removal out of the MyCollab without making MyCollab functionalities broken. One example is the caching is only presented in the Premium edition, but the lacking does not make the Community edition stop working. Our microservices architect designs to run as the standalone appl

Design patterns in MyCollab (part 1)

Design Patterns, Java
MyCollab is the big project contains 45 sub-projects up-to-date of this published post. Its architect makes us challenge when we design the software meet all the following goals: MyCollab has 3 different versions: Open Source, Ultimate, and the Cloud edition. Three editions use some shared modules, and they have the separated modules as well. The open source edition has public its source code and of course, all these open source modules must not depend on the premium modules requires in both compile and runtime phases. Follow the SOLID (Object Oriented Design) to let MyCollab is maintainable, testable, and remove the code smells. Keep the code clean, trackable and easy to write unit tests at any level from unit test, integration test, and automation test. The speed of applica

Freemarker templates over Velocity

Java, Tools
We have used templates over JSP for many years. The templates are used in our mail sending library, HTML pages in the pure java program, web application or in the Spring container. Velocity was our first choice due to its simplicity and ease of use. However, while our template files become more complex, we face many issues with Velocity's usage in MyCollab. We evaluated several template libraries and finally Freemarker is a tool we choose to invest time for integrating (more…)

Java pipe streams and concurrency

Java
The Java pipe stream is the old terminology from the Java 1. Pipes in Java allows two threads running in the same JVM can communicate, one is the source and another is the destination. In MyCollab product, the end users can export the data to the downloaded file with the formats are PDF, Excel or CSV. The challenge is the process of exporting may be long because we do not limit the number of records to export, and the system may execute some complex business rules which consume time to finish. We do not wait for the process to export file to the server and then the user will download the whole file to their site. The pipes solution solve this case as what we expected. (more…)

Serialize and de-serialize with Jackson

Java, Tools
At the first time to serialize Java objects and vice versa, we are overwhelmed when there are a lot of JSON libraries. We come to the three libraries in our final list: XStream, Gson, and Jackson. After that, we excluded the XStream out of the list because XStream did not do a good job when it binds the Java object to the JSON and vice versa. It is very hard to custom the output of JSON for the complicated Java objects via XStream's Converter and in many cases it is impossible. Gson is the good JSON library, and both it and Jackson are simple to use. However, we choose Jackson because it is integrated flawlessly with Spring framework. The starter is simple to write. (more…)