Workflow of creating new datasource if user wants to use 'Test Connection' button in create new datasource wizard assuming started let's say standalone EAP:
- using web console navigate Configuration > Datasources > Non-XA > Add
- in wizard choose H2 datasource template > Next
- edit names if you want > Next > Next
- edit connection url if you want, change username and password to 'sa', click 'Test Connection' - two popups will appear - that you have to reload server and that connection was successful
- At this point you can't finish the wizard otherwise you will face 'DuplicateServiceException: Service org.wildfly.data-source.H2DS is already registered' but you have to reload server first and then create the datasource once more! Fortunately at least the wizard remembers what you entered last time in text fields.
Test connection button seems to create datasource first, test it and than remove it but this prevents user to create it immediately by clicking finish wizard and leads to this very confusing and user not friendly behavior.