Package org.teiid.services

Examples of org.teiid.services.SessionServiceImpl


    Mockito.stub(impl.getUserName()).toReturn("steve@somedomain");
    Mockito.stub(impl.getLoginContext()).toReturn(Mockito.mock(LoginContext.class));
    final ArrayList<String> domains = new ArrayList<String>();
    domains.add("somedomain");       

    SessionServiceImpl ssi = new SessionServiceImpl() {
      @Override
      protected TeiidLoginContext authenticate(String userName, Credentials credentials, String applicationName, List<String> domains, SecurityHelper helper, boolean passthough)
        throws LoginException {
        impl.authenticateUser(userName, credentials, applicationName, domains, passthough);
        return impl;
      }
    };
 
    ssi.setSecurityDomains("somedomain");
   
    try {
      ssi.validateSession(String.valueOf(1));
      fail("exception expected"); //$NON-NLS-1$
    } catch (InvalidSessionException e) {
     
    }
   
    SessionMetadata info = ssi.createSession("steve", null, "foo", new Properties(), false, true); //$NON-NLS-1$ //$NON-NLS-2$
    if (securityEnabled) {
      Mockito.verify(impl).authenticateUser("steve", null, "foo", domains, false);
    }
   
    String id1 = info.getSessionId();
    ssi.validateSession(id1);
   
    assertEquals(1, ssi.getActiveSessionsCount());
    assertEquals(0, ssi.getSessionsLoggedInToVDB("a", 1).size()); //$NON-NLS-1$
   
    ssi.closeSession(id1);
   
    try {
      ssi.validateSession(id1);
      fail("exception expected"); //$NON-NLS-1$
    } catch (InvalidSessionException e) {
     
    }
   
    try {
      ssi.closeSession(id1);
      fail("exception expected"); //$NON-NLS-1$
    } catch (InvalidSessionException e) {
     
    }
  }
View Full Code Here


    vdb.setStatus(Status.ACTIVE);
   
   
    Mockito.stub(repo.getVDB("name")).toReturn(vdb);
   
    SessionServiceImpl ssi = new SessionServiceImpl();
    ssi.setVDBRepository(repo);
   
    ssi.getActiveVDB("name", null);
   
    Mockito.verify(repo, Mockito.times(1)).getVDB("name");
  }
View Full Code Here

    vdb.setStatus(Status.ACTIVE);
   
   
    Mockito.stub(repo.getVDB("name", 1)).toReturn(vdb);
   
    SessionServiceImpl ssi = new SessionServiceImpl();
    ssi.setVDBRepository(repo);
   
    ssi.getActiveVDB("name", "1");
   
    Mockito.verify(repo, Mockito.times(1)).getVDB("name", 1);
  }
View Full Code Here

    vdb.setStatus(Status.ACTIVE);
   
   
    Mockito.stub(repo.getVDB("name", 1)).toReturn(vdb);
   
    SessionServiceImpl ssi = new SessionServiceImpl();
    ssi.setVDBRepository(repo);
   
    ssi.getActiveVDB("name.1", null);
   
    Mockito.verify(repo, Mockito.times(1)).getVDB("name", 1);
  }
View Full Code Here

    vdb.setStatus(Status.ACTIVE);
   
   
    Mockito.stub(repo.getVDB("name", 1)).toReturn(vdb);
   
    SessionServiceImpl ssi = new SessionServiceImpl();
    ssi.setVDBRepository(repo);
   
    try {
      ssi.getActiveVDB("name.x", null);
      fail("must have failed with non integer version");
    } catch (SessionServiceException e) {
    }
  }
View Full Code Here

    vdb.setStatus(Status.ACTIVE);
   
   
    Mockito.stub(repo.getVDB("name", 1)).toReturn(vdb);
   
    SessionServiceImpl ssi = new SessionServiceImpl();
    ssi.setVDBRepository(repo);
   
    try {
      ssi.getActiveVDB("name.1", "1");
      fail("must have failed with ambigious version info");
    } catch (SessionServiceException e) {
    }
   
    try {
      ssi.getActiveVDB("name..1", null);
      fail("must have failed with ambigious version info");
    } catch (SessionServiceException e) {
    }
  } 
View Full Code Here

TOP

Related Classes of org.teiid.services.SessionServiceImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.