My favorites | Sign in
Project Home Wiki Issues Source
Checkout   Browse   Changes    
 
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
/**
*
*/
package org.openiaml.model.tests.codegen.model0_4;

import org.openiaml.model.tests.CodegenTestCase;

/**
* A QueryParameter connected to a text field via a SetWire.
*
* @example QueryParameter,SetWire Setting a {@model InputTextField} to
* the value of a {@model QueryParameter} from the current URI.
*
* @implementation SetWire A {@model SetWire} can be connected directly
* to a {@model InputTextField}.
*
* @author jmwright
*
*/
public class QueryParameterSet extends CodegenTestCase {

@Override
public void setUp() throws Exception {
super.setUp();
root = loadAndCodegen(QueryParameterSet.class);
}

/**
* Initially, the query is empty.
*
* @throws Exception
*/
public void testInitial() throws Exception {
beginAtSitemapThenPage("Home");

String source = getLabelIDForText("current name");
assertLabeledFieldEquals(source, "empty");
}

/**
* Check the page with the query set.
*
* @throws Exception
*/
public void testQuery() throws Exception {
beginAtSitemapThenPageQuery("Home", "name=value");

String source = getLabelIDForText("current name");
assertLabeledFieldEquals(source, "value");
}

/**
* Try visiting the page multiple times with different queries.
*
* @throws Exception
*/
public void testMultiple() throws Exception {
beginAtSitemapThenPageQuery("Home", "name=value");

{
String source = getLabelIDForText("current name");
assertLabeledFieldEquals(source, "value");
}

beginAtSitemapThenPageQuery("Home", "name=new");

{
String source = getLabelIDForText("current name");
assertLabeledFieldEquals(source, "new");
}

// blank
beginAtSitemapThenPage("Home");

{
String source = getLabelIDForText("current name");
assertLabeledFieldEquals(source, "empty");
}

// empty value
beginAtSitemapThenPageQuery("Home", "name=");

{
String source = getLabelIDForText("current name");
assertLabeledFieldEquals(source, "");
}
}

/**
* We can edit the target field and it will not change, because
* the value is taken from the query parameter.
*
* @throws Exception
*/
public void testChangeable() throws Exception {
beginAtSitemapThenPageQuery("Home", "name=test1");

{
String source = getLabelIDForText("current name");
assertLabeledFieldEquals(source, "test1");

// set it
setLabeledFormElementField(source, "a new value");
}

// reload
beginAtSitemapThenPageQuery("Home", "name=test1");

// it hasn't changed
{
String source = getLabelIDForText("current name");
assertLabeledFieldEquals(source, "test1");
}
}

}

Change log

r1561 by soundasleep on Feb 22, 2010   Diff
replacing '@operational' modeldoc tag with
'@implementation'
fixing some broken '@link' javadoc tags,
which were causing problems with generated
modeldoc
modeldoc no longer displays Operational
Semantics unless there are some
Go to: 
Project members, sign in to write a code review

Older revisions

r1231 by soundasleep on Sep 30, 2009   Diff
adding operational semantics and
examples to most other model 0.4
codegen test cases
r1228 by soundasleep on Sep 29, 2009   Diff
adding inline documentation for
modeldoc, based on /wiki/Model0_4
r1000 by soundasleep on Aug 16, 2009   Diff
implemented QueryParameter code
generation
All revisions of this file

File info

Size: 2754 bytes, 116 lines
Powered by Google Project Hosting