ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/DBS/Servers/AppServer/test/swigTestNew.py
Revision: 1.3
Committed: Mon Feb 6 23:18:53 2006 UTC (19 years, 2 months ago) by afaq
Content type: text/x-python
Branch: MAIN
CVS Tags: AfterJan2006SchemaChanges
Changes since 1.2: +21 -6 lines
Log Message:
Non working set, Checking IN for securing the changes, will resume working

File Contents

# User Rev Content
1 sekhri 1.1
2     import dbsclient
3    
4     client = dbsclient.DBSClient()
5     def stringp(inStr) :
6     return client.str(inStr)
7    
8     def delStringp(inStr) :
9     dbsclient.delete_stringp(inStr)
10    
11     def string(key) :
12     return dbsclient.ASTR(key)
13    
14     def integer(key) :
15     return dbsclient.AINT(key)
16    
17     def character(key) :
18     return dbsclient.ACHR(key)
19    
20     def setStrValue(aRow, key, value) :
21     if(value != None and key != None):
22     key = stringp(key)
23     aRow.setValue(key, string(value))
24     delStringp(key)
25    
26     def setIntValue(aRow, key, value) :
27     key = stringp(key)
28     aRow.setValue(key, integer(int(value)))
29     delStringp(key)
30    
31     def setChrValue(aRow, key, value) :
32     key = stringp(key)
33     aRow.setValue(key, character(value))
34     delStringp(key)
35    
36     def getStrValue(table, key, index) :
37     if(index != None and key != None):
38     if(index > -1) :
39     key = stringp(key)
40     value = table.getStrValue(index, key)
41     delStringp(key)
42     return value
43 afaq 1.2 def writeFile():
44    
45     table = dbsclient.FileviewMultiTable()
46     aRow = dbsclient.Fileviewmultirow()
47     fileVector = dbsclient.FileVector()
48    
49     setStrValue(aRow, "t_file_status.name", "afile")
50     setStrValue(aRow, "t_file.guid", "Test-1234-Guid")
51     setStrValue(aRow, "t_file.checksum", "1234")
52     setStrValue(aRow, "t_file.logical_name", "afilexgetLogicalFileNamex")
53     setIntValue(aRow, "t_file.inblock", 10)
54     setStrValue(aRow, "t_file_type.name", "ROOT_All")
55     setStrValue(aRow, "t_file.filesize", "sucks")
56     setIntValue(aRow, "t_evcoll_file.evcoll", 1840)
57     fileVector.push_back(aRow)
58 afaq 1.3
59     aRow1 = dbsclient.Fileviewmultirow()
60     setStrValue(aRow1, "t_file_status.name", "afile")
61     setStrValue(aRow1, "t_file.guid", "Test-1234-Guid")
62     setStrValue(aRow1, "t_file.checksum", "1234")
63     setStrValue(aRow1, "t_file.logical_name", "afilexgetLogicalFileNamexy")
64     setIntValue(aRow1, "t_file.inblock", 10)
65     setStrValue(aRow1, "t_file_type.name", "ROOT_All")
66     setStrValue(aRow1, "t_file.filesize", "sucks")
67     setIntValue(aRow1, "t_evcoll_file.evcoll", 1840)
68     fileVector.push_back(aRow1)
69    
70 afaq 1.2 client.insertFiles(fileVector, table)
71    
72 sekhri 1.1
73    
74     def writePrimary() :
75     aRow = dbsclient.Primarydatasetmultirow()
76     table = dbsclient.PrimarydatasetMultiTable()
77    
78     setStrValue(aRow, "t_desc_mc.description", "dummy_value")
79     setStrValue(aRow, "t_desc_trigger.description", "t_desc_trigger.descriptiondummy_value")
80     setStrValue(aRow, "t_desc_mc.decay_chain", "dummyt_desc_mc.decay_chain")
81     setStrValue(aRow, "t_desc_mc.production", "dummyt_desc_mc.production")
82     setStrValue(aRow, "t_physics_group.name", "t_physics_group.namedummy_value")
83     setChrValue(aRow, "t_desc_primary.is_mc_data", "y")
84    
85     a = client.createPrimaryDataset(aRow, table)
86     print "ID is ",a
87     #key = stringp("t_primary_dataset.id")
88     #print "table.getStrValue ", table.getStrValue(0,key)
89     #delStringp(key)
90    
91     def readPrimary() :
92     aRow = dbsclient.Primarydatasetmultirow()
93     table = dbsclient.PrimarydatasetMultiTable()
94     setStrValue(aRow, "t_desc_mc.description", "dummy_value")
95    
96     client.readPrimaryDataset(aRow, table)
97     noOfRows = table.getNoOfRows()
98     print "no of Rows ",noOfRows
99     for j in range(noOfRows) :
100     print "table.getStrValue", getStrValue(table, "t_desc_mc.description", j)
101     table.dispose()
102    
103    
104     def writeProcessed() :
105     aRow = dbsclient.Processingpathmultirow()
106     table = dbsclient.ProcessingpathMultiTable()
107    
108     setStrValue(aRow, "t_processed_dataset.name", "dummy_valuet_processed_dataset.name")
109     setStrValue(aRow, "t_app_family.name", "dummyvaluet_app_family.name")
110     setStrValue(aRow, "t_data_tier.name", "t_data_tier.namedummy_value")
111     setStrValue(aRow, "t_application.executable", "t_application.executablemmy_value")
112     setStrValue(aRow, "t_app_config.parameter_set", "dummyt_app_config.parameter_set")
113     setChrValue(aRow, "t_processed_dataset.is_open", "y")
114     setStrValue(aRow, "t_application.app_version", "dummyt_application.app_version")
115     setStrValue(aRow, "t_app_config.conditions_version", "dummyt_app_config.conditions_version")
116     setStrValue(aRow, "t_processing_path.full_path", "dummyt_processing_path.full_path")
117     setStrValue(aRow, "t_primary_dataset.name", "t_primary_dataset.name")
118     setStrValue(aRow, "t_collection_type.name.t_application.output_type", "dummyt_collection_type.name.t_application.output_type")
119     setStrValue(aRow, "t_collection_type.name.t_application.input_type", "dummyt_collection_type.name.t_application.input_type")
120    
121     a = client.createProcessedDataset(aRow, table)
122     print "ID is ",a
123    
124    
125     def readProcessed() :
126     aRow = dbsclient.Processingpathmultirow()
127     table = dbsclient.ProcessingpathMultiTable()
128    
129     setStrValue(aRow, "t_primary_dataset.name", "t_primary_dataset.name")
130    
131     client.readProcessedDataset(aRow, table)
132     noOfRows = table.getNoOfRows()
133     print "no of Rows ",noOfRows
134     for j in range(noOfRows) :
135     print "table.getStrValue", getStrValue(table, "t_primary_dataset.name", j)
136     table.dispose()
137    
138    
139     def writeEC() :
140     aRow = dbsclient.Processingpathmultirow()
141     table = dbsclient.ProcessingpathMultiTable()
142    
143     setStrValue(aRow, "t_processed_dataset.name", "dummy_valuet_processed_dataset.name")
144    
145     def readCrabEC() :
146     aRow = dbsclient.Crabevcollviewmultirow()
147     table = dbsclient.CrabevcollviewMultiTable()
148    
149     setIntValue(aRow, "t_block.id", 270)
150    
151     client.readCrabEC(aRow, table)
152     noOfRows = table.getNoOfRows()
153     print "no of Rows ",noOfRows
154     for j in range(noOfRows) :
155     print "table.getStrValue", getStrValue(table, "t_info_evcoll.name", j)
156     table.dispose()
157    
158     #while(1):
159     for i in range(1) :
160 afaq 1.3 try:
161     #readPrimary()
162     #writePrimary()
163     #writeProcessed()
164     #readProcessed()
165     #readCrabEC()
166     writeFile()
167     except Exception ,e:
168     print "Exception ", e