Author: musachy
Date: Mon Dec 29 07:59:38 2008
New Revision: 729923
URL: http://svn.apache.org/viewvc?rev=729923&view=rev
Log:
Add integration tests to Showcase
Added:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ActionChainingTest.java
(with props)
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/CRUDTest.java
(with props)
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ConversionTest.java
(with props)
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ExecAndWaitTest.java
(with props)
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/FileDownloadTest.java
(with props)
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/FreeMarkerManagerTest.java
(with props)
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ValidationTest.java
(with props)
Modified:
struts/struts2/trunk/apps/showcase/src/main/webapp/freemarker/customFreemarkerManagerUsage.ftl
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ActionTagExampleTest.java
(contents, props changed)
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ComponentTagExampleTest.java
(contents, props changed)
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ITBaseTest.java
(contents, props changed)
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ParameterUtils.java
(props changed)
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/UITagExampleTest.java
(contents, props changed)
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/staticcontent/StaticContentTest.java
(contents, props changed)
Modified:
struts/struts2/trunk/apps/showcase/src/main/webapp/freemarker/customFreemarkerManagerUsage.ftl
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/main/webapp/freemarker/customFreemarkerManagerUsage.ftl?rev=729923&r1=729922&r2=729923&view=diff
==============================================================================
---
struts/struts2/trunk/apps/showcase/src/main/webapp/freemarker/customFreemarkerManagerUsage.ftl
(original)
+++
struts/struts2/trunk/apps/showcase/src/main/webapp/freemarker/customFreemarkerManagerUsage.ftl
Mon Dec 29 07:59:38 2008
@@ -18,8 +18,8 @@
<li>$ { customFreemarkerManagerUtil.timeNow } - to get the time
now</li>
</ul>
- Today's Date = ${customFreemarkerManagerUtil.todayDate}<br/>
- Time now = ${customFreemarkerManagerUtil.getTimeNow()}<br/>
+ Today's Date = <span
id="todaysDate">${customFreemarkerManagerUtil.todayDate}</span><br/>
+ Time now = <span
id="timeNow">${customFreemarkerManagerUtil.getTimeNow()}</span><br/>
</body>
</html>
Added:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ActionChainingTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ActionChainingTest.java?rev=729923&view=auto
==============================================================================
---
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ActionChainingTest.java
(added)
+++
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ActionChainingTest.java
Mon Dec 29 07:59:38 2008
@@ -0,0 +1,30 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package it.org.apache.struts2.showcase;
+
+public class ActionChainingTest extends ITBaseTest {
+ public void test() {
+ beginAt("/actionchaining/actionChain1!input");
+ assertTextPresent("Action Chain 1 Property 1: Property Set In Action
Chain 1");
+ assertTextPresent("Action Chain 2 Property 1: Property Set in Action
Chain 2");
+ assertTextPresent("Action Chain 3 Property 1: Property set in Action
Chain 3");
+ }
+}
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ActionChainingTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ActionChainingTest.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ActionTagExampleTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ActionTagExampleTest.java?rev=729923&r1=729922&r2=729923&view=diff
==============================================================================
---
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ActionTagExampleTest.java
(original)
+++
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ActionTagExampleTest.java
Mon Dec 29 07:59:38 2008
@@ -1,29 +1,29 @@
-/*
- * $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package it.org.apache.struts2.showcase;
-
-public class ActionTagExampleTest extends ITBaseTest {
- public void test() {
- beginAt("/tags/ui/actionTagExample!input.action");
- assertTextPresent("This text is from the called class");
- }
-
-}
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package it.org.apache.struts2.showcase;
+
+public class ActionTagExampleTest extends ITBaseTest {
+ public void test() {
+ beginAt("/tags/ui/actionTagExample!input.action");
+ assertTextPresent("This text is from the called class");
+ }
+
+}
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ActionTagExampleTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/CRUDTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/CRUDTest.java?rev=729923&view=auto
==============================================================================
---
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/CRUDTest.java
(added)
+++
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/CRUDTest.java
Mon Dec 29 07:59:38 2008
@@ -0,0 +1,36 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package it.org.apache.struts2.showcase;
+
+public class CRUDTest extends ITBaseTest {
+ public void testCreate() {
+ beginAt("/skill/edit.action");
+
+ setTextField("currentSkill.name", "somename1");
+ setTextField("currentSkill.description", "somedescription1");
+
+ submit();
+
+ beginAt("/skill/list.action");
+ assertTextPresent("somename1");
+ assertTextPresent("somedescription1");
+ }
+}
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/CRUDTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/CRUDTest.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ComponentTagExampleTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ComponentTagExampleTest.java?rev=729923&r1=729922&r2=729923&view=diff
==============================================================================
---
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ComponentTagExampleTest.java
(original)
+++
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ComponentTagExampleTest.java
Mon Dec 29 07:59:38 2008
@@ -1,31 +1,31 @@
-/*
- * $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package it.org.apache.struts2.showcase;
-
-public class ComponentTagExampleTest extends ITBaseTest {
- public void test() {
- beginAt("/tags/ui/componentTagExample.jsp");
- assertTextPresent("Freemarker Custom Template - parameter 'paramName'
- paramValue1");
- assertTextPresent("Freemarker Custom Template - parameter 'paramName'
- paramValue4");
- assertTextPresent("JSP Custom Template - parameter 'paramName' -
paramValue2");
- assertTextPresent("JSP Custom Template - parameter 'paramName' -
paramValue3");
- }
-}
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package it.org.apache.struts2.showcase;
+
+public class ComponentTagExampleTest extends ITBaseTest {
+ public void test() {
+ beginAt("/tags/ui/componentTagExample.jsp");
+ assertTextPresent("Freemarker Custom Template - parameter 'paramName'
- paramValue1");
+ assertTextPresent("Freemarker Custom Template - parameter 'paramName'
- paramValue4");
+ assertTextPresent("JSP Custom Template - parameter 'paramName' -
paramValue2");
+ assertTextPresent("JSP Custom Template - parameter 'paramName' -
paramValue3");
+ }
+}
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ComponentTagExampleTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ConversionTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ConversionTest.java?rev=729923&view=auto
==============================================================================
---
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ConversionTest.java
(added)
+++
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ConversionTest.java
Mon Dec 29 07:59:38 2008
@@ -0,0 +1,67 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package it.org.apache.struts2.showcase;
+
+public class ConversionTest extends ITBaseTest {
+ public void testList() {
+ beginAt("/conversion/enterPersonsInfo.action");
+ setTextField("persons[0].name", "name0");
+ setTextField("persons[0].age", "0");
+ setTextField("persons[1].name", "name1");
+ setTextField("persons[1].age", "1");
+ setTextField("persons[2].name", "name2");
+ setTextField("persons[2].age", "2");
+
+ submit();
+
+ assertTextPresent("SET 0 Name: name0");
+ assertTextPresent("SET 0 Age: 0");
+ assertTextPresent("SET 1 Name: name1");
+ assertTextPresent("SET 1 Age: 1");
+ assertTextPresent("SET 2 Name: name2");
+ assertTextPresent("SET 2 Age: 2");
+ }
+
+ public void testSet() {
+ beginAt("/conversion/enterAddressesInfo.action");
+ setTextField("addresses('id0').address", "address0");
+ setTextField("addresses('id1').address", "address1");
+ setTextField("addresses('id2').address", "address2");
+
+ submit();
+
+ assertTextPresent("id0 -> address0");
+ assertTextPresent("id1 -> address1");
+ assertTextPresent("id2 -> address2");
+ }
+
+ public void testEnum() {
+ beginAt("/conversion/enterOperationEnumInfo.action");
+ checkCheckbox("selectedOperations", "ADD");
+ checkCheckbox("selectedOperations", "MINUS");
+
+ submit();
+
+ assertTextPresent("ADD");
+ assertTextPresent("MINUS");
+ }
+}
+
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ConversionTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ConversionTest.java
------------------------------------------------------------------------------
svn:keywords = Id
Added:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ExecAndWaitTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ExecAndWaitTest.java?rev=729923&view=auto
==============================================================================
---
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ExecAndWaitTest.java
(added)
+++
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ExecAndWaitTest.java
Mon Dec 29 07:59:38 2008
@@ -0,0 +1,35 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package it.org.apache.struts2.showcase;
+
+public class ExecAndWaitTest extends ITBaseTest {
+ public void testNodelay() throws InterruptedException {
+ beginAt("/wait/example1.jsp");
+
+ setTextField("time", "7000");
+ submit();
+ assertTextPresent("We are processing your request. Please wait.");
+
+ //hit it again
+ beginAt("/wait/longProcess1.action?time=1000");
+ assertTextPresent("We are processing your request. Please wait.");
+ }
+}
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ExecAndWaitTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ExecAndWaitTest.java
------------------------------------------------------------------------------
svn:keywords = Id
Added:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/FileDownloadTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/FileDownloadTest.java?rev=729923&view=auto
==============================================================================
---
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/FileDownloadTest.java
(added)
+++
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/FileDownloadTest.java
Mon Dec 29 07:59:38 2008
@@ -0,0 +1,40 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package it.org.apache.struts2.showcase;
+
+import java.net.URL;
+import java.net.MalformedURLException;
+
+public class FileDownloadTest extends ITBaseTest {
+ public void testImage() throws InterruptedException, MalformedURLException
{
+ beginAt("/filedownload/download.action");
+
+ URL url = new
URL("http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/showcase/src/main/webapp/images/struts.gif");
+ assertDownloadedFileEquals(url);
+ }
+
+ public void testZip() throws InterruptedException, MalformedURLException {
+ beginAt("/filedownload/download2.action");
+
+ URL url = new
URL("http://svn.apache.org/repos/asf/struts/struts2/trunk/apps/showcase/src/main/webapp/images/struts-gif.zip");
+ assertDownloadedFileEquals(url);
+ }
+}
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/FileDownloadTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/FileDownloadTest.java
------------------------------------------------------------------------------
svn:keywords = Id
Added:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/FreeMarkerManagerTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/FreeMarkerManagerTest.java?rev=729923&view=auto
==============================================================================
---
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/FreeMarkerManagerTest.java
(added)
+++
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/FreeMarkerManagerTest.java
Mon Dec 29 07:59:38 2008
@@ -0,0 +1,44 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package it.org.apache.struts2.showcase;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+public class FreeMarkerManagerTest extends ITBaseTest {
+ public void testCustomManager() {
+ beginAt("/freemarker/customFreemarkerManagerDemo.action");
+
+ String date = getElementTextByXPath("//*...@id='todaysDate']");
+ assertNotNull(date);
+ assertTrue(date.length() > 0);
+
+ String time = getElementTextByXPath("//*...@id='timeNow']");
+ assertNotNull(time);
+ assertTrue(time.length() > 0);
+ }
+
+ public void testTags() {
+ beginAt("/freemarker/standardTags.action");
+ assertElementPresent("test_name");
+ assertElementPresent("test_");
+ }
+}
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/FreeMarkerManagerTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/FreeMarkerManagerTest.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ITBaseTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ITBaseTest.java?rev=729923&r1=729922&r2=729923&view=diff
==============================================================================
---
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ITBaseTest.java
(original)
+++
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ITBaseTest.java
Mon Dec 29 07:59:38 2008
@@ -1,30 +1,30 @@
-/*
- * $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package it.org.apache.struts2.showcase;
-
-import net.sourceforge.jwebunit.junit.WebTestCase;
-
-public abstract class ITBaseTest extends WebTestCase {
-
- public void setUp() throws Exception {
- getTestContext().setBaseUrl(ParameterUtils.getBaseUrl());
- }
-}
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package it.org.apache.struts2.showcase;
+
+import net.sourceforge.jwebunit.junit.WebTestCase;
+
+public abstract class ITBaseTest extends WebTestCase {
+
+ public void setUp() throws Exception {
+ getTestContext().setBaseUrl(ParameterUtils.getBaseUrl());
+ }
+}
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ITBaseTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ParameterUtils.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/UITagExampleTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/UITagExampleTest.java?rev=729923&r1=729922&r2=729923&view=diff
==============================================================================
---
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/UITagExampleTest.java
(original)
+++
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/UITagExampleTest.java
Mon Dec 29 07:59:38 2008
@@ -1,55 +1,55 @@
-/*
- * $Id$
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package it.org.apache.struts2.showcase;
-
-public class UITagExampleTest extends ITBaseTest {
- public void testInputForm() {
- setScriptingEnabled(false);
- beginAt("/tags/ui/example!input.action");
- assertFormPresent("exampleSubmit");
- // text box
- assertFormElementPresent("name");
- // textarea
- assertFormElementPresent("bio");
- // select
- assertFormElementPresent("favouriteColor");
- // checkbox list
- assertFormElementPresent("friends");
- // checkbox
- assertFormElementPresent("legalAge");
-
- // set fields
- setTextField("name", "name");
- setTextField("bio", "bio");
- selectOption("favouriteColor", "Red");
- checkCheckbox("friends", "Patrick");
- checkCheckbox("friends", "Jason");
- checkCheckbox("legalAge");
-
- submit();
-
- assertTextInElement("name", "name");
- assertTextInElement("bio", "bio");
- assertTextInElement("favouriteColor", "Red");
- assertTextInElement("friends", "[Patrick, Jason]");
- assertTextInElement("legalAge", "true");
- }
-}
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package it.org.apache.struts2.showcase;
+
+public class UITagExampleTest extends ITBaseTest {
+ public void testInputForm() {
+ setScriptingEnabled(false);
+ beginAt("/tags/ui/example!input.action");
+ assertFormPresent("exampleSubmit");
+ // text box
+ assertFormElementPresent("name");
+ // textarea
+ assertFormElementPresent("bio");
+ // select
+ assertFormElementPresent("favouriteColor");
+ // checkbox list
+ assertFormElementPresent("friends");
+ // checkbox
+ assertFormElementPresent("legalAge");
+
+ // set fields
+ setTextField("name", "name");
+ setTextField("bio", "bio");
+ selectOption("favouriteColor", "Red");
+ checkCheckbox("friends", "Patrick");
+ checkCheckbox("friends", "Jason");
+ checkCheckbox("legalAge");
+
+ submit();
+
+ assertTextInElement("name", "name");
+ assertTextInElement("bio", "bio");
+ assertTextInElement("favouriteColor", "Red");
+ assertTextInElement("friends", "[Patrick, Jason]");
+ assertTextInElement("legalAge", "true");
+ }
+}
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/UITagExampleTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ValidationTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ValidationTest.java?rev=729923&view=auto
==============================================================================
---
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ValidationTest.java
(added)
+++
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ValidationTest.java
Mon Dec 29 07:59:38 2008
@@ -0,0 +1,46 @@
+/*
+ * $Id$
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package it.org.apache.struts2.showcase;
+
+public class ValidationTest extends ITBaseTest {
+ public void testFieldValidators() {
+ beginAt("/validation/showFieldValidatorsExamples.action");
+
+ setTextField("integerValidatorField", "nonint");
+ setTextField("dateValidatorField", "nondate");
+ setTextField("emailValidatorField", "!@@#%");
+ setTextField("urlValidatorField", "!@@#%");
+ setTextField("stringLengthValidatorField", "a");
+ setTextField("regexValidatorField", "abc");
+ setTextField("fieldExpressionValidatorField", "abc");
+
+ submit();
+
+ assertTextPresent("Invalid field value for field
\"dateValidatorField\"");
+ assertTextPresent("Invalid field value for field
\"integerValidatorField\"");
+ assertTextPresent("required and must be string");
+ assertTextPresent("must be a valid email if supplied");
+ assertTextPresent("must be a valid url if supplied ");
+ assertTextPresent("must be a String of a specific greater than 1 less
than 5 if specified ");
+ assertTextPresent("regexValidatorField must match a regexp (.*\\.txt)
if specified ");
+ assertTextPresent("must be the same as the Required Validator Field if
specified ");
+ }
+}
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ValidationTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/ValidationTest.java
------------------------------------------------------------------------------
svn:keywords = Id
Modified:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/staticcontent/StaticContentTest.java
URL:
http://svn.apache.org/viewvc/struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/staticcontent/StaticContentTest.java?rev=729923&r1=729922&r2=729923&view=diff
==============================================================================
---
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/staticcontent/StaticContentTest.java
(original)
+++
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/staticcontent/StaticContentTest.java
Mon Dec 29 07:59:38 2008
@@ -1,37 +1,37 @@
-package it.org.apache.struts2.showcase.staticcontent;
-
-import it.org.apache.struts2.showcase.ITBaseTest;
-
-import java.io.IOException;
-
-import net.sourceforge.jwebunit.exception.TestingEngineResponseException;
-
-public class StaticContentTest extends ITBaseTest {
-
- public void testInvalidRersources1() throws IOException {
- try {
- beginAt("/struts..");
- fail("Previous request should have failed");
- } catch (TestingEngineResponseException ex) {
- // ok
- }
- }
-
- public void testInvalidRersources2() throws IOException {
- try {
- beginAt("/struts/..%252f");
- fail("Previous request should have failed");
- } catch (TestingEngineResponseException ex) {
- // ok
- }
- }
-
- /*public void testInvalidRersources3() throws IOException {
- try {
-
beginAt("/struts/..%252f..%252f..%252fWEB-INF/classes/org/apache/struts2/showcase/action/EmployeeAction.class/");
- fail("Previous request should have failed");
- } catch (TestingEngineResponseException ex) {
- // ok
- }
- }*/
-}
+package it.org.apache.struts2.showcase.staticcontent;
+
+import it.org.apache.struts2.showcase.ITBaseTest;
+
+import java.io.IOException;
+
+import net.sourceforge.jwebunit.exception.TestingEngineResponseException;
+
+public class StaticContentTest extends ITBaseTest {
+
+ public void testInvalidRersources1() throws IOException {
+ try {
+ beginAt("/struts..");
+ fail("Previous request should have failed");
+ } catch (TestingEngineResponseException ex) {
+ // ok
+ }
+ }
+
+ public void testInvalidRersources2() throws IOException {
+ try {
+ beginAt("/struts/..%252f");
+ fail("Previous request should have failed");
+ } catch (TestingEngineResponseException ex) {
+ // ok
+ }
+ }
+
+ /*public void testInvalidRersources3() throws IOException {
+ try {
+
beginAt("/struts/..%252f..%252f..%252fWEB-INF/classes/org/apache/struts2/showcase/action/EmployeeAction.class/");
+ fail("Previous request should have failed");
+ } catch (TestingEngineResponseException ex) {
+ // ok
+ }
+ }*/
+}
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/staticcontent/StaticContentTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange:
struts/struts2/trunk/apps/showcase/src/test/java/it/org/apache/struts2/showcase/staticcontent/StaticContentTest.java
------------------------------------------------------------------------------
svn:keywords = Id