64 |
|
|
65 |
assert b.getId().getContentType() == "text/plain" |
assert b.getId().getContentType() == "text/plain" |
66 |
|
|
67 |
|
def testBlockTmpFile(): |
68 |
|
""" |
69 |
|
Test that creating a blocktmpfile out of a block |
70 |
|
in the pool works. |
71 |
|
""" |
72 |
|
bos = pool.getBlockOutputStream("text/plain") |
73 |
|
osw = OutputStreamWriter(bos) |
74 |
|
osw.write("Hallo, Welt!") |
75 |
|
osw.close() |
76 |
|
blockid = bos.getBlockId() |
77 |
|
block = pool.get(blockid) |
78 |
|
f = org.nongnu.storm.BlockTmpFile.get(block) |
79 |
|
inp = java.io.FileReader(f.getFile()) |
80 |
|
buf = java.lang.StringBuffer() |
81 |
|
str = "Hallo, Welt!" |
82 |
|
ind = 0 |
83 |
|
while 1: |
84 |
|
c = inp.read() |
85 |
|
if c < 0: break |
86 |
|
# print "R: ", chr(c), str[ind] |
87 |
|
assert chr(c) == str[ind] |
88 |
|
ind += 1 |
89 |
|
assert ind == len(str) |
90 |
|
inp.close() |
91 |
|
f.close() |
92 |
|
|
93 |
|
|
94 |
def testAddTwice(): |
def testAddTwice(): |
95 |
""" |
""" |