PILLUTLAAVINASH / google-enterprise-connector-manager

Automatically exported from code.google.com/p/google-enterprise-connector-manager
0 stars 0 forks source link

Login problem with mock repository #3

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Instanciate any class implementing Connector interface
2. Set a user and a password (user==password)
2 bis. Set MockRepositoryEventList7.txt as the docbase
3. Connector.login()
4. leads to :

MockRepositoryEventList mrel =
            new MockRepositoryEventList("MockRepositoryEventList7.txt");

        MockJcrRepository repo = 
            new MockJcrRepository(new MockRepository(mrel));

        Credentials creds = new SimpleCredentials("Mark", "Mark".toCharArray());

        MockJcrSession sess = null;
        try {
            sess = (MockJcrSession) repo.login(creds);
        } catch (javax.jcr.LoginException e) {
            LoginException re = new LoginException(e.getMessage(),e.getCause());
            re.setStackTrace(e.getStackTrace());
            throw re;
        } catch (javax.jcr.RepositoryException e) {
            com.google.enterprise.connector.spi.RepositoryException re = new
com.google.enterprise.connector.spi.RepositoryException(e.getMessage(),e.getCaus
e());
            re.setStackTrace(e.getStackTrace());
            throw re;
        }

What is the expected output? What do you see instead?

Excpected LoginException caught.
Obtained null session (return null instead of throw new
javax.jcr.LoginException(); in MockJcrRepository.makeSession(Credentials
creds))

Original issue reported on code.google.com by pasquonj...@gmail.com on 12 Jan 2007 at 2:47

GoogleCodeExporter commented 8 years ago
I will evaluate further.

Original comment by donald.z...@gmail.com on 24 Jan 2007 at 11:44

GoogleCodeExporter commented 8 years ago
Brian, please add to backlog.

Original comment by donald.z...@gmail.com on 24 Jan 2007 at 11:48

GoogleCodeExporter commented 8 years ago
Google Bug #243975

Original comment by vjo...@gmail.com on 9 Feb 2007 at 4:00

GoogleCodeExporter commented 8 years ago

Original comment by mobe...@gmail.com on 18 Apr 2008 at 10:02

GoogleCodeExporter commented 8 years ago
Google bug #243975 is a duplicate of this issue.

Original comment by jl1615@gmail.com on 3 Feb 2009 at 9:33

GoogleCodeExporter commented 8 years ago
Fixed.

r2382 | mgronber | 2009-12-01 13:11:01 -0800 (Tue, 01 Dec 2009) | 29 lines
Changed paths:
   M
/trunk/projects/connector-manager/source/javatests/com/google/enterprise/connect
or/jcr/JcrAuthenticationManager.java
   M
/trunk/projects/connector-manager/source/javatests/com/google/enterprise/connect
or/jcr/JcrAuthenticationManagerTest.java
   M
/trunk/projects/connector-manager/source/javatests/com/google/enterprise/connect
or/jcr/JcrAuthorizationManagerTest.java
   M
/trunk/projects/connector-manager/source/javatests/com/google/enterprise/connect
or/mock/jcr/MockJcrRepository.java
   M
/trunk/projects/connector-manager/source/javatests/com/google/enterprise/connect
or/mock/jcr/MockJcrRepositoryTest.java

Fix for Issue 3.  Changed MockJcrRepository.login() to throw LoginException as
described by the Repository Interface rather than just return null Session.

ChangeLog:
---------
M 
source/javatests/com/google/enterprise/connector/mock/jcr/MockJcrRepository.java
:
  - Changed login() impl to now throw LoginException if the given credentials
    were invalid.
  - Same change to makeSession().

M 
source/javatests/com/google/enterprise/connector/mock/jcr/MockJcrRepositoryTest.
java:
  - Added some throws to those tests that don't test bad credentials.
  - Moved bad credentials test from testAuthnRepository() to new testIssue3()
    test.
  - Added testIssue3() test to test for exception when bad credentials are used.

M 
source/javatests/com/google/enterprise/connector/jcr/JcrAuthenticationManager.ja
va:
  - Removed TODO and changed authenticate() to return false in the case of bad
    credentials rather than perpetuate the Session exception.

M 
source/javatests/com/google/enterprise/connector/jcr/JcrAuthenticationManagerTes
t.java:
M 
source/javatests/com/google/enterprise/connector/jcr/JcrAuthorizationManagerTest
.java:
  - Added LoginException to the throws clause.

Tests Passed:
------------
- All Unit tests

Original comment by mar...@google.com on 1 Dec 2009 at 9:14

GoogleCodeExporter commented 8 years ago

Original comment by jla...@google.com on 9 Dec 2010 at 10:22