3505 |
30 Nov 09 |
gregory |
# Cross table query |
3505 |
30 Nov 09 |
gregory |
2 |
|
3505 |
30 Nov 09 |
gregory |
# Initialize test parameters |
3505 |
30 Nov 09 |
gregory |
4 |
generate_name |
3505 |
30 Nov 09 |
gregory |
5 |
p1="p1_$name" |
3505 |
30 Nov 09 |
gregory |
6 |
p2="p2_$name" |
3505 |
30 Nov 09 |
gregory |
7 |
A="in_projects.tsv" |
3505 |
30 Nov 09 |
gregory |
8 |
B="result_1.tsv" |
3505 |
30 Nov 09 |
gregory |
9 |
C="result_2.tsv" |
3505 |
30 Nov 09 |
gregory |
10 |
D="result_3.tsv" |
3505 |
30 Nov 09 |
gregory |
11 |
|
3505 |
30 Nov 09 |
gregory |
# Create two projects, which automatically will create two directories |
3505 |
30 Nov 09 |
gregory |
13 |
echo "Name" > $A |
3505 |
30 Nov 09 |
gregory |
14 |
echo "$p1" >> $A |
3505 |
30 Nov 09 |
gregory |
15 |
echo "$p2" >> $A |
3505 |
30 Nov 09 |
gregory |
16 |
PUT "$A" "$resource/projects?$auth" |
3505 |
30 Nov 09 |
gregory |
17 |
|
3505 |
30 Nov 09 |
gregory |
18 |
|
3505 |
30 Nov 09 |
gregory |
# Check that both projects where created |
3505 |
30 Nov 09 |
gregory |
20 |
check_creation() |
3505 |
30 Nov 09 |
gregory |
21 |
{ |
3505 |
30 Nov 09 |
gregory |
22 |
file=$1 |
3505 |
30 Nov 09 |
gregory |
23 |
name=$2 |
3505 |
30 Nov 09 |
gregory |
24 |
GET "$file" "$resource/projects?$auth&select=Id,Name&whereName==$name" |
3505 |
30 Nov 09 |
gregory |
25 |
count=`cat $file | wc -l` |
3505 |
30 Nov 09 |
gregory |
26 |
if [ "$count" != "2" ]; then |
3505 |
30 Nov 09 |
gregory |
27 |
fail "$test" "Project named $name was not found. See $file for response."; |
3505 |
30 Nov 09 |
gregory |
28 |
fi |
3505 |
30 Nov 09 |
gregory |
29 |
} |
3505 |
30 Nov 09 |
gregory |
30 |
check_creation $B $p1 |
3505 |
30 Nov 09 |
gregory |
31 |
check_creation $C $p2 |
3505 |
30 Nov 09 |
gregory |
32 |
|
3505 |
30 Nov 09 |
gregory |
33 |
|
3505 |
30 Nov 09 |
gregory |
# Select projects by filtering on one project.directory.name |
3514 |
07 Dec 09 |
gregory |
35 |
GET "$D" "$resource/projects?$auth&select=Id,Name,ProjectDirectory&whereProjectDirectory.Name==$p1" |
3505 |
30 Nov 09 |
gregory |
36 |
|
3505 |
30 Nov 09 |
gregory |
# Check that the result contains one,and only one, a project with the same name as the directory |
3505 |
30 Nov 09 |
gregory |
38 |
count=`cat $D | wc -l` |
3505 |
30 Nov 09 |
gregory |
39 |
if [ "$count" != "2" ]; then |
3505 |
30 Nov 09 |
gregory |
40 |
fail "$test" "Project named $p1 was not found using cross table query. See $D for response."; |
3505 |
30 Nov 09 |
gregory |
41 |
fi |
3505 |
30 Nov 09 |
gregory |
42 |
|
3505 |
30 Nov 09 |
gregory |
43 |
|
3505 |
30 Nov 09 |
gregory |
# $Id$ |