|
@@ -0,0 +1,86 @@
|
|
1
|
+#!/bin/bash
|
|
2
|
+
|
|
3
|
+host=$1
|
|
4
|
+instance=$2
|
|
5
|
+N=$3
|
|
6
|
+HOSTDB=localhost:27017
|
|
7
|
+
|
|
8
|
+for i in ${1..$N..10)
|
|
9
|
+do
|
|
10
|
+ COLT=$(lenmax=100;wcount=5; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
11
|
+ curl -A "Mozilla/5.0" -L -s -d "field_input_title=$COLT&field_input_publications=$COLPUBLI&classname=Collection" http://$host/$instance/admin/create?classname=Collection
|
|
12
|
+ ITTHM="themetest"
|
|
13
|
+ ITNAME=$(lenmax=30;wcount=3; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
14
|
+ ITVAL=$(lenmax=10;wcount=1; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
15
|
+ curl -A "Mozilla/5.0" -L -s -d "field_input_theme=$ITTHM&field_input_name=$ITNAME&field_input_value=$ITVAL&classname=Indextheme" http://$host/$instance/admin/create?classname=Indextheme
|
|
16
|
+ LN=$(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/")
|
|
17
|
+ 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/")
|
|
18
|
+ curl -A "Mozilla/5.0" -L -s -d "field_input_lastname=$LN&field_input_firstname=$FN&classname=Person" http://$host/$instance/admin/create?classname=Person
|
|
19
|
+ PWD='pwgen 10'
|
|
20
|
+ LOGIN="${FN,,}$(printf "%d" $RANDOM)"
|
|
21
|
+ curl -A "Mozilla/5.0" -L -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
|
|
22
|
+done
|
|
23
|
+
|
|
24
|
+for i in ${1..$N..4)
|
|
25
|
+do
|
|
26
|
+ persons=$(printf "use lodel2\ndb.Person.find\({}, {lodel_id:1, _id:0}\).limit\(3\)" | mongo HOSTDB/admin -u lodel_admin -p lapwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed '\$d')
|
|
27
|
+ tmp=""
|
|
28
|
+ for i in $persons
|
|
29
|
+ do
|
|
30
|
+ if [ $tmp = "" ]
|
|
31
|
+ then
|
|
32
|
+ tmp=$(printf("$tmp, $i"))
|
|
33
|
+ else
|
|
34
|
+ tmp=$i
|
|
35
|
+ fi
|
|
36
|
+ done
|
|
37
|
+ SECLP=$tmp
|
|
38
|
+ SECST=$(lenmax=120;wcount=10; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
39
|
+ res=$(printf "use lodel2\ndb.Indextheme.find\({}, {lodel_id:1, _id:0}\).limit\(5\)" | mongo HOSTDB/admin -u lodel_admin -p lapwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed '\$d')
|
|
40
|
+ tmp=""
|
|
41
|
+ for i in $res
|
|
42
|
+ do
|
|
43
|
+ if [ $tmp = "" ]
|
|
44
|
+ then
|
|
45
|
+ tmp=$(printf("$tmp, $i"))
|
|
46
|
+ else
|
|
47
|
+ tmp=$i
|
|
48
|
+ fi
|
|
49
|
+ SECIND=$tmp
|
|
50
|
+ SECTTL=$(lenmax=100;wcount=5; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
51
|
+ curl -A "Mozilla/5.0" -L -s -d "field_input_linked_persons=$SECLP&field_input_subtitle=$SECST&field_input_indexes=$SECIND&field_input_title=$SECTTL&classname=Section" http://$host/$instance/admin/create?classname=Section
|
|
52
|
+done
|
|
53
|
+
|
|
54
|
+for i in ${seq $N}
|
|
55
|
+do
|
|
56
|
+ persons=$(printf "use lodel2\ndb.Person.find\({}, {lodel_id:1, _id:0}\).limit\(3\)" | mongo HOSTDB/admin -u lodel_admin -p lapwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed '\$d')
|
|
57
|
+ for i in $persons
|
|
58
|
+ do
|
|
59
|
+ if [ $tmp = "" ]
|
|
60
|
+ then
|
|
61
|
+ tmp=$(printf("$tmp, $i"))
|
|
62
|
+ else
|
|
63
|
+ tmp=$i
|
|
64
|
+ fi
|
|
65
|
+ done
|
|
66
|
+ SSSECLP=$tmp
|
|
67
|
+ SSSECST=$(lenmax=120;wcount=10; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
68
|
+ res=$(printf "use lodel2\ndb.Section.find\({}, {lodel_id:1, _id:0}\).limit\(1\)" | mongo HOSTDB/admin -u lodel_admin -p lapwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed '\$d')
|
|
69
|
+ SSSECPAR=$res
|
|
70
|
+ res=$(printf "use lodel2\ndb.Indextheme.find\({}, {lodel_id:1, _id:0}\).limit\(3\)" | mongo HOSTDB/admin -u lodel_admin -p lapwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed '\$d')
|
|
71
|
+ tmp=""
|
|
72
|
+ for i in $res
|
|
73
|
+ do
|
|
74
|
+ if [ $tmp = "" ]
|
|
75
|
+ then
|
|
76
|
+ tmp=$(printf("$tmp, $i"))
|
|
77
|
+ else
|
|
78
|
+ tmp=$i
|
|
79
|
+ fi
|
|
80
|
+ SSSECIND=$tmp
|
|
81
|
+ SSSECTTL=$(lenmax=100;wcount=5; rlenmax=$(expr $lenmax - 1); echo $(shuf /usr/share/dict/words | head -n $wcount | tr -s "\n" " ") | sed -E "s/^(.{$rlenmax}).*$/\1/")
|
|
82
|
+ res=$(printf "use lodel2\ndb.Collection.find\({}, {lodel_id:1, _id:0}\).limit\(1\)" | mongo HOSTDB/admin -u lodel_admin -p lapwd | sed "1,3d" | sed -e "s/{ \"lodel_id\" : //g" | sed -e "s/ }//g" | sed '\$d')
|
|
83
|
+ PUBCOLLS=$res
|
|
84
|
+ curl -A "Mozilla/5.0" -L -s -d "field_input_linked_persons=$SSSECLP&field_input_subtitle=$SSSECST&field_input_parent=$SSSECPAR&field_input_indexes=$SSSECIND&field_input_title=$SSSECTTL&classname=Subsection" http://$host/$instance/admin/create?classname=Subsection
|
|
85
|
+curl -A "Mozilla/5.0" -L -s -d "field_input_collection=$PUBCOLLS&classname=Publication" http://$host/$instance/admin/create?classname=Publication
|
|
86
|
+done
|