gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] storm/org/nongnu/storm/http/client testSimpleHT...


From: Hermanni Hyytiälä
Subject: [Gzz-commits] storm/org/nongnu/storm/http/client testSimpleHT...
Date: Mon, 28 Apr 2003 07:05:02 -0400

CVSROOT:        /cvsroot/storm
Module name:    storm
Changes by:     Hermanni Hyytiälä <address@hidden>      03/04/28 07:05:02

Modified files:
        org/nongnu/storm/http/client: testSimpleHTTPClient.test 

Log message:
        Create pool, create block, do GET using block's ID

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/http/client/testSimpleHTTPClient.test.diff?tr1=1.4&tr2=1.5&r1=text&r2=text

Patches:
Index: storm/org/nongnu/storm/http/client/testSimpleHTTPClient.test
diff -u storm/org/nongnu/storm/http/client/testSimpleHTTPClient.test:1.4 
storm/org/nongnu/storm/http/client/testSimpleHTTPClient.test:1.5
--- storm/org/nongnu/storm/http/client/testSimpleHTTPClient.test:1.4    Mon Apr 
28 05:22:49 2003
+++ storm/org/nongnu/storm/http/client/testSimpleHTTPClient.test        Mon Apr 
28 07:05:01 2003
@@ -22,14 +22,10 @@
 
 import java, org
 
-
 from org.nongnu.storm.http.client import HTTPConnection
 from org.nongnu.storm.http.client import HTTPRequest
 from org.nongnu.storm.http.client import HTTPResponse
 from org.nongnu.storm.impl import TransientPool
-from org.nongnu.storm.modules.gispmap import GispP2PMap
-from org.nongnu.storm.impl.p2p import Peer
-from org.nongnu.storm.impl import DirPool
 from org.nongnu.storm.util import HTTPProxy
 
 host0 = "127.0.0.1"
@@ -47,32 +43,42 @@
 
 def testHTTPClient():
 
+    
+         # Create a empty pool (transient pool)
         empty = java.util.Collections.EMPTY_SET
-        pool = TransientPool(empty)         
-        
-        #pub = TransientPool(empty)
-        #cache = TransientPool(empty)
-        #map1 = GispP2PMap("/home/hemppah/cvs/storm")    
-        #peer = Peer(pub, cache, map1)    
-        #pool = peer.getPool()
-        
-        
-        serverthread = java.lang.Thread(HTTPProxy(pool, 5555))
-         serverthread.start()         
+        pool = TransientPool(empty)
+
+         # Create data form block
+         bos = pool.getBlockOutputStream("text/plain")
+         osw = java.io.OutputStreamWriter(bos)
+         osw.write("Hello, world!")
+         osw.close()
+         block = pool.get(bos.getBlockId())        
+         blockid = block.getId().toString()
          
-        
+         
+         # Start HTTP-proxy thread
+        serverthread = java.lang.Thread(HTTPProxy(pool, 5555))
+         serverthread.start() 
         print "HTTP proxy thread started..."
         
+         
+         #Create HTTP connection to localhost
         httpconn = org.nongnu.storm.http.client.HTTPConnection(host0, port)
                 
-        req = httpconn.newRequest("GET", request, protocol2, 
java.lang.Boolean.FALSE)
-        print "Make GET request(s)..."
-        
+                 
+         # Perform GET request using the ID of created block
+         print "Perform GET request(s)..."
+        req = httpconn.newRequest("GET", "rewrite/" + blockid, protocol2, 
java.lang.Boolean.FALSE)
+        # Add more requests here...
+         
+         
         resp = httpconn.send(req)       
         print resp.status, resp.reason
-        #assert resp.status == "Ok"
-        
-        httpconn.close
-        #java.lang.Thread.currentThread().interrupt()
+
+         # Conditions here...
+         assert resp.status == 200
+                  
+        httpconn.close  
         java.lang.Thread(serverthread).interrupt()
         print "HTTP proxy thread stopped..."    




reply via email to

[Prev in Thread] Current Thread [Next in Thread]