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
117
118
/**
*
*/
package org.openiaml.model.tests.codegen.model0_4_4;

import java.util.Calendar;
import java.util.TimeZone;

/**
* Simple test cases to check sync wires between elements of the
* <em>same</em> type.
*
* @example InputTextField,CastNode
* Two {@model InputTextField}s of the same type can easily be {@model SyncWire synchronised}
* with each other.
*/
public class InputTextFieldDataTypeSyncDirect extends WarningEnabledCodegenTestCase {

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

/**
* The home page can be accessed.
*
* @throws Exception
*/
public void testHome() throws Exception {

beginAtSitemapThenPage("Home");
assertNoProblem();

}

private void doTest(String label1, String label2, String initial, String text) {
doTest(label1, label2, initial, text, text);
}

private void doTest(String label1, String label2, String initial, String text, String expected) {
{
String target = getLabelIDForText(label1);
assertLabeledFieldEquals(target, initial); // empty

// we can set it to a string
setLabeledFormElementField(target, text);
assertLabeledFieldEquals(target, expected);
}

// and the other one
{
String target = getLabelIDForText(label2);
assertLabeledFieldEquals(target, expected);
}
}

public void testString() throws Exception {
beginAtSitemapThenPage("Home");
assertNoProblem();

doTest("String 1", "String 2", "", "hello, world!");
assertNoProblem();
doTest("String 2", "String 1", "hello, world!", "goodbye, world!");
assertNoProblem();
}

public void testEmail() throws Exception {
beginAtSitemapThenPage("Home");
assertNoProblem();

doTest("Email 1", "Email 2", "", "one@openiaml.org");
assertNoProblem();
doTest("Email 2", "Email 1", "one@openiaml.org", "two@openiaml.org");
assertNoProblem();
}

public void testInteger() throws Exception {
beginAtSitemapThenPage("Home");
assertNoProblem();

doTest("Integer 1", "Integer 2", "", "1234");
assertNoProblem();
doTest("Integer 2", "Integer 1", "1234", "5678");
assertNoProblem();
}

public void testDefault() throws Exception {
beginAtSitemapThenPage("Home");
assertNoProblem();

doTest("Default 1", "Default 2", "", "one@openiaml.org");
assertNoProblem();
doTest("Default 2", "Default 1", "one@openiaml.org", "12345");
assertNoProblem();
}

public void testDate() throws Exception {
beginAtSitemapThenPage("Home");
assertNoProblem();

// construct two expected dates
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("UTC"));
c.clear();
c.set(1998, 11 /* 0-based */, 25);
String date1 = rfc2822(c.getTime());

c.clear();
c.set(2001, 0 /* 0-based */, 12);
String date2 = rfc2822(c.getTime());

doTest("Date 1", "Date 2", "", "12/25/1998 +0000", date1);
assertNoProblem();
doTest("Date 2", "Date 1", date1, "01/12/2001 +0000", date2);
assertNoProblem();
}

}

Change log

r2660 by soundasleep on Apr 10, 2011   Diff
improving some failing codegen tests by
reducing their fragility
Go to: 
Project members, sign in to write a code review

Older revisions

r1726 by soundasleep on Mar 16, 2010   Diff
adding
InputTextFieldDataTypeSyncDirect test
case
All revisions of this file

File info

Size: 3138 bytes, 118 lines
Powered by Google Project Hosting