use of com.azure.android.core.test.implementation.entities.HttpBinJSON in project azure-sdk-for-android by Azure.
the class RestProxyTests method service19PutWithBodyParamApplicationOctetStreamContentTypeAndStringBodyWithNonEmptyBody.
@Test
public void service19PutWithBodyParamApplicationOctetStreamContentTypeAndStringBodyWithNonEmptyBody() {
CountDownLatch latch = new CountDownLatch(1);
CallbackResult<HttpBinJSON> cbResult = new CallbackResult<>();
createService(Service19.class).putWithBodyParamApplicationOctetStreamContentTypeAndStringBody("penguins", new Callback<Response<HttpBinJSON>>() {
@Override
public void onSuccess(Response<HttpBinJSON> response) {
cbResult.response = response;
latch.countDown();
}
@Override
public void onFailure(Throwable error) {
cbResult.error = error;
latch.countDown();
}
});
awaitOnLatch(latch, "service19PutWithBodyParamApplicationOctetStreamContentTypeAndStringBodyWithNonEmptyBody");
if (cbResult.error != null) {
Assertions.fail(cbResult.error);
} else {
final Response<HttpBinJSON> response = cbResult.response;
HttpBinJSON json = response.getValue();
Assertions.assertNotNull(json);
assertEquals("penguins", json.data());
}
}
use of com.azure.android.core.test.implementation.entities.HttpBinJSON in project azure-sdk-for-android by Azure.
the class RestProxyTests method service19PutWithHeaderApplicationJsonContentTypeAndByteArrayBodyWithEmptyBody.
@Test
public void service19PutWithHeaderApplicationJsonContentTypeAndByteArrayBodyWithEmptyBody() {
CountDownLatch latch = new CountDownLatch(1);
CallbackResult<HttpBinJSON> cbResult = new CallbackResult<>();
createService(Service19.class).putWithHeaderApplicationJsonContentTypeAndByteArrayBody(new byte[0], new Callback<Response<HttpBinJSON>>() {
@Override
public void onSuccess(Response<HttpBinJSON> response) {
cbResult.response = response;
latch.countDown();
}
@Override
public void onFailure(Throwable error) {
cbResult.error = error;
latch.countDown();
}
});
awaitOnLatch(latch, "service19PutWithHeaderApplicationJsonContentTypeAndByteArrayBodyWithEmptyBody");
if (cbResult.error != null) {
Assertions.fail(cbResult.error);
} else {
final Response<HttpBinJSON> response = cbResult.response;
HttpBinJSON json = response.getValue();
Assertions.assertNotNull(json);
assertEquals("\"\"", json.data());
}
}
use of com.azure.android.core.test.implementation.entities.HttpBinJSON in project azure-sdk-for-android by Azure.
the class RestProxyTests method service24Put.
@Test
public void service24Put() {
CountDownLatch latch = new CountDownLatch(1);
CallbackResult<HttpBinJSON> cbResult = new CallbackResult<>();
final Map<String, String> headerCollection = new HashMap<>();
headerCollection.put("DEF", "GHIJ");
headerCollection.put("123", "45");
createService(Service24.class).put(headerCollection, new Callback<Response<HttpBinJSON>>() {
@Override
public void onSuccess(Response<HttpBinJSON> response) {
cbResult.response = response;
latch.countDown();
}
@Override
public void onFailure(Throwable error) {
cbResult.error = error;
latch.countDown();
}
});
awaitOnLatch(latch, "service24Put");
if (cbResult.error != null) {
Assertions.fail(cbResult.error);
} else {
final Response<HttpBinJSON> response = cbResult.response;
assertNotNull(response);
assertEquals(200, response.getStatusCode());
HttpBinJSON result = response.getValue();
assertNotNull(result.headers());
final HttpHeaders resultHeaders = new HttpHeaders(result.headers());
assertEquals("GHIJ", resultHeaders.getValue("ABCDEF"));
assertEquals("45", resultHeaders.getValue("ABC123"));
}
}
use of com.azure.android.core.test.implementation.entities.HttpBinJSON in project azure-sdk-for-android by Azure.
the class RestProxyTests method service19PutWithBodyParamApplicationJsonContentTypeAndByteArrayBodyWithNullBody.
@Test
public void service19PutWithBodyParamApplicationJsonContentTypeAndByteArrayBodyWithNullBody() {
CountDownLatch latch = new CountDownLatch(1);
CallbackResult<HttpBinJSON> cbResult = new CallbackResult<>();
createService(Service19.class).putWithBodyParamApplicationJsonContentTypeAndByteArrayBody(null, new Callback<Response<HttpBinJSON>>() {
@Override
public void onSuccess(Response<HttpBinJSON> response) {
cbResult.response = response;
latch.countDown();
}
@Override
public void onFailure(Throwable error) {
cbResult.error = error;
latch.countDown();
}
});
awaitOnLatch(latch, "service19PutWithBodyParamApplicationJsonContentTypeAndByteArrayBodyWithNullBody");
if (cbResult.error != null) {
Assertions.fail(cbResult.error);
} else {
final Response<HttpBinJSON> response = cbResult.response;
HttpBinJSON json = response.getValue();
Assertions.assertNotNull(json);
assertEquals("", json.data());
}
}
use of com.azure.android.core.test.implementation.entities.HttpBinJSON in project azure-sdk-for-android by Azure.
the class RestProxyTests method service19PutWithHeaderApplicationJsonContentTypeAndByteArrayBodyWithNullBody.
@Test
public void service19PutWithHeaderApplicationJsonContentTypeAndByteArrayBodyWithNullBody() {
CountDownLatch latch = new CountDownLatch(1);
CallbackResult<HttpBinJSON> cbResult = new CallbackResult<>();
createService(Service19.class).putWithHeaderApplicationJsonContentTypeAndByteArrayBody(null, new Callback<Response<HttpBinJSON>>() {
@Override
public void onSuccess(Response<HttpBinJSON> response) {
cbResult.response = response;
latch.countDown();
}
@Override
public void onFailure(Throwable error) {
cbResult.error = error;
latch.countDown();
}
});
awaitOnLatch(latch, "service19PutWithHeaderApplicationJsonContentTypeAndByteArrayBodyWithNullBody");
if (cbResult.error != null) {
Assertions.fail(cbResult.error);
} else {
final Response<HttpBinJSON> response = cbResult.response;
HttpBinJSON json = response.getValue();
Assertions.assertNotNull(json);
assertEquals("", json.data());
}
}
Aggregations