We have a number of unit tests using GWTTestCase that have the structure of:

1) Make a request to login.

2) In the response handler, make second call that requires a login.

This all used to work fine, but after upgrading from 2.5.1 to 2.7.0, the 
tests fail with 'login required' errors. It appears that the problem is 
that the session no longer persists between the calls (lost or not 
connected). In particular, we have verified that the login call works, sets 
the session properly.

There's another test that updates session data for localization selection 
that fails as well with the same pattern.

Simplified code snippet:


userService.login("user", "password", new AsyncFail<DatumResponse<User>>() {
    @Override
    public void onSuccess(DatumResponse<User> result) {
        final int userId = 1053;
        final int userDocId = 44;
        authService.isAuthorized(userId, OPERATION_READ, userDocId,
                new AsyncFail<AuthorizationResponse>() {
            @Override
            public void onSuccess(AuthorizationResponse result) {
                assertFalse("Unexpected error.", result.isError());
            }
        }
    }
}


We were able to address this partially by adding the following to the test 
suite:

    
SecurityContextHolder.setStrategyName(SecurityContextHolder.MODE_GLOBAL);

This may indicate it's related to threads?

I understand that GWTTestCase is generally not the preferred method for 
testing; this is an existing body of tests. "Use Selenium" or other 
suggestions are not really helpful.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-web-toolkit+unsubscr...@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to