|
@@ -2,8 +2,8 @@
|
2
|
2
|
|
3
|
3
|
usage() {
|
4
|
4
|
echo -e "Usage : $0 host_of_server instance_name host_of_db number_of_iterations >&2"
|
5
|
|
- echo -e "Example : create_datas locahost instance_00001 localhost:28015 1000"
|
6
|
|
- echo -e "Example : create_datas locahost instance_00001 localhost 1000"
|
|
5
|
+ echo -e "Example : create_data_simpleem locahost instance_00001 localhost:28015 1000"
|
|
6
|
+ echo -e "Example : create_data_simpleem locahost instance_00001 localhost 1000"
|
7
|
7
|
exit 1
|
8
|
8
|
}
|
9
|
9
|
|
|
@@ -18,7 +18,7 @@ instance=$2
|
18
|
18
|
N=$4
|
19
|
19
|
HOSTDB=$3
|
20
|
20
|
dbname=lodel2_$instance
|
21
|
|
-dbuser=admin
|
|
21
|
+dbuser=admin
|
22
|
22
|
dbpwd=pass
|
23
|
23
|
curl_options='--silent -o /dev/null -s -w %{url_effective};%{http_code};%{time_connect};%{time_starttransfer};%{time_total}\n'
|
24
|
24
|
|
|
@@ -30,12 +30,12 @@ do
|
30
|
30
|
FN=$(lenmax=20;wcount=1; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
31
|
31
|
LC=''
|
32
|
32
|
curl -o /dev/null -s -d "field_input_lastname=$LN&field_input_firstname=$FN&field_input_linked_containers=$LC&classname=Person" http://$host/$instance/admin/create?classname=Person
|
33
|
|
-
|
|
33
|
+
|
34
|
34
|
# Classe User
|
35
|
35
|
PWD='pwgen 10'
|
36
|
36
|
LOGIN="${FN,,}$(printf "%d" $RANDOM)"
|
37
|
37
|
curl -o /dev/null -s -d "field_input_lastname=$LN&field_input_firstname=$FN&field_input_password=$PWD&field_input_login=$LOGIN&classname=User" http://$host/$instance/admin/create?classname=User
|
38
|
|
-
|
|
38
|
+
|
39
|
39
|
# Classe Entry, champs à remplir : name, description, role, linked_texts
|
40
|
40
|
ENLT='' #$(printf "use $dbname\nDBQuery.shellBatchSize = 30000\n db.Article.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | shuf | head -n 3; )
|
41
|
41
|
ENROLE=$(shuf -e 'geography' 'subject' 'keywords' | head -n 1)
|
|
@@ -62,11 +62,11 @@ do
|
62
|
62
|
fi
|
63
|
63
|
done
|
64
|
64
|
COLLD=$tmp
|
65
|
|
- COLT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
66
|
|
- COLST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
65
|
+ COLT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
66
|
+ COLST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
67
|
67
|
LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
|
68
|
|
- DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
69
|
|
- PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
68
|
+ DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
69
|
+ PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
70
|
70
|
ISSN=$(</dev/urandom tr -dc 0-9 | head -c8;echo;)
|
71
|
71
|
curl $curl_options -d "field_input_title=$COLT&field_input_subtitle=$COLST&field_input_language=$LG&field_input_linked_directors=$COLLD&field_input_description=$DESC&field_input_publisher_note=$PBN&field_input_issn=$ISSN&classname=Collection" http://$host/$instance/admin/create?classname=Collection
|
72
|
72
|
collection=$(printf "use $dbname\n db.Collection.find({}, {lodel_id:1, _id:0}).sort({_id:-1}).limit(1)" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d";)
|
|
@@ -77,7 +77,7 @@ do
|
77
|
77
|
NB=$(shuf -e '25' '30' '35' '40' '45' '50' '55' '60' '65' | head -n 1) # Nombre de textes pour le numéro
|
78
|
78
|
NBR=$(($NB/3)) # Nombre de reviews
|
79
|
79
|
NBA=$(($NBR*2)) # Nombre d'articles
|
80
|
|
-
|
|
80
|
+
|
81
|
81
|
# Classe Issue, champs à remplir : title, subtitle, language, linked_directors, description, publisher_note, isbn, print_isbn, number, cover, print_pub_date, e_pub_date, abstract, collection, linked_parts, linked_texts
|
82
|
82
|
NBLD=$(shuf -e '1' '2' '3' '4' | head -n 1)
|
83
|
83
|
directors=$(printf "use $dbname\n DBQuery.shellBatchSize = 30000\n db.Person.find({}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n $NBLD;)
|
|
@@ -92,15 +92,15 @@ do
|
92
|
92
|
fi
|
93
|
93
|
done
|
94
|
94
|
ISSLD=$tmp
|
95
|
|
- ISST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
96
|
|
- ISSST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
95
|
+ ISST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
96
|
+ ISSST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
97
|
97
|
LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
|
98
|
|
- DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
99
|
|
- PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
98
|
+ DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
99
|
+ PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
100
|
100
|
ISBN=$(</dev/urandom tr -dc 0-9 | head -c10;echo;)
|
101
|
101
|
PISBN=$(</dev/urandom tr -dc 0-9 | head -c10;echo;)
|
102
|
|
- ISSNU=$(lenmax=30;wcount=10; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
103
|
|
- ISSCOV=$(lenmax=100;wcount=15; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
102
|
+ ISSNU=$(lenmax=30;wcount=10; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
103
|
+ ISSCOV=$(lenmax=100;wcount=15; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
104
|
104
|
M=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' | head -n 1)
|
105
|
105
|
JJ=$(shuf -e '01' '02' '03' '04' '05' '06' '07' '08' '09' '10' '11' '12' '13' '14' '15' '16' '17' '18' '19' '20' '21' '22' '23' '24' '25' '26' '27' '28' | head -n 1)
|
106
|
106
|
AA=$(shuf -e '2012' '2005' '2010' '2015' '2016'| head -n 1)
|
|
@@ -115,7 +115,7 @@ do
|
115
|
115
|
ISSLTXT=''
|
116
|
116
|
curl $curl_options -d "field_input_title=$ISST&field_input_subtitle=$ISSST&field_input_language=$LG&field_input_linked_directors=$ISSLD&field_input_description=$DESC&field_input_publisher_note=$PBN&field_input_isbn=$ISBN&field_input_print_isbn=$PISBN&field_input_number=$ISSNU&field_input_cover=$ISSCOV&field_input_print_pub_date=$PPDATE&field_input_e_pub_date=$EPDATE&field_input_abstract=$ISSAB&field_input_collection=$collection&field_input_linked_parts=$ISSLPA&field_input_linked_texts=$ISSLTXT&classname=Issue" http://$host/$instance/admin/create?classname=Issue
|
117
|
117
|
issue=$(printf "use $dbname\n db.Issue.find({}, {lodel_id:1, _id:0}).sort({_id:-1}).limit(1)" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" )
|
118
|
|
-
|
|
118
|
+
|
119
|
119
|
# On entre les textes correspondants aux numéros indépendemment des parts
|
120
|
120
|
NBT=$(shuf -e '2' '3' '4' '5' '6' '8' | head -n 1)
|
121
|
121
|
for i in `eval echo {1..$NBT}`;
|
|
@@ -231,17 +231,17 @@ do
|
231
|
231
|
fi
|
232
|
232
|
done
|
233
|
233
|
PALD=$tmp
|
234
|
|
- PAT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
235
|
|
- PAST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
234
|
+ PAT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
235
|
+ PAST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
236
|
236
|
LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
|
237
|
|
- DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
238
|
|
- PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
237
|
+ DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
238
|
+ PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
239
|
239
|
issue=$(printf "use $dbname\nDBQuery.shellBatchSize = 1000\n db.Issue.find({collection:$collection}, {lodel_id:1, _id:0})" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,4d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" | shuf | head -n 1;)
|
240
|
240
|
PALTXT=''
|
241
|
241
|
PALP=''
|
242
|
242
|
curl $curl_options -d "field_input_title=$PAT&field_input_subtitle=$PAST&field_input_language=$LG&field_input_linked_directors=$PALD&field_input_description=$DESC&field_input_publisher_note=$PBN&field_input_publication=$issue&field_input_linked_parts=$PALP&field_input_linked_texts=$PALTXT&classname=Part" http://$host/$instance/admin/create?classname=Part
|
243
|
243
|
part=$(printf "use $dbname\n db.Part.find({}, {lodel_id:1, _id:0}).sort({_id:-1}).limit(1)" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" )
|
244
|
|
-
|
|
244
|
+
|
245
|
245
|
# On entre les textes correspondants aux parts
|
246
|
246
|
NBPANBT=$(shuf -e '2' '3' '4' | head -n 1)
|
247
|
247
|
for i in `eval echo {1..$NBPANBT}`;
|
|
@@ -357,11 +357,11 @@ do
|
357
|
357
|
fi
|
358
|
358
|
done
|
359
|
359
|
PALD=$tmp
|
360
|
|
- PAT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
361
|
|
- PAST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
360
|
+ PAT=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
361
|
+ PAST=$(lenmax=100;wcount=20; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
362
|
362
|
LG=$(shuf -e 'fr' 'en' 'es' 'ger' 'it'| head -n 1)
|
363
|
|
- DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
364
|
|
- PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
363
|
+ DESC=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
364
|
+ PBN=$(lenmax=500;wcount=100; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
365
|
365
|
PALTXT=''
|
366
|
366
|
PALP=''
|
367
|
367
|
curl $curl_options -d "field_input_title=$PAT
|
|
@@ -371,7 +371,7 @@ do
|
371
|
371
|
&field_input_description=$DESC&field_input_publisher_note=$PBN&field_input_publication=$part
|
372
|
372
|
&field_input_linked_parts=$PALP&field_input_linked_texts=$PALTXT&classname=Part" http://$host/$instance/admin/create?classname=Part
|
373
|
373
|
part=$(printf "use $dbname\n db.Part.find({}, {lodel_id:1, _id:0}).sort({_id:-1}).limit(1)" | mongo $HOSTDB/admin -u $dbuser -p $dbpwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed "\$d" )
|
374
|
|
-
|
|
374
|
+
|
375
|
375
|
# On entre les textes correspondants aux numéros indépendemment des parts
|
376
|
376
|
for i in `eval echo {1..$NBA}`;
|
377
|
377
|
do
|
|
@@ -471,4 +471,4 @@ do
|
471
|
471
|
done
|
472
|
472
|
done
|
473
|
473
|
done
|
474
|
|
-done
|
|
474
|
+done
|