Project

General

Profile

Actions

Bug #5294

open

Enable Junit test on http://dev-testing.dataone.org:8080/hudson/job/Metacat/

Added by Jing Tao about 13 years ago. Updated about 13 years ago.

Status:
New
Priority:
Normal
Assignee:
Category:
metacat
Target version:
Start date:
02/04/2011
Due date:
% Done:

0%

Estimated time:
Bugzilla-Id:
5294

Description

Currently in hudson test, the build will run "ant clean war" to verify the new commitment code would not break the build. We need another further step: enable junit tests.

In order to run the junit test on hudson, Metacat should be configured. Currently the metacat/lib/metacat.properties are not configured. User should use admin page to do the configuration. We need to modify metacat.properties to make it configured.

Here are some properties need to be modified in metacat.properties:
database.user=
database.password=
database.type=
database.driver=
database.adapter=
test.metacatDeployDir=
configutil.propertiesConfigured=false
configutil.authConfigured=false
configutil.skinsConfigured=false
configutil.databaseConfigured=false
configutil.geoserverConfigured=false

In test.properties:
metacat.contextDir

In build.properties:
build.tomcat.dir
app.deploy.dir

After modifying above properties file, when a developer to build a installer, he has to modify those properties:
configutil.propertiesConfigured
configutil.authConfigured
configutil.skinsConfigured
configutil.databaseConfigured
configutil.geoserverConfigured

Otherwise, the amdin servlet will be bypassed.

We also need to figure out how to deploy the service in dev-testing.dataone.

Actions #1

Updated by Jing Tao about 13 years ago

<matt> another possibility would be to create a new target in the build that sets those properties explicitly for the hudson build.

This is a good way too.

Actions #2

Updated by Jing Tao about 13 years ago

I just tested if we set:
configutil.propertiesConfigured=false
configutil.authConfigured=false
configutil.skinsConfigured=false
configutil.databaseConfigured=false
configutil.geoserverConfigured=false

And add some default values on:
database.user=
database.password=
database.type=
database.driver=
database.adapter=

The administration servlet still works.

So here is the plan:
1. In metacat.properties fill those values base on the configuration of dev-testing:
database.user=
database.password=
database.type=
database.driver=
database.adapter=
test.metacatDeployDir=
And set:
configutil.propertiesConfigured=false
configutil.authConfigured=false
configutil.skinsConfigured=false
configutil.databaseConfigured=false
configutil.geoserverConfigured=false

2. In build.properties, fill the values base on dev-testing configuration
build.tomcat.dir
app.deploy.dir

3. In test.properties: fill the value base on dev-testing configuration
metacat.contextDir

4. Create a new target in build.xml to set:
configutil.propertiesConfigured=true
configutil.authConfigured=true
configutil.skinsConfigured=true
configutil.databaseConfigured=true
configutil.geoserverConfigured=true.

In above approach, the junit test can run without any additional configuration. And developer don't need to modify the metacat.properties during building installers.

Actions #3

Updated by Matt Jones about 13 years ago

This sounds good, Jing. One other issue is that the admin servlet runs SQL scripts to create/update databases, etc. So we'll need to execute that code on the deployed instance when the DB changes. Maybe there could be an ant target that checks and runs the sql code (I think there is one there already to run it, but we need to be able to determine which scripts to run (which the admin servlet does by querying the DB version).

Actions #4

Updated by Jing Tao about 13 years ago

I will add the target to check the database.

I added two targets into the build.xml. One will set configutil.* to be true. The other will install a metacat with the modified metacat.properties.

There are two issues now:
1. The metacat gives the error:
javax.servlet.ServletException: Service problem while intializing MetaCat Servlet: ServiceService.registerService - Service: DatabaseService is already registered. Use ServiceService.reregister() to replace the service.

2. The metacaturl value is "http\://localhost\:8080/knb/metacat" in metacat.properties and junit test doesn't like it.

Actions #5

Updated by Jing Tao about 13 years ago

The first issue in above comment relates to the second one. When metacat initializes the db service, it can recognize the url:
jdbc\:postgresql\://localhost/test

Actions #6

Updated by Jing Tao about 13 years ago

in above comment, can = can NOT :)

Actions #7

Updated by Jing Tao about 13 years ago

It turns out that Metacat is using a customized properties file management system.It makes the properties file more readable. But it can't recognize the escape character.

In order to avoiding the character escaping, "echo" is used to replace "propertyFile". New "configutil.propertiesConfigured=true" and other configutil properties are set on echo command.

This approach works.

Here are the next steps:
1. Install tomcat and postgreSQL in the testing machine.
2. Write a script to build the metacat with the new target - install-configured-metacat. The new script will also include to stop and start tomcat.
3. Let hudson run the script after any new svn commitment or daily.

Actions #8

Updated by Redmine Admin about 11 years ago

Original Bugzilla ID was 5294

Actions

Also available in: Atom PDF