Add Java mapscript to the test target; Fix a thread safety issue with msWMSGetCapabilities by wrapping it with a lock