-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·138 lines (105 loc) · 2.73 KB
/
test.py
File metadata and controls
executable file
·138 lines (105 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/usr/bin/python
import cas
def checkstorevalid(cas):
if (cas.isvalidstore()):
print "The store is valid."
else:
print "The store is not valid."
print "Starting up."
cas = cas.CAS('/extraspace/workspace/castest')
checkstorevalid(cas)
print
print "Clearing the store."
cas.clear()
checkstorevalid(cas)
print
print "Building the structures."
cas.buildstruct()
checkstorevalid(cas)
print
print "Instilling a blob."
key1 = cas.putblob("This is a blob.")
print "The key is", key1
print
print "Retrieving the blob."
print "Retrieved blob is:", cas.getblob(key1)
print
print "Instilling a file."
key2 = cas.putfile('test.py')
print "The key is", key2
print "Retrieving the file."
cas.getfile(key2, 'retrievedfile')
print "Checking keys."
if (cas.exists(key1)):
print "Key 1 exists."
else:
print "Key 1 does NOT exist."
if (cas.exists(key2)):
print "Key 2 exists."
else:
print "Key 2 does NOT exist."
if (cas.isvalidkey(key1)):
print "Key 1 is valid."
else:
print "Key 1 is NOT valid."
if (cas.isvalidkey(key2)):
print "Key 2 is valid."
else:
print "Key 2 is NOT valid."
print
print "Here are all the keys in the store:"
for key in cas.listkeys():
print key
print
print "Key sizes:"
print ' ', cas.getkeysize(key1)
print ' ', cas.getkeysize(key2)
print
print "Remove key 1."
cas.removekey(key1)
if (cas.isvalidkey(key1)):
print "Key 1 is valid."
else:
print "Key 1 is NOT valid."
if (cas.exists(key1)):
print "Key 1 exists."
else:
print "Key 1 does NOT exist."
print
print "Instilling a blob."
key1 = cas.putblob("This is a blob.")
print "The key is", key1
print
print "Moving keys to invalid values"
cas.changekey(key1, '0000000000000000000000000000000000000000000000000000000000000000')
cas.changekey(key2, 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff')
print "Here are all the keys in the store:"
for key in cas.listkeys():
print key
if (cas.isvalidkey(key1)):
print "Key 1 is valid."
else:
print "Key 1 is NOT valid."
print
print "These keys are invalid:"
for key in cas.findinvalidkeys():
print key
print
print "Correcting keys."
for (old,new) in cas.correctinvalidkeys():
print "Moving", old, "to", new
print "Here are all the keys in the store:"
for key in cas.listkeys():
print key
print "Moving keys to invalid values"
cas.changekey(key1, '0000000000000000000000000000000000000000000000000000000000000000')
cas.changekey(key2, 'ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff')
print "Here are all the keys in the store:"
for key in cas.listkeys():
print key
print
print "Deleting invalid keys"
print cas.removeinvalidkeys()
print "Here are all the keys in the store:"
for key in cas.listkeys():
print key