Testing Jazz repository connection data [message #1706409] |
Wed, 26 August 2015 16:45  |
Eclipse User |
|
|
|
I have Jazz repository connection data entered by a user that I would like to test for correctness.
The JazzFormAuthClient.formLogin method looks like something I could use. So I tried the following:
try
{
JazzFormAuthClient client = new JazzFormAuthClient( repositoryUrl,
repositoryUserId, repositoryPassword );
client.formLogin();
System.out.print( "result: " + Integer.toString( result ) );
}
catch (OslcClientApplicationException e)
{
// handle exception
}
However when repositoryUrl, repositoryUserId, and repositoryPassword are all set to "test", no exception is thrown. I would expect an exception to be thrown since repositoryUrl has invalid syntax.
I notice from the JazzFormAuthClient.formLogin Javadoc that it returns an int, though the return value is not actually documented. So I tried:
try
{
JazzFormAuthClient client = new JazzFormAuthClient( repositoryUrl,
repositoryUserId, repositoryPassword );
client.formLogin();
int result = client.formLogin();
System.out.print( "result: " + Integer.toString( result ) );
}
catch (OslcClientApplicationException e)
{
// handle exception
}
With this code, I found that when repositoryUrl, repositoryUserId, and repositoryPassword are all set to "test", JazzFormAuthClient.formLogin returns -1.
I have the following questions:
1. Why doesn't JazzFormAuthClient.formLogin throw an exception when repositoryUrl is invalid?
2. What are the possible values returned by JazzFormAuthClient.formLogin and what does each value mean?
3. Is there a better way of testing Jazz repository connection data using the Lyo OSLC4J library?
|
|
|
Re: Testing Jazz repository connection data [message #1706512 is a reply to message #1706409] |
Thu, 27 August 2015 13:01   |
Eclipse User |
|
|
|
The formLogin() method in that class has been deprecated in favor of the login() method which does (should) throw exceptions for all errors instead of returning the mysterious -1.
formLogin() does in turn call login() and will return the -1 if a ClientProtocolException or IOException occurs in login(). The exception should also appear in the log4j logger. I recommend calling login() directly I believe you will see one of these exceptions as an indication of your invalid URL.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04280 seconds