Package org.teiid.client.security

Examples of org.teiid.client.security.LogonResult


            try {
          this.service.closeSession(oldToken.getSessionID());
        } catch (InvalidSessionException e) {
        }
          }
      return new LogonResult(sessionInfo.getSessionToken(), sessionInfo.getVDBName(), sessionInfo.getVDBVersion(), clusterName);
    } catch (LoginException e) {
      throw new LogonException(e.getMessage());
    } catch (SessionServiceException e) {
      throw new LogonException(e, e.getMessage());
    }
View Full Code Here


      ClientServiceRegistryImpl server = new ClientServiceRegistryImpl();
      server.registerClientService(ILogon.class, new LogonImpl(mock(SessionService.class), "fakeCluster") { //$NON-NLS-1$
        @Override
        public LogonResult logon(Properties connProps)
            throws LogonException, ComponentNotFoundException {
          return new LogonResult(new SessionToken("dummy"), "x", 1, "z");
        }
       
        @Override
        public ResultsFuture<?> ping() throws InvalidSessionException,
            TeiidComponentException {
View Full Code Here

    Mockito.stub(ssi.createSession(userName, null, applicationName,p, false, true)).toReturn(session);

    LogonImpl impl = new LogonImpl(ssi, "fakeCluster"); //$NON-NLS-1$

    LogonResult result = impl.logon(p);
    assertEquals(userName, result.getUserName());
    assertEquals(String.valueOf(1), result.getSessionID());
  }
View Full Code Here

          return result;
        }

        public LogonResult logon(Properties connectionProperties)
            throws LogonException, TeiidComponentException {
          return new LogonResult();
        }

        // tests asynch where we don't care about the result
        public ResultsFuture<?> ping() throws InvalidSessionException,
            TeiidComponentException {
View Full Code Here

    server.registerClientService(ILogon.class, new LogonImpl(mock(SessionService.class), "fakeCluster") { //$NON-NLS-1$
      @Override
      public LogonResult logon(Properties connProps)
          throws LogonException, ComponentNotFoundException {
        logonAttempts++;
        return new LogonResult(new SessionToken("dummy"), "x", 1, "z");
      }
     
      @Override
      public ResultsFuture<?> ping() throws InvalidSessionException,
          TeiidComponentException {
View Full Code Here

    throw new CommunicationException(JDBCPlugin.Util.getString("SocketServerInstancePool.No_valid_host_available", hostCopy.toString())); //$NON-NLS-1$
  }

  private void logon(ILogon newLogon, boolean logoff) throws LogonException,
      TeiidComponentException, CommunicationException {
    LogonResult newResult = newLogon.logon(connProps);
    SocketServerInstance instance = this.serverInstance;
    if (logoff) {
      if ("7.3".compareTo(this.serverInstance.getServerVersion()) <= 0) { //$NON-NLS-1$
        //just remove the current instance - the server has already logged off the current user
        LogonResult old = this.logonResults.remove(this.serverInstance.getHostInfo());
        this.connectionFactory.disconnected(this.serverInstance, old.getSessionToken());
      }
      logoffAll();
    }
    this.logonResult = newResult;
    this.logonResults.put(instance.getHostInfo(), this.logonResult);
View Full Code Here

  @Test public void testBatchedUpdateExecution() throws Exception {
    // Build up a fake connection instance for use with the prepared statement
    ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
    DQP dqp = Mockito.mock(DQP.class);
    ServerConnection serverConn = Mockito.mock(ServerConnection.class);
    LogonResult logonResult = Mockito.mock(LogonResult.class);
   
    // stub methods
    Mockito.stub(conn.getServerConnection()).toReturn(serverConn);
    Mockito.stub(serverConn.getLogonResult()).toReturn(logonResult);
    Mockito.stub(logonResult.getTimeZone()).toReturn(TimeZone.getDefault());

    // a dummy result message that is specific to this test case
    ResultsFuture<ResultsMessage> results = new ResultsFuture<ResultsMessage>();
    Mockito.stub(dqp.executeRequest(Matchers.anyLong(), (RequestMessage)Matchers.anyObject())).toReturn(results);
    ResultsMessage rm = new ResultsMessage();
View Full Code Here

   * @throws SQLException
   */
  protected PreparedStatementImpl getMMPreparedStatement(final String sql) throws SQLException {
    ConnectionImpl conn = Mockito.mock(ConnectionImpl.class);
    ServerConnection serverConn = Mockito.mock(ServerConnection.class);
    LogonResult logonResult = Mockito.mock(LogonResult.class);
   
    Mockito.stub(conn.getServerConnection()).toReturn(serverConn);
    Mockito.stub(serverConn.getLogonResult()).toReturn(logonResult);
    Mockito.stub(logonResult.getTimeZone()).toReturn(TimeZone.getDefault());

    return getMMPreparedStatement(conn, sql);
  }
View Full Code Here

    @Override
    public LogonResult logon(
        Properties connectionProperties)
        throws LogonException,
        TeiidComponentException {
      return new LogonResult(new SessionToken(1, connectionProperties.getProperty(TeiidURL.CONNECTION.USER_NAME, "fooUser")), "foo", 1, "fake"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    }
View Full Code Here

      stub(mock.getService(DQP.class)).toReturn(dqp);
      Properties props = new Properties();
      props.setProperty(BaseDataSource.VDB_NAME, STD_DATABASE_NAME);
      props.setProperty(BaseDataSource.VDB_VERSION, String.valueOf(STD_DATABASE_VERSION));
      props.setProperty(BaseDataSource.USER_NAME, "metamatrixadmin"); //$NON-NLS-1$
      stub(mock.getLogonResult()).toReturn(new LogonResult(new SessionToken(1, "metamatrixadmin"), STD_DATABASE_NAME,STD_DATABASE_VERSION , "fake")); //$NON-NLS-1$
      return new ConnectionImpl(mock, props, serverUrl);
    }
View Full Code Here

TOP

Related Classes of org.teiid.client.security.LogonResult

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.