Categories
Grails Moving to Grails

Searchable comboboxes

Comboboxes, ie. html <select>, are not searchable by default. This is only ok for very short lists. After a short search i found the https://select2.org/ which was quite easy to use with Grails. I will walk through the steps needed to make it work in a new project. First create an application to run the […]

Categories
Grails Moving to Grails

Geb testing – revisited

I have now written a couple of domain geb tests and overcome the first practical obstacles. Internationalization Firefox and chrome browsers language is Norwegian, while htmlUnit is English. This means that labels et.c. will change with the configured language of the browser. Starting with this EmployeeListPage: And then change the title: I put code used […]

Categories
Grails Moving to Grails

Geb testing on linux

I started with downloading https://guides.grails.org/grails-geb-multiple-browsers/guide/index.html and followed the guide. Running the test with HtmlUnit worked at once. The Chrome test worked once the drivers had been installed. Firefox test gave a few error messages. After some searching, and re-reading the message I noticed this “The path to the driver executable must be set by the […]

Categories
Grails Moving to Grails

Documentation – rest api

When resarching documentation for the previous blog posts I stumbled upon this project: https://github.com/grails/groovy-rest-doc where Sergio del Amo have writen a tool to help document a rest api. First I downloaded the whole code, and run integration test, then asciidoctor task. Now lets see how this works with a new project. Then create a domain […]

Categories
Grails

Spring security – multitenant

In this post I will demonstrate how to configure Spring security with a per tenant user database. In order to make it work we will need: Custom UserDetailsService Rewrite the UserPasswordEncoderListener Initialize per tenant beans First lets create the application and add security. Import the new project into IDEA. Edit build.gradle: Initialize spring security core […]

Categories
Grails Moving to Grails

Making SystemPropertyTenantResolver work

I use SystemPropertyTenantResolver for testing purposes. One use-case is building a simple app to see how some aspects of multitenancy works. The other use-case is testing with Spock. Minimum necessary code to setup multitenancy and select one tenant. First in application.yml enable multitenancy. Then in application.yml define datasources for each tenant. In this example the […]