dloy avatar dloy committed d0d20ec

Test multithread

Comments (0)

Files changed (2)

core/src/main/java/org/cdlib/mrt/core/FixityClient.java

 
 public class FixityClient
 {
-    private static final String NAME = "FixityAddClient";
+    private static final String NAME = "FixityClient";
     private static final String MESSAGE = NAME + ": ";
-    private static boolean DEBUG = true;
+    private static boolean DEBUG = false;
     protected final static String NL = System.getProperty("line.separator");
     protected final static String FORMAT_NAME_POST = "t";
     protected final static String FORMAT_NAME_MULTIPART = "response-form";
                 link,
                 timeout,
                 retry,
+                0,
                 url,
                 source,
                 size,
             String linkS,
             int timeout,
             int retry,
+            String itemKeyS,
             String urlS,
             String source,
             String sizeS,
         URL link = null;
         URL url = null;
         long size = -1;
+        long itemKey = 0;
         MessageDigest messageDigest = null;
         FormatInfo format = null;
 
                 }
             }
 
+            if (StringUtil.isNotEmpty(itemKeyS)) {
+                try {
+                    itemKey = Long.parseLong(itemKeyS);
+                } catch (Exception ex) {
+                    throw new TException.INVALID_OR_MISSING_PARM("itemKeyS invalid:" + itemKeyS);
+                }
+            }
+
             if (StringUtil.isNotEmpty(digestType)
                     && StringUtil.isNotEmpty(digestValue)) {
                 try {
             if (messageDigest != null) messageDigestS = messageDigest.toString();
             log(MESSAGE + "update:"
                     + " - cmd=" + cmd
+                    + " - itemKey=" + itemKey
                     + " - url=" + url.toString()
                     + " - source=" + source
                     + " - size=" + size
                 link,
                 timeout,
                 retry,
+                itemKey,
                 url,
                 source,
                 size,
                 String cmd,
                 URL link,
                 int timeout,
+                long itemKey,
                 URL url,
                 String source,
                 long size,
             HttpClient httpclient = new DefaultHttpClient(params);
             HttpPost httppost = new HttpPost(addFixityURL.toString());
             MultipartEntity reqEntity = new MultipartEntity();
+            if (itemKey > 0) {
+                StringBody body = new StringBody("" + itemKey);
+                reqEntity.addPart("itemkey", body);
+            }
             if (url != null) {
                 StringBody body = new StringBody(url.toString());
                 reqEntity.addPart("url", body);
 
             httppost.setEntity(reqEntity);
 
-            System.out.println("executing request " + httppost.getRequestLine());
+            if (DEBUG) System.out.println("executing request " + httppost.getRequestLine());
             HttpResponse response = httpclient.execute(httppost);
             return response;
 
             URL link,
             int timeout,
             int retry,
+            long itemKey,
             URL url,
             String source,
             long size,
                     cmd,
                     link,
                     timeout,
+                    itemKey,
                     url,
                     source,
                     size,
             String responseState = StringUtil.streamToString(resEntity.getContent(), "utf-8");
             if (StringUtil.isNotEmpty(responseState)) {
                 resultProp.setProperty("response.state", responseState);
-                System.out.println("mrt-response:" + responseState);
+                if (DEBUG) System.out.println("mrt-response:" + responseState);
             }
             Header [] headers = response.getAllHeaders();
             for (Header header : headers) {
                         "header." + header.getName(),
                         header.getValue());
             }
-            System.out.println(PropertiesUtil.dumpProperties("!!!!sendArchiveMultipart!!!!", resultProp, 100));
+            if (DEBUG) {
+                System.out.println(PropertiesUtil.dumpProperties("!!!!sendArchiveMultipart!!!!", resultProp, 100));
 
-            System.out.println("----------------------------------------");
-            System.out.println(response.getStatusLine());
-            if (resEntity != null) {
-                System.out.println("Response content length: " + resEntity.getContentLength());
-                System.out.println("Chunked?: " + resEntity.isChunked());
+                System.out.println("----------------------------------------");
+                System.out.println(response.getStatusLine());
+                if (resEntity != null) {
+                    System.out.println("Response content length: " + resEntity.getContentLength());
+                    System.out.println("Chunked?: " + resEntity.isChunked());
+                }
             }
             if (resEntity != null) {
                 resEntity.consumeContent();

core/src/test/java/org/cdlib/mrt/utility/TimerUtilTest.java

     }
 
     
-    //@Test
+    @Test
     public void testLog()
     {
         try {
             //File log = FileUtil.getTempFile("tst", "txt");
-            String path = "C:/Documents and Settings/dloy/My Documents/MRTMaven/fixity/log/fix110707.log";
+            String path = "C:/Documents and Settings/dloy/My Documents/MRTMaven/work/timings/split-fix110711.log";
+            System.out.println("PATH:" + path);
             File log = new File(path);
             TimerUtil util = new TimerUtil(log);
             util.process();
     }
 
 
-    @Test
+    //@Test
     public void genericTimerTest()
     {
         File log = null;
         }
     }
 
-    @Test
+    //@Test
     public void genericTimerThread()
     {
         File log = null;
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.