本文整理汇总了Java中com.datastax.driver.core.exceptions.AuthenticationException类的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationException类的具体用法?Java AuthenticationException怎么用?Java AuthenticationException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticationException类属于com.datastax.driver.core.exceptions包,在下文中一共展示了AuthenticationException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkCassandraException
import com.datastax.driver.core.exceptions.AuthenticationException; //导入依赖的package包/类
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);
}
}
示例2: checkCassandraReachable
import com.datastax.driver.core.exceptions.AuthenticationException; //导入依赖的package包/类
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;
}
示例3: testNoUsername
import com.datastax.driver.core.exceptions.AuthenticationException; //导入依赖的package包/类
@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.");
}
示例4: testShouldReturnAuthenticationError
import com.datastax.driver.core.exceptions.AuthenticationException; //导入依赖的package包/类
@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();
}