-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshop.ben.xml
211 lines (191 loc) · 13.2 KB
/
shop.ben.xml
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<?xml version="1.0" encoding="iso-8859-1"?>
<setup
xmlns="http://databene.org/benerator/0.7.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://databene.org/benerator/0.7.0 http://databene.org/benerator-0.7.0.xsd">
<comment>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
! Demonstration file for populating the shop database. !
! !
! You can choose a database and a stage like this: !
! -Dstage=development -Ddatabase=oracle !
! !
! These database types are provided: !
! oracle, db2, sql_server, mysql, postgres, hsql, !
! hsqlmem, firebird, derby, h2 !
! !
! ...and these stage configurations: !
! development, perftest !
! !
! Set up your database connection in the file !
! <database>/shop.<database>.properties !
! !
! You may want to try different generation quantities in !
! shop.<stage>.properties !
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
</comment>
<import domains = "person,net,product,datetime" />
<import platforms = "db"/>
<comment>setting default values</comment>
<setting name="stage" default="development" />
<setting name="database" default="postgres" />
<setting name="dbCatalog" default="dataload" />
<setting name="dbSchema" default="" />
<setting name="dbPassword" default="" />
<setting name="dbBatch" default="false" />
<comment>import stage and database specific properties</comment>
<include uri="{ftl:${database}/shop.${database}.properties}" /> <!-- ftl: is the prefix used for scripting with FreeMarker Template Language -->
<include uri="{ftl:shop.${stage}.properties}" />
<comment>log the settings to the console</comment>
<echo>Starting generation for</echo>
<echo>{ftl: ${product_count + 6} products}</echo>
<echo>{ftl: ${customer_count + 1} customers}</echo>
<echo>{ftl: ${orders_per_customer} orders per customer}</echo>
<echo>{ftl: ${items_per_order} items per order}</echo>
<echo>{ftl:encoding:${context.defaultEncoding} default pageSize:${context.defaultPageSize}}</echo>
<echo>{ftl:JDBC URL: ${dbUrl}}</echo>
<!-- TODO use environment file -->
<comment>define a database that will be referred by the id 'db' subsequently</comment>
<database id="db" url="{dbUrl}" driver="{dbDriver}" catalog="{dbCatalog}" schema="{dbSchema}"
user="{dbUser}" password="{dbPassword}" batch="{dbBatch}" />
<!-- MUJIR - DO NOT NEED TO CREATE/DELETE ON ACTUAL SCHEMA >
<comment>drop the current tables/sequences if they exist and recreate them</comment>
<execute uri="{ftl:${database}/drop_tables.${database}.sql}" target="db" onError="ignore" />
<execute uri="{ftl:${database}/create_tables.${database}.sql}" target="db" /-->
<!--comment>Creating a valid base data set for regression testing by importing a DbUnit file</comment>
<iterate source="shop.dbunit.xml" consumer="db" />
<comment>Importing some more predefined products from a CSV file</comment>
<iterate source="products.import.csv" type="db_product" encoding="utf-8" consumer="db" /-->
<generate type="rapidsms_backend" count="5" consumer="db">
<id name="id" type="long" generator="new IncrementalIdGenerator(1)" />
<attribute name="name" type="string" values="'Airtel','Orange','MTN','Aircel','Tata'" unique="true" />
</generate>
<generate type="rapidsms_contact" count="6000" consumer="db">
<id name="id" type="long" generator="new IncrementalIdGenerator(7000)" />
<variable name="person" generator="PersonGenerator"/>
<attribute name="name" source="person.givenName" />
<attribute name="language" values="'En'"/>
<attribute name="needs_reminders" type="boolean" constant="true"/>
<attribute name="is_active" type="boolean" constant="true"/>
<attribute name="is_approved" type="boolean" constant="true"/>
<attribute name="active" type="boolean" constant="true"/>
</generate>
<generate type="rapidsms_connection" count="6000" consumer="db">
<id name="id" type="long" generator="new IncrementalIdGenerator(7000)" />
<attribute name="backend_id" source="db" selector="select id from rapidsms_backend" distribution="random"/>
<attribute name="identity" type="string" pattern="[1-9][0-9]{2}\-[0-9]{4}\-[0-9]{5}" unique="true" />
<attribute name="contact_id" source="select id from rapidsms_contact" distribution="random" />
</generate>
<bean id="idGen" spec="new IncrementGenerator(1000)" />
<bean id="confirmationIdGen" spec="new IncrementGenerator(1)" />
<generate type="rapidsms_xforms_xformsubmission" count="400" consumer="db">
<id name="id" type="long" generator="idGen" />
<attribute name="xform_id" values="74" />
<attribute name="connection_id" source="db" selector="select id from rapidsms_connection" distribution="random" />
<attribute name="raw" type="string" pattern="recv\.1000\.subcounty[0-9]" />
<attribute name="has_errors" type="boolean" values="true,false" />
<attribute name="approved" type="boolean" values="true,false" />
<attribute name="confirmation_id" generator="confirmationIdGen" />
<attribute name="type" values="'sms'" />
<attribute name="created" generator="org.databene.benerator.primitive.datetime.CurrentDateGenerator"/>
</generate>
<generate type="rapidsms_xforms_xformsubmission" count="20000" consumer="db">
<id name="id" type="long" generator="idGen" />
<attribute name="xform_id" values="73" />
<attribute name="connection_id" source="db" selector="select id from rapidsms_connection" distribution="random" />
<attribute name="raw" type="string" pattern="send\.250\.subcounty[0-9]\.distributioncentre[0-9]|send\.250\.subcounty[0-9]\.distributioncentre[0-9]|send\.250\.subcounty[0-9]\.distributioncentre[0-9]|send\.250\.subcounty[0-9]\.distributioncentre[0-9]" />
<attribute name="has_errors" type="boolean" values="true,false" />
<attribute name="approved" type="boolean" values="true,false" />
<attribute name="confirmation_id" generator="confirmationIdGen"/>
<attribute name="type" values="'sms'" />
<attribute name="created" generator="org.databene.benerator.primitive.datetime.CurrentDateGenerator"/>
</generate>
<generate type="rapidsms_xforms_xformsubmission" count="20000" consumer="db">
<id name="id" type="long" generator="idGen" />
<attribute name="xform_id" values="75" />
<attribute name="connection_id" source="db" selector="select id from rapidsms_connection" distribution="random" />
<attribute name="raw" type="string" pattern="recv\.230\.distributioncentre[0-9]|recv\.250\.distributioncentre[0-9]|recv\.240\.distributioncentre[0-9]" />
<attribute name="has_errors" type="boolean" values="true,false" />
<attribute name="approved" type="boolean" values="true,false" />
<attribute name="confirmation_id" generator="confirmationIdGen" />
<attribute name="type" values="'sms'" />
<attribute name="created" generator="org.databene.benerator.primitive.datetime.CurrentDateGenerator"/>
</generate>
<generate type="rapidsms_xforms_xformsubmission" count="20000" consumer="db">
<id name="id" type="long" generator="idGen" />
<attribute name="xform_id" values="75" />
<attribute name="connection_id" source="db" selector="select id from rapidsms_connection" distribution="random" />
<attribute name="raw" type="string" pattern="dist\.230\.distributioncentre[0-9]|dist\.250\.distributioncentre[0-9]|dist\.240\.distributioncentre[0-9]" />
<attribute name="has_errors" type="boolean" values="true,false" />
<attribute name="approved" type="boolean" values="true,false" />
<attribute name="confirmation_id" generator="confirmationIdGen" />
<attribute name="type" values="'sms'" />
<attribute name="created" generator="org.databene.benerator.primitive.datetime.CurrentDateGenerator"/>
</generate>
<!--generate type="rapidsms_xforms_xformsubmission" count="400" consumer="db">
<id name="id" type="long" generator="idGen" />
<attribute name="xform_id" values="74" />
<attribute name="connection_id" source="db" selector="select id from rapidsms_connection" distribution="random" />
<attribute name="raw" type="string" pattern="recv\.1000\.subcounty[0-2]{4}" />
<attribute name="has_errors" type="boolean" values="true,false" />
<attribute name="approved" type="boolean" values="true,false" />
<attribute name="confirmation_id" generator="confirmationIdGen" />
<attribute name="type" values="'sms'" />
<attribute name="created" generator="org.databene.benerator.primitive.datetime.CurrentDateGenerator"/>
</generate>
<generate type="rapidsms_xforms_xformsubmission" count="20000" consumer="db">
<id name="id" type="long" generator="idGen" />
<attribute name="connection_id" source="db" selector="select id from rapidsms_connection" distribution="random" />
<attribute name="xform_id" values="73" />
<attribute name="raw" type="string" pattern="send\.250\.subcounty[0-2]{4}\.distributioncentre[0-2]{4}[1-9]|SEND\.250\.subcounty[0-2]{4}\.distributioncentre[0-2]{4}[1-9]|SEND\.250\.subcounty[0-2]{4}\.distributioncentre[0-2]{4}[1-9]|SEND\.250\.subcounty[0-2]{4}\.distributioncentre[0-2]{4}[1-9]" />
<attribute name="has_errors" type="boolean" values="true,false" />
<attribute name="approved" type="boolean" values="true,false" />
<attribute name="confirmation_id" generator="confirmationIdGen" />
<attribute name="type" values="'sms'" />
<attribute name="created" generator="org.databene.benerator.primitive.datetime.CurrentDateGenerator"/>
</generate>
<generate type="rapidsms_xforms_xformsubmission" count="20000" consumer="db">
<id name="id" type="long" generator="idGen" />
<attribute name="xform_id" values="75" />
<attribute name="connection_id" source="db" selector="select id from rapidsms_connection" distribution="random" />
<attribute name="raw" type="string" pattern="dist\.230\.distributioncentre[0-2]{4}[1-9]|DIST\.250\.distributioncentre[0-2]{4}[1-9]|DIST\.240\.distributioncentre[0-2]{4}[1-9]" />
<attribute name="has_errors" type="boolean" values="true,false" />
<attribute name="approved" type="boolean" values="true,false" />
<attribute name="confirmation_id" generator="confirmationIdGen" />
<attribute name="type" values="'sms'" />
<attribute name="created" generator="org.databene.benerator.primitive.datetime.CurrentDateGenerator"/>
</generate>
<generate type="rapidsms_xforms_xformsubmission" count="400" consumer="db">
<id name="id" type="long" generator="idGen" />
<attribute name="xform_id" values="74" />
<attribute name="connection_id" source="db" selector="select id from rapidsms_connection" distribution="random" />
<attribute name="raw" type="string" pattern="recv\.1000\.subcounty[0-2]{4}" />
<attribute name="has_errors" type="boolean" values="true,false" />
<attribute name="approved" type="boolean" values="true,false" />
<attribute name="confirmation_id" generator="confirmationIdGen" />
<attribute name="type" values="'sms'" />
<attribute name="created" generator="org.databene.benerator.primitive.datetime.CurrentDateGenerator"/>
</generate>
<generate type="rapidsms_xforms_xformsubmission" count="20000" consumer="db">
<id name="id" type="long" generator="idGen" />
<attribute name="xform_id" values="73" />
<attribute name="connection_id" source="db" selector="select id from rapidsms_connection" distribution="random" />
<attribute name="raw" type="string" pattern="send\.250\.subcounty[0-2]{4}\.distributioncentre[0-2]{4}[1-9]|SEND\.250\.subcounty[0-2]{4}\.distributioncentre[0-2]{4}[1-9]|SEND\.250\.subcounty[0-2]{4}\.distributioncentre[0-2]{4}[1-9]|SEND\.250\.subcounty[0-2]{4}\.distributioncentre[0-2]{4}[1-9]" />
<attribute name="has_errors" type="boolean" values="true,false" />
<attribute name="approved" type="boolean" values="true,false" />
<attribute name="confirmation_id" generator="confirmationIdGen" />
<attribute name="type" values="'sms'" />
<attribute name="created" generator="org.databene.benerator.primitive.datetime.CurrentDateGenerator"/>
</generate>
<generate type="rapidsms_xforms_xformsubmission" count="20000" consumer="db">
<id name="id" type="long" generator="idGen" />
<attribute name="xform_id" values="75" />
<attribute name="connection_id" source="db" selector="select id from rapidsms_connection" distribution="random" />
<attribute name="raw" type="string" pattern="dist\.230\.distributioncentre[0-2]{4}[1-9]|DIST\.250\.distributioncentre[0-2]{4}[1-9]|DIST\.240\.distributioncentre[0-2]{4}[1-9]" />
<attribute name="has_errors" type="boolean" values="true,false" />
<attribute name="approved" type="boolean" values="true,false" />
<attribute name="confirmation_id" generator="confirmationIdGen" />
<attribute name="type" values="'sms'" />
<attribute name="created" generator="org.databene.benerator.primitive.datetime.CurrentDateGenerator"/>git
</generate-->
</setup>