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 * @return the observable to the AttachmentInfo object
* @throws IllegalArgumentException thrown if parameters fail the validation * @throws IllegalArgumentException thrown if parameters fail the validation
*/ */
CompletableFuture<AttachmentInfo> getAttachmentInfoAsync(String attachmentId); CompletableFuture<AttachmentInfo> getAttachmentInfo(String attachmentId);
/** /**
* GetAttachment. * GetAttachment.
@ -58,5 +58,5 @@ public interface Attachments {
* @return the observable to the InputStream object * @return the observable to the InputStream object
* @throws IllegalArgumentException thrown if parameters fail the validation * @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 * @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ConversationsResult object * @return the observable to the ConversationsResult object
*/ */
CompletableFuture<ConversationsResult> getConversationsAsync(); CompletableFuture<ConversationsResult> getConversations();
/** /**
* GetConversations. * GetConversations.
@ -86,7 +86,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation * @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ConversationsResult object * @return the observable to the ConversationsResult object
*/ */
CompletableFuture<ConversationsResult> getConversationsAsync(String continuationToken); CompletableFuture<ConversationsResult> getConversations(String continuationToken);
/** /**
* CreateConversation. * CreateConversation.
@ -102,7 +102,7 @@ public interface Conversations {
* ``` * ```
* var resource = await connector.conversations.CreateConversation(new ConversationParameters(){ Bot = bot, * var resource = await connector.conversations.CreateConversation(new ConversationParameters(){ Bot = bot,
* members = new ChannelAccount[] { new ChannelAccount("user1") } ); * 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 * @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, * var resource = await connector.conversations.CreateConversation(new ConversationParameters(){ Bot = bot,
* members = new ChannelAccount[] { new ChannelAccount("user1") } ); * 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 * @param parameters Parameters to create the conversation from
* @throws IllegalArgumentException thrown if parameters fail the validation * @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ConversationResourceResponse object * @return the observable to the ConversationResourceResponse object
*/ */
CompletableFuture<ConversationResourceResponse> createConversationAsync(ConversationParameters parameters); CompletableFuture<ConversationResourceResponse> createConversation(ConversationParameters parameters);
/** /**
* SendToConversation. * SendToConversation.
@ -170,7 +170,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation * @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ResourceResponse object * @return the observable to the ResourceResponse object
*/ */
CompletableFuture<ResourceResponse> sendToConversationAsync(String conversationId, Activity activity); CompletableFuture<ResourceResponse> sendToConversation(String conversationId, Activity activity);
/** /**
* UpdateActivity. * UpdateActivity.
@ -199,7 +199,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation * @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ResourceResponse object * @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. * ReplyToActivity.
@ -238,7 +238,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation * @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ResourceResponse object * @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. * DeleteActivity.
@ -264,7 +264,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation * @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful. * @return the {@link ServiceResponse} object if successful.
*/ */
CompletableFuture<Void> deleteActivityAsync(String conversationId, String activityId); CompletableFuture<Void> deleteActivity(String conversationId, String activityId);
/** /**
* GetConversationMembers. * GetConversationMembers.
@ -289,7 +289,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation * @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the List&lt;ChannelAccount&gt; object * @return the observable to the List&lt;ChannelAccount&gt; object
*/ */
CompletableFuture<List<ChannelAccount>> getConversationMembersAsync(String conversationId); CompletableFuture<List<ChannelAccount>> getConversationMembers(String conversationId);
/** /**
* DeleteConversationMember. * DeleteConversationMember.
@ -315,7 +315,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation * @throws IllegalArgumentException thrown if parameters fail the validation
* @return the {@link ServiceResponse} object if successful. * @return the {@link ServiceResponse} object if successful.
*/ */
CompletableFuture<Void> deleteConversationMemberAsync(String conversationId, String memberId); CompletableFuture<Void> deleteConversationMember(String conversationId, String memberId);
/** /**
* GetActivityMembers. * GetActivityMembers.
@ -342,7 +342,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation * @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the List&lt;ChannelAccount&gt; object * @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. * UploadAttachment.
@ -371,7 +371,7 @@ public interface Conversations {
* @throws IllegalArgumentException thrown if parameters fail the validation * @throws IllegalArgumentException thrown if parameters fail the validation
* @return the observable to the ResourceResponse object * @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. * 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 * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the ResourceResponse object if successful. * @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. * 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 * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @return the PagedMembersResult object if successful. * @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.TO_BOT_FROM_CHANNEL_OPENID_METADATA_URL,
AuthenticationConstants.AllowedSigningAlgorithms); AuthenticationConstants.AllowedSigningAlgorithms);
return tokenExtractor.getIdentityAsync(authHeader, channelId) return tokenExtractor.getIdentity(authHeader, channelId)
.thenApply(identity -> { .thenApply(identity -> {
if (identity == null) { if (identity == null) {
// No valid identity. Not Authorized. // No valid identity. Not Authorized.
@ -90,7 +90,7 @@ public class ChannelValidation {
throw new AuthenticationException("No Audience Claim"); 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'.", throw new AuthenticationException(String.format("Invalid AppId passed on token: '%s'.",
appIdFromAudienceClaim)); 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 * @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. * 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. * 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 * 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. * 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. * 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 * 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. * 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, openIdMetadataUrl,
AuthenticationConstants.AllowedSigningAlgorithms); AuthenticationConstants.AllowedSigningAlgorithms);
return tokenExtractor.getIdentityAsync(authHeader, channelId, authConfig.requiredEndorsements()) return tokenExtractor.getIdentity(authHeader, channelId, authConfig.requiredEndorsements())
.thenApply(identity -> { .thenApply(identity -> {
if (identity == null) { if (identity == null) {
// No valid identity. Not Authorized. // No valid identity. Not Authorized.
@ -182,7 +182,7 @@ public class EmulatorValidation {
String.format("Unknown Emulator Token version '%s'.", tokenVersion)); String.format("Unknown Emulator Token version '%s'.", tokenVersion));
} }
if (!credentials.isValidAppIdAsync(appId).join()) { if (!credentials.isValidAppId(appId).join()) {
throw new AuthenticationException( throw new AuthenticationException(
String.format("Invalid AppId passed on token: '%s'.", appId)); String.format("Invalid AppId passed on token: '%s'.", appId));
} }

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

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

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

@ -68,7 +68,7 @@ public class GovernmentChannelValidation {
GovernmentAuthenticationConstants.TO_BOT_FROM_CHANNEL_OPENID_METADATA_URL, GovernmentAuthenticationConstants.TO_BOT_FROM_CHANNEL_OPENID_METADATA_URL,
AuthenticationConstants.AllowedSigningAlgorithms); AuthenticationConstants.AllowedSigningAlgorithms);
return tokenExtractor.getIdentityAsync(authHeader, channelId, authConfig.requiredEndorsements()) return tokenExtractor.getIdentity(authHeader, channelId, authConfig.requiredEndorsements())
.thenCompose(identity -> { .thenCompose(identity -> {
return validateIdentity(identity, credentials, serviceUrl); return validateIdentity(identity, credentials, serviceUrl);
}); });
@ -89,7 +89,7 @@ public class GovernmentChannelValidation {
CredentialProvider credentials, CredentialProvider credentials,
String serviceUrl) { String serviceUrl) {
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supply(() -> {
if (identity == null || !identity.isAuthenticated()) { if (identity == null || !identity.isAuthenticated()) {
throw new AuthenticationException("Invalid Identity"); throw new AuthenticationException("Invalid Identity");
} }
@ -111,7 +111,7 @@ public class GovernmentChannelValidation {
throw new AuthenticationException("No Audience Claim"); throw new AuthenticationException("No Audience Claim");
} }
boolean isValid = credentials.isValidAppIdAsync(appIdFromAudienceClaim).join(); boolean isValid = credentials.isValidAppId(appIdFromAudienceClaim).join();
if (!isValid) { if (!isValid) {
throw new AuthenticationException( throw new AuthenticationException(
String.format("Invalid AppId passed on token: '%s'.", appIdFromAudienceClaim)); 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)); this.openIdMetadata = openIdMetadataCache.computeIfAbsent(metadataUrl, key -> new OpenIdMetadata(metadataUrl));
} }
public CompletableFuture<ClaimsIdentity> getIdentityAsync(String authorizationHeader, String channelId) { public CompletableFuture<ClaimsIdentity> getIdentity(String authorizationHeader, String channelId) {
return getIdentityAsync(authorizationHeader, channelId, new ArrayList<>()); return getIdentity(authorizationHeader, channelId, new ArrayList<>());
} }
public CompletableFuture<ClaimsIdentity> getIdentityAsync(String authorizationHeader, public CompletableFuture<ClaimsIdentity> getIdentity(String authorizationHeader,
String channelId, String channelId,
List<String> requiredEndorsements) { List<String> requiredEndorsements) {
if (authorizationHeader == null) { if (authorizationHeader == null) {
@ -52,13 +52,13 @@ public class JwtTokenExtractor {
String[] parts = authorizationHeader.split(" "); String[] parts = authorizationHeader.split(" ");
if (parts.length == 2) { if (parts.length == 2) {
return getIdentityAsync(parts[0], parts[1], channelId, requiredEndorsements); return getIdentity(parts[0], parts[1], channelId, requiredEndorsements);
} }
return CompletableFuture.completedFuture(null); return CompletableFuture.completedFuture(null);
} }
public CompletableFuture<ClaimsIdentity> getIdentityAsync(String schema, public CompletableFuture<ClaimsIdentity> getIdentity(String schema,
String token, String token,
String channelId, String channelId,
List<String> requiredEndorsements) { List<String> requiredEndorsements) {
@ -72,7 +72,7 @@ public class JwtTokenExtractor {
return CompletableFuture.completedFuture(null); return CompletableFuture.completedFuture(null);
} }
return validateTokenAsync(token, channelId, requiredEndorsements); return validateToken(token, channelId, requiredEndorsements);
} }
private boolean hasAllowedIssuer(String token) { private boolean hasAllowedIssuer(String token) {
@ -82,7 +82,7 @@ public class JwtTokenExtractor {
} }
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private CompletableFuture<ClaimsIdentity> validateTokenAsync(String token, private CompletableFuture<ClaimsIdentity> validateToken(String token,
String channelId, String channelId,
List<String> requiredEndorsements) { List<String> requiredEndorsements) {
DecodedJWT decodedJWT = JWT.decode(token); DecodedJWT decodedJWT = JWT.decode(token);
@ -92,7 +92,7 @@ public class JwtTokenExtractor {
return CompletableFuture.completedFuture(null); return CompletableFuture.completedFuture(null);
} }
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supply(() -> {
Verification verification = JWT.require(Algorithm.RSA256(key.key, null)); Verification verification = JWT.require(Algorithm.RSA256(key.key, null));
try { try {
verification.build().verify(token); verification.build().verify(token);

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

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

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

@ -75,8 +75,8 @@ public class OAuthClient extends ServiceClient {
* @param magicCode * @param magicCode
* @return CompletableFuture<TokenResponse> on success; otherwise null. * @return CompletableFuture<TokenResponse> on success; otherwise null.
*/ */
public CompletableFuture<TokenResponse> GetUserTokenAsync(String userId, String connectionName, String magicCode) throws IOException, URISyntaxException, ExecutionException, InterruptedException { public CompletableFuture<TokenResponse> GetUserToken(String userId, String connectionName, String magicCode) throws IOException, URISyntaxException, ExecutionException, InterruptedException {
return GetUserTokenAsync(userId, connectionName, magicCode, null); return GetUserToken(userId, connectionName, magicCode, null);
} }
protected URI MakeUri(String uri, HashMap<String, String> queryStrings) throws URISyntaxException { protected URI MakeUri(String uri, HashMap<String, String> queryStrings) throws URISyntaxException {
@ -103,7 +103,7 @@ public class OAuthClient extends ServiceClient {
* @param customHeaders * @param customHeaders
* @return CompletableFuture<TokenResponse> on success; null otherwise. * @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)) { if (StringUtils.isEmpty(userId)) {
throw new IllegalArgumentException("userId"); throw new IllegalArgumentException("userId");
} }
@ -111,7 +111,7 @@ public class OAuthClient extends ServiceClient {
throw new IllegalArgumentException("connectionName"); throw new IllegalArgumentException("connectionName");
} }
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supply(() -> {
// Construct URL // Construct URL
HashMap<String, String> qstrings = new HashMap<>(); HashMap<String, String> qstrings = new HashMap<>();
qstrings.put("userId", userId); qstrings.put("userId", userId);
@ -172,7 +172,7 @@ public class OAuthClient extends ServiceClient {
* @param connectionName * @param connectionName
* @return True on successful sign-out; False otherwise. * @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)) { if (StringUtils.isEmpty(userId)) {
throw new IllegalArgumentException("userId"); throw new IllegalArgumentException("userId");
} }
@ -180,7 +180,7 @@ public class OAuthClient extends ServiceClient {
throw new IllegalArgumentException("connectionName"); throw new IllegalArgumentException("connectionName");
} }
return CompletableFuture.supplyAsync(() -> { return CompletableFuture.supply(() -> {
// Construct URL // Construct URL
HashMap<String, String> qstrings = new HashMap<>(); HashMap<String, String> qstrings = new HashMap<>();
qstrings.put("userId", userId); qstrings.put("userId", userId);
@ -233,7 +233,7 @@ public class OAuthClient extends ServiceClient {
* @param connectionName * @param connectionName
* @return Sign in link on success; null otherwise. * @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)) { if (StringUtils.isEmpty(connectionName)) {
throw new IllegalArgumentException("connectionName"); throw new IllegalArgumentException("connectionName");
} }
@ -264,7 +264,7 @@ public class OAuthClient extends ServiceClient {
String strUri = String.format("%sapi/botsignin/getsigninurl", this.uri); String strUri = String.format("%sapi/botsignin/getsigninurl", this.uri);
final URI tokenUrl = MakeUri(strUri, qstrings); 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. // add botframework api service url to the list of trusted service url's for these app credentials.
MicrosoftAppCredentials.trustServiceUrl(tokenUrl); MicrosoftAppCredentials.trustServiceUrl(tokenUrl);
@ -299,7 +299,7 @@ public class OAuthClient extends ServiceClient {
* @param emulateOAuthCards * @param emulateOAuthCards
* @return CompletableFuture with no result code * @return CompletableFuture with no result code
*/ */
public CompletableFuture SendEmulateOAuthCardsAsync(Boolean emulateOAuthCards) throws URISyntaxException, IOException { public CompletableFuture SendEmulateOAuthCards(Boolean emulateOAuthCards) throws URISyntaxException, IOException {
// Construct URL // Construct URL
HashMap<String, String> qstrings = new HashMap<>(); 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. // add botframework api service url to the list of trusted service url's for these app credentials.
MicrosoftAppCredentials.trustServiceUrl(tokenUrl); MicrosoftAppCredentials.trustServiceUrl(tokenUrl);
return CompletableFuture.runAsync(() -> { return CompletableFuture.run(() -> {
// Construct dummy body // Construct dummy body
RequestBody body = RequestBody.create(JSON, "{}"); 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. * @return If the task is successful, the result is true if appId is valid for the controller; otherwise, false.
*/ */
@Override @Override
public CompletableFuture<Boolean> isValidAppIdAsync(String appId) { public CompletableFuture<Boolean> isValidAppId(String appId) {
return CompletableFuture.completedFuture(StringUtils.equals(appId, this.appId)); return CompletableFuture.completedFuture(StringUtils.equals(appId, this.appId));
} }
@ -66,7 +66,7 @@ public class SimpleCredentialProvider implements CredentialProvider {
* contains the password; otherwise, null. * contains the password; otherwise, null.
*/ */
@Override @Override
public CompletableFuture<String> getAppPasswordAsync(String appId) { public CompletableFuture<String> getAppPassword(String appId) {
return CompletableFuture.completedFuture(StringUtils.equals(appId, this.appId) ? this.password : null); 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. * is disabled, the result is true; otherwise, false.
*/ */
@Override @Override
public CompletableFuture<Boolean> isAuthenticationDisabledAsync() { public CompletableFuture<Boolean> isAuthenticationDisabled() {
return CompletableFuture.completedFuture(StringUtils.isEmpty(this.appId)); return CompletableFuture.completedFuture(StringUtils.isEmpty(this.appId));
} }
} }

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

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

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

@ -145,7 +145,7 @@ public class RestConversations implements Conversations {
*/ */
@Override @Override
public ConversationsResult getConversations() { public ConversationsResult getConversations() {
return getConversationsAsync().join(); return getConversations().join();
} }
/** /**
@ -154,8 +154,8 @@ public class RestConversations implements Conversations {
* @see Conversations#getConversationsAsync * @see Conversations#getConversationsAsync
*/ */
@Override @Override
public CompletableFuture<ConversationsResult> getConversationsAsync() { public CompletableFuture<ConversationsResult> getConversations() {
return getConversationsAsync(null); return getConversations(null);
} }
/** /**
@ -165,7 +165,7 @@ public class RestConversations implements Conversations {
*/ */
@Override @Override
public ConversationsResult getConversations(String continuationToken) { 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 * @see Conversations#getConversationsAsync
*/ */
@Override @Override
public CompletableFuture<ConversationsResult> getConversationsAsync(String continuationToken) { public CompletableFuture<ConversationsResult> getConversations(String continuationToken) {
return service.getConversations(continuationToken, this.client.getAcceptLanguage(), this.client.getUserAgent()) return service.getConversations(continuationToken, this.client.getAcceptLanguage(), this.client.getUserAgent())
.thenApply(responseBodyResponse -> { .thenApply(responseBodyResponse -> {
try { try {
@ -203,7 +203,7 @@ public class RestConversations implements Conversations {
*/ */
@Override @Override
public ConversationResourceResponse createConversation(ConversationParameters parameters) { 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 * @see Conversations#createConversationAsync
*/ */
@Override @Override
public CompletableFuture<ConversationResourceResponse> createConversationAsync(ConversationParameters parameters) { public CompletableFuture<ConversationResourceResponse> createConversation(ConversationParameters parameters) {
if (parameters == null) { if (parameters == null) {
throw new IllegalArgumentException("Parameter parameters is required and cannot be null."); throw new IllegalArgumentException("Parameter parameters is required and cannot be null.");
} }
@ -248,7 +248,7 @@ public class RestConversations implements Conversations {
*/ */
@Override @Override
public ResourceResponse sendToConversation(String conversationId, Activity activity) { 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 * @see Conversations#sendToConversationAsync
*/ */
@Override @Override
public CompletableFuture<ResourceResponse> sendToConversationAsync(String conversationId, Activity activity) { public CompletableFuture<ResourceResponse> sendToConversation(String conversationId, Activity activity) {
if (conversationId == null) { if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null."); throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
} }
@ -296,7 +296,7 @@ public class RestConversations implements Conversations {
*/ */
@Override @Override
public ResourceResponse updateActivity(String conversationId, String activityId, Activity activity) { 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 * @see Conversations#updateActivityAsync
*/ */
@Override @Override
public CompletableFuture<ResourceResponse> updateActivityAsync(String conversationId, String activityId, Activity activity) { public CompletableFuture<ResourceResponse> updateActivity(String conversationId, String activityId, Activity activity) {
if (conversationId == null) { if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null."); throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
} }
@ -347,7 +347,7 @@ public class RestConversations implements Conversations {
*/ */
@Override @Override
public ResourceResponse replyToActivity(String conversationId, String activityId, Activity activity) { 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 * @see Conversations#replyToActivityAsync
*/ */
@Override @Override
public CompletableFuture<ResourceResponse> replyToActivityAsync(String conversationId, public CompletableFuture<ResourceResponse> replyToActivity(String conversationId,
String activityId, String activityId,
Activity activity) { Activity activity) {
if (conversationId == null) { if (conversationId == null) {
@ -400,7 +400,7 @@ public class RestConversations implements Conversations {
*/ */
@Override @Override
public void deleteActivity(String conversationId, String activityId) { 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 * @see Conversations#deleteActivityAsync
*/ */
@Override @Override
public CompletableFuture<Void> deleteActivityAsync(String conversationId, String activityId) { public CompletableFuture<Void> deleteActivity(String conversationId, String activityId) {
if (conversationId == null) { if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null."); throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
} }
@ -446,7 +446,7 @@ public class RestConversations implements Conversations {
*/ */
@Override @Override
public List<ChannelAccount> getConversationMembers(String conversationId) { 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 * @see Conversations#getConversationMembersAsync
*/ */
@Override @Override
public CompletableFuture<List<ChannelAccount>> getConversationMembersAsync(String conversationId) { public CompletableFuture<List<ChannelAccount>> getConversationMembers(String conversationId) {
if (conversationId == null) { if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null."); throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
} }
@ -487,7 +487,7 @@ public class RestConversations implements Conversations {
*/ */
@Override @Override
public void deleteConversationMember(String conversationId, String memberId) { 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 * @see Conversations#deleteConversationMemberAsync
*/ */
@Override @Override
public CompletableFuture<Void> deleteConversationMemberAsync(String conversationId, String memberId) { public CompletableFuture<Void> deleteConversationMember(String conversationId, String memberId) {
if (conversationId == null) { if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null."); throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
} }
@ -534,7 +534,7 @@ public class RestConversations implements Conversations {
*/ */
@Override @Override
public List<ChannelAccount> getActivityMembers(String conversationId, String activityId) { 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 * @see Conversations#getActivityMembersAsync
*/ */
@Override @Override
public CompletableFuture<List<ChannelAccount>> getActivityMembersAsync(String conversationId, String activityId) { public CompletableFuture<List<ChannelAccount>> getActivityMembers(String conversationId, String activityId) {
if (conversationId == null) { if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null."); throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
} }
@ -579,7 +579,7 @@ public class RestConversations implements Conversations {
*/ */
@Override @Override
public ResourceResponse uploadAttachment(String conversationId, AttachmentData attachmentUpload) { 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 * @see Conversations#uploadAttachmentAsync
*/ */
@Override @Override
public CompletableFuture<ResourceResponse> uploadAttachmentAsync(String conversationId, AttachmentData attachmentUpload) { public CompletableFuture<ResourceResponse> uploadAttachment(String conversationId, AttachmentData attachmentUpload) {
if (conversationId == null) { if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null."); throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
} }
@ -628,7 +628,7 @@ public class RestConversations implements Conversations {
*/ */
@Override @Override
public ResourceResponse sendConversationHistory(String conversationId, Transcript history) { 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 * @see Conversations#sendConversationHistoryAsync
*/ */
@Override @Override
public CompletableFuture<ResourceResponse> sendConversationHistoryAsync(String conversationId, Transcript history) { public CompletableFuture<ResourceResponse> sendConversationHistory(String conversationId, Transcript history) {
if (conversationId == null) { if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be null."); throw new IllegalArgumentException("Parameter conversationId is required and cannot be null.");
} }
@ -677,7 +677,7 @@ public class RestConversations implements Conversations {
*/ */
@Override @Override
public PagedMembersResult getConversationPagedMembers(String conversationId){ 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 * @see Conversations#getConversationPagedMembersAsync
*/ */
@Override @Override
public CompletableFuture<PagedMembersResult> getConversationPagedMembersAsync(String conversationId){ public CompletableFuture<PagedMembersResult> getConversationPagedMembers(String conversationId){
if (conversationId == null) { if (conversationId == null) {
throw new IllegalArgumentException("Parameter conversationId is required and cannot be 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) @Test(expected = IllegalArgumentException.class)
public void GetUserToken_ShouldThrowOnEmptyUserId() throws URISyntaxException, IOException, ExecutionException, InterruptedException { public void GetUserToken_ShouldThrowOnEmptyUserId() throws URISyntaxException, IOException, ExecutionException, InterruptedException {
OAuthClient client = new OAuthClient(this.connector, "https://localhost"); OAuthClient client = new OAuthClient(this.connector, "https://localhost");
client.GetUserTokenAsync("", "mockConnection", ""); client.GetUserToken("", "mockConnection", "");
} }
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void GetUserToken_ShouldThrowOnEmptyConnectionName() throws URISyntaxException, IOException, ExecutionException, InterruptedException { public void GetUserToken_ShouldThrowOnEmptyConnectionName() throws URISyntaxException, IOException, ExecutionException, InterruptedException {
OAuthClient client = new OAuthClient(this.connector, "https://localhost"); 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) 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; TokenResponse token = null;
try { try {
System.out.println("This is a test asdfasdfasdf"); 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) { if (null==token) {
System.out.println(String.format("This is a test 2 - NULL TOKEN")); System.out.println(String.format("This is a test 2 - NULL TOKEN"));
System.out.flush(); System.out.flush();
@ -84,7 +84,7 @@ public class OAuthConnectorTest extends OAuthTestBase {
public async Task GetUserToken_ShouldReturnNullOnInvalidConnectionString() throws URISyntaxException { public async Task GetUserToken_ShouldReturnNullOnInvalidConnectionString() throws URISyntaxException {
await UseOAuthClientFor(async client => await UseOAuthClientFor(async client =>
{ {
var token = await client.GetUserTokenAsync("default-user", "mygithubconnection1", ""); var token = await client.GetUserToken("default-user", "mygithubconnection1", "");
Assert.Null(token); Assert.Null(token);
}); });
} }
@ -100,7 +100,7 @@ public async Task GetUserToken_ShouldReturnNullOnInvalidConnectionString() throw
// }; // };
// await UseOAuthClientFor(async client => // await UseOAuthClientFor(async client =>
// { // {
// var uri = await client.GetSignInLinkAsync(activity, "mygithubconnection"); // var uri = await client.GetSignInLink(activity, "mygithubconnection");
// Assert.False(string.IsNullOrEmpty(uri)); // Assert.False(string.IsNullOrEmpty(uri));
// Uri uriResult; // Uri uriResult;
// Assert.True(Uri.TryCreate(uri, UriKind.Absolute, out uriResult) && uriResult.Scheme == Uri.UriSchemeHttps); // Assert.True(Uri.TryCreate(uri, UriKind.Absolute, out uriResult) && uriResult.Scheme == Uri.UriSchemeHttps);
@ -110,26 +110,26 @@ public async Task GetUserToken_ShouldReturnNullOnInvalidConnectionString() throw
@Test @Test
public async Task SignOutUser_ShouldThrowOnEmptyUserId() throws URISyntaxException { public async Task SignOutUser_ShouldThrowOnEmptyUserId() throws URISyntaxException {
var client = new OAuthClient(mockConnectorClient, "https://localhost"); var client = new OAuthClient(mockConnectorClient, "https://localhost");
await Assert.ThrowsAsync<ArgumentNullException>(() => client.SignOutUserAsync("", "mockConnection")); await Assert.ThrowsAsync<ArgumentNullException>(() => client.SignOutUser("", "mockConnection"));
} }
@Test @Test
public async Task SignOutUser_ShouldThrowOnEmptyConnectionName() throws URISyntaxException { public async Task SignOutUser_ShouldThrowOnEmptyConnectionName() throws URISyntaxException {
var client = new OAuthClient(mockConnectorClient, "https://localhost"); var client = new OAuthClient(mockConnectorClient, "https://localhost");
await Assert.ThrowsAsync<ArgumentNullException>(() => client.SignOutUserAsync("userid", "")); await Assert.ThrowsAsync<ArgumentNullException>(() => client.SignOutUser("userid", ""));
} }
@Test @Test
public async Task GetSigninLink_ShouldThrowOnEmptyConnectionName() throws URISyntaxException { public async Task GetSigninLink_ShouldThrowOnEmptyConnectionName() throws URISyntaxException {
var activity = new Activity(); var activity = new Activity();
var client = new OAuthClient(mockConnectorClient, "https://localhost"); var client = new OAuthClient(mockConnectorClient, "https://localhost");
await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetSignInLinkAsync(activity, "")); await Assert.ThrowsAsync<ArgumentNullException>(() => client.GetSignInLink(activity, ""));
} }
@Test @Test
public async Task GetSigninLink_ShouldThrowOnNullActivity() throws URISyntaxException { public async Task GetSigninLink_ShouldThrowOnNullActivity() throws URISyntaxException {
var client = new OAuthClient(mockConnectorClient, "https://localhost"); 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 { 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; OAuthClient oauthClient = null;
try { try {
oauthClient = new OAuthClient(this.connector, AuthenticationConstants.OAUTH_URL); oauthClient = new OAuthClient(this.connector, AuthenticationConstants.OAUTH_URL);

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

@ -9,24 +9,24 @@ import org.junit.Test;
public class SimpleCredentialProviderTests { public class SimpleCredentialProviderTests {
@Test @Test
public void ValidAppIdAsync() { public void ValidAppId() {
SimpleCredentialProvider credentialProvider = new SimpleCredentialProvider("appid", "pwd"); SimpleCredentialProvider credentialProvider = new SimpleCredentialProvider("appid", "pwd");
Assert.assertTrue(credentialProvider.isValidAppIdAsync("appid").join()); Assert.assertTrue(credentialProvider.isValidAppId("appid").join());
Assert.assertFalse(credentialProvider.isValidAppIdAsync("wrongappid").join()); Assert.assertFalse(credentialProvider.isValidAppId("wrongappid").join());
} }
@Test @Test
public void AppPasswordAsync() { public void AppPassword() {
SimpleCredentialProvider credentialProvider = new SimpleCredentialProvider("appid", "pwd"); SimpleCredentialProvider credentialProvider = new SimpleCredentialProvider("appid", "pwd");
Assert.assertEquals(credentialProvider.getAppPasswordAsync("appid").join(), "pwd"); Assert.assertEquals(credentialProvider.getAppPassword("appid").join(), "pwd");
Assert.assertNull(credentialProvider.getAppPasswordAsync("wrongappid").join()); Assert.assertNull(credentialProvider.getAppPassword("wrongappid").join());
} }
@Test @Test
public void AuthenticationDisabledAsync() { public void AuthenticationDisabled() {
Assert.assertFalse(new SimpleCredentialProvider("appid", "pwd").isAuthenticationDisabledAsync().join()); Assert.assertFalse(new SimpleCredentialProvider("appid", "pwd").isAuthenticationDisabled().join());
Assert.assertTrue(new SimpleCredentialProvider(null, null).isAuthenticationDisabledAsync().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. * @param context The dialog context.
* @return A task that represents the start code for a dialog. * @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. * @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(); var message = botToUser.MakeMessage();
message.Text = text; message.Text = text;
@ -98,7 +98,7 @@ public static partial class Extensions
message.Locale = locale; 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. * @param locale The locale of the text.
* @return A task that represents the post operation. * @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(); var message = botToUser.MakeMessage();
@ -136,7 +136,7 @@ public static partial class Extensions
message.Entities = options.Entities; 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; 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 public class MessageOptions
{ {

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

@ -158,7 +158,7 @@
"Conversations" "Conversations"
], ],
"summary": "CreateConversation", "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", "operationId": "Conversations_CreateConversation",
"consumes": [ "consumes": [
"application/json", "application/json",