You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by hu...@apache.org on 2006/11/06 16:02:22 UTC
svn commit: r471756 [27/31] - in /struts/struts2/trunk: apps/blank/
apps/blank/src/main/java/example/ apps/blank/src/test/java/example/
apps/mailreader/src/main/java/mailreader2/
apps/portlet/src/main/java/org/apache/struts2/portlet/example/ apps/portl...
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/SetTagTest.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp;
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/SortIteratorTagTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/SortIteratorTagTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/SortIteratorTagTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/SortIteratorTagTest.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp;
@@ -69,8 +72,8 @@
}
public void testSortWithIdIteratorAvailableInStackTop() throws Exception {
-
- SortIteratorTag tag = new SortIteratorTag();
+
+ SortIteratorTag tag = new SortIteratorTag();
tag.setId("myId");
tag.setComparator("comparator");
@@ -98,14 +101,14 @@
// 5
assertTrue(sortedIterator.hasNext());
assertEquals(sortedIterator.next(), new Integer(5));
-
+
assertFalse(sortedIterator.hasNext());
}
tag.doEndTag();
}
-
-
+
+
public void testSortWithIdIteratorAvailableInPageContext() throws Exception {
SortIteratorTag tag = new SortIteratorTag();
@@ -135,7 +138,7 @@
// 5
assertTrue(sortedIterator.hasNext());
assertEquals(sortedIterator.next(), new Integer(5));
-
+
assertFalse(sortedIterator.hasNext());
}
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockBodyContent.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockBodyContent.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockBodyContent.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockBodyContent.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp;
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpServletRequest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpServletRequest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpServletRequest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpServletRequest.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp;
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpServletResponse.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpServletResponse.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpServletResponse.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpServletResponse.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp;
@@ -32,7 +35,7 @@
public class StrutsMockHttpServletResponse extends MockHttpServletResponse {
private Locale locale;
private PrintWriter writer;
-
+
public Locale getLocale() {
return locale;
}
@@ -42,14 +45,14 @@
}
public PrintWriter getWriter() throws IOException {
- if (writer == null)
- return new PrintWriter(new ByteArrayOutputStream());
- else
- return writer;
+ if (writer == null)
+ return new PrintWriter(new ByteArrayOutputStream());
+ else
+ return writer;
}
-
+
public void setWriter(PrintWriter writer) {
- this.writer = writer;
+ this.writer = writer;
}
public String encodeURL(String s) {
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpSession.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpSession.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpSession.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockHttpSession.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp;
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockJspWriter.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockJspWriter.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockJspWriter.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockJspWriter.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp;
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockPageContext.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockPageContext.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockPageContext.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockPageContext.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp;
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockServletContext.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockServletContext.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockServletContext.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/StrutsMockServletContext.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp;
@@ -81,14 +84,14 @@
}
public InputStream getResourceAsStream(String s) {
- if (resourceAsStream != null) {
- return resourceAsStream;
- }
+ if (resourceAsStream != null) {
+ return resourceAsStream;
+ }
return null;
}
-
+
public void setResourceAsStream(InputStream is) {
- this.resourceAsStream = is;
+ this.resourceAsStream = is;
}
public RequestDispatcher getRequestDispatcher(String s) {
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/SubsetIteratorTagTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/SubsetIteratorTagTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/SubsetIteratorTagTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/SubsetIteratorTagTest.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp;
@@ -30,247 +33,247 @@
/**
* Test case for SubsetIteratorTag.
- *
+ *
*/
public class SubsetIteratorTagTest extends AbstractTagTest {
-
- public void testBasic() throws Exception {
- { // List as Source
- SubsetIteratorTag tag = new SubsetIteratorTag();
- tag.setPageContext(pageContext);
- tag.setSource("myList");
-
- tag.doStartTag();
- Iterator subsetIterator = (Iterator) stack.findValue("top");
- tag.doEndTag();
-
- assertEquals(subsetIterator.next(), new Integer(1));
- assertEquals(subsetIterator.next(), new Integer(2));
- assertEquals(subsetIterator.next(), new Integer(3));
- assertEquals(subsetIterator.next(), new Integer(4));
- assertEquals(subsetIterator.next(), new Integer(5));
- }
-
- { // Array as Source
- SubsetIteratorTag tag = new SubsetIteratorTag();
- tag.setPageContext(pageContext);
- tag.setSource("myArray");
-
- tag.doStartTag();
- Iterator subsetIterator = (Iterator) stack.findValue("top");
- tag.doEndTag();
-
- assertEquals(subsetIterator.next(), new Integer(1));
- assertEquals(subsetIterator.next(), new Integer(2));
- assertEquals(subsetIterator.next(), new Integer(3));
- assertEquals(subsetIterator.next(), new Integer(4));
- assertEquals(subsetIterator.next(), new Integer(5));
- }
- }
-
- public void testWithStartAttribute() throws Exception {
- { // List as source
- SubsetIteratorTag tag = new SubsetIteratorTag();
- tag.setPageContext(pageContext);
- tag.setSource("myList");
- tag.setStart("3");
-
- tag.doStartTag();
- Iterator subsetIterator = (Iterator) stack.findValue("top");
- tag.doEndTag();
-
- assertEquals(subsetIterator.next(), new Integer(4));
- assertEquals(subsetIterator.next(), new Integer(5));
- }
-
- { // Array as source
- SubsetIteratorTag tag = new SubsetIteratorTag();
- tag.setPageContext(pageContext);
- tag.setSource("myArray");
- tag.setStart("3");
-
- tag.doStartTag();
- Iterator subsetIterator = (Iterator) stack.findValue("top");
- tag.doEndTag();
-
- assertEquals(subsetIterator.next(), new Integer(4));
- assertEquals(subsetIterator.next(), new Integer(5));
- }
- }
-
- public void testWithCountAttribute() throws Exception {
- { // List as source
- SubsetIteratorTag tag = new SubsetIteratorTag();
- tag.setPageContext(pageContext);
- tag.setSource("myList");
- tag.setCount("3");
-
- tag.doStartTag();
- Iterator subsetIterator = (Iterator) stack.findValue("top");
- tag.doEndTag();
-
- assertEquals(subsetIterator.next(), new Integer(1));
- assertEquals(subsetIterator.next(), new Integer(2));
- assertEquals(subsetIterator.next(), new Integer(3));
- }
-
- { // array as source
- SubsetIteratorTag tag = new SubsetIteratorTag();
- tag.setPageContext(pageContext);
- tag.setSource("myArray");
- tag.setCount("3");
-
- tag.doStartTag();
- Iterator subsetIterator = (Iterator) stack.findValue("top");
- tag.doEndTag();
-
- assertEquals(subsetIterator.next(), new Integer(1));
- assertEquals(subsetIterator.next(), new Integer(2));
- assertEquals(subsetIterator.next(), new Integer(3));
- }
- }
-
- public void testWIthStartAndCountAttribute() throws Exception {
- { // List as source
- SubsetIteratorTag tag = new SubsetIteratorTag();
- tag.setPageContext(pageContext);
- tag.setSource("myList");
- tag.setStart("3");
- tag.setCount("3");
-
- tag.doStartTag();
- Iterator subsetIterator = (Iterator) stack.findValue("top");
- tag.doEndTag();
-
- assertEquals(subsetIterator.next(), new Integer("4"));
- assertEquals(subsetIterator.next(), new Integer("5"));
- }
-
- { // Array as source
- SubsetIteratorTag tag = new SubsetIteratorTag();
- tag.setPageContext(pageContext);
- tag.setSource("myArray");
- tag.setStart("3");
- tag.setCount("3");
-
- tag.doStartTag();
- Iterator subsetIterator = (Iterator) stack.findValue("top");
- tag.doEndTag();
-
- assertEquals(subsetIterator.next(), new Integer("4"));
- assertEquals(subsetIterator.next(), new Integer("5"));
- }
- }
-
- public void testWithId() throws Exception {
- { // List as Source
- SubsetIteratorTag tag = new SubsetIteratorTag();
- tag.setPageContext(pageContext);
- tag.setSource("myList");
- tag.setId("myPageContextId1");
-
- tag.doStartTag();
- Iterator subsetIterator1 = (Iterator) stack.findValue("top");
- tag.doEndTag();
-
- Iterator subsetIterator2 = (Iterator) pageContext.getAttribute("myPageContextId1");
-
- assertNotNull(subsetIterator1);
- assertNotNull(subsetIterator2);
- assertEquals(subsetIterator1, subsetIterator2);
- assertEquals(subsetIterator2.next(), new Integer(1));
- assertEquals(subsetIterator2.next(), new Integer(2));
- assertEquals(subsetIterator2.next(), new Integer(3));
- assertEquals(subsetIterator2.next(), new Integer(4));
- assertEquals(subsetIterator2.next(), new Integer(5));
- }
-
- { // Array as source
- SubsetIteratorTag tag = new SubsetIteratorTag();
- tag.setPageContext(pageContext);
- tag.setSource("myArray");
- tag.setId("myPageContextId2");
-
- tag.doStartTag();
- Iterator subsetIterator1 = (Iterator) stack.findValue("top");
- tag.doEndTag();
-
- Iterator subsetIterator2 = (Iterator) pageContext.getAttribute("myPageContextId2");
-
- assertNotNull(subsetIterator1);
- assertNotNull(subsetIterator2);
- assertEquals(subsetIterator1, subsetIterator2);
- assertEquals(subsetIterator2.next(), new Integer(1));
- assertEquals(subsetIterator2.next(), new Integer(2));
- assertEquals(subsetIterator2.next(), new Integer(3));
- assertEquals(subsetIterator2.next(), new Integer(4));
- assertEquals(subsetIterator2.next(), new Integer(5));
- }
- }
-
- public void testWithDecider() throws Exception {
- { // List as source
- SubsetIteratorTag tag = new SubsetIteratorTag();
- tag.setPageContext(pageContext);
- tag.setSource("myList");
- tag.setDecider("myDecider");
-
- tag.doStartTag();
- Iterator subsetIterator = (Iterator) stack.findValue("top");
- tag.doEndTag();
-
- assertEquals(subsetIterator.next(), new Integer(2));
- assertEquals(subsetIterator.next(), new Integer(4));
- }
-
- { // Array As source
- SubsetIteratorTag tag = new SubsetIteratorTag();
- tag.setPageContext(pageContext);
- tag.setSource("myList");
- tag.setDecider("myDecider");
-
- tag.doStartTag();
- Iterator subsetIterator = (Iterator) stack.findValue("top");
- tag.doEndTag();
-
- assertEquals(subsetIterator.next(), new Integer(2));
- assertEquals(subsetIterator.next(), new Integer(4));
- }
- }
-
-
-
- public Action getAction() {
- return new ActionSupport() {
- public List getMyList() {
- List l = new ArrayList();
- l.add(new Integer(1));
- l.add(new Integer(2));
- l.add(new Integer(3));
- l.add(new Integer(4));
- l.add(new Integer(5));
- return l;
- }
-
- public Integer[] getMyArray() {
- Integer[] integers = new Integer[5];
- integers[0] = new Integer(1);
- integers[1] = new Integer(2);
- integers[2] = new Integer(3);
- integers[3] = new Integer(4);
- integers[4] = new Integer(5);
- return integers;
- }
-
- public Decider getMyDecider() {
- return new Decider() {
- public boolean decide(Object element) throws Exception {
- int integer = ((Integer)element).intValue();
- return (((integer % 2) == 0)?true:false);
- }
- };
- }
- };
- }
+
+ public void testBasic() throws Exception {
+ { // List as Source
+ SubsetIteratorTag tag = new SubsetIteratorTag();
+ tag.setPageContext(pageContext);
+ tag.setSource("myList");
+
+ tag.doStartTag();
+ Iterator subsetIterator = (Iterator) stack.findValue("top");
+ tag.doEndTag();
+
+ assertEquals(subsetIterator.next(), new Integer(1));
+ assertEquals(subsetIterator.next(), new Integer(2));
+ assertEquals(subsetIterator.next(), new Integer(3));
+ assertEquals(subsetIterator.next(), new Integer(4));
+ assertEquals(subsetIterator.next(), new Integer(5));
+ }
+
+ { // Array as Source
+ SubsetIteratorTag tag = new SubsetIteratorTag();
+ tag.setPageContext(pageContext);
+ tag.setSource("myArray");
+
+ tag.doStartTag();
+ Iterator subsetIterator = (Iterator) stack.findValue("top");
+ tag.doEndTag();
+
+ assertEquals(subsetIterator.next(), new Integer(1));
+ assertEquals(subsetIterator.next(), new Integer(2));
+ assertEquals(subsetIterator.next(), new Integer(3));
+ assertEquals(subsetIterator.next(), new Integer(4));
+ assertEquals(subsetIterator.next(), new Integer(5));
+ }
+ }
+
+ public void testWithStartAttribute() throws Exception {
+ { // List as source
+ SubsetIteratorTag tag = new SubsetIteratorTag();
+ tag.setPageContext(pageContext);
+ tag.setSource("myList");
+ tag.setStart("3");
+
+ tag.doStartTag();
+ Iterator subsetIterator = (Iterator) stack.findValue("top");
+ tag.doEndTag();
+
+ assertEquals(subsetIterator.next(), new Integer(4));
+ assertEquals(subsetIterator.next(), new Integer(5));
+ }
+
+ { // Array as source
+ SubsetIteratorTag tag = new SubsetIteratorTag();
+ tag.setPageContext(pageContext);
+ tag.setSource("myArray");
+ tag.setStart("3");
+
+ tag.doStartTag();
+ Iterator subsetIterator = (Iterator) stack.findValue("top");
+ tag.doEndTag();
+
+ assertEquals(subsetIterator.next(), new Integer(4));
+ assertEquals(subsetIterator.next(), new Integer(5));
+ }
+ }
+
+ public void testWithCountAttribute() throws Exception {
+ { // List as source
+ SubsetIteratorTag tag = new SubsetIteratorTag();
+ tag.setPageContext(pageContext);
+ tag.setSource("myList");
+ tag.setCount("3");
+
+ tag.doStartTag();
+ Iterator subsetIterator = (Iterator) stack.findValue("top");
+ tag.doEndTag();
+
+ assertEquals(subsetIterator.next(), new Integer(1));
+ assertEquals(subsetIterator.next(), new Integer(2));
+ assertEquals(subsetIterator.next(), new Integer(3));
+ }
+
+ { // array as source
+ SubsetIteratorTag tag = new SubsetIteratorTag();
+ tag.setPageContext(pageContext);
+ tag.setSource("myArray");
+ tag.setCount("3");
+
+ tag.doStartTag();
+ Iterator subsetIterator = (Iterator) stack.findValue("top");
+ tag.doEndTag();
+
+ assertEquals(subsetIterator.next(), new Integer(1));
+ assertEquals(subsetIterator.next(), new Integer(2));
+ assertEquals(subsetIterator.next(), new Integer(3));
+ }
+ }
+
+ public void testWIthStartAndCountAttribute() throws Exception {
+ { // List as source
+ SubsetIteratorTag tag = new SubsetIteratorTag();
+ tag.setPageContext(pageContext);
+ tag.setSource("myList");
+ tag.setStart("3");
+ tag.setCount("3");
+
+ tag.doStartTag();
+ Iterator subsetIterator = (Iterator) stack.findValue("top");
+ tag.doEndTag();
+
+ assertEquals(subsetIterator.next(), new Integer("4"));
+ assertEquals(subsetIterator.next(), new Integer("5"));
+ }
+
+ { // Array as source
+ SubsetIteratorTag tag = new SubsetIteratorTag();
+ tag.setPageContext(pageContext);
+ tag.setSource("myArray");
+ tag.setStart("3");
+ tag.setCount("3");
+
+ tag.doStartTag();
+ Iterator subsetIterator = (Iterator) stack.findValue("top");
+ tag.doEndTag();
+
+ assertEquals(subsetIterator.next(), new Integer("4"));
+ assertEquals(subsetIterator.next(), new Integer("5"));
+ }
+ }
+
+ public void testWithId() throws Exception {
+ { // List as Source
+ SubsetIteratorTag tag = new SubsetIteratorTag();
+ tag.setPageContext(pageContext);
+ tag.setSource("myList");
+ tag.setId("myPageContextId1");
+
+ tag.doStartTag();
+ Iterator subsetIterator1 = (Iterator) stack.findValue("top");
+ tag.doEndTag();
+
+ Iterator subsetIterator2 = (Iterator) pageContext.getAttribute("myPageContextId1");
+
+ assertNotNull(subsetIterator1);
+ assertNotNull(subsetIterator2);
+ assertEquals(subsetIterator1, subsetIterator2);
+ assertEquals(subsetIterator2.next(), new Integer(1));
+ assertEquals(subsetIterator2.next(), new Integer(2));
+ assertEquals(subsetIterator2.next(), new Integer(3));
+ assertEquals(subsetIterator2.next(), new Integer(4));
+ assertEquals(subsetIterator2.next(), new Integer(5));
+ }
+
+ { // Array as source
+ SubsetIteratorTag tag = new SubsetIteratorTag();
+ tag.setPageContext(pageContext);
+ tag.setSource("myArray");
+ tag.setId("myPageContextId2");
+
+ tag.doStartTag();
+ Iterator subsetIterator1 = (Iterator) stack.findValue("top");
+ tag.doEndTag();
+
+ Iterator subsetIterator2 = (Iterator) pageContext.getAttribute("myPageContextId2");
+
+ assertNotNull(subsetIterator1);
+ assertNotNull(subsetIterator2);
+ assertEquals(subsetIterator1, subsetIterator2);
+ assertEquals(subsetIterator2.next(), new Integer(1));
+ assertEquals(subsetIterator2.next(), new Integer(2));
+ assertEquals(subsetIterator2.next(), new Integer(3));
+ assertEquals(subsetIterator2.next(), new Integer(4));
+ assertEquals(subsetIterator2.next(), new Integer(5));
+ }
+ }
+
+ public void testWithDecider() throws Exception {
+ { // List as source
+ SubsetIteratorTag tag = new SubsetIteratorTag();
+ tag.setPageContext(pageContext);
+ tag.setSource("myList");
+ tag.setDecider("myDecider");
+
+ tag.doStartTag();
+ Iterator subsetIterator = (Iterator) stack.findValue("top");
+ tag.doEndTag();
+
+ assertEquals(subsetIterator.next(), new Integer(2));
+ assertEquals(subsetIterator.next(), new Integer(4));
+ }
+
+ { // Array As source
+ SubsetIteratorTag tag = new SubsetIteratorTag();
+ tag.setPageContext(pageContext);
+ tag.setSource("myList");
+ tag.setDecider("myDecider");
+
+ tag.doStartTag();
+ Iterator subsetIterator = (Iterator) stack.findValue("top");
+ tag.doEndTag();
+
+ assertEquals(subsetIterator.next(), new Integer(2));
+ assertEquals(subsetIterator.next(), new Integer(4));
+ }
+ }
+
+
+
+ public Action getAction() {
+ return new ActionSupport() {
+ public List getMyList() {
+ List l = new ArrayList();
+ l.add(new Integer(1));
+ l.add(new Integer(2));
+ l.add(new Integer(3));
+ l.add(new Integer(4));
+ l.add(new Integer(5));
+ return l;
+ }
+
+ public Integer[] getMyArray() {
+ Integer[] integers = new Integer[5];
+ integers[0] = new Integer(1);
+ integers[1] = new Integer(2);
+ integers[2] = new Integer(3);
+ integers[3] = new Integer(4);
+ integers[4] = new Integer(5);
+ return integers;
+ }
+
+ public Decider getMyDecider() {
+ return new Decider() {
+ public boolean decide(Object element) throws Exception {
+ int integer = ((Integer)element).intValue();
+ return (((integer % 2) == 0)?true:false);
+ }
+ };
+ }
+ };
+ }
}
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/TextTagTest.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp;
@@ -56,21 +59,21 @@
return action;
}
-
+
public void testDefaultMessageOk() throws Exception {
- // NOTE:
- // simulate the condition
- // <s:text name="some.invalid.key">My Default Message</s:text>
-
- StrutsMockBodyContent mockBodyContent = new StrutsMockBodyContent(new MockJspWriter());
- mockBodyContent.setString("Sample Of Default Message");
- tag.setBodyContent(mockBodyContent);
- tag.setName("some.invalid.key.so.we.should.get.the.default.message");
- int startStatus = tag.doStartTag();
- tag.doEndTag();
-
- assertEquals(startStatus, BodyTag.EVAL_BODY_BUFFERED);
- assertEquals("Sample Of Default Message", writer.toString());
+ // NOTE:
+ // simulate the condition
+ // <s:text name="some.invalid.key">My Default Message</s:text>
+
+ StrutsMockBodyContent mockBodyContent = new StrutsMockBodyContent(new MockJspWriter());
+ mockBodyContent.setString("Sample Of Default Message");
+ tag.setBodyContent(mockBodyContent);
+ tag.setName("some.invalid.key.so.we.should.get.the.default.message");
+ int startStatus = tag.doStartTag();
+ tag.doEndTag();
+
+ assertEquals(startStatus, BodyTag.EVAL_BODY_BUFFERED);
+ assertEquals("Sample Of Default Message", writer.toString());
}
public void testExpressionsEvaluated() throws Exception {
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/URLTagTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/URLTagTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/URLTagTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/URLTagTest.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp;
@@ -31,177 +34,177 @@
public class URLTagTest extends AbstractUITagTest {
private URLTag tag;
-
-
+
+
/**
- * To test priority of parameter passed in to url component though
- * various way
+ * To test priority of parameter passed in to url component though
+ * various way
* - current request url
* - tag's value attribute
* - tag's nested param tag
- *
- * id1
- * ===
- * - found in current request url
- * - found in tag's value attribute
- * - found in tag's param tag
- * CONCLUSION: tag's param tag takes precedence (paramId1)
- *
- * id2
- * ===
- * - found in current request url
- * - found in tag's value attribute
- * CONCLUSION: tag's value attribute take precedence (tagId2)
- *
- * urlParam1
- * =========
- * - found in current request url
- * CONCLUSION: param in current request url will be used (urlValue1)
- *
- * urlParam2
- * =========
- * - found in current request url
- * CONCLUSION: param in current request url will be used. (urlValue2)
- *
- * tagId
- * =====
- * - found in tag's value attribute
- * CONCLUSION: param in tag's value attribute wil; be used. (tagValue)
- *
- * param1
- * ======
- * - found in nested param tag
- * CONCLUSION: param in nested param tag will be used. (param1value)
- *
- * param2
- * ======
- * - found in nested param tag
- * CONCLUSION: param in nested param tag will be used. (param2value)
- */
+ *
+ * id1
+ * ===
+ * - found in current request url
+ * - found in tag's value attribute
+ * - found in tag's param tag
+ * CONCLUSION: tag's param tag takes precedence (paramId1)
+ *
+ * id2
+ * ===
+ * - found in current request url
+ * - found in tag's value attribute
+ * CONCLUSION: tag's value attribute take precedence (tagId2)
+ *
+ * urlParam1
+ * =========
+ * - found in current request url
+ * CONCLUSION: param in current request url will be used (urlValue1)
+ *
+ * urlParam2
+ * =========
+ * - found in current request url
+ * CONCLUSION: param in current request url will be used. (urlValue2)
+ *
+ * tagId
+ * =====
+ * - found in tag's value attribute
+ * CONCLUSION: param in tag's value attribute wil; be used. (tagValue)
+ *
+ * param1
+ * ======
+ * - found in nested param tag
+ * CONCLUSION: param in nested param tag will be used. (param1value)
+ *
+ * param2
+ * ======
+ * - found in nested param tag
+ * CONCLUSION: param in nested param tag will be used. (param2value)
+ */
public void testParametersPriority() throws Exception {
- request.setQueryString("id1=urlId1&id2=urlId2&urlParam1=urlValue1&urlParam2=urlValue2");
-
- tag.setValue("testAction.action?id1=tagId1&id2=tagId2&tagId=tagValue");
-
- ParamTag param1 = new ParamTag();
- param1.setPageContext(pageContext);
- param1.setName("param1");
- param1.setValue("%{'param1value'}");
-
- ParamTag param2 = new ParamTag();
- param2.setPageContext(pageContext);
- param2.setName("param2");
- param2.setValue("%{'param2value'}");
-
- ParamTag param3 = new ParamTag();
- param3.setPageContext(pageContext);
- param3.setName("id1");
- param3.setValue("%{'paramId1'}");
-
-
- tag.doStartTag();
- param1.doStartTag();
- param1.doEndTag();
- param2.doStartTag();
- param2.doEndTag();
- param3.doStartTag();
- param3.doEndTag();
-
- URL url = (URL) tag.getComponent();
- Map parameters = url.getParameters();
-
-
- assertNotNull(parameters);
- assertEquals(parameters.size(), 7);
- assertEquals(parameters.get("id1"), "paramId1");
- assertEquals(parameters.get("id2"), "tagId2");
- assertEquals(parameters.get("urlParam1"), "urlValue1");
- assertEquals(parameters.get("urlParam2"), "urlValue2");
- assertEquals(parameters.get("tagId"), "tagValue");
- assertEquals(parameters.get("param1"), "param1value");
- assertEquals(parameters.get("param2"), "param2value");
+ request.setQueryString("id1=urlId1&id2=urlId2&urlParam1=urlValue1&urlParam2=urlValue2");
+
+ tag.setValue("testAction.action?id1=tagId1&id2=tagId2&tagId=tagValue");
+
+ ParamTag param1 = new ParamTag();
+ param1.setPageContext(pageContext);
+ param1.setName("param1");
+ param1.setValue("%{'param1value'}");
+
+ ParamTag param2 = new ParamTag();
+ param2.setPageContext(pageContext);
+ param2.setName("param2");
+ param2.setValue("%{'param2value'}");
+
+ ParamTag param3 = new ParamTag();
+ param3.setPageContext(pageContext);
+ param3.setName("id1");
+ param3.setValue("%{'paramId1'}");
+
+
+ tag.doStartTag();
+ param1.doStartTag();
+ param1.doEndTag();
+ param2.doStartTag();
+ param2.doEndTag();
+ param3.doStartTag();
+ param3.doEndTag();
+
+ URL url = (URL) tag.getComponent();
+ Map parameters = url.getParameters();
+
+
+ assertNotNull(parameters);
+ assertEquals(parameters.size(), 7);
+ assertEquals(parameters.get("id1"), "paramId1");
+ assertEquals(parameters.get("id2"), "tagId2");
+ assertEquals(parameters.get("urlParam1"), "urlValue1");
+ assertEquals(parameters.get("urlParam2"), "urlValue2");
+ assertEquals(parameters.get("tagId"), "tagValue");
+ assertEquals(parameters.get("param1"), "param1value");
+ assertEquals(parameters.get("param2"), "param2value");
}
-
-
+
+
/**
- * To test priority of parameter passed in to url component though
+ * To test priority of parameter passed in to url component though
* various way, with includeParams="NONE"
* - current request url
* - tag's value attribute
* - tag's nested param tag
- *
+ *
* In this case only parameters from the tag itself is taken into account.
- * Those from request will not count, only those in tag's value attribute
+ * Those from request will not count, only those in tag's value attribute
* and nested param tag.
- *
+ *
* @throws Exception
*/
public void testParametersPriorityWithIncludeParamsAsNONE() throws Exception {
- request.setQueryString("id1=urlId1&id2=urlId2&urlParam1=urlValue1&urlParam2=urlValue2");
-
- tag.setValue("testAction.action?id1=tagId1&id2=tagId2&tagId=tagValue");
- tag.setIncludeParams("NONE");
-
- ParamTag param1 = new ParamTag();
- param1.setPageContext(pageContext);
- param1.setName("param1");
- param1.setValue("%{'param1value'}");
-
- ParamTag param2 = new ParamTag();
- param2.setPageContext(pageContext);
- param2.setName("param2");
- param2.setValue("%{'param2value'}");
-
- ParamTag param3 = new ParamTag();
- param3.setPageContext(pageContext);
- param3.setName("id1");
- param3.setValue("%{'paramId1'}");
-
-
- tag.doStartTag();
- param1.doStartTag();
- param1.doEndTag();
- param2.doStartTag();
- param2.doEndTag();
- param3.doStartTag();
- param3.doEndTag();
-
- URL url = (URL) tag.getComponent();
- Map parameters = url.getParameters();
-
- assertEquals(parameters.size(), 5);
- assertEquals(parameters.get("id1"), "paramId1");
- assertEquals(parameters.get("id2"), "tagId2");
- assertEquals(parameters.get("tagId"), "tagValue");
- assertEquals(parameters.get("param1"), "param1value");
- assertEquals(parameters.get("param2"), "param2value");
+ request.setQueryString("id1=urlId1&id2=urlId2&urlParam1=urlValue1&urlParam2=urlValue2");
+
+ tag.setValue("testAction.action?id1=tagId1&id2=tagId2&tagId=tagValue");
+ tag.setIncludeParams("NONE");
+
+ ParamTag param1 = new ParamTag();
+ param1.setPageContext(pageContext);
+ param1.setName("param1");
+ param1.setValue("%{'param1value'}");
+
+ ParamTag param2 = new ParamTag();
+ param2.setPageContext(pageContext);
+ param2.setName("param2");
+ param2.setValue("%{'param2value'}");
+
+ ParamTag param3 = new ParamTag();
+ param3.setPageContext(pageContext);
+ param3.setName("id1");
+ param3.setValue("%{'paramId1'}");
+
+
+ tag.doStartTag();
+ param1.doStartTag();
+ param1.doEndTag();
+ param2.doStartTag();
+ param2.doEndTag();
+ param3.doStartTag();
+ param3.doEndTag();
+
+ URL url = (URL) tag.getComponent();
+ Map parameters = url.getParameters();
+
+ assertEquals(parameters.size(), 5);
+ assertEquals(parameters.get("id1"), "paramId1");
+ assertEquals(parameters.get("id2"), "tagId2");
+ assertEquals(parameters.get("tagId"), "tagValue");
+ assertEquals(parameters.get("param1"), "param1value");
+ assertEquals(parameters.get("param2"), "param2value");
}
public void testIncludeParamsDefaultToGET() throws Exception {
- request.setQueryString("one=oneVal&two=twoVal&three=threeVal");
-
- // request parameter map should not have any effect, as includeParams
- // default to GET, which get its param from request.getQueryString()
- Map tmp = new HashMap();
- tmp.put("one", "aaa");
- tmp.put("two", "bbb");
- tmp.put("three", "ccc");
- request.setParameterMap(tmp);
-
- tag.setValue("TestAction.acton");
-
- tag.doStartTag();
-
- URL url = (URL) tag.getComponent();
- Map parameters = url.getParameters();
-
- tag.doEndTag();
-
- assertEquals(parameters.get("one"), "oneVal");
- assertEquals(parameters.get("two"), "twoVal");
- assertEquals(parameters.get("three"), "threeVal");
+ request.setQueryString("one=oneVal&two=twoVal&three=threeVal");
+
+ // request parameter map should not have any effect, as includeParams
+ // default to GET, which get its param from request.getQueryString()
+ Map tmp = new HashMap();
+ tmp.put("one", "aaa");
+ tmp.put("two", "bbb");
+ tmp.put("three", "ccc");
+ request.setParameterMap(tmp);
+
+ tag.setValue("TestAction.acton");
+
+ tag.doStartTag();
+
+ URL url = (URL) tag.getComponent();
+ Map parameters = url.getParameters();
+
+ tag.doEndTag();
+
+ assertEquals(parameters.get("one"), "oneVal");
+ assertEquals(parameters.get("two"), "twoVal");
+ assertEquals(parameters.get("three"), "threeVal");
}
-
+
public void testActionURL() throws Exception {
tag.setValue("TestAction.action");
@@ -258,50 +261,50 @@
tag.doEndTag();
assertEquals("list-members.action#test", writer.toString());
}
-
+
public void testParamPrecedence() throws Exception {
- request.setRequestURI("/context/someAction.action");
- request.setQueryString("id=22&name=John");
-
- URLTag urlTag = new URLTag();
- urlTag.setPageContext(pageContext);
- urlTag.setIncludeParams("get");
- urlTag.setEncode("%{false}");
-
- ParamTag paramTag = new ParamTag();
- paramTag.setPageContext(pageContext);
- paramTag.setName("id");
- paramTag.setValue("%{'33'}");
-
- urlTag.doStartTag();
- paramTag.doStartTag();
- paramTag.doEndTag();
- urlTag.doEndTag();
-
- assertEquals(writer.getBuffer().toString(), "/context/someAction.action?name=John&id=33");
+ request.setRequestURI("/context/someAction.action");
+ request.setQueryString("id=22&name=John");
+
+ URLTag urlTag = new URLTag();
+ urlTag.setPageContext(pageContext);
+ urlTag.setIncludeParams("get");
+ urlTag.setEncode("%{false}");
+
+ ParamTag paramTag = new ParamTag();
+ paramTag.setPageContext(pageContext);
+ paramTag.setName("id");
+ paramTag.setValue("%{'33'}");
+
+ urlTag.doStartTag();
+ paramTag.doStartTag();
+ paramTag.doEndTag();
+ urlTag.doEndTag();
+
+ assertEquals(writer.getBuffer().toString(), "/context/someAction.action?name=John&id=33");
}
public void testParamPrecedenceWithAnchor() throws Exception {
- request.setRequestURI("/context/someAction.action");
- request.setQueryString("id=22&name=John");
+ request.setRequestURI("/context/someAction.action");
+ request.setQueryString("id=22&name=John");
- URLTag urlTag = new URLTag();
- urlTag.setPageContext(pageContext);
- urlTag.setIncludeParams("get");
- urlTag.setEncode("%{false}");
+ URLTag urlTag = new URLTag();
+ urlTag.setPageContext(pageContext);
+ urlTag.setIncludeParams("get");
+ urlTag.setEncode("%{false}");
urlTag.setAnchor("testAnchor");
ParamTag paramTag = new ParamTag();
- paramTag.setPageContext(pageContext);
- paramTag.setName("id");
- paramTag.setValue("%{'33'}");
-
- urlTag.doStartTag();
- paramTag.doStartTag();
- paramTag.doEndTag();
- urlTag.doEndTag();
+ paramTag.setPageContext(pageContext);
+ paramTag.setName("id");
+ paramTag.setValue("%{'33'}");
+
+ urlTag.doStartTag();
+ paramTag.doStartTag();
+ paramTag.doEndTag();
+ urlTag.doEndTag();
- assertEquals(writer.getBuffer().toString(), "/context/someAction.action?name=John&id=33#testAnchor");
+ assertEquals(writer.getBuffer().toString(), "/context/someAction.action?name=John&id=33#testAnchor");
}
public void testPutId() throws Exception {
@@ -313,7 +316,7 @@
assertEquals("", writer.toString());
assertEquals("/public/about", stack.findString("myId")); // is in stack now
}
-
+
public void testUsingValueOnly() throws Exception {
tag.setValue("/public/about/team.jsp");
tag.doStartTag();
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionErrorTagTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionErrorTagTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionErrorTagTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionErrorTagTest.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp.ui;
@@ -29,65 +32,65 @@
/**
* ActionErrorTag test case.
- *
+ *
*/
public class ActionErrorTagTest extends AbstractUITagTest {
-
- boolean shouldActionHaveError = false;
-
- public void testNoActionErrors() throws Exception {
- ActionErrorTag tag = new ActionErrorTag();
- ((InternalActionSupport)action).setHasActionErrors(false);
- tag.setPageContext(pageContext);
- tag.doStartTag();
- tag.doEndTag();
-
- //assertEquals("", writer.toString());
- verify(ActionErrorTagTest.class.getResource("actionerror-1.txt"));
- }
-
- public void testHaveActionErrors() throws Exception {
-
- ActionErrorTag tag = new ActionErrorTag();
- ((InternalActionSupport)action).setHasActionErrors(true);
- tag.setPageContext(pageContext);
- tag.doStartTag();
- tag.doEndTag();
-
- verify(ActionErrorTagTest.class.getResource("actionerror-2.txt"));
- }
-
-
- public Action getAction() {
- return new InternalActionSupport();
- }
-
-
- public class InternalActionSupport extends ActionSupport {
-
- private static final long serialVersionUID = -4777466640658557661L;
-
- private boolean yesActionErrors;
-
- public void setHasActionErrors(boolean aYesActionErrors) {
- yesActionErrors = aYesActionErrors;
- }
-
- public boolean hasActionErrors() {
- return yesActionErrors;
- }
-
- public Collection getActionErrors() {
- if (yesActionErrors) {
- List errors = new ArrayList();
- errors.add("action error number 1");
- errors.add("action error number 2");
- errors.add("action error number 3");
- return errors;
- }
- else {
- return Collections.EMPTY_LIST;
- }
- }
- }
+
+ boolean shouldActionHaveError = false;
+
+ public void testNoActionErrors() throws Exception {
+ ActionErrorTag tag = new ActionErrorTag();
+ ((InternalActionSupport)action).setHasActionErrors(false);
+ tag.setPageContext(pageContext);
+ tag.doStartTag();
+ tag.doEndTag();
+
+ //assertEquals("", writer.toString());
+ verify(ActionErrorTagTest.class.getResource("actionerror-1.txt"));
+ }
+
+ public void testHaveActionErrors() throws Exception {
+
+ ActionErrorTag tag = new ActionErrorTag();
+ ((InternalActionSupport)action).setHasActionErrors(true);
+ tag.setPageContext(pageContext);
+ tag.doStartTag();
+ tag.doEndTag();
+
+ verify(ActionErrorTagTest.class.getResource("actionerror-2.txt"));
+ }
+
+
+ public Action getAction() {
+ return new InternalActionSupport();
+ }
+
+
+ public class InternalActionSupport extends ActionSupport {
+
+ private static final long serialVersionUID = -4777466640658557661L;
+
+ private boolean yesActionErrors;
+
+ public void setHasActionErrors(boolean aYesActionErrors) {
+ yesActionErrors = aYesActionErrors;
+ }
+
+ public boolean hasActionErrors() {
+ return yesActionErrors;
+ }
+
+ public Collection getActionErrors() {
+ if (yesActionErrors) {
+ List errors = new ArrayList();
+ errors.add("action error number 1");
+ errors.add("action error number 2");
+ errors.add("action error number 3");
+ return errors;
+ }
+ else {
+ return Collections.EMPTY_LIST;
+ }
+ }
+ }
}
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionMessageTagTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionMessageTagTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionMessageTagTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ActionMessageTagTest.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp.ui;
@@ -29,68 +32,66 @@
/**
* ActionMessageTag test case.
- *
+ *
*/
public class ActionMessageTagTest extends AbstractUITagTest {
- public void testNoActionMessages() throws Exception {
-
- ActionMessageTag tag = new ActionMessageTag();
- ((InternalActionSupport)action).setHasActionMessage(false);
- tag.setPageContext(pageContext);
- tag.doStartTag();
- tag.doEndTag();
-
- verify(ActionMessageTagTest.class.getResource("actionmessage-1.txt"));
- }
-
- public void testYesActionMessages() throws Exception {
-
- ActionMessageTag tag = new ActionMessageTag();
- ((InternalActionSupport)action).setHasActionMessage(true);
- tag.setPageContext(pageContext);
- tag.doStartTag();
- tag.doEndTag();
-
- verify(ActionMessageTagTest.class.getResource("actionmessage-2.txt"));
- }
-
- public Action getAction() {
- return new InternalActionSupport();
- }
-
- /**
- * Internal ActionSupport class for testing, can be in state with
- * or without action messages.
- *
- * @author tm_jee
- * @version $Date$ $Id$
- */
- public class InternalActionSupport extends ActionSupport {
-
- private static final long serialVersionUID = -3230043189352453629L;
-
- private boolean canHaveActionMessage;
-
- public void setHasActionMessage(boolean canHaveActionMessage) {
- this.canHaveActionMessage = canHaveActionMessage;
- }
-
- public Collection getActionMessages() {
- if (canHaveActionMessage) {
- List messages = new ArrayList();
- messages.add("action message number 1");
- messages.add("action message number 2");
- messages.add("action message number 3");
- return messages;
- }
- else {
- return Collections.EMPTY_LIST;
- }
- }
-
- public boolean hasActionMessages() {
- return canHaveActionMessage;
- }
- }
+ public void testNoActionMessages() throws Exception {
+
+ ActionMessageTag tag = new ActionMessageTag();
+ ((InternalActionSupport)action).setHasActionMessage(false);
+ tag.setPageContext(pageContext);
+ tag.doStartTag();
+ tag.doEndTag();
+
+ verify(ActionMessageTagTest.class.getResource("actionmessage-1.txt"));
+ }
+
+ public void testYesActionMessages() throws Exception {
+
+ ActionMessageTag tag = new ActionMessageTag();
+ ((InternalActionSupport)action).setHasActionMessage(true);
+ tag.setPageContext(pageContext);
+ tag.doStartTag();
+ tag.doEndTag();
+
+ verify(ActionMessageTagTest.class.getResource("actionmessage-2.txt"));
+ }
+
+ public Action getAction() {
+ return new InternalActionSupport();
+ }
+
+ /**
+ * Internal ActionSupport class for testing, can be in state with
+ * or without action messages.
+ *
+ */
+ public class InternalActionSupport extends ActionSupport {
+
+ private static final long serialVersionUID = -3230043189352453629L;
+
+ private boolean canHaveActionMessage;
+
+ public void setHasActionMessage(boolean canHaveActionMessage) {
+ this.canHaveActionMessage = canHaveActionMessage;
+ }
+
+ public Collection getActionMessages() {
+ if (canHaveActionMessage) {
+ List messages = new ArrayList();
+ messages.add("action message number 1");
+ messages.add("action message number 2");
+ messages.add("action message number 3");
+ return messages;
+ }
+ else {
+ return Collections.EMPTY_LIST;
+ }
+ }
+
+ public boolean hasActionMessages() {
+ return canHaveActionMessage;
+ }
+ }
}
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/AnchorTest.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp.ui;
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/Category.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/Category.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/Category.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/Category.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp.ui;
@@ -26,7 +29,7 @@
* Used by Tree Component Test. Copied from showcase.
*/
public class Category {
- private static Map<Long, Category> catMap = new HashMap<Long, Category>();
+ private static Map<Long, Category> catMap = new HashMap<Long, Category>();
static {
new Category(1, "Root",
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxListTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxListTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxListTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxListTest.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp.ui;
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/CheckboxTest.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp.ui;
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ComboBoxTest.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp.ui;
@@ -82,58 +85,58 @@
verify(ComboBoxTag.class.getResource("ComboBox-1.txt"));
}
-
+
public void testWithEmptyOptionAndHeader() throws Exception {
- TestAction testAction = (TestAction) action;
- testAction.setFoo("banana");
-
- List l = new ArrayList();
- l.add("apple");
- l.add("banana");
- l.add("pineaple");
- l.add("grapes");
- testAction.setCollection(l);
-
- ComboBoxTag tag = new ComboBoxTag();
- tag.setPageContext(pageContext);
- tag.setLabel("My Favourite Fruit");
- tag.setName("myFavouriteFruit");
- tag.setEmptyOption("true");
- tag.setHeaderKey("-1");
- tag.setHeaderValue("--- Please Select ---");
- tag.setList("collection");
- tag.setValue("%{foo}");
-
- tag.doStartTag();
- tag.doEndTag();
-
- verify(ComboBoxTag.class.getResource("ComboBox-2.txt"));
+ TestAction testAction = (TestAction) action;
+ testAction.setFoo("banana");
+
+ List l = new ArrayList();
+ l.add("apple");
+ l.add("banana");
+ l.add("pineaple");
+ l.add("grapes");
+ testAction.setCollection(l);
+
+ ComboBoxTag tag = new ComboBoxTag();
+ tag.setPageContext(pageContext);
+ tag.setLabel("My Favourite Fruit");
+ tag.setName("myFavouriteFruit");
+ tag.setEmptyOption("true");
+ tag.setHeaderKey("-1");
+ tag.setHeaderValue("--- Please Select ---");
+ tag.setList("collection");
+ tag.setValue("%{foo}");
+
+ tag.doStartTag();
+ tag.doEndTag();
+
+ verify(ComboBoxTag.class.getResource("ComboBox-2.txt"));
}
-
+
public void testWithMap() throws Exception {
- TestAction testAction = (TestAction) action;
- testAction.setFoo("banana");
-
- Map m = new LinkedHashMap();
- m.put("apple", "apple");
- m.put("banana", "banana");
- m.put("pineaple", "pineaple");
- m.put("grapes", "grapes");
- testAction.setMap(m);
-
- ComboBoxTag tag = new ComboBoxTag();
- tag.setPageContext(pageContext);
- tag.setLabel("My Favourite Fruit");
- tag.setName("myFavouriteFruit");
- tag.setHeaderKey("-1");
- tag.setHeaderValue("--- Please Select ---");
- tag.setEmptyOption("true");
- tag.setList("map");
- tag.setValue("%{foo}");
-
- tag.doStartTag();
- tag.doEndTag();
-
- verify(ComboBoxTag.class.getResource("ComboBox-3.txt"));
+ TestAction testAction = (TestAction) action;
+ testAction.setFoo("banana");
+
+ Map m = new LinkedHashMap();
+ m.put("apple", "apple");
+ m.put("banana", "banana");
+ m.put("pineaple", "pineaple");
+ m.put("grapes", "grapes");
+ testAction.setMap(m);
+
+ ComboBoxTag tag = new ComboBoxTag();
+ tag.setPageContext(pageContext);
+ tag.setLabel("My Favourite Fruit");
+ tag.setName("myFavouriteFruit");
+ tag.setHeaderKey("-1");
+ tag.setHeaderValue("--- Please Select ---");
+ tag.setEmptyOption("true");
+ tag.setList("map");
+ tag.setValue("%{foo}");
+
+ tag.doStartTag();
+ tag.doEndTag();
+
+ verify(ComboBoxTag.class.getResource("ComboBox-3.txt"));
}
}
Modified: struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ComponentTest.java
URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ComponentTest.java?view=diff&rev=471756&r1=471755&r2=471756
==============================================================================
--- struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ComponentTest.java (original)
+++ struts/struts2/trunk/core/src/test/java/org/apache/struts2/views/jsp/ui/ComponentTest.java Mon Nov 6 07:01:43 2006
@@ -1,19 +1,22 @@
/*
* $Id$
*
- * Copyright 2006 The Apache Software Foundation.
+ * 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
*
- * Licensed 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
*
- * 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.
+ * 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 org.apache.struts2.views.jsp.ui;
@@ -25,45 +28,45 @@
*/
public class ComponentTest extends AbstractUITagTest {
- /**
- * Test that id attribute is evaludated against the Ognl Stack.
- * @throws Exception
- */
- public void testIdIsEvaluatedAgainstStack1() throws Exception {
- TestAction testAction = (TestAction) action;
- testAction.setFoo("myFooValue");
-
- TextFieldTag tag = new TextFieldTag();
- tag.setPageContext(pageContext);
+ /**
+ * Test that id attribute is evaludated against the Ognl Stack.
+ * @throws Exception
+ */
+ public void testIdIsEvaluatedAgainstStack1() throws Exception {
+ TestAction testAction = (TestAction) action;
+ testAction.setFoo("myFooValue");
+
+ TextFieldTag tag = new TextFieldTag();
+ tag.setPageContext(pageContext);
tag.setLabel("mylabel");
tag.setName("myname");
tag.setValue("foo");
tag.setId("%{foo}");
-
+
tag.doStartTag();
tag.doEndTag();
verify(ComponentTag.class.getResource("Component-2.txt"));
- }
-
- public void testIdIsEvaludatedAgainstStack2() throws Exception {
- TestAction testAction = (TestAction) action;
- testAction.setFoo("myFooValue");
-
- TextFieldTag tag = new TextFieldTag();
- tag.setPageContext(pageContext);
+ }
+
+ public void testIdIsEvaludatedAgainstStack2() throws Exception {
+ TestAction testAction = (TestAction) action;
+ testAction.setFoo("myFooValue");
+
+ TextFieldTag tag = new TextFieldTag();
+ tag.setPageContext(pageContext);
tag.setLabel("mylabel");
tag.setName("myname");
tag.setValue("foo");
tag.setId("foo");
-
+
tag.doStartTag();
tag.doEndTag();
verify(ComponentTag.class.getResource("Component-3.txt"));
- }
-
-
+ }
+
+
/**
* Note -- this test uses empty.vm, so it's basically clear
*/