Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 335241

Summary: [server] Authentication for tests
Product: [ECD] Orion Reporter: John Arthorne <john.arthorne>
Component: ClientAssignee: John Arthorne <john.arthorne>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: aniefer, tomasz.zarna
Version: 0.2   
Target Milestone: 0.2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on:    
Bug Blocks: 336095    
Attachments:
Description Flags
Work in progress none

Description John Arthorne CLA 2011-01-24 15:10:51 EST
With the recent change to store authentication data in equinox secure storage, I couldn't find a way to get our JUnit tests running with authentication. After wasting a lot of time I get the tests running by doing this:

 - Set authentication to "None" in ConfigurationFormat.java
 - In NoneAuthenticationService.java, change the user name to "test"

However it would be good if we could run the tests with authentication, so we don't have to manually hack these things before running the tests.
Comment 1 John Arthorne CLA 2011-01-24 15:15:06 EST
Created attachment 187467 [details]
Work in progress

This patch contains some things I was trying to get this to work.
Comment 2 John Arthorne CLA 2011-01-24 15:16:43 EST
One of the problems I had was that the tests seemed to be picking up the useradmin.xml implementation of OrionUserAdmin instead of the secure storage implementation. I had to delete that bundle, and all references to it, to make sure I was using the correct UserAdmin implementation.
Comment 3 Szymon Brandys CLA 2011-01-25 08:13:08 EST
I had to fix bug 335301 to see that the new user service on Secure Storage works fine. I got rid of XML User Storage tests. The old storage can be tested via BasicUserTests now.
Comment 4 John Arthorne CLA 2011-02-08 10:51:07 EST
I'll take this, working with Andrew on getting tests running.
Comment 5 John Arthorne CLA 2011-02-08 10:56:25 EST
The authentication preference is consulted very early in startup, so I couldn't see a way for the tests to set this value early enough. Since we really don't need the ability to set authentication on the fly, I think the easiest solution is a system property that can be set by the test harness: 

-Dorion.tests.authtype=Basic
Comment 6 John Arthorne CLA 2011-02-08 10:57:04 EST
Fixed.
Comment 7 Szymon Brandys CLA 2011-02-08 10:58:39 EST
I think we should just create the workspace first before tests are launched. Then in the instance scope prefs you can configure the authentication type.
Comment 8 John Arthorne CLA 2011-02-08 13:11:30 EST
(In reply to comment #7)
> I think we should just create the workspace first before tests are launched.
> Then in the instance scope prefs you can configure the authentication type.

The system property is much easier. For the tests we would need to store the preferences file somewhere, and copy it into the workspace each time a new one is created. For people running tests in their dev environment, they would have the manual step to configure the workspace before running tests. With the system property we just add it to the launch configuration for the tests, and our tests work immediately out of the box for someone who wants to run them in their workspace.