gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] storm ./test.py org/nongnu/storm/BlockId.java o...


From: Benja Fallenstein
Subject: [Gzz-commits] storm ./test.py org/nongnu/storm/BlockId.java o...
Date: Mon, 21 Apr 2003 17:07:41 -0400

CVSROOT:        /cvsroot/storm
Module name:    storm
Changes by:     Benja Fallenstein <address@hidden>      03/04/21 17:07:41

Modified files:
        .              : test.py 
        org/nongnu/storm: BlockId.java BlockId.test 
                          BlockOutputStream.java CollectionListener.java 
                          IndexedPool.java IndexedPool.meta 
                          StormPool.java StormPool.meta 
        org/nongnu/storm/http/server: HTTPConnection.java 
        org/nongnu/storm/impl: AbstractPool.java AsyncSetCollector.java 
                               SimpleSetCollector.java 
        org/nongnu/storm/impl/p2p: P2PPool.java Peer.java 
        org/nongnu/storm/util: HTTPProxy.java 
Added files:
        org/nongnu/storm/impl/p2p: Peer.test 

Log message:
        Add tests for p2p stuff and missing code for p2p indexing;
        fix bugs. Now, p2p with indexing apparently about *works*.
        When we've added the indexing plugin for Alph,
        it will therefore *work with p2p*.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/test.py.diff?tr1=1.2&tr2=1.3&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/BlockId.java.diff?tr1=1.10&tr2=1.11&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/BlockId.test.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/BlockOutputStream.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/CollectionListener.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/IndexedPool.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/IndexedPool.meta.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/StormPool.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/StormPool.meta.diff?tr1=1.7&tr2=1.8&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/http/server/HTTPConnection.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/impl/AbstractPool.java.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/impl/AsyncSetCollector.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/impl/SimpleSetCollector.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/impl/p2p/Peer.test?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/impl/p2p/P2PPool.java.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/impl/p2p/Peer.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/storm/storm/org/nongnu/storm/util/HTTPProxy.java.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: storm/org/nongnu/storm/BlockId.java
diff -u storm/org/nongnu/storm/BlockId.java:1.10 
storm/org/nongnu/storm/BlockId.java:1.11
--- storm/org/nongnu/storm/BlockId.java:1.10    Tue Apr 15 05:33:41 2003
+++ storm/org/nongnu/storm/BlockId.java Mon Apr 21 17:07:41 2003
@@ -171,6 +171,9 @@
            throw new IllegalArgumentException("x- and x. content types "
                                               + "not allowed in "
                                               + "Storm URNs");
+
+       if(s.indexOf(' ') >= 0)
+           throw new IllegalArgumentException("URIs cannot contain spaces");
     }
 
     /** Create a new SHA-1 message digest; throw an error
Index: storm/org/nongnu/storm/BlockId.test
diff -u storm/org/nongnu/storm/BlockId.test:1.7 
storm/org/nongnu/storm/BlockId.test:1.8
--- storm/org/nongnu/storm/BlockId.test:1.7     Tue Apr 15 05:33:41 2003
+++ storm/org/nongnu/storm/BlockId.test Mon Apr 21 17:07:41 2003
@@ -59,6 +59,29 @@
     assert id != id3
     assert id.hashCode() != id3.hashCode()
 
+def testSpaces():
+    """Spaces in content types must throw exceptions"""
+    str = ("urn:x-storm:1.0:%s,"
+           "u7uu5zpmkoeykkwhxd4unlqycc36gvl7."
+           "jtlcbiy2r6gfsznbgj42yzqbqk4ti373bqs5qyy")
+
+    BlockId(str % 'text/plain;charset=UTF-8')
+
+    try: BlockId(str % 'text/plain; charset=UTF-8')
+    except java.lang.IllegalArgumentException: pass
+    else: assert 0
+
+    sha1 = com.bitzi.util.Base32.decode(
+        "u7uu5zpmkoeykkwhxd4unlqycc36gvl7")
+    tiger = com.bitzi.util.Base32.decode(
+        "jtlcbiy2r6gfsznbgj42yzqbqk4ti373bqs5qyy")
+    BlockId("text/plain;charset=UTF-8", sha1, tiger)
+
+    try: BlockId("text/plain; charset=UTF-8", sha1, tiger)
+    except java.lang.IllegalArgumentException: pass
+    else: assert 0
+
+
 def testXType():
     """X- content types must throw exceptions"""
 
Index: storm/org/nongnu/storm/BlockOutputStream.java
diff -u storm/org/nongnu/storm/BlockOutputStream.java:1.3 
storm/org/nongnu/storm/BlockOutputStream.java:1.4
--- storm/org/nongnu/storm/BlockOutputStream.java:1.3   Mon Apr  7 15:35:58 2003
+++ storm/org/nongnu/storm/BlockOutputStream.java       Mon Apr 21 17:07:41 2003
@@ -100,13 +100,15 @@
 
     /** Get the <code>Block</code> created by this stream.
      *  This may only be called after the stream has been closed.
+     *  @throws IllegalStateException if the stream isn't closed yet.
      */
-    abstract public Block getBlock() throws IOException;
+    abstract public Block getBlock() throws IOException, IllegalStateException;
 
     /** Get the id of the block created by this stream.
      *  This may only be called after the stream has been closed.
+     *  @throws IllegalStateException if the stream isn't closed yet.
      */
-    public BlockId getBlockId() throws IOException {
+    public BlockId getBlockId() throws IOException, IllegalStateException {
         return getBlock().getId();
     }
 }
Index: storm/org/nongnu/storm/CollectionListener.java
diff -u storm/org/nongnu/storm/CollectionListener.java:1.3 
storm/org/nongnu/storm/CollectionListener.java:1.4
--- storm/org/nongnu/storm/CollectionListener.java:1.3  Mon Apr  7 15:35:58 2003
+++ storm/org/nongnu/storm/CollectionListener.java      Mon Apr 21 17:07:41 2003
@@ -36,4 +36,12 @@
      *          from this <code>Collector</code>.
      */
     boolean item(Object item);
+
+    /** No more items will be received.
+     *  @param timeout Whether the operation finished
+     *         because of a timeout. If false,
+     *         we know the operation has completed
+     *         successfully.
+     */
+    void finish(boolean timeout);
 }
Index: storm/org/nongnu/storm/IndexedPool.java
diff -u storm/org/nongnu/storm/IndexedPool.java:1.4 
storm/org/nongnu/storm/IndexedPool.java:1.5
--- storm/org/nongnu/storm/IndexedPool.java:1.4 Sat Apr 19 08:20:28 2003
+++ storm/org/nongnu/storm/IndexedPool.java     Mon Apr 21 17:07:41 2003
@@ -158,6 +158,11 @@
      */
     Map getIndices();
 
+    /** Get a set of all index types this pool supports.
+     *  The returned set cannot be modified.
+     */
+    Set getIndexTypes();
+
     /** A convenience method to get a <code>Pointer</code> instance
      *  for this pool. This is defined always to return this:
      *  <pre>
Index: storm/org/nongnu/storm/IndexedPool.meta
diff -u storm/org/nongnu/storm/IndexedPool.meta:1.3 
storm/org/nongnu/storm/IndexedPool.meta:1.4
--- storm/org/nongnu/storm/IndexedPool.meta:1.3 Mon Apr  7 19:27:54 2003
+++ storm/org/nongnu/storm/IndexedPool.meta     Mon Apr 21 17:07:41 2003
@@ -73,3 +73,16 @@
     assert i.getBlocks("text/enriched") == set([])
 
     assert i == 
p.getIndex(org.nongnu.storm.util.ContentTypeIndexType.contentTypeIndexTypeURI)
+
+def testGetIndexTypes():
+    p = Pool([])
+    assert p.getIndexTypes().isEmpty()
+
+    t = org.nongnu.storm.util.ContentTypeIndexType()
+    q = Pool([t])
+    assert q.getIndexTypes().contains(t)
+    assert q.getIndexTypes().size() == 1
+
+    try: p.getIndexTypes().add(t)
+    except: pass
+    else: assert 0
Index: storm/org/nongnu/storm/StormPool.java
diff -u storm/org/nongnu/storm/StormPool.java:1.4 
storm/org/nongnu/storm/StormPool.java:1.5
--- storm/org/nongnu/storm/StormPool.java:1.4   Mon Apr  7 16:07:38 2003
+++ storm/org/nongnu/storm/StormPool.java       Mon Apr 21 17:07:41 2003
@@ -148,6 +148,11 @@
     // CREATING NEW BLOCKS
 
     /** Get an <code>OutputStream</code> for adding a new block to this pool.
+     *  @param contentType The content type of the new block.
+     *         Must already be URI-escaped: All non-URN characters
+     *         (except the first slash, as in image/jpeg) and significant
+     *         upper-case characters must be percent-escaped.
+     *         There must be no spaces in the contentType string.
      *  @see BlockOutputStream
      */
     BlockOutputStream getBlockOutputStream(String contentType) throws 
IOException;
Index: storm/org/nongnu/storm/StormPool.meta
diff -u storm/org/nongnu/storm/StormPool.meta:1.7 
storm/org/nongnu/storm/StormPool.meta:1.8
--- storm/org/nongnu/storm/StormPool.meta:1.7   Sat Apr 19 09:11:13 2003
+++ storm/org/nongnu/storm/StormPool.meta       Mon Apr 21 17:07:41 2003
@@ -49,8 +49,14 @@
     osw.close()
 
     b = pool.get(bos.getBlockId())
-    
-    assert bos.getBlock().getPool() == b.getPool() == pool
+
+    # We do *not* perform the test on the following line
+    # because it is entirely allowable for a pool to
+    # proxy block creation requests to another pool,
+    # and also to retrieve blocks from a different pool
+    # than blocks are written to.
+    #assert bos.getBlock().getPool() == b.getPool() == pool
+
     b.getId().check(CopyUtil.readBytes(b.getInputStream()))
 
     s = ""
@@ -64,6 +70,23 @@
 
     assert b.getId().getContentType() == "text/plain"
 
+def testCloseBlockOutputStream():
+    """getBlock() on a non-closed BOS must throw an error"""
+    bos = pool.getBlockOutputStream("text/plain")
+
+    try: bos.getBlock()
+    except: pass
+    else: assert 0
+
+    try: bos.getBlockId()
+    except: pass
+    else: assert 0
+
+    bos.close()
+
+    bos.getBlock()
+    bos.getBlockId()
+
 def testBlockTmpFile():
     """
     Test that creating a blocktmpfile out of a block
@@ -218,9 +241,30 @@
 
 def testAddBlock():
     """
-    Test adding a block from a different pool. XXX missing!!!
+    Test adding a block from a different pool.
     """
 
-    pass
+    p2 = org.nongnu.storm.impl.TransientPool(java.util.HashSet())
+
+    bos = p2.getBlockOutputStream("text/plain")
+    bos.write("Hi")
+    bos.close();
+
+    block = bos.getBlock()
+    id = block.getId()
+
+    pool.add(block)
+    b2 = pool.get(id)
 
+    assert b2.getId() == id
 
+    stream = b2.getInputStream()
+    assert org.nongnu.storm.util.CopyUtil.readString(stream) == "Hi"
+
+
+def testAddBadBlock():
+    """
+    Test adding a spoofed block with a wrong id (XXX missing!)
+    Must throw a WrongIdException.
+    """
+    pass
Index: storm/org/nongnu/storm/http/server/HTTPConnection.java
diff -u storm/org/nongnu/storm/http/server/HTTPConnection.java:1.1 
storm/org/nongnu/storm/http/server/HTTPConnection.java:1.2
--- storm/org/nongnu/storm/http/server/HTTPConnection.java:1.1  Sat Apr 19 
08:20:29 2003
+++ storm/org/nongnu/storm/http/server/HTTPConnection.java      Mon Apr 21 
17:07:41 2003
@@ -253,7 +253,10 @@
                         try {
                             iter(this);
                         } catch (IOException _) {
-                           _.printStackTrace();
+                           // doesn't seem to be a big problem--
+                           // don't print stack trace if dbg is off,
+                           // in order not to frighten users XXX
+                           if(dbg) _.printStackTrace();
 
                            // IOExceptions often occur when the pipe
                            // is somehow broken or closed-- if it's
@@ -349,7 +352,8 @@
                     + "</h1> - " + reason + "\n");
             res.close();
         } catch (IOException e) { 
-            e.printStackTrace();
+           // XXX not only when dbg is on?
+            if(dbg) e.printStackTrace();
         }
     }
 
Index: storm/org/nongnu/storm/impl/AbstractPool.java
diff -u storm/org/nongnu/storm/impl/AbstractPool.java:1.3 
storm/org/nongnu/storm/impl/AbstractPool.java:1.4
--- storm/org/nongnu/storm/impl/AbstractPool.java:1.3   Mon Apr  7 16:07:38 2003
+++ storm/org/nongnu/storm/impl/AbstractPool.java       Mon Apr 21 17:07:41 2003
@@ -88,6 +88,10 @@
 
        return index;
     }
+    
+    public Set getIndexTypes() {
+       return Collections.unmodifiableSet(indexTypes);
+    }
 
     /**
     public Pointer getPointer(String uri) throws IOException {
@@ -129,7 +133,10 @@
         */
        protected abstract Block makeBlock() throws IOException;
 
-        public Block getBlock() { return block; }
+        public Block getBlock() { 
+           if(!closed) throw new IllegalStateException("Not closed");
+           return block; 
+       }
     }
 
     protected abstract class AbstractBlock implements Block {
Index: storm/org/nongnu/storm/impl/AsyncSetCollector.java
diff -u storm/org/nongnu/storm/impl/AsyncSetCollector.java:1.4 
storm/org/nongnu/storm/impl/AsyncSetCollector.java:1.5
--- storm/org/nongnu/storm/impl/AsyncSetCollector.java:1.4      Mon Apr 21 
14:15:43 2003
+++ storm/org/nongnu/storm/impl/AsyncSetCollector.java  Mon Apr 21 17:07:41 2003
@@ -54,7 +54,7 @@
        this.state = 0;
     }
 
-    protected void receive(Object o) {
+    public void receive(Object o) {
        if(state != 0)
            throw new IllegalStateException("Cannot receive more elements");
        
@@ -67,8 +67,13 @@
        }
     }
 
-    protected synchronized void finish(boolean timeout) {
+    public synchronized void finish(boolean timeout) {
        state = timeout ? -1 : 1;
+
+       for(Iterator i=listeners.iterator(); i.hasNext();) {
+           CollectionListener l = (CollectionListener)i.next();
+           l.finish(timeout);
+       }
        notifyAll();
     }
 
@@ -139,6 +144,8 @@
                    queue.add(item);
                    queue.notifyAll();
                    return true;
+               }
+               public void finish(boolean timeout) {
                }
            });
        return new Iterator() {
Index: storm/org/nongnu/storm/impl/SimpleSetCollector.java
diff -u storm/org/nongnu/storm/impl/SimpleSetCollector.java:1.4 
storm/org/nongnu/storm/impl/SimpleSetCollector.java:1.5
--- storm/org/nongnu/storm/impl/SimpleSetCollector.java:1.4     Mon Apr 21 
14:15:43 2003
+++ storm/org/nongnu/storm/impl/SimpleSetCollector.java Mon Apr 21 17:07:41 2003
@@ -96,8 +96,9 @@
 
     public void addCollectionListener(CollectionListener l) {
        for(Iterator i=set.iterator(); i.hasNext();) {
-           if(!l.item(i.next())) return;
+           if(!l.item(i.next())) break;
        }
+       l.finish(false);
     }
 
     public int size() {
Index: storm/org/nongnu/storm/impl/p2p/P2PPool.java
diff -u storm/org/nongnu/storm/impl/p2p/P2PPool.java:1.4 
storm/org/nongnu/storm/impl/p2p/P2PPool.java:1.5
--- storm/org/nongnu/storm/impl/p2p/P2PPool.java:1.4    Mon Apr 21 14:15:43 2003
+++ storm/org/nongnu/storm/impl/p2p/P2PPool.java        Mon Apr 21 17:07:41 2003
@@ -63,15 +63,21 @@
            Collector c = map.get(id.toString());
            for(Iterator i=c.blockingIterator(); i.hasNext();) {
                String url = (String)i.next();
-               URLConnection conn = new URL(url).openConnection();
-               BlockOutputStream bos = 
-                   cache.getBlockOutputStream(conn.getContentType());
-               CopyUtil.copy(conn.getInputStream(), bos);
-               if(bos.getBlockId().equals(id))
-                   return bos.getBlock();
-               else
-                   p("Block ids didn't match: "+id+" / "+
-                     bos.getBlockId()+" (from "+url+").");
+               try {
+                   URLConnection conn = new URL(url).openConnection();
+                   String contentType = conn.getContentType();
+                   if(contentType == null) continue;
+                   BlockOutputStream bos = 
+                       cache.getBlockOutputStream(conn.getContentType());
+                   CopyUtil.copy(conn.getInputStream(), bos);
+                   if(bos.getBlockId().equals(id))
+                       return bos.getBlock();
+                   else
+                       p("Block ids didn't match: "+id+" / "+
+                         bos.getBlockId()+" (from "+url+").");
+               } catch(IOException e) {
+                   // next iteration
+               }
            }
            throw new FileNotFoundException(""+id);
        }
@@ -97,8 +103,39 @@
        final String prefix = indexType.getIndexTypeURI()+" ";
        return new DB() {
                public Collector get(String key) throws IOException {
-                   return map.get(prefix + key);
+                   Collector collector = map.get(prefix+key);
+                   AsyncSetCollector result = new AsyncSetCollector();
+                   CollectionListener l = new MyListener(key, result);
+                   collector.addCollectionListener(l);
+                   return result;
                }
            };
+    }
+
+    private class MyListener implements CollectionListener {
+       String key;
+       AsyncSetCollector addTo;
+       MyListener(String key, AsyncSetCollector addTo) {
+           this.key = key;
+           this.addTo = addTo;
+       }
+       public boolean item(Object o) {
+           try {
+               String s = (String)o;
+               int sp = s.indexOf(' ');
+               if(sp < 0) return true; // ignore bad data
+               BlockId id = new BlockId(s.substring(0, sp));
+               String value = s.substring(sp+1);
+               addTo.receive(new IndexedPool.Mapping(id, key, value));
+           } catch(IllegalArgumentException _) {
+               // When there's an exception when creating the id, 
+               // assume that the data we received from the net 
+                // was bad; simply ignore.
+           }
+           return true;
+       }
+       public void finish(boolean timeout) {
+           addTo.finish(timeout);
+       }
     }
 }
Index: storm/org/nongnu/storm/impl/p2p/Peer.java
diff -u storm/org/nongnu/storm/impl/p2p/Peer.java:1.1 
storm/org/nongnu/storm/impl/p2p/Peer.java:1.2
--- storm/org/nongnu/storm/impl/p2p/Peer.java:1.1       Sat Apr 19 08:20:32 2003
+++ storm/org/nongnu/storm/impl/p2p/Peer.java   Mon Apr 21 17:07:41 2003
@@ -39,6 +39,8 @@
 public class Peer {
 
     protected P2PPool pool;
+    protected IndexedPool publishedPool;
+    protected P2PMap map;
     protected HTTPProxy server;
 
     public Peer(IndexedPool publishedPool,
@@ -47,16 +49,47 @@
        if(publishedPool == null)
            publishedPool = new TransientPool(Collections.EMPTY_SET);
 
+       this.publishedPool = publishedPool;
+       this.map = map;
+
        pool = new P2PPool(map, cachePool, 
-                          publishedPool.getIndices().keySet());
+                          publishedPool.getIndexTypes());
+
+       int port = 37000;
+       while(server == null) {
+           try {
+               server = new HTTPProxy(publishedPool, port);
+           } catch(java.net.BindException _) {
+               port++;
+           }
+       }
+       publish();
+       new Thread(server).start();
+    }
 
-       server = new HTTPProxy(publishedPool, 37000+(int)(2000 * new 
java.util.Random().nextDouble()));
+    /** Re-publish the contents of <code>publishedPool</code>
+     *  to the p2p map.
+     */
+    public void publish() throws IOException {
+       Set types = publishedPool.getIndexTypes();
        for(Iterator i=publishedPool.getIds().block().iterator();
            i.hasNext();) {
            BlockId id = (BlockId)i.next();
+           Block block = publishedPool.get(id);
            map.put(id.toString(), server.getURL()+id.toString());
+
+           for(Iterator j=types.iterator(); j.hasNext();) {
+               IndexedPool.IndexType type = 
+                   (IndexedPool.IndexType)j.next();
+               Set mappings = type.getMappings(block);
+               for(Iterator k = mappings.iterator(); k.hasNext();) {
+                   IndexedPool.Mapping m =
+                       (IndexedPool.Mapping)k.next();
+                   map.put(type.getIndexTypeURI()+" "+m.key,
+                           m.block+" "+m.value);
+               }
+           }
        }
-       new Thread(server).start();
        // XXX put indexing information into pool!
     }
 
Index: storm/org/nongnu/storm/util/HTTPProxy.java
diff -u storm/org/nongnu/storm/util/HTTPProxy.java:1.1 
storm/org/nongnu/storm/util/HTTPProxy.java:1.2
--- storm/org/nongnu/storm/util/HTTPProxy.java:1.1      Sat Apr 19 08:20:32 2003
+++ storm/org/nongnu/storm/util/HTTPProxy.java  Mon Apr 21 17:07:41 2003
@@ -37,7 +37,7 @@
 /** An HTTP server serving blocks from a Storm pool.
  */
 public class HTTPProxy implements Runnable {
-    public static boolean dbg = true;
+    public static boolean dbg = false;
     private static void p(String s) { System.out.println(s); }
 
     protected StormPool pool;
@@ -58,7 +58,7 @@
     }
 
     public void run() {
-       p("Starting server @ "+url+".");
+       if(dbg) p("Starting server @ "+url+".");
        server.run();
     }
 
@@ -85,7 +85,7 @@
 
                BlockId id = new BlockId(uri);
                Block block = pool.get(id);
-               p("<"+port+"> Serve: "+id);
+               if(dbg) p("<"+port+"> Serve: "+id);
                HTTPResponse resp = resf.makeResponse(200, "Ok");
                resp.setField("Content-Type", id.getContentType());
                if(!rewrite || !id.getContentType().equals("text/html")) {
@@ -121,6 +121,7 @@
     }
 
     public static void main(String[] args) throws Exception {
+       dbg = true;
        StormPool pool;
        java.util.Set empty = java.util.Collections.EMPTY_SET;
        if(!args[0].equals("-gisp")) {
Index: storm/test.py
diff -u storm/test.py:1.2 storm/test.py:1.3
--- storm/test.py:1.2   Thu Apr 17 04:36:34 2003
+++ storm/test.py       Mon Apr 21 17:07:40 2003
@@ -75,11 +75,11 @@
             if hasattr(module, 'tearDown'): module.tearDown()
         except:
             print "failed."
-            exceptions.append({
+            exceptions.append([name, {
                 'exception': sys.exc_info(),
                 'test': test,
                 'testname': name,
-            })
+            }])
         else:
             print "ok."
 
@@ -166,18 +166,30 @@
         print
         #except org.fenfire.test.gfx.GLNeeded, e:
         #    print "Skipping, needs GL."
-        
-        for exc in exceptions:
+
+    if exceptions:
+        print "Java stack traces:"
+        for name, exc in exceptions:
+            print name
             print 75 * '-'
-            traceback.print_exception(*exc['exception'])
+            exc['exception'][1].printStackTrace()
             
+        print 75 * '-'
+        print
+
+        print "Python stack traces:"
+        for name, exc in exceptions:
             print 75 * '-'
-            print
-            print "%s test failures." % len(exceptions)
+            print name
+            traceback.print_exception(*exc['exception'])
+            
+        print 75 * '-'
+        print
+
+    print "%s test failures." % len(exceptions)
             
-            java.lang.System.exit(exceptions != [])
+    java.lang.System.exit(exceptions != [])
             
 
 if __name__ == '__main__':
     main(sys.argv[1:])
-    sys.exit()




reply via email to

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