Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Lyo » Testing Jazz repository connection data
Testing Jazz repository connection data [message #1706409] Wed, 26 August 2015 16:45 Go to next message
Geoff Alexander is currently offline Geoff AlexanderFriend
Messages: 28
Registered: November 2013
Junior Member
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 Go to previous messageGo to next message
Michael Fiedler is currently offline Michael FiedlerFriend
Messages: 15
Registered: September 2012
Junior Member
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.


Regards,
Mike
Re: Testing Jazz repository connection data [message #1706584 is a reply to message #1706512] Thu, 27 August 2015 20:30 Go to previous messageGo to next message
Geoff Alexander is currently offline Geoff AlexanderFriend
Messages: 28
Registered: November 2013
Junior Member
Michael, thanks for getting back to me. I don't see a login() method in the JazzFormAuthClient class. I'm using Lyo/OSLC4J 2.1 that I downloaded from https://www.eclipse.org/lyo/download.html. Is the login() method a new method that has yet to be included in a released version of OSLC4J?

[Updated on: Thu, 27 August 2015 20:34]

Report message to a moderator

Re: Testing Jazz repository connection data [message #1706913 is a reply to message #1706584] Mon, 31 August 2015 18:57 Go to previous message
Geoff Alexander is currently offline Geoff AlexanderFriend
Messages: 28
Registered: November 2013
Junior Member
To answer my own question, it does seem that the JazzFormAuthClient.login() method was added under Bug 452220 - JazzFormAuthClient should throw all exceptions after OSLC4J 2.1 was released.

OSLC4J 2.1 is fairly old (March 2014). Are there any plans for a new release that picks ups recent Bug fixes anytime soon?
Previous Topic:What is difference between JazzAuthErrorException and JazzAuthFailedException?
Next Topic:Sample code for creating RTC work item?
Goto Forum:
  


Current Time: Tue Mar 19 05:11:20 GMT 2024

Powered by FUDForum. Page generated in 0.02176 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top