camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject camel git commit: fix olingo2's sporadic test error caused by non-determinism
Date Wed, 11 Nov 2015 13:53:02 GMT
Repository: camel
Updated Branches:
  refs/heads/camel-2.16.x 369d0a6d6 -> 44c1d7e04


fix olingo2's sporadic test error caused by non-determinism


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/44c1d7e0
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/44c1d7e0
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/44c1d7e0

Branch: refs/heads/camel-2.16.x
Commit: 44c1d7e04c41146c15e376f438937a794a5c4ec8
Parents: 369d0a6
Author: Akitoshi Yoshida <ay@apache.org>
Authored: Wed Nov 11 14:47:00 2015 +0100
Committer: Akitoshi Yoshida <ay@apache.org>
Committed: Wed Nov 11 14:52:26 2015 +0100

----------------------------------------------------------------------
 .../camel/component/olingo2/Olingo2AppAPITest.java   | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/44c1d7e0/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2AppAPITest.java
----------------------------------------------------------------------
diff --git a/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2AppAPITest.java
b/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2AppAPITest.java
index 3d1bdd2..2dd6ca4 100644
--- a/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2AppAPITest.java
+++ b/components/camel-olingo2/camel-olingo2-component/src/test/java/org/apache/camel/component/olingo2/Olingo2AppAPITest.java
@@ -41,6 +41,7 @@ import org.apache.camel.test.AvailablePortFinder;
 import org.apache.http.entity.ContentType;
 import org.apache.olingo.odata2.api.commons.HttpStatusCodes;
 import org.apache.olingo.odata2.api.edm.Edm;
+import org.apache.olingo.odata2.api.edm.EdmEntitySet;
 import org.apache.olingo.odata2.api.edm.EdmEntitySetInfo;
 import org.apache.olingo.odata2.api.ep.EntityProvider;
 import org.apache.olingo.odata2.api.ep.EntityProviderReadProperties;
@@ -104,6 +105,7 @@ public class Olingo2AppAPITest {
 
     private static Olingo2App olingoApp;
     private static Edm edm;
+    private static Map<String, EdmEntitySet> edmEntitySetMap;
 
     private static Olingo2SampleServer server;
 
@@ -142,6 +144,11 @@ public class Olingo2AppAPITest {
         edm = responseHandler.await();
         LOG.info("Read default EntityContainer:  {}", responseHandler.await().getDefaultEntityContainer().getName());
 
+        edmEntitySetMap = new HashMap<String, EdmEntitySet>();
+        for (EdmEntitySet ees : edm.getEntitySets()) {
+            edmEntitySetMap.put(ees.getName(), ees);
+        }
+
         // wait for generated data to be registered in server
         Thread.sleep(2000);
     }
@@ -183,7 +190,7 @@ public class Olingo2AppAPITest {
         final InputStream rawfeed = responseHandler.await();
         assertNotNull("Data feed", rawfeed);
         // for this test, we just let EP to verify the stream data 
-        final ODataFeed dataFeed = EntityProvider.readFeed(TEST_FORMAT_STRING, edm.getEntitySets().get(2),

+        final ODataFeed dataFeed = EntityProvider.readFeed(TEST_FORMAT_STRING, edmEntitySetMap.get(MANUFACTURERS),

                                                            rawfeed, EntityProviderReadProperties.init().build());
         LOG.info("Entries:  {}", prettyPrint(dataFeed));
     }
@@ -218,7 +225,7 @@ public class Olingo2AppAPITest {
 
         olingoApp.uread(edm, TEST_MANUFACTURER, null, responseHandler);
         InputStream rawentry = responseHandler.await();
-        ODataEntry entry = EntityProvider.readEntry(TEST_FORMAT_STRING, edm.getEntitySets().get(2),

+        ODataEntry entry = EntityProvider.readEntry(TEST_FORMAT_STRING, edmEntitySetMap.get(MANUFACTURERS),

                                                     rawentry, EntityProviderReadProperties.init().build());
         LOG.info("Single Entry:  {}", prettyPrint(entry));
 
@@ -226,7 +233,7 @@ public class Olingo2AppAPITest {
 
         olingoApp.uread(edm, TEST_CAR, null, responseHandler);
         rawentry = responseHandler.await();
-        entry = EntityProvider.readEntry(TEST_FORMAT_STRING, edm.getEntitySets().get(0),

+        entry = EntityProvider.readEntry(TEST_FORMAT_STRING, edmEntitySetMap.get(CARS),
                                          rawentry, EntityProviderReadProperties.init().build());
         LOG.info("Single Entry:  {}", prettyPrint(entry));
 
@@ -237,7 +244,7 @@ public class Olingo2AppAPITest {
         olingoApp.uread(edm, TEST_MANUFACTURER, queryParams, responseHandler);
 
         rawentry = responseHandler.await();
-        ODataEntry entryExpanded = EntityProvider.readEntry(TEST_FORMAT_STRING, edm.getEntitySets().get(2),

+        ODataEntry entryExpanded = EntityProvider.readEntry(TEST_FORMAT_STRING, edmEntitySetMap.get(MANUFACTURERS),

                                                             rawentry, EntityProviderReadProperties.init().build());
         LOG.info("Single Entry with expanded Cars relation:  {}", prettyPrint(entryExpanded));
     }


Mime
View raw message