org.wildfly.common.Assert.assertTrue()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(5.7k)|赞(0)|评价(0)|浏览(189)

本文整理了Java中org.wildfly.common.Assert.assertTrue()方法的一些代码示例,展示了Assert.assertTrue()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Assert.assertTrue()方法的具体详情如下:
包路径:org.wildfly.common.Assert
类名称:Assert
方法名:assertTrue

Assert.assertTrue介绍

[英]Assert that the given expression is always true.
[中]断言给定的表达式始终为真。

代码示例

代码示例来源:origin: wildfly/wildfly

private void runReadTask() {
  Assert.assertTrue(pooledByteBuffer == null);
  channel.getReadSetter().set(channelListener);
  channel.wakeupReads(); //should just be resume, see UNDERTOW-1192
}

代码示例来源:origin: wildfly/wildfly

public OAuth2InitialClientMessage getInitialResponse() throws AuthenticationMechanismException {
  final CredentialCallback credentialCallback = new CredentialCallback(BearerTokenCredential.class);
  try {
    MechanismUtil.handleCallbacks(log, this.callbackHandler, credentialCallback);
  } catch (UnsupportedCallbackException e) {
    throw log.mechCallbackHandlerUnsupportedCallback(e);
  }
  assertTrue(credentialCallback.isCredentialTypeSupported(BearerTokenCredential.class));
  final String token = credentialCallback.applyToCredential(BearerTokenCredential.class, BearerTokenCredential::getToken);
  if (token == null) {
    throw log.mechNoTokenGiven();
  }
  final ByteStringBuilder encoded = new ByteStringBuilder();
  encoded.append("n").append(",");
  if (this.authorizationId != null) {
    encoded.append('a').append('=');
    StringPrep.encode(this.authorizationId, encoded, StringPrep.PROFILE_SASL_STORED | StringPrep.MAP_SCRAM_LOGIN_CHARS);
  }
  encoded.append(",").append(KV_DELIMITER).append("auth").append("=").append("Bearer").append(" ").append(token).append(KV_DELIMITER);
  return new OAuth2InitialClientMessage(null, null, encoded.toArray());
}

代码示例来源:origin: org.wildfly.wildfly-http-client/wildfly-http-client-common

private void runReadTask() {
  Assert.assertTrue(pooledByteBuffer == null);
  channel.getReadSetter().set(channelListener);
  channel.wakeupReads(); //should just be resume, see UNDERTOW-1192
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

private void runReadTask() {
  Assert.assertTrue(pooledByteBuffer == null);
  channel.getReadSetter().set(channelListener);
  channel.wakeupReads(); //should just be resume, see UNDERTOW-1192
}

代码示例来源:origin: org.jboss.eap/wildfly-client-all

public OAuth2InitialClientMessage getInitialResponse() throws AuthenticationMechanismException {
  final CredentialCallback credentialCallback = new CredentialCallback(BearerTokenCredential.class);
  try {
    MechanismUtil.handleCallbacks(log, this.callbackHandler, credentialCallback);
  } catch (UnsupportedCallbackException e) {
    throw log.mechCallbackHandlerUnsupportedCallback(e);
  }
  assertTrue(credentialCallback.isCredentialTypeSupported(BearerTokenCredential.class));
  final String token = credentialCallback.applyToCredential(BearerTokenCredential.class, BearerTokenCredential::getToken);
  if (token == null) {
    throw log.mechNoTokenGiven();
  }
  final ByteStringBuilder encoded = new ByteStringBuilder();
  encoded.append("n").append(",");
  if (this.authorizationId != null) {
    encoded.append('a').append('=');
    StringPrep.encode(this.authorizationId, encoded, StringPrep.PROFILE_SASL_STORED | StringPrep.MAP_SCRAM_LOGIN_CHARS);
  }
  encoded.append(",").append(KV_DELIMITER).append("auth").append("=").append("Bearer").append(" ").append(token).append(KV_DELIMITER);
  return new OAuth2InitialClientMessage(null, null, encoded.toArray());
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron

public OAuth2InitialClientMessage getInitialResponse() throws AuthenticationMechanismException {
  final CredentialCallback credentialCallback = new CredentialCallback(BearerTokenCredential.class);
  try {
    MechanismUtil.handleCallbacks(log, this.callbackHandler, credentialCallback);
  } catch (UnsupportedCallbackException e) {
    throw log.mechCallbackHandlerUnsupportedCallback(e);
  }
  assertTrue(credentialCallback.isCredentialTypeSupported(BearerTokenCredential.class));
  final String token = credentialCallback.applyToCredential(BearerTokenCredential.class, BearerTokenCredential::getToken);
  if (token == null) {
    throw log.mechNoTokenGiven();
  }
  final ByteStringBuilder encoded = new ByteStringBuilder();
  encoded.append("n").append(",");
  if (this.authorizationId != null) {
    encoded.append('a').append('=');
    StringPrep.encode(this.authorizationId, encoded, StringPrep.PROFILE_SASL_STORED | StringPrep.MAP_SCRAM_LOGIN_CHARS);
  }
  encoded.append(",").append(KV_DELIMITER).append("auth").append("=").append("Bearer").append(" ").append(token).append(KV_DELIMITER);
  return new OAuth2InitialClientMessage(null, null, encoded.toArray());
}

代码示例来源:origin: org.wildfly.security/wildfly-elytron-mechanism-oauth2

public OAuth2InitialClientMessage getInitialResponse() throws AuthenticationMechanismException {
  final CredentialCallback credentialCallback = new CredentialCallback(BearerTokenCredential.class);
  try {
    MechanismUtil.handleCallbacks(log, this.callbackHandler, credentialCallback);
  } catch (UnsupportedCallbackException e) {
    throw log.mechCallbackHandlerUnsupportedCallback(e);
  }
  assertTrue(credentialCallback.isCredentialTypeSupported(BearerTokenCredential.class));
  final String token = credentialCallback.applyToCredential(BearerTokenCredential.class, BearerTokenCredential::getToken);
  if (token == null) {
    throw log.mechNoTokenGiven();
  }
  final ByteStringBuilder encoded = new ByteStringBuilder();
  encoded.append("n").append(",");
  if (this.authorizationId != null) {
    encoded.append('a').append('=');
    StringPrep.encode(this.authorizationId, encoded, StringPrep.PROFILE_SASL_STORED | StringPrep.MAP_SCRAM_LOGIN_CHARS);
  }
  encoded.append(",").append(KV_DELIMITER).append("auth").append("=").append("Bearer").append(" ").append(token).append(KV_DELIMITER);
  return new OAuth2InitialClientMessage(null, null, encoded.toArray());
}

相关文章