/[gzz]/gzz/lava/test/gzz/storm/impl/DirPool.test
ViewVC logotype

Diff of /gzz/lava/test/gzz/storm/impl/DirPool.test

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by benja, Sat Nov 16 04:38:04 2002 UTC revision 1.6 by benja, Sat Nov 16 05:03:40 2002 UTC
# Line 33  def testBlockId(): s.testBlockId(p) Line 33  def testBlockId(): s.testBlockId(p)
33  def testAddBlock(): s.testAddBlock(p)  def testAddBlock(): s.testAddBlock(p)
34  def testGetNonexistent(): s.testGetNonexistent(p)  def testGetNonexistent(): s.testGetNonexistent(p)
35    
36    def testGetBlockWithBadId():
37        """
38        Put a block with a bad id into the directory, then load it
39        and check that an exception is thrown.
40        """
41    
42        id = gzz.storm.BlockId('storm:block:01' + 40*'A')
43          
44        file = java.io.File(dir, "b_01" + 40*"A")
45        f = open(file.getPath(), 'w')
46        f.write("Content-Type: text/plain\r\n\r\nFOO");
47        f.close()
48    
49        try:
50            block = p.get(id)
51            i = block.getInputStream()
52            while i.read() >= 0: pass
53            i.close()
54        except gzz.storm.BlockId.WrongIdException:
55            pass
56        else:
57            assert 0, "Id not checked"
58    
59  def tearDown():  def tearDown():
60      gzz.util.TempFileUtil.deltree(dir)      gzz.util.TempFileUtil.deltree(dir)
61    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26