You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@olingo.apache.org by mi...@apache.org on 2015/07/10 15:17:55 UTC

[04/11] olingo-odata4 git commit: [OLINGO-708] Improved FIT test for async support

[OLINGO-708] Improved FIT test for async support


Project: http://git-wip-us.apache.org/repos/asf/olingo-odata4/repo
Commit: http://git-wip-us.apache.org/repos/asf/olingo-odata4/commit/a30fb16f
Tree: http://git-wip-us.apache.org/repos/asf/olingo-odata4/tree/a30fb16f
Diff: http://git-wip-us.apache.org/repos/asf/olingo-odata4/diff/a30fb16f

Branch: refs/heads/master
Commit: a30fb16f25a855f92de91dffea218bc2e5fef7ef
Parents: 03bf387
Author: mibo <mi...@apache.org>
Authored: Sat Jun 27 12:18:14 2015 +0200
Committer: mibo <mi...@apache.org>
Committed: Sat Jun 27 12:18:14 2015 +0200

----------------------------------------------------------------------
 .../fit/tecsvc/client/AsyncSupportITCase.java   | 22 ++++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/a30fb16f/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java
----------------------------------------------------------------------
diff --git a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java
index c40ff85..db7dc5c 100644
--- a/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java
+++ b/fit/src/test/java/org/apache/olingo/fit/tecsvc/client/AsyncSupportITCase.java
@@ -23,20 +23,18 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
-import java.io.InputStream;
 import java.net.URI;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.commons.io.IOUtils;
 import org.apache.olingo.client.api.ODataClient;
 import org.apache.olingo.client.api.communication.request.ODataRequest;
-import org.apache.olingo.client.api.communication.request.retrieve.ODataEntityRequest;
 import org.apache.olingo.client.api.communication.response.AsyncResponseWrapper;
 import org.apache.olingo.client.api.communication.response.ODataResponse;
 import org.apache.olingo.client.api.communication.response.ODataRetrieveResponse;
 import org.apache.olingo.client.api.domain.ClientEntity;
 import org.apache.olingo.client.core.ODataClientFactory;
-import org.apache.olingo.client.core.communication.request.AsyncRequestWrapperImpl;
+import org.apache.olingo.commons.api.data.Entity;
+import org.apache.olingo.commons.api.data.ResWrap;
 import org.apache.olingo.commons.api.format.ContentType;
 import org.apache.olingo.fit.AbstractBaseTestITCase;
 import org.apache.olingo.fit.tecsvc.TecSvcConst;
@@ -78,14 +76,16 @@ public final class AsyncSupportITCase extends AbstractBaseTestITCase {
     // get result of first async request
     assertFalse(first.isDone());
 
-//    TimeUnit.SECONDS.sleep(2);
-//    assertTrue(first.isDone());
+    TimeUnit.SECONDS.sleep(2);
+    assertTrue(first.isDone());
 
-//    assertNotNull(first.getODataResponse());
-//    final ODataRetrieveResponse<ClientEntity> firstAsyncResult = getClient().getRetrieveRequestFactory()
-//        .getEntityRequest(respLocationFirstUri).execute();
-//    assertEquals(32767, firstAsyncResult.getBody().getProperty("PropertyInt16").getPrimitiveValue().toValue());
-//    assertEquals(200, firstAsyncResult.getStatusCode());
+    assertNotNull(first.getODataResponse());
+    ODataResponse firstResponse = first.getODataResponse();
+    assertEquals(200, firstResponse.getStatusCode());
+    ResWrap<Entity> entity = getClient().getDeserializer(ContentType.APPLICATION_JSON)
+        .toEntity(firstResponse.getRawResponse());
+    assertEquals(32767, entity.getPayload().getProperty("PropertyInt16").asPrimitive());
+    assertEquals("First Resource - positive values", entity.getPayload().getProperty("PropertyString").asPrimitive());
   }
 
   @Override