Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd30eb24

Browse files
committed
move some tests from blocked Facebook to vk.com to simplify release testing
1 parentf8f9587 commitd30eb24

File tree

5 files changed

+24
-22
lines changed

5 files changed

+24
-22
lines changed

‎scribejava-apis/src/test/java/com/github/scribejava/apis/examples/FacebookAsyncApacheExample.javarenamed to‎scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteAsyncApacheExample.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
importjava.util.Random;
44
importjava.util.Scanner;
55
importjava.util.concurrent.ExecutionException;
6-
importcom.github.scribejava.apis.FacebookApi;
6+
importcom.github.scribejava.apis.VkontakteApi;
77
importcom.github.scribejava.core.builder.ServiceBuilder;
88
importcom.github.scribejava.core.model.OAuth2AccessToken;
99
importcom.github.scribejava.core.model.OAuthRequest;
@@ -13,12 +13,13 @@
1313
importcom.github.scribejava.httpclient.apache.ApacheHttpClientConfig;
1414
importjava.io.IOException;
1515

16-
publicclassFacebookAsyncApacheExample {
16+
publicclassVkontakteAsyncApacheExample {
1717

18-
privatestaticfinalStringNETWORK_NAME ="Facebook";
19-
privatestaticfinalStringPROTECTED_RESOURCE_URL ="https://graph.facebook.com/v3.2/me";
18+
privatestaticfinalStringNETWORK_NAME ="vk.com";
19+
privatestaticfinalStringPROTECTED_RESOURCE_URL ="https://api.vk.com/method/users.get?v="
20+
+VkontakteApi.VERSION;
2021

21-
privateFacebookAsyncApacheExample() {
22+
privateVkontakteAsyncApacheExample() {
2223
}
2324

2425
@SuppressWarnings("PMD.SystemPrintln")
@@ -28,11 +29,11 @@ public static void main(String... args) throws InterruptedException, ExecutionEx
2829
finalStringclientSecret ="your client secret";
2930
finalStringsecretState ="secret" +newRandom().nextInt(999_999);
3031

31-
try (OAuth20Serviceservice =newServiceBuilder(clientId)
32+
try (OAuth20Serviceservice =newServiceBuilder(clientId)
3233
.apiSecret(clientSecret)
3334
.callback("http://www.example.com/oauth_callback/")
3435
.httpClientConfig(ApacheHttpClientConfig.defaultConfig())
35-
.build(FacebookApi.instance())) {
36+
.build(VkontakteApi.instance())) {
3637
finalScannerin =newScanner(System.in,"UTF-8");
3738

3839
System.out.println("=== " +NETWORK_NAME +"'s Async OAuth Workflow ===");
@@ -73,7 +74,7 @@ public static void main(String... args) throws InterruptedException, ExecutionEx
7374
System.out.println("Now we're going to access a protected resource...");
7475
finalOAuthRequestrequest =newOAuthRequest(Verb.GET,PROTECTED_RESOURCE_URL);
7576
service.signRequest(accessToken,request);
76-
try (Responseresponse =service.execute(request)) {
77+
try (Responseresponse =service.execute(request)) {
7778
System.out.println("Got it! Lets see what we found...");
7879
System.out.println();
7980
System.out.println(response.getCode());

‎scribejava-apis/src/test/java/com/github/scribejava/apis/examples/FacebookAsyncNingExample.javarenamed to‎scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteAsyncNingExample.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
importjava.util.Random;
66
importjava.util.Scanner;
77
importjava.util.concurrent.ExecutionException;
8-
importcom.github.scribejava.apis.FacebookApi;
8+
importcom.github.scribejava.apis.VkontakteApi;
99
importcom.github.scribejava.core.builder.ServiceBuilder;
1010
importcom.github.scribejava.core.model.OAuth2AccessToken;
1111
importcom.github.scribejava.core.model.OAuthRequest;
@@ -14,12 +14,13 @@
1414
importcom.github.scribejava.core.oauth.OAuth20Service;
1515
importjava.io.IOException;
1616

17-
publicclassFacebookAsyncNingExample {
17+
publicclassVkontakteAsyncNingExample {
1818

19-
privatestaticfinalStringNETWORK_NAME ="Facebook";
20-
privatestaticfinalStringPROTECTED_RESOURCE_URL ="https://graph.facebook.com/v3.2/me";
19+
privatestaticfinalStringNETWORK_NAME ="vk.com";
20+
privatestaticfinalStringPROTECTED_RESOURCE_URL ="https://api.vk.com/method/users.get?v="
21+
+VkontakteApi.VERSION;
2122

22-
privateFacebookAsyncNingExample() {
23+
privateVkontakteAsyncNingExample() {
2324
}
2425

2526
@SuppressWarnings("PMD.SystemPrintln")
@@ -36,11 +37,11 @@ public static void main(String... args) throws InterruptedException, ExecutionEx
3637
.setReadTimeout(1_000)
3738
.build());
3839

39-
try (OAuth20Serviceservice =newServiceBuilder(clientId)
40+
try (OAuth20Serviceservice =newServiceBuilder(clientId)
4041
.apiSecret(clientSecret)
4142
.callback("http://www.example.com/oauth_callback/")
4243
.httpClientConfig(clientConfig)
43-
.build(FacebookApi.instance())) {
44+
.build(VkontakteApi.instance())) {
4445
finalScannerin =newScanner(System.in,"UTF-8");
4546

4647
System.out.println("=== " +NETWORK_NAME +"'s Async OAuth Workflow ===");
@@ -81,7 +82,7 @@ public static void main(String... args) throws InterruptedException, ExecutionEx
8182
System.out.println("Now we're going to access a protected resource...");
8283
finalOAuthRequestrequest =newOAuthRequest(Verb.GET,PROTECTED_RESOURCE_URL);
8384
service.signRequest(accessToken,request);
84-
try (Responseresponse =service.execute(request)) {
85+
try (Responseresponse =service.execute(request)) {
8586
System.out.println("Got it! Lets see what we found...");
8687
System.out.println();
8788
System.out.println(response.getCode());

‎scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteClientCredentialsGrantExample.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
publicclassVkontakteClientCredentialsGrantExample {
1111

12-
privatestaticfinalStringNETWORK_NAME ="Vkontakte.ru";
12+
privatestaticfinalStringNETWORK_NAME ="vk.com>";
1313

1414
privateVkontakteClientCredentialsGrantExample() {
1515
}

‎scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteExample.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
publicclassVkontakteExample {
1717

18-
privatestaticfinalStringNETWORK_NAME ="Vkontakte.ru";
18+
privatestaticfinalStringNETWORK_NAME ="vk.com";
1919
privatestaticfinalStringPROTECTED_RESOURCE_URL ="https://api.vk.com/method/users.get?v="
2020
+VkontakteApi.VERSION;
2121

@@ -66,7 +66,7 @@ public static void main(String... args) throws IOException, InterruptedException
6666
System.out.println("Now we're going to access a protected resource...");
6767
finalOAuthRequestrequest =newOAuthRequest(Verb.GET,PROTECTED_RESOURCE_URL);
6868
service.signRequest(accessToken,request);
69-
try (Responseresponse =service.execute(request)) {
69+
try (Responseresponse =service.execute(request)) {
7070
System.out.println("Got it! Lets see what we found...");
7171
System.out.println();
7272
System.out.println(response.getCode());

‎scribejava-apis/src/test/java/com/github/scribejava/apis/examples/VkontakteExternalHttpExample.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
publicclassVkontakteExternalHttpExample {
1818

19-
privatestaticfinalStringNETWORK_NAME ="Vkontakte.ru";
19+
privatestaticfinalStringNETWORK_NAME ="vk.com";
2020
privatestaticfinalStringPROTECTED_RESOURCE_URL ="https://api.vk.com/method/users.get?v="
2121
+VkontakteApi.VERSION;
2222

@@ -37,7 +37,7 @@ public static void main(String... args) throws IOException, InterruptedException
3737
.setReadTimeout(1_000)
3838
.build();
3939
//wrap it
40-
try (DefaultAsyncHttpClientahcHttpClient =newDefaultAsyncHttpClient(httpClientConfig)) {
40+
try (DefaultAsyncHttpClientahcHttpClient =newDefaultAsyncHttpClient(httpClientConfig)) {
4141
//wrap it
4242
finalAhcHttpClientwrappedAHCHttpClient =newAhcHttpClient(ahcHttpClient);
4343

@@ -74,7 +74,7 @@ public static void main(String... args) throws IOException, InterruptedException
7474
System.out.println("Now we're going to access a protected resource...");
7575
finalOAuthRequestrequest =newOAuthRequest(Verb.GET,PROTECTED_RESOURCE_URL);
7676
service.signRequest(accessToken,request);
77-
try (Responseresponse =service.execute(request)) {
77+
try (Responseresponse =service.execute(request)) {
7878
System.out.println("Got it! Lets see what we found...");
7979
System.out.println();
8080
System.out.println(response.getCode());

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp