The app is deployed to www.hhb.eu-gb.mybluemix.net.
- Install eclipse tools
- Add a liberty-profile server for local testing
- Import the app into Eclipse
- Add a 'turtle'-sized ElephantSQL service instance
- Run on Server => Bluemix (the database tables will be auto-created)
Additional Information about the Eclipse tools is available at the Bluemix documentation site.
Using TDD, implement the following features:
- Show a list of all categories at
/categories/all
- Show all entries of a certain category at
/entries/by-category
For each feature, add unit, integration and acceptance tests.
- There are unit- and integration tests that can be run from Eclipse
- The integration- and acceptance tests require a local Postgres
- Acceptance tests require ruby. See the separate README.
The application specifies the context root itself as /
, which can be changed in WEB-INF/ibm-web-ext.xml
. It should override the setting in the server's server.xml
, but in case it doesn't the contextRoot
attribute of the webApplication
element should be removed from server.xml
.
Bluemix provides the datasource for a bound service in JDNI. We could configure the local dev server in the same way, but to make development even simpler, we take a shortcut and manually initialize the PostgreSQL JDBC driver when testing locally. The code does this automatically; there are no manual steps to be taken.
Add the currently logged on user as a new (password-less) PostgreSQL user:
# create a user
$ postgres -c "createuser --createdb --no-superuser --no-createrole $USER"
# start postgres
$ postgres -D /usr/local/var/postgres
# create the user's database (prereq for tests)
$ createdb
# create the database
$ createdb haushaltsbuch
If the database URL is specified without a host component (e.g. postgres:///haushaltsbuch
), a local domain socket will be used for the Postgres connection. This avoids having to provide a separate password for the TCP connection.
The entries table auto-generates the UUID on insert. This requires the uuid-ossp
extension to be available. It will be enabled automatically.
In order to see the raw SQL statements, logging can be enabled for the local postgres
process:
$ psql postgres:///haushaltsbuch
# ALTER SYSTEM SET log_destination = 'stderr';
# ALTER SYSTEM SET log_statement = 'all';
# SELECT pg_reload_conf();
The last statement will apply the values. Alternatively, restart with pg_ctl reload -D /usr/local/var/postgres
.
- If Eclipse complains about
Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"
, simply right-click the project and choose "Validate".
- Input validation happens at two places: client-side (HTML form validation), where we are nice with the user, and at the database level, where we make sure only valid data enters the system. Right now there is no need for additional validation on the domain layer.
Please see CONTRIBUTING.md.
HDM-Haushaltsbuch is Copyright© 2016 Steffen Uhlig. It is free software, and may be redistributed under the terms specified in the LICENSE file.