Skip to content

Commit d4d246e

Browse files
committed
Refactor AsyncResponse use common execTask virtual method, rename to AsyncResult
1 parent 407e88d commit d4d246e

File tree

7 files changed

+183
-189
lines changed

7 files changed

+183
-189
lines changed

src/AndroidClient/client/src/androidTest/java/servicestack/net/client/tests/TechStacksServiceTestsAsync.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import net.servicestack.android.AndroidLogProvider;
77
import net.servicestack.android.AndroidServiceClient;
8-
import net.servicestack.client.AsyncResponse;
8+
import net.servicestack.client.AsyncResult;
99
import net.servicestack.client.Log;
1010
import net.servicestack.client.Utils;
1111

@@ -25,7 +25,7 @@ public TechStacksServiceTestsAsync() {
2525
public void test_Can_GET_TechStacks_Overview() throws InterruptedException {
2626
final CountDownLatch signal = new CountDownLatch(1);
2727

28-
client.getAsync(new Overview(), new AsyncResponse<OverviewResponse>(){
28+
client.getAsync(new Overview(), new AsyncResult<OverviewResponse>(){
2929
@Override
3030
public void success(OverviewResponse response) {
3131
TechStacksServiceTests.assertOverviewResponse(response);
@@ -43,7 +43,7 @@ public void complete() {
4343
public void test_Can_GET_TechStacks_AppOverview_Async() throws InterruptedException {
4444
final CountDownLatch signal = new CountDownLatch(1);
4545

46-
client.getAsync(new AppOverview(), new AsyncResponse<AppOverviewResponse>(){
46+
client.getAsync(new AppOverview(), new AsyncResult<AppOverviewResponse>(){
4747
@Override
4848
public void success(AppOverviewResponse r) {
4949
assertNotNull(r);
@@ -63,7 +63,7 @@ public void complete() {
6363
public void test_Can_GET_TechStacks_Overview_with_relative_url_Async() throws InterruptedException {
6464
final CountDownLatch signal = new CountDownLatch(1);
6565

66-
client.getAsync("/overview", OverviewResponse.class, new AsyncResponse<OverviewResponse>() {
66+
client.getAsync("/overview", OverviewResponse.class, new AsyncResult<OverviewResponse>() {
6767
@Override
6868
public void success(OverviewResponse response) {
6969
TechStacksServiceTests.assertOverviewResponse(response);
@@ -81,7 +81,7 @@ public void complete() {
8181
public void test_Can_GET_TechStacks_Overview_with_absolute_url_Async() throws InterruptedException {
8282
final CountDownLatch signal = new CountDownLatch(1);
8383

84-
client.getAsync("http://techstacks.io/overview", OverviewResponse.class, new AsyncResponse<OverviewResponse>() {
84+
client.getAsync("http://techstacks.io/overview", OverviewResponse.class, new AsyncResult<OverviewResponse>() {
8585
@Override
8686
public void success(OverviewResponse response) {
8787
TechStacksServiceTests.assertOverviewResponse(response);
@@ -102,7 +102,7 @@ public void test_Can_GET_GetTechnology_with_params_Async() throws InterruptedExc
102102

103103
final CountDownLatch signal = new CountDownLatch(1);
104104

105-
client.getAsync(requestDto, new AsyncResponse<GetTechnologyResponse>() {
105+
client.getAsync(requestDto, new AsyncResult<GetTechnologyResponse>() {
106106
@Override
107107
public void success(GetTechnologyResponse response) {
108108
TechStacksServiceTests.assertGetTechnologyResponse(response);
@@ -120,7 +120,7 @@ public void complete() {
120120
public void test_Can_GET_GetTechnology_with_url_Async() throws InterruptedException {
121121
final CountDownLatch signal = new CountDownLatch(1);
122122

123-
client.getAsync("/technology/servicestack", GetTechnologyResponse.class, new AsyncResponse<GetTechnologyResponse>() {
123+
client.getAsync("/technology/servicestack", GetTechnologyResponse.class, new AsyncResult<GetTechnologyResponse>() {
124124
@Override
125125
public void success(GetTechnologyResponse response) {
126126
TechStacksServiceTests.assertGetTechnologyResponse(response);
@@ -141,7 +141,7 @@ public void test_Can_call_FindTechnologies_AutoQuery_Service_Async() throws Inte
141141

142142
final CountDownLatch signal = new CountDownLatch(1);
143143

144-
client.getAsync(request, new AsyncResponse<QueryResponse<Technology>>() {
144+
client.getAsync(request, new AsyncResult<QueryResponse<Technology>>() {
145145
@Override
146146
public void success(QueryResponse<Technology> response) {
147147
assertEquals(1, response.getResults().size());
@@ -164,7 +164,7 @@ public void test_Can_call_FindTechnologies_AutoQuery_Implicit_Service() throws I
164164
final CountDownLatch signal = new CountDownLatch(1);
165165

166166
client.getAsync(request, Utils.createMap("DescriptionContains", "framework"),
167-
new AsyncResponse<QueryResponse<Technology>>() {
167+
new AsyncResult<QueryResponse<Technology>>() {
168168
@Override
169169
public void success(QueryResponse<Technology> response) {
170170
assertEquals(5, response.getResults().size());

src/AndroidClient/client/src/androidTest/java/servicestack/net/client/tests/TestServiceTests.java

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -177,20 +177,21 @@ public void test_Can_POST_valid_ThrowValidation_request() {
177177

178178
/* TEST HELPERS */
179179

180-
HelloAllTypes createHelloAllTypes(){
180+
public static HelloAllTypes createHelloAllTypes(){
181181
HelloAllTypes to = new HelloAllTypes()
182182
.setName("name")
183183
.setAllTypes(createAllTypes())
184184
.setAllCollectionTypes(createAllCollectionTypes());
185185
return to;
186186
}
187-
private void assertHelloAllTypesResponse(HelloAllTypesResponse actual, HelloAllTypes expected) {
187+
188+
public static void assertHelloAllTypesResponse(HelloAllTypesResponse actual, HelloAllTypes expected) {
188189
assertNotNull(actual);
189190
assertAllTypes(actual.allTypes, expected.allTypes);
190191
assertAllCollectionTypes(actual.allCollectionTypes, expected.allCollectionTypes);
191192
}
192193

193-
AllTypes createAllTypes() {
194+
public static AllTypes createAllTypes() {
194195
AllTypes to = new AllTypes()
195196
.setId(1)
196197
.setChar("c")
@@ -218,7 +219,7 @@ AllTypes createAllTypes() {
218219
return to;
219220
}
220221

221-
AllCollectionTypes createAllCollectionTypes(){
222+
public static AllCollectionTypes createAllCollectionTypes(){
222223
AllCollectionTypes to = new AllCollectionTypes()
223224
.setIntArray(Utils.createList(1, 2, 3))
224225
.setIntList(Utils.createList(4, 5, 6))
@@ -231,11 +232,11 @@ AllCollectionTypes createAllCollectionTypes(){
231232
return to;
232233
}
233234

234-
Poco createPoco(String name){
235+
public static Poco createPoco(String name){
235236
return new Poco().setName(name);
236237
}
237238

238-
private void assertAllTypes(AllTypes actual, AllTypes expected) {
239+
public static void assertAllTypes(AllTypes actual, AllTypes expected) {
239240
assertEquals(expected.getId(), actual.getId());
240241
assertEquals(expected.getByte(), actual.getByte());
241242
assertEquals(expected.getShort(), actual.getShort());
@@ -261,7 +262,7 @@ private void assertAllTypes(AllTypes actual, AllTypes expected) {
261262
assertEquals(expected.getSubType().getName(), actual.getSubType().getName());
262263
}
263264

264-
private void assertAllCollectionTypes(AllCollectionTypes actual, AllCollectionTypes expected) {
265+
public static void assertAllCollectionTypes(AllCollectionTypes actual, AllCollectionTypes expected) {
265266
assertEquals(expected.getIntArray(), actual.getIntArray());
266267
assertEquals(expected.getIntList(), actual.getIntList());
267268
assertEquals(expected.getStringArray(), actual.getStringArray());
@@ -273,42 +274,42 @@ private void assertAllCollectionTypes(AllCollectionTypes actual, AllCollectionTy
273274
assertPocoLookupMapEquals(expected.getPocoLookupMap(), actual.getPocoLookupMap());
274275
}
275276

276-
void assertPocoEquals(List<Poco> expected, List<Poco> actual){
277+
public static void assertPocoEquals(List<Poco> expected, List<Poco> actual){
277278
assertEquals(expected.size(), actual.size());
278279
for (int i = 0; i < actual.size(); i++) {
279280
assertPocoEquals(expected.get(i), actual.get(i));
280281
}
281282
}
282283

283-
void assertPocoLookupEquals(HashMap<String,ArrayList<Poco>> expected, HashMap<String,ArrayList<Poco>> actual){
284+
public static void assertPocoLookupEquals(HashMap<String,ArrayList<Poco>> expected, HashMap<String,ArrayList<Poco>> actual){
284285
assertEquals(expected.size(), actual.size());
285286
for (String key : actual.keySet()) {
286287
assertPocoEquals(expected.get(key), actual.get(key));
287288
}
288289
}
289290

290-
void assertPocoLookupMapEquals(HashMap<String,ArrayList<HashMap<String,Poco>>> expected, HashMap<String,ArrayList<HashMap<String,Poco>>> actual){
291+
public static void assertPocoLookupMapEquals(HashMap<String,ArrayList<HashMap<String,Poco>>> expected, HashMap<String,ArrayList<HashMap<String,Poco>>> actual){
291292
assertEquals(expected.size(), actual.size());
292293
for (String key : actual.keySet()) {
293294
assertPocoEquals(expected.get(key), actual.get(key));
294295
}
295296
}
296297

297-
private void assertPocoEquals(ArrayList<HashMap<String, Poco>> expected, ArrayList<HashMap<String, Poco>> actual) {
298+
public static void assertPocoEquals(ArrayList<HashMap<String, Poco>> expected, ArrayList<HashMap<String, Poco>> actual) {
298299
assertEquals(expected.size(), actual.size());
299300
for (int i = 0; i < actual.size(); i++) {
300301
assertPocoEquals(expected.get(i), actual.get(i));
301302
}
302303
}
303304

304-
private void assertPocoEquals(HashMap<String, Poco> expected, HashMap<String, Poco> actual) {
305+
public static void assertPocoEquals(HashMap<String, Poco> expected, HashMap<String, Poco> actual) {
305306
assertEquals(expected.size(), actual.size());
306307
for (String key : actual.keySet()) {
307308
assertPocoEquals(expected.get(key), actual.get(key));
308309
}
309310
}
310311

311-
void assertPocoEquals(Poco expected, Poco actual){
312+
public static void assertPocoEquals(Poco expected, Poco actual){
312313
assertNotNull(actual);
313314
assertEquals(actual.getName(), expected.getName());
314315
}

src/AndroidClient/client/src/main/java/net/servicestack/android/AndroidLogProvider.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// Copyright (c) 2015 ServiceStack LLC. All rights reserved.
2+
13
package net.servicestack.android;
24

35
import net.servicestack.client.LogProvider;

0 commit comments

Comments
 (0)