olingo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject [06/39] olingo-odata4 git commit: [OLINGO-832] Minor change for PoC demo
Date Fri, 04 Mar 2016 20:36:49 GMT
[OLINGO-832] Minor change for PoC demo


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

Branch: refs/heads/OLINGO-856_ODataHandlerInAPI
Commit: 44e1b02633380e7262ab8985de5c455ee615073c
Parents: c02215e
Author: Michael Bolz <michael.bolz@sap.com>
Authored: Mon Jan 25 14:43:24 2016 +0100
Committer: Michael Bolz <michael.bolz@sap.com>
Committed: Mon Jan 25 14:43:24 2016 +0100

----------------------------------------------------------------------
 .../processor/TechnicalEntityProcessor.java     | 32 +++++++++++++++++---
 1 file changed, 27 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/olingo-odata4/blob/44e1b026/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
----------------------------------------------------------------------
diff --git a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
index f4c81c1..dc7f0b7 100644
--- a/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
+++ b/lib/server-tecsvc/src/main/java/org/apache/olingo/server/tecsvc/processor/TechnicalEntityProcessor.java
@@ -567,12 +567,11 @@ public class TechnicalEntityProcessor extends TechnicalProcessor
       @Override
       public Entity next() {
         Entity next = entityIterator.next();
-        replacePrimitiveProperty(next, "PropertyString", generateData(28192));
-//        next.getProperties().remove(1);
+//        replacePrimitiveProperty(next, "PropertyString", generateData(28192));
+        replacePrimitiveProperty(next, "PropertyString", generateData(request));
 //        next.addProperty(new Property(null, "PropertyString", ValueType.PRIMITIVE, generateData(28192)));
-        try {
-          TimeUnit.MILLISECONDS.sleep(2500);
-        } catch (InterruptedException e) { }
+
+        sleep(request, 2500);
         return next;
       }
 
@@ -594,6 +593,29 @@ public class TechnicalEntityProcessor extends TechnicalProcessor
         }
       }
 
+      private void sleep(ODataRequest request, int defaultTimeMs) {
+        String sleepTimeMs = request.getHeader("StreamSleep");
+        if(sleepTimeMs != null) {
+          try {
+            defaultTimeMs = Integer.parseInt(sleepTimeMs);
+          } catch (NumberFormatException e) { }
+        }
+        try {
+          TimeUnit.MILLISECONDS.sleep(defaultTimeMs);
+        } catch (InterruptedException e) { }
+
+      }
+
+      private String generateData(ODataRequest request) {
+        String streamHeader = request.getHeader("StreamData");
+        if(streamHeader != null) {
+          try {
+            return generateData(Integer.parseInt(streamHeader));
+          } catch (NumberFormatException e) { }
+        }
+        return generateData(28192);
+      }
+
       private String generateData(final int len) {
         Random random = new Random();
         StringBuilder b = new StringBuilder(len);


Mime
View raw message