Examples of ILogon


Examples of org.teiid.client.security.ILogon

  }
 
  @Test
  public void testMethodInvocation() throws Exception {
    ClientServiceRegistryImpl csr = new ClientServiceRegistryImpl();
    csr.registerClientService(ILogon.class, new ILogon() {

        public ResultsFuture<?> logoff()
            throws InvalidSessionException {
          ResultsFuture<?> result = new ResultsFuture<Void>();
          result.getResultsReceiver().exceptionOccurred(new TeiidComponentException("some exception")); //$NON-NLS-1$
          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 {
          return null;
        }
       
        @Override
        public ResultsFuture<?> ping(Collection<String> sessions)
          throws TeiidComponentException, CommunicationException {
          return null;
        }
       
        @Override
        public void assertIdentity(SessionToken sessionId)
          throws InvalidSessionException,
          TeiidComponentException {
        }

      }, "foo"); //$NON-NLS-1$
    csr.registerClientService(FakeService.class, new FakeServiceImpl(), "foo"); //$NON-NLS-1$
    final FakeClientServerInstance serverInstance = new FakeClientServerInstance(csr);
    SocketServerConnection connection = createFakeConnection(serverInstance);
    ILogon logon = connection.getService(ILogon.class);
    Future<?> result = logon.ping();
    assertNull(result.get(0, TimeUnit.MILLISECONDS));
    result = logon.logoff();
    try {
      result.get(0, TimeUnit.MICROSECONDS);
      fail("exception expected"); //$NON-NLS-1$
    } catch (ExecutionException e) {
      assertTrue(e.getCause() instanceof TeiidComponentException);
View Full Code Here

Examples of org.teiid.client.security.ILogon

      Exception ex = null;
      try {
        if (!hostInfo.isResolved()) {
          hostInfo = new HostInfo(hostInfo.getHostName(), new InetSocketAddress(hostInfo.getInetAddress(), hostInfo.getPortNumber()));
        }
        ILogon newLogon = connect(hostInfo);
        if (this.logonResult == null) {
              try {
                  logon(newLogon, logoff);
            this.serverDiscovery.connectionSuccessful(hostInfo);
                  if (discoverHosts) {
View Full Code Here

Examples of org.teiid.client.security.ILogon

  private ILogon connect(HostInfo hostInfo) throws CommunicationException,
      IOException {
    hostInfo.setSsl(secure);
    this.serverInstance = connectionFactory.getServerInstance(hostInfo);
    this.logonResult = logonResults.get(hostInfo);
    ILogon newLogon = this.serverInstance.getService(ILogon.class);
    if (this.logonResult != null) {
      try {
        newLogon.assertIdentity(logonResult.getSessionToken());
      } catch (TeiidException e) {
        // session is no longer valid
        disconnect();
      }
    }
View Full Code Here

Examples of org.teiid.client.security.ILogon

  public void authenticate() throws ConnectionException,
      CommunicationException {
    if (this.serverInstance == null) {
      selectServerInstance(true); //this will trigger a logon with the new credentials
    } else {
      ILogon logonInstance = this.serverInstance.getService(ILogon.class);
      try {
        this.logon(logonInstance, true);
      } catch (LogonException e) {
        throw new ConnectionException(e);
      } catch (TeiidComponentException e) {
View Full Code Here

Examples of org.teiid.client.security.ILogon

          synchronized (sessions) {
            entries = new HashSet<SessionToken>(entry.getValue());
          }
          try {
            instance = getServerInstance(entry.getKey());
            ILogon logon = instance.getService(ILogon.class);
            if ("7.1.1".compareTo(instance.getServerVersion()) > 0) { //$NON-NLS-1$
              for (SessionToken session : entries) {
                try {
                  logon.assertIdentity(session);
                  logon.ping();
                  log.log(Level.FINER, "issueing ping for session:", session); //$NON-NLS-1$
                } catch (InvalidSessionException e) {
                }
              }
            } else {
              ArrayList<String> sessionStrings = new ArrayList<String>(entry.getValue().size());
              for (SessionToken session : entries) {
                sessionStrings.add(session.getSessionID());
              }
              logon.ping(sessionStrings);
              log.log(Level.FINER, "issueing ping for sessions:", sessionStrings); //$NON-NLS-1$
            }
          } catch (Exception e) {
            log.log(Level.WARNING, "Error performing keep-alive ping", e); //$NON-NLS-1$
          } finally {
View Full Code Here

Examples of org.teiid.client.security.ILogon

      key = new CachedInstance(info);
      synchronized (instancePool) {
        instance = instancePool.remove(key);
      }
      if (instance != null) {
        ILogon logon = instance.actual.getService(ILogon.class);
        boolean valid = false;
        try {
          Future<?> success = logon.ping();
          success.get(this.channelFactory.getSoTimeout(), TimeUnit.MILLISECONDS);
          valid = true;
        } catch (Exception e) {
          log.log(Level.FINE, "Error performing ping, will select another instance", e); //$NON-NLS-1$
        }
View Full Code Here

Examples of org.teiid.client.security.ILogon

   */
  @Test public void testRetry() throws Exception {
    SocketServerConnection connection = createConnection(new SingleInstanceCommunicationException());
    connection.setFailOver(true);
    connection.setFailOverPingInterval(50);
    ILogon logon = connection.getService(ILogon.class);
    Thread.sleep(70);
    logon.ping();
  }
View Full Code Here

Examples of org.teiid.client.security.ILogon

    logon.ping();
  }
 
  @Test(expected=CommunicationException.class) public void testImmediateFail() throws Exception {
    SocketServerConnection connection = createConnection(new CommunicationException());
    ILogon logon = connection.getService(ILogon.class);
    logon.ping();
  }
View Full Code Here

Examples of org.teiid.client.security.ILogon

  }
 
  @Test(expected=CommunicationException.class) public void testImmediateFail1() throws Exception {
    SocketServerConnection connection = createConnection(new CommunicationException());
    connection.setFailOver(true);
    ILogon logon = connection.getService(ILogon.class);
    logon.ping();
  }
View Full Code Here

Examples of org.teiid.client.security.ILogon

    final FakeObjectChannel channel = new FakeObjectChannel(Arrays.asList(new Handshake(), new SocketTimeoutException()));
   
    SocketServerInstanceImpl instance = createInstance(channel);
   
    //no remote server is hooked up, so this will timeout
    ILogon logon = instance.getService(ILogon.class);
    try {
      logon.logon(new Properties());
      fail("Exception expected"); //$NON-NLS-1$
    } catch (TeiidComponentException e) {
      assertTrue(e.getCause().getCause() instanceof TimeoutException);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.