Java 类com.datastax.driver.core.exceptions.AuthenticationException 实例源码

项目:storm-cassandra-cql    文件:CassandraCqlMapState.java   
protected void checkCassandraException(Exception e) {
    _mexceptions.incr();
    if (e instanceof AlreadyExistsException ||
            e instanceof AuthenticationException ||
            e instanceof DriverException ||
            e instanceof DriverInternalError ||
            e instanceof InvalidConfigurationInQueryException ||
            e instanceof InvalidQueryException ||
            e instanceof InvalidTypeException ||
            e instanceof QueryExecutionException ||
            e instanceof QueryTimeoutException ||
            e instanceof QueryValidationException ||
            e instanceof ReadTimeoutException ||
            e instanceof SyntaxError ||
            e instanceof TraceRetrievalException ||
            e instanceof TruncateException ||
            e instanceof UnauthorizedException ||
            e instanceof UnavailableException ||
            e instanceof ReadTimeoutException ||
            e instanceof WriteTimeoutException) {
        throw new ReportedFailedException(e);
    } else {
        throw new RuntimeException(e);
    }
}
项目:datacollector    文件:CassandraTarget.java   
private boolean checkCassandraReachable(List<ConfigIssue> issues) {
  boolean isReachable = true;
  try (Cluster validationCluster = getCluster()) {
    Session validationSession = validationCluster.connect();
    validationSession.close();
  } catch (NoHostAvailableException | AuthenticationException | IllegalStateException | StageException e) {
    isReachable = false;
    Target.Context context = getContext();
    LOG.error(Errors.CASSANDRA_05.getMessage(), e.toString(), e);
    issues.add(
        context.createConfigIssue(
        Groups.CASSANDRA.name(),
        CONTACT_NODES_LABEL,
        Errors.CASSANDRA_05, e.toString()
        )
    );
  }
  return isReachable;
}
项目:jmeter-cassandra    文件:UserPassConnectionTest.java   
@Test
public void testNoUsername() {
    CassandraConnection cc = new CassandraConnection();

    cc.setProperty("contactPoints", NODE_1_IP);
    cc.setProperty("sessionName", "testsession2");

    Boolean exeptionCaught=false;

    try {
        cc.testStarted();
    } catch (AuthenticationException e) {
        exeptionCaught = true;
    }
    assertTrue(exeptionCaught, "AuthenticationException did not occur.");
}
项目:simulacron    文件:ErrorResultIntegrationTest.java   
@Test
public void testShouldReturnAuthenticationError() throws Exception {
  String message = "Invalid password, man!";
  server.prime(when(query).then(authenticationError(message)));

  thrown.expect(AuthenticationException.class);
  thrown.expectMessage(endsWith(message));
  query();
}