This commit is contained in:
Tracy Boehrer 2019-09-09 14:34:45 -05:00
Родитель a168d7be55
Коммит a080d9524a
19 изменённых файлов: 111 добавлений и 111 удалений

Просмотреть файл

@ -35,7 +35,7 @@ public interface Attachments {
* @return the observable to the AttachmentInfo object
* @throws IllegalArgumentException thrown if parameters fail the validation
*/
CompletableFuture<AttachmentInfo> getAttachmentInfoAsync(String attachmentId);
CompletableFuture<AttachmentInfo> getAttachmentInfo(String attachmentId);
/**
* GetAttachment.
@ -58,5 +58,5 @@ public interface Attachments {
* @return the observable to the InputStream object
* @throws IllegalArgumentException thrown if parameters fail the validation
*/
CompletableFuture<InputStream> getAttachmentAsync(String attachmentId, String viewId);
CompletableFuture<InputStream> getAttachment(String attachmentId, String viewId);
}

Просмотреть файл

@ -52,7 +52,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ConversationsResult object
*/
CompletableFuture<ConversationsResult> getConversationsAsync();
CompletableFuture<ConversationsResult> getConversations();
/**
* GetConversations.
@ -86,7 +86,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ConversationsResult object
*/
CompletableFuture<ConversationsResult> getConversationsAsync(String continuationToken);
CompletableFuture<ConversationsResult> getConversations(String continuationToken);
/**
* CreateConversation.
@ -102,7 +102,7 @@ public interface Conversations {
* ```
* var resource = await connector.conversations.CreateConversation(new ConversationParameters(){ Bot = bot,
* members = new ChannelAccount[] { new ChannelAccount("user1") } );
* await connect.Conversations.SendToConversationAsync(resource.Id, new Activity() ... ) ;
* await connect.Conversations.SendToConversation(resource.Id, new Activity() ... ) ;
* ```.
*
* @param parameters Parameters to create the conversation from
@ -126,14 +126,14 @@ public interface Conversations {
* ```
* var resource = await connector.conversations.CreateConversation(new ConversationParameters(){ Bot = bot,
* members = new ChannelAccount[] { new ChannelAccount("user1") } );
* await connect.Conversations.SendToConversationAsync(resource.Id, new Activity() ... ) ;
* await connect.Conversations.SendToConversation(resource.Id, new Activity() ... ) ;
* ```
*
* @param parameters Parameters to create the conversation from
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ConversationResourceResponse object
*/
CompletableFuture<ConversationResourceResponse> createConversationAsync(ConversationParameters parameters);
CompletableFuture<ConversationResourceResponse> createConversation(ConversationParameters parameters);
/**
* SendToConversation.
@ -170,7 +170,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ResourceResponse object
*/
CompletableFuture<ResourceResponse> sendToConversationAsync(String conversationId, Activity activity);
CompletableFuture<ResourceResponse> sendToConversation(String conversationId, Activity activity);
/**
* UpdateActivity.
@ -199,7 +199,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ResourceResponse object
*/
CompletableFuture<ResourceResponse> updateActivityAsync(String conversationId, String activityId, Activity activity);
CompletableFuture<ResourceResponse> updateActivity(String conversationId, String activityId, Activity activity);
/**
* ReplyToActivity.
@ -238,7 +238,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ResourceResponse object
*/
CompletableFuture<ResourceResponse> replyToActivityAsync(String conversationId, String activityId, Activity activity);
CompletableFuture<ResourceResponse> replyToActivity(String conversationId, String activityId, Activity activity);
/**
* DeleteActivity.
@ -264,7 +264,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
CompletableFuture<Void> deleteActivityAsync(String conversationId, String activityId);
CompletableFuture<Void> deleteActivity(String conversationId, String activityId);
/**
* GetConversationMembers.
@ -289,7 +289,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the List&lt;ChannelAccount&gt; object
*/
CompletableFuture<List<ChannelAccount>> getConversationMembersAsync(String conversationId);
CompletableFuture<List<ChannelAccount>> getConversationMembers(String conversationId);
/**
* DeleteConversationMember.
@ -315,7 +315,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful.
*/
CompletableFuture<Void> deleteConversationMemberAsync(String conversationId, String memberId);
CompletableFuture<Void> deleteConversationMember(String conversationId, String memberId);
/**
* GetActivityMembers.
@ -342,7 +342,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the List&lt;ChannelAccount&gt; object
*/
CompletableFuture<List<ChannelAccount>> getActivityMembersAsync(String conversationId, String activityId);
CompletableFuture<List<ChannelAccount>> getActivityMembers(String conversationId, String activityId);
/**
* UploadAttachment.
@ -371,7 +371,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ResourceResponse object
*/
CompletableFuture<ResourceResponse> uploadAttachmentAsync(String conversationId, AttachmentData attachmentUpload);
CompletableFuture<ResourceResponse> uploadAttachment(String conversationId, AttachmentData attachmentUpload);
/**
* This method allows you to upload the historic activities to the conversation.
@ -401,7 +401,7 @@ public interface Conversations {
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the ResourceResponse object if successful.
*/
CompletableFuture<ResourceResponse> sendConversationHistoryAsync(String conversationId, Transcript history);
CompletableFuture<ResourceResponse> sendConversationHistory(String conversationId, Transcript history);
/**
* Enumerate the members of a conversation one page at a time.
@ -445,5 +445,5 @@ public interface Conversations {
* @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedMembersResult object if successful.
*/
CompletableFuture<PagedMembersResult> getConversationPagedMembersAsync(String conversationId);
CompletableFuture<PagedMembersResult> getConversationPagedMembers(String conversationId);
}

Просмотреть файл

@ -60,7 +60,7 @@ public class ChannelValidation {
AuthenticationConstants.TO_BOT_FROM_CHANNEL_OPENID_METADATA_URL,
AuthenticationConstants.AllowedSigningAlgorithms);
return tokenExtractor.getIdentityAsync(authHeader, channelId)
return tokenExtractor.getIdentity(authHeader, channelId)
.thenApply(identity -> {
if (identity == null) {
// No valid identity. Not Authorized.
@ -90,7 +90,7 @@ public class ChannelValidation {
throw new AuthenticationException("No Audience Claim");
}
if (!credentials.isValidAppIdAsync(appIdFromAudienceClaim).join()) {
if (!credentials.isValidAppId(appIdFromAudienceClaim).join()) {
throw new AuthenticationException(String.format("Invalid AppId passed on token: '%s'.",
appIdFromAudienceClaim));
}

Просмотреть файл

@ -20,7 +20,7 @@ public interface CredentialProvider {
* @return A task that represents the work queued to execute. If the task is successful, the result is
* true if appId is valid for the controller; otherwise, false.
*/
CompletableFuture<Boolean> isValidAppIdAsync(String appId);
CompletableFuture<Boolean> isValidAppId(String appId);
/**
* Gets the app password for a given bot app ID.
@ -30,7 +30,7 @@ public interface CredentialProvider {
* the result contains the password; otherwise, null. This method is async to enable custom implementations
* that may need to call out to serviced to validate the appId / password pair.
*/
CompletableFuture<String> getAppPasswordAsync(String appId);
CompletableFuture<String> getAppPassword(String appId);
/**
* Checks whether bot authentication is disabled.
@ -39,5 +39,5 @@ public interface CredentialProvider {
* is disabled, the result is true; otherwise, false. This method is async to enable custom implementations
* that may need to call out to serviced to validate the appId / password pair.
*/
CompletableFuture<Boolean> isAuthenticationDisabledAsync();
CompletableFuture<Boolean> isAuthenticationDisabled();
}

Просмотреть файл

@ -129,7 +129,7 @@ public class EmulatorValidation {
openIdMetadataUrl,
AuthenticationConstants.AllowedSigningAlgorithms);
return tokenExtractor.getIdentityAsync(authHeader, channelId, authConfig.requiredEndorsements())
return tokenExtractor.getIdentity(authHeader, channelId, authConfig.requiredEndorsements())
.thenApply(identity -> {
if (identity == null) {
// No valid identity. Not Authorized.
@ -182,7 +182,7 @@ public class EmulatorValidation {
String.format("Unknown Emulator Token version '%s'.", tokenVersion));
}
if (!credentials.isValidAppIdAsync(appId).join()) {
if (!credentials.isValidAppId(appId).join()) {
throw new AuthenticationException(
String.format("Invalid AppId passed on token: '%s'.", appId));
}

Просмотреть файл

@ -80,7 +80,7 @@ public class EnterpriseChannelValidation {
channelService),
AuthenticationConstants.AllowedSigningAlgorithms);
return tokenExtractor.getIdentityAsync(authHeader, channelId, authConfig.requiredEndorsements());
return tokenExtractor.getIdentity(authHeader, channelId, authConfig.requiredEndorsements());
})
.thenCompose(identity -> {
@ -96,7 +96,7 @@ public class EnterpriseChannelValidation {
public static CompletableFuture<ClaimsIdentity> validateIdentity(ClaimsIdentity identity,
CredentialProvider credentials,
String serviceUrl) {
return CompletableFuture.supplyAsync(() -> {
return CompletableFuture.supply(() -> {
if (identity == null || !identity.isAuthenticated()) {
throw new AuthenticationException("Invalid Identity");
}
@ -118,7 +118,7 @@ public class EnterpriseChannelValidation {
throw new AuthenticationException("No Audience Claim");
}
boolean isValid = credentials.isValidAppIdAsync(appIdFromAudienceClaim).join();
boolean isValid = credentials.isValidAppId(appIdFromAudienceClaim).join();
if (!isValid) {
throw new AuthenticationException(
String.format("Invalid AppId passed on token: '%s'.", appIdFromAudienceClaim));

Просмотреть файл

@ -68,7 +68,7 @@ public class GovernmentChannelValidation {
GovernmentAuthenticationConstants.TO_BOT_FROM_CHANNEL_OPENID_METADATA_URL,
AuthenticationConstants.AllowedSigningAlgorithms);
return tokenExtractor.getIdentityAsync(authHeader, channelId, authConfig.requiredEndorsements())
return tokenExtractor.getIdentity(authHeader, channelId, authConfig.requiredEndorsements())
.thenCompose(identity -> {
return validateIdentity(identity, credentials, serviceUrl);
});
@ -89,7 +89,7 @@ public class GovernmentChannelValidation {
CredentialProvider credentials,
String serviceUrl) {
return CompletableFuture.supplyAsync(() -> {
return CompletableFuture.supply(() -> {
if (identity == null || !identity.isAuthenticated()) {
throw new AuthenticationException("Invalid Identity");
}
@ -111,7 +111,7 @@ public class GovernmentChannelValidation {
throw new AuthenticationException("No Audience Claim");
}
boolean isValid = credentials.isValidAppIdAsync(appIdFromAudienceClaim).join();
boolean isValid = credentials.isValidAppId(appIdFromAudienceClaim).join();
if (!isValid) {
throw new AuthenticationException(
String.format("Invalid AppId passed on token: '%s'.", appIdFromAudienceClaim));

Просмотреть файл

@ -39,11 +39,11 @@ public class JwtTokenExtractor {
this.openIdMetadata = openIdMetadataCache.computeIfAbsent(metadataUrl, key -> new OpenIdMetadata(metadataUrl));
}
public CompletableFuture<ClaimsIdentity> getIdentityAsync(String authorizationHeader, String channelId) {
return getIdentityAsync(authorizationHeader, channelId, new ArrayList<>());
public CompletableFuture<ClaimsIdentity> getIdentity(String authorizationHeader, String channelId) {
return getIdentity(authorizationHeader, channelId, new ArrayList<>());
}
public CompletableFuture<ClaimsIdentity> getIdentityAsync(String authorizationHeader,
public CompletableFuture<ClaimsIdentity> getIdentity(String authorizationHeader,
String channelId,
List<String> requiredEndorsements) {
if (authorizationHeader == null) {
@ -52,13 +52,13 @@ public class JwtTokenExtractor {
String[] parts = authorizationHeader.split(" ");
if (parts.length == 2) {
return getIdentityAsync(parts[0], parts[1], channelId, requiredEndorsements);
return getIdentity(parts[0], parts[1], channelId, requiredEndorsements);
}
return CompletableFuture.completedFuture(null);
}
public CompletableFuture<ClaimsIdentity> getIdentityAsync(String schema,
public CompletableFuture<ClaimsIdentity> getIdentity(String schema,
String token,
String channelId,
List<String> requiredEndorsements) {
@ -72,7 +72,7 @@ public class JwtTokenExtractor {
return CompletableFuture.completedFuture(null);
}
return validateTokenAsync(token, channelId, requiredEndorsements);
return validateToken(token, channelId, requiredEndorsements);
}
private boolean hasAllowedIssuer(String token) {
@ -82,7 +82,7 @@ public class JwtTokenExtractor {
}
@SuppressWarnings("unchecked")
private CompletableFuture<ClaimsIdentity> validateTokenAsync(String token,
private CompletableFuture<ClaimsIdentity> validateToken(String token,
String channelId,
List<String> requiredEndorsements) {
DecodedJWT decodedJWT = JWT.decode(token);
@ -92,7 +92,7 @@ public class JwtTokenExtractor {
return CompletableFuture.completedFuture(null);
}
return CompletableFuture.supplyAsync(() -> {
return CompletableFuture.supply(() -> {
Verification verification = JWT.require(Algorithm.RSA256(key.key, null));
try {
verification.build().verify(token);

Просмотреть файл

@ -47,10 +47,10 @@ public class JwtTokenValidation {
CredentialProvider credentials,
ChannelProvider channelProvider,
AuthenticationConfiguration authConfig) {
return CompletableFuture.supplyAsync(() -> {
return CompletableFuture.supply(() -> {
if (StringUtils.isEmpty(authHeader)) {
// No auth header was sent. We might be on the anonymous code path.
boolean isAuthDisable = credentials.isAuthenticationDisabledAsync().join();
boolean isAuthDisable = credentials.isAuthenticationDisabled().join();
if (isAuthDisable) {
// In the scenario where Auth is disabled, we still want to have the
// IsAuthenticated flag set in the ClaimsIdentity. To do this requires

Просмотреть файл

@ -75,8 +75,8 @@ public class OAuthClient extends ServiceClient {
* @param magicCode
* @return CompletableFuture<TokenResponse> on success; otherwise null.
*/
public CompletableFuture<TokenResponse> GetUserTokenAsync(String userId, String connectionName, String magicCode) throws IOException, URISyntaxException, ExecutionException, InterruptedException {
return GetUserTokenAsync(userId, connectionName, magicCode, null);
public CompletableFuture<TokenResponse> GetUserToken(String userId, String connectionName, String magicCode) throws IOException, URISyntaxException, ExecutionException, InterruptedException {
return GetUserToken(userId, connectionName, magicCode, null);
}
protected URI MakeUri(String uri, HashMap<String, String> queryStrings) throws URISyntaxException {
@ -103,7 +103,7 @@ public class OAuthClient extends ServiceClient {
* @param customHeaders
* @return CompletableFuture<TokenResponse> on success; null otherwise.
*/
public CompletableFuture<TokenResponse> GetUserTokenAsync(String userId, String connectionName, String magicCode, Map<String, ArrayList<String>> customHeaders) throws IllegalArgumentException {
public CompletableFuture<TokenResponse> GetUserToken(String userId, String connectionName, String magicCode, Map<String, ArrayList<String>> customHeaders) throws IllegalArgumentException {
if (StringUtils.isEmpty(userId)) {
throw new IllegalArgumentException("userId");
}
@ -111,7 +111,7 @@ public class OAuthClient extends ServiceClient {
throw new IllegalArgumentException("connectionName");
}
return CompletableFuture.supplyAsync(() -> {
return CompletableFuture.supply(() -> {
// Construct URL
HashMap<String, String> qstrings = new HashMap<>();
qstrings.put("userId", userId);
@ -172,7 +172,7 @@ public class OAuthClient extends ServiceClient {
* @param connectionName
* @return True on successful sign-out; False otherwise.
*/
public CompletableFuture<Boolean> SignOutUserAsync(String userId, String connectionName) throws URISyntaxException, IOException {
public CompletableFuture<Boolean> SignOutUser(String userId, String connectionName) throws URISyntaxException, IOException {
if (StringUtils.isEmpty(userId)) {
throw new IllegalArgumentException("userId");
}
@ -180,7 +180,7 @@ public class OAuthClient extends ServiceClient {
throw new IllegalArgumentException("connectionName");
}
return CompletableFuture.supplyAsync(() -> {
return CompletableFuture.supply(() -> {
// Construct URL
HashMap<String, String> qstrings = new HashMap<>();
qstrings.put("userId", userId);
@ -233,7 +233,7 @@ public class OAuthClient extends ServiceClient {
* @param connectionName
* @return Sign in link on success; null otherwise.
*/
public CompletableFuture<String> GetSignInLinkAsync(Activity activity, String connectionName) throws IllegalArgumentException, URISyntaxException, JsonProcessingException {
public CompletableFuture<String> GetSignInLink(Activity activity, String connectionName) throws IllegalArgumentException, URISyntaxException, JsonProcessingException {
if (StringUtils.isEmpty(connectionName)) {
throw new IllegalArgumentException("connectionName");
}
@ -264,7 +264,7 @@ public class OAuthClient extends ServiceClient {
String strUri = String.format("%sapi/botsignin/getsigninurl", this.uri);
final URI tokenUrl = MakeUri(strUri, qstrings);
return CompletableFuture.supplyAsync(() -> {
return CompletableFuture.supply(() -> {
// add botframework api service url to the list of trusted service url's for these app credentials.
MicrosoftAppCredentials.trustServiceUrl(tokenUrl);
@ -299,7 +299,7 @@ public class OAuthClient extends ServiceClient {
* @param emulateOAuthCards
* @return CompletableFuture with no result code
*/
public CompletableFuture SendEmulateOAuthCardsAsync(Boolean emulateOAuthCards) throws URISyntaxException, IOException {
public CompletableFuture SendEmulateOAuthCards(Boolean emulateOAuthCards) throws URISyntaxException, IOException {
// Construct URL
HashMap<String, String> qstrings = new HashMap<>();
@ -310,7 +310,7 @@ public class OAuthClient extends ServiceClient {
// add botframework api service url to the list of trusted service url's for these app credentials.
MicrosoftAppCredentials.trustServiceUrl(tokenUrl);
return CompletableFuture.runAsync(() -> {
return CompletableFuture.run(() -> {
// Construct dummy body
RequestBody body = RequestBody.create(JSON, "{}");

Просмотреть файл

@ -54,7 +54,7 @@ public class SimpleCredentialProvider implements CredentialProvider {
* @return If the task is successful, the result is true if appId is valid for the controller; otherwise, false.
*/
@Override
public CompletableFuture<Boolean> isValidAppIdAsync(String appId) {
public CompletableFuture<Boolean> isValidAppId(String appId) {
return CompletableFuture.completedFuture(StringUtils.equals(appId, this.appId));
}
@ -66,7 +66,7 @@ public class SimpleCredentialProvider implements CredentialProvider {
* contains the password; otherwise, null.
*/
@Override
public CompletableFuture<String> getAppPasswordAsync(String appId) {
public CompletableFuture<String> getAppPassword(String appId) {
return CompletableFuture.completedFuture(StringUtils.equals(appId, this.appId) ? this.password : null);
}
@ -77,7 +77,7 @@ public class SimpleCredentialProvider implements CredentialProvider {
* is disabled, the result is true; otherwise, false.
*/
@Override
public CompletableFuture<Boolean> isAuthenticationDisabledAsync() {
public CompletableFuture<Boolean> isAuthenticationDisabled() {
return CompletableFuture.completedFuture(StringUtils.isEmpty(this.appId));
}
}

Просмотреть файл

@ -76,7 +76,7 @@ public class RestAttachments implements Attachments {
* @return the AttachmentInfo object if successful.
*/
public AttachmentInfo getAttachmentInfo(String attachmentId) {
return getAttachmentInfoAsync(attachmentId).join();
return getAttachmentInfo(attachmentId).join();
}
/**
@ -87,7 +87,7 @@ public class RestAttachments implements Attachments {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the AttachmentInfo object
*/
public CompletableFuture<AttachmentInfo> getAttachmentInfoAsync(String attachmentId) {
public CompletableFuture<AttachmentInfo> getAttachmentInfo(String attachmentId) {
if (attachmentId == null) {
throw new IllegalArgumentException("Parameter attachmentId is required and cannot be null.");
}
@ -125,7 +125,7 @@ public class RestAttachments implements Attachments {
* @return the InputStream object if successful.
*/
public InputStream getAttachment(String attachmentId, String viewId) {
return getAttachmentAsync(attachmentId, viewId).join();
return getAttachment(attachmentId, viewId).join();
}
/**
@ -137,7 +137,7 @@ public class RestAttachments implements Attachments {
* @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the InputStream object
*/
public CompletableFuture<InputStream> getAttachmentAsync(String attachmentId, String viewId) {
public CompletableFuture<InputStream> getAttachment(String attachmentId, String viewId) {
if (attachmentId == null) {
throw new IllegalArgumentException("Parameter attachmentId is required and cannot be null.");
}

Просмотреть файл

@ -145,7 +145,7 @@ public class RestConversations implements Conversations {
*/
@Override
public ConversationsResult getConversations() {
return getConversationsAsync().join();
return getConversations().join();
}
/**
@ -154,8 +154,8 @@ public class RestConversations implements Conversations {
* @see Conversations#getConversationsAsync
*/
@Override
public CompletableFuture<ConversationsResult> getConversationsAsync() {
return getConversationsAsync(null);
public CompletableFuture<ConversationsResult> getConversations() {
return getConversations(null);
}
/**
@ -165,7 +165,7 @@ public class RestConversations implements Conversations {
*/
@Override
public ConversationsResult getConversations(String continuationToken) {
return getConversationsAsync(continuationToken).join();
return getConversations(continuationToken).join();
}
/**
@ -174,7 +174,7 @@ public class RestConversations implements Conversations {
* @see Conversations#getConversationsAsync
*/
@Override
public CompletableFuture<ConversationsResult> getConversationsAsync(String continuationToken) {
public CompletableFuture<ConversationsResult> getConversations(String continuationToken) {
return service.getConversations(continuationToken, this.client.getAcceptLanguage(), this.client.getUserAgent())
.thenApply(responseBodyResponse -> {
try {
@ -203,7 +203,7 @@ public class RestConversations implements Conversations {
*/
@Override
public ConversationResourceResponse createConversation(ConversationParameters parameters) {
return createConversationAsync(parameters).join();
return createConversation(parameters).join();
}
/**
@ -212,7 +212,7 @@ public class RestConversations implements Conversations {
* @see Conversations#createConversationAsync
*/
@Override
public CompletableFuture<ConversationResourceResponse> createConversationAsync(ConversationParameters parameters) {
public CompletableFuture<ConversationResourceResponse> createConversation(ConversationParameters parameters) {
if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
}
@ -248,7 +248,7 @@ public class RestConversations implements Conversations {
*/
@Override
public ResourceResponse sendToConversation(String conversationId, Activity activity) {
return sendToConversationAsync(conversationId, activity).join();
return sendToConversation(conversationId, activity).join();
}
/**
@ -257,7 +257,7 @@ public class RestConversations implements Conversations {
* @see Conversations#sendToConversationAsync
*/
@Override
public CompletableFuture<ResourceResponse> sendToConversationAsync(String conversationId, Activity activity) {
public CompletableFuture<ResourceResponse> sendToConversation(String conversationId, Activity activity) {
if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
}
@ -296,7 +296,7 @@ public class RestConversations implements Conversations {
*/
@Override
public ResourceResponse updateActivity(String conversationId, String activityId, Activity activity) {
return updateActivityAsync(conversationId, activityId, activity).join();
return updateActivity(conversationId, activityId, activity).join();
}
/**
@ -305,7 +305,7 @@ public class RestConversations implements Conversations {
* @see Conversations#updateActivityAsync
*/
@Override
public CompletableFuture<ResourceResponse> updateActivityAsync(String conversationId, String activityId, Activity activity) {
public CompletableFuture<ResourceResponse> updateActivity(String conversationId, String activityId, Activity activity) {
if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
}
@ -347,7 +347,7 @@ public class RestConversations implements Conversations {
*/
@Override
public ResourceResponse replyToActivity(String conversationId, String activityId, Activity activity) {
return replyToActivityAsync(conversationId, activityId, activity).join();
return replyToActivity(conversationId, activityId, activity).join();
}
/**
@ -356,7 +356,7 @@ public class RestConversations implements Conversations {
* @see Conversations#replyToActivityAsync
*/
@Override
public CompletableFuture<ResourceResponse> replyToActivityAsync(String conversationId,
public CompletableFuture<ResourceResponse> replyToActivity(String conversationId,
String activityId,
Activity activity) {
if (conversationId == null) {
@ -400,7 +400,7 @@ public class RestConversations implements Conversations {
*/
@Override
public void deleteActivity(String conversationId, String activityId) {
deleteActivityAsync(conversationId, activityId).join();
deleteActivity(conversationId, activityId).join();
}
/**
@ -409,7 +409,7 @@ public class RestConversations implements Conversations {
* @see Conversations#deleteActivityAsync
*/
@Override
public CompletableFuture<Void> deleteActivityAsync(String conversationId, String activityId) {
public CompletableFuture<Void> deleteActivity(String conversationId, String activityId) {
if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
}
@ -446,7 +446,7 @@ public class RestConversations implements Conversations {
*/
@Override
public List<ChannelAccount> getConversationMembers(String conversationId) {
return getConversationMembersAsync(conversationId).join();
return getConversationMembers(conversationId).join();
}
/**
@ -455,7 +455,7 @@ public class RestConversations implements Conversations {
* @see Conversations#getConversationMembersAsync
*/
@Override
public CompletableFuture<List<ChannelAccount>> getConversationMembersAsync(String conversationId) {
public CompletableFuture<List<ChannelAccount>> getConversationMembers(String conversationId) {
if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
}
@ -487,7 +487,7 @@ public class RestConversations implements Conversations {
*/
@Override
public void deleteConversationMember(String conversationId, String memberId) {
deleteConversationMemberAsync(conversationId, memberId).join();
deleteConversationMember(conversationId, memberId).join();
}
/**
@ -496,7 +496,7 @@ public class RestConversations implements Conversations {
* @see Conversations#deleteConversationMemberAsync
*/
@Override
public CompletableFuture<Void> deleteConversationMemberAsync(String conversationId, String memberId) {
public CompletableFuture<Void> deleteConversationMember(String conversationId, String memberId) {
if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
}
@ -534,7 +534,7 @@ public class RestConversations implements Conversations {
*/
@Override
public List<ChannelAccount> getActivityMembers(String conversationId, String activityId) {
return getActivityMembersAsync(conversationId, activityId).join();
return getActivityMembers(conversationId, activityId).join();
}
/**
@ -543,7 +543,7 @@ public class RestConversations implements Conversations {
* @see Conversations#getActivityMembersAsync
*/
@Override
public CompletableFuture<List<ChannelAccount>> getActivityMembersAsync(String conversationId, String activityId) {
public CompletableFuture<List<ChannelAccount>> getActivityMembers(String conversationId, String activityId) {
if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
}
@ -579,7 +579,7 @@ public class RestConversations implements Conversations {
*/
@Override
public ResourceResponse uploadAttachment(String conversationId, AttachmentData attachmentUpload) {
return uploadAttachmentAsync(conversationId, attachmentUpload).join();
return uploadAttachment(conversationId, attachmentUpload).join();
}
/**
@ -588,7 +588,7 @@ public class RestConversations implements Conversations {
* @see Conversations#uploadAttachmentAsync
*/
@Override
public CompletableFuture<ResourceResponse> uploadAttachmentAsync(String conversationId, AttachmentData attachmentUpload) {
public CompletableFuture<ResourceResponse> uploadAttachment(String conversationId, AttachmentData attachmentUpload) {
if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
}
@ -628,7 +628,7 @@ public class RestConversations implements Conversations {
*/
@Override
public ResourceResponse sendConversationHistory(String conversationId, Transcript history) {
return sendConversationHistoryAsync(conversationId, history).join();
return sendConversationHistory(conversationId, history).join();
}
/**
@ -637,7 +637,7 @@ public class RestConversations implements Conversations {
* @see Conversations#sendConversationHistoryAsync
*/
@Override
public CompletableFuture<ResourceResponse> sendConversationHistoryAsync(String conversationId, Transcript history) {
public CompletableFuture<ResourceResponse> sendConversationHistory(String conversationId, Transcript history) {
if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
}
@ -677,7 +677,7 @@ public class RestConversations implements Conversations {
*/
@Override
public PagedMembersResult getConversationPagedMembers(String conversationId){
return getConversationPagedMembersAsync(conversationId).join();
return getConversationPagedMembers(conversationId).join();
}
/**
@ -686,7 +686,7 @@ public class RestConversations implements Conversations {
* @see Conversations#getConversationPagedMembersAsync
*/
@Override
public CompletableFuture<PagedMembersResult> getConversationPagedMembersAsync(String conversationId){
public CompletableFuture<PagedMembersResult> getConversationPagedMembers(String conversationId){
if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
}

Просмотреть файл

@ -35,13 +35,13 @@ public class OAuthConnectorTest extends OAuthTestBase {
@Test(expected = IllegalArgumentException.class)
public void GetUserToken_ShouldThrowOnEmptyUserId() throws URISyntaxException, IOException, ExecutionException, InterruptedException {
OAuthClient client = new OAuthClient(this.connector, "https://localhost");
client.GetUserTokenAsync("", "mockConnection", "");
client.GetUserToken("", "mockConnection", "");
}
@Test(expected = IllegalArgumentException.class)
public void GetUserToken_ShouldThrowOnEmptyConnectionName() throws URISyntaxException, IOException, ExecutionException, InterruptedException {
OAuthClient client = new OAuthClient(this.connector, "https://localhost");
client.GetUserTokenAsync("userid", "", "");
client.GetUserToken("userid", "", "");
}
/*
TODO: Need to set up a bot and login with AADv2 to perform new recording (or convert the C# recordings)
@ -53,7 +53,7 @@ public class OAuthConnectorTest extends OAuthTestBase {
TokenResponse token = null;
try {
System.out.println("This is a test asdfasdfasdf");
token = await(client.GetUserTokenAsync("default-user", "mygithubconnection", ""));
token = await(client.GetUserToken("default-user", "mygithubconnection", ""));
if (null==token) {
System.out.println(String.format("This is a test 2 - NULL TOKEN"));
System.out.flush();
@ -84,7 +84,7 @@ public class OAuthConnectorTest extends OAuthTestBase {
public async Task GetUserToken_ShouldReturnNullOnInvalidConnectionString() throws URISyntaxException {
await UseOAuthClientFor(async client =>
{
var token = await client.GetUserTokenAsync("default-user", "mygithubconnection1", "");
var token = await client.GetUserToken("default-user", "mygithubconnection1", "");
Assert.Null(token);
});
}
@ -100,7 +100,7 @@ public async Task GetUserToken_ShouldReturnNullOnInvalidConnectionString() throw
// };
// await UseOAuthClientFor(async client =>
// {
// var uri = await client.GetSignInLinkAsync(activity, "mygithubconnection");
// var uri = await client.GetSignInLink(activity, "mygithubconnection");
// Assert.False(string.IsNullOrEmpty(uri));
// Uri uriResult;
// Assert.True(Uri.TryCreate(uri, UriKind.Absolute, out uriResult) && uriResult.Scheme == Uri.UriSchemeHttps);
@ -110,26 +110,26 @@ public async Task GetUserToken_ShouldReturnNullOnInvalidConnectionString() throw
@Test
public async Task SignOutUser_ShouldThrowOnEmptyUserId() throws URISyntaxException {
var client = new OAuthClient(mockConnectorClient, "https://localhost");
await Assert.ThrowsAsync<ArgumentNullException>(() => client.SignOutUserAsync("", "mockConnection"));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.SignOutUser("", "mockConnection"));
}
@Test
public async Task SignOutUser_ShouldThrowOnEmptyConnectionName() throws URISyntaxException {
var client = new OAuthClient(mockConnectorClient, "https://localhost");
await Assert.ThrowsAsync<ArgumentNullException>(() => client.SignOutUserAsync("userid", ""));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.SignOutUser("userid", ""));
}
@Test
public async Task GetSigninLink_ShouldThrowOnEmptyConnectionName() throws URISyntaxException {
var activity = new Activity();
var client = new OAuthClient(mockConnectorClient, "https://localhost");
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetSignInLinkAsync(activity, ""));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetSignInLink(activity, ""));
}
@Test
public async Task GetSigninLink_ShouldThrowOnNullActivity() throws URISyntaxException {
var client = new OAuthClient(mockConnectorClient, "https://localhost");
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetSignInLinkAsync(null, "mockConnection"));
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetSignInLink(null, "mockConnection"));
}
*/
}

Просмотреть файл

@ -106,7 +106,7 @@ public class OAuthTestBase extends TestBase {
}
public CompletableFuture<Void> UseOAuthClientFor(Function<OAuthClient, CompletableFuture<Void>> doTest, String className, String methodName) throws MalformedURLException, URISyntaxException {
return CompletableFuture.runAsync(() -> {
return CompletableFuture.run(() -> {
OAuthClient oauthClient = null;
try {
oauthClient = new OAuthClient(this.connector, AuthenticationConstants.OAUTH_URL);

Просмотреть файл

@ -9,24 +9,24 @@ import org.junit.Test;
public class SimpleCredentialProviderTests {
@Test
public void ValidAppIdAsync() {
public void ValidAppId() {
SimpleCredentialProvider credentialProvider = new SimpleCredentialProvider("appid", "pwd");
Assert.assertTrue(credentialProvider.isValidAppIdAsync("appid").join());
Assert.assertFalse(credentialProvider.isValidAppIdAsync("wrongappid").join());
Assert.assertTrue(credentialProvider.isValidAppId("appid").join());
Assert.assertFalse(credentialProvider.isValidAppId("wrongappid").join());
}
@Test
public void AppPasswordAsync() {
public void AppPassword() {
SimpleCredentialProvider credentialProvider = new SimpleCredentialProvider("appid", "pwd");
Assert.assertEquals(credentialProvider.getAppPasswordAsync("appid").join(), "pwd");
Assert.assertNull(credentialProvider.getAppPasswordAsync("wrongappid").join());
Assert.assertEquals(credentialProvider.getAppPassword("appid").join(), "pwd");
Assert.assertNull(credentialProvider.getAppPassword("wrongappid").join());
}
@Test
public void AuthenticationDisabledAsync() {
Assert.assertFalse(new SimpleCredentialProvider("appid", "pwd").isAuthenticationDisabledAsync().join());
Assert.assertTrue(new SimpleCredentialProvider(null, null).isAuthenticationDisabledAsync().join());
public void AuthenticationDisabled() {
Assert.assertFalse(new SimpleCredentialProvider("appid", "pwd").isAuthenticationDisabled().join());
Assert.assertTrue(new SimpleCredentialProvider(null, null).isAuthenticationDisabled().join());
}
}

Просмотреть файл

@ -58,7 +58,7 @@ public delegate Task ResumeAfter<in T>(IDialogContext context, IAwaitable<T> res
* @param context The dialog context.
* @return A task that represents the start code for a dialog.
*/
//public delegate Task StartAsync(IDialogContext context);
//public delegate Task Start(IDialogContext context);
@ -88,7 +88,7 @@ public static partial class Extensions
* @return A task that represents the post operation.
*/
/*
public static async Task PostAsync(this BotToUser botToUser, string text, string locale = null)
public static async Task Post(this BotToUser botToUser, string text, string locale = null)
{
var message = botToUser.MakeMessage();
message.Text = text;
@ -98,7 +98,7 @@ public static partial class Extensions
message.Locale = locale;
}
await botToUser.PostAsync(message);
await botToUser.Post(message);
}
*/
@ -115,7 +115,7 @@ public static partial class Extensions
* @param locale The locale of the text.
* @return A task that represents the post operation.
*/
/* public static async Task SayAsync(this BotToUser botToUser, string text, string speak = null, MessageOptions options = null, string locale = null)
/* public static async Task Say(this BotToUser botToUser, string text, string speak = null, MessageOptions options = null, string locale = null)
{
var message = botToUser.MakeMessage();
@ -136,7 +136,7 @@ public static partial class Extensions
message.Entities = options.Entities;
}
await botToUser.PostAsync(message);
await botToUser.Post(message);
}*/
/**

Просмотреть файл

@ -4,7 +4,7 @@ import com.microsoft.bot.schema.AttachmentLayoutTypes;
import com.microsoft.bot.schema.TextFormatTypes;
/**
* Optional message properties that can be sent {@link Extensions.SayAsync(BotToUser, String MessageOptions,)}
* Optional message properties that can be sent {@link Extensions.Say(BotToUser, String MessageOptions,)}
*/
public class MessageOptions
{

Просмотреть файл

@ -158,7 +158,7 @@
"Conversations"
],
"summary": "CreateConversation",
"description": "Create a new Conversation.\r\n\r\nPOST to this method with a\r\n* Bot being the bot creating the conversation\r\n* IsGroup set to true if this is not a direct message (default is false)\r\n* Array containing the members to include in the conversation\r\n\r\nThe return value is a ResourceResponse which contains a conversation id which is suitable for use\r\nin the message payload and REST API uris.\r\n\r\nMost channels only support the semantics of bots initiating a direct message conversation. An example of how to do that would be:\r\n\r\n```\r\nvar resource = await connector.conversations.CreateConversation(new ConversationParameters(){ Bot = bot, members = new ChannelAccount[] { new ChannelAccount(\"user1\") } );\r\nawait connect.Conversations.SendToConversationAsync(resource.Id, new Activity() ... ) ;\r\n\r\n```",
"description": "Create a new Conversation.\r\n\r\nPOST to this method with a\r\n* Bot being the bot creating the conversation\r\n* IsGroup set to true if this is not a direct message (default is false)\r\n* Array containing the members to include in the conversation\r\n\r\nThe return value is a ResourceResponse which contains a conversation id which is suitable for use\r\nin the message payload and REST API uris.\r\n\r\nMost channels only support the semantics of bots initiating a direct message conversation. An example of how to do that would be:\r\n\r\n```\r\nvar resource = await connector.conversations.CreateConversation(new ConversationParameters(){ Bot = bot, members = new ChannelAccount[] { new ChannelAccount(\"user1\") } );\r\nawait connect.Conversations.SendToConversation(resource.Id, new Activity() ... ) ;\r\n\r\n```",
"operationId": "Conversations_CreateConversation",
"consumes": [
"application/json",
@ -2671,4 +2671,4 @@
"in": "header"
}
}
}
}