incubator-olio-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shee...@apache.org
Subject svn commit: r819699 - /incubator/olio/workload/php/trunk/src/org/apache/olio/workload/driver/UIDriver.java
Date Mon, 28 Sep 2009 20:06:52 GMT
Author: sheetal
Date: Mon Sep 28 20:06:51 2009
New Revision: 819699

URL: http://svn.apache.org/viewvc?rev=819699&view=rev
Log:
OLIO-84 Modified the php driver to use new multipart api from faban
Also the tagsearchimages misc stats modified to check if > 0 to determine pass/fail criteria.

Modified:
    incubator/olio/workload/php/trunk/src/org/apache/olio/workload/driver/UIDriver.java

Modified: incubator/olio/workload/php/trunk/src/org/apache/olio/workload/driver/UIDriver.java
URL: http://svn.apache.org/viewvc/incubator/olio/workload/php/trunk/src/org/apache/olio/workload/driver/UIDriver.java?rev=819699&r1=819698&r2=819699&view=diff
==============================================================================
--- incubator/olio/workload/php/trunk/src/org/apache/olio/workload/driver/UIDriver.java (original)
+++ incubator/olio/workload/php/trunk/src/org/apache/olio/workload/driver/UIDriver.java Mon
Sep 28 20:06:51 2009
@@ -29,7 +29,6 @@
 import org.apache.commons.httpclient.HttpStatus;
 import org.apache.commons.httpclient.methods.PostMethod;
 import org.apache.commons.httpclient.methods.multipart.FilePart;
-import org.apache.commons.httpclient.methods.multipart.MultipartRequestEntity;
 import org.apache.commons.httpclient.methods.multipart.Part;
 import org.apache.commons.httpclient.methods.multipart.StringPart;
 import com.sun.faban.driver.transport.hc3.ApacheHC3Transport;
@@ -522,13 +521,17 @@
             // We do the images last, not to split the fields into parts
             params.add(new FilePart("upload_image", eventImg));
             params.add(new FilePart("upload_literature", eventPdf));
-            params.add(new StringPart("addeventsubmit", "Create"));
-            Part[] parts = new Part[params.size()];
-            parts = params.toArray(parts);
-            PostMethod post = new PostMethod(addEventResultURL);
-            post.setRequestEntity(
-                        new MultipartRequestEntity(parts, post.getParams()));
-            doMultiPartPost(post);
+            params.add(new StringPart("addeventsubmit", "Create"));            
+            ((ApacheHC3Transport) http).fetchURL(addEventResultURL, params);
+
+            int status = http.getResponseCode();
+            String[] locationHeader = http.getResponseHeader("location");
+            if (locationHeader != null) {
+                logger.fine("redirectLocation is " + locationHeader[0]);
+                http.readURL(baseURL + '/' + locationHeader[0]);
+            } else if (status != HttpStatus.SC_OK) {
+                throw new IOException("Multipart Post did not work, returned status code:
" + status);
+            }
         }      
         ++driverMetrics.addEventTotal;
     }
@@ -540,7 +543,7 @@
     )
     @NegativeExponential(
         cycleType = CycleType.CYCLETIME,
-        cycleMean = 5000,
+        cycleMean = 5000,       
         cycleMin = 2000,
         truncateAtMin = false,
         cycleDeviation = 2
@@ -581,12 +584,17 @@
         params.add(new FilePart("user_image", personImg));
         params.add(new StringPart("summary", parameters[6]));
         params.add(new StringPart("addpersonsubmit", "Create"));
-        Part[] parts = new Part[params.size()];
-        parts = params.toArray(parts);
-        PostMethod post = new PostMethod(addPersonResultURL);
-        post.setRequestEntity(
-                        new MultipartRequestEntity(parts, post.getParams()));
-        doMultiPartPost(post);
+       
+        ((ApacheHC3Transport)http).fetchURL(addPersonResultURL, params);
+
+        int status = http.getResponseCode();
+        String[] locationHeader = http.getResponseHeader("location");
+        if (locationHeader != null) {
+            logger.fine("redirectLocation is " + locationHeader[0]);
+			http.readURL(baseURL + '/' + locationHeader[0]);
+        } else if(status != HttpStatus.SC_OK){
+            throw new IOException("Multipart Post did not work, returned status code: " +
status);
+        }
         ++driverMetrics.addPersonTotal;
     }
 
@@ -990,11 +998,11 @@
             cnt = r.getOpsCountSteady("TagSearch");
             el[5] = new Element();
             el[5].description = "Average images on Tag Search Results";
-            el[5].target = ">= 3.6";
+            //el[5].target = ">= 3.6";
             if (cnt > 0) {
                 double avgImgs = tagSearchImages / (double) cnt;
                 el[5].result = String.format("%.2f", avgImgs);
-                if (avgImgs >= 3.6d)
+                if (avgImgs > 0)
                     el[5].passed = Boolean.TRUE;
                 else
                     el[5].passed = Boolean.FALSE;



Mime
View raw message