You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2010/05/02 11:27:06 UTC
svn commit: r940176 [1/2] - in /myfaces/tobago/trunk:
core/src/main/java/org/apache/myfaces/tobago/config/
core/src/main/java/org/apache/myfaces/tobago/internal/component/
core/src/main/java/org/apache/myfaces/tobago/util/
core/src/test/java/org/apache...
Author: bommel
Date: Sun May 2 09:27:03 2010
New Revision: 940176
URL: http://svn.apache.org/viewvc?rev=940176&view=rev
Log:
checkstyle
Modified:
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectItem.java
myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/UISheetUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/context/MarkupUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/context/UserAgentUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/internal/context/ResponseWriterDividerUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MeasureUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/model/NodeUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/taglib/component/GenericComponentTagUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/taglib/component/GenericTagUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/util/HtmlWriterUtilsUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/util/LocaleUtilsUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/util/RangeParserUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoMultipartFormdataRequestUnitTest.java
myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java
myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/MultiplePageDeclarationLanguageNavigationHandler.java
myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/TobagoDemoController.java
myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/SelectItemModel.java
myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/TreeController.java
myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/test/Parameterized.java
myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java
myfaces/tobago/trunk/extension/message-fix/src/test/java/org/apache/myfaces/tobago/extension/fix/message/MessageFixFacesContextUnitTest.java
myfaces/tobago/trunk/sandbox/src/test/java/org/apache/myfaces/tobago/taglib/sandbox/SandboxGenericTagUnitTest.java
myfaces/tobago/trunk/theme/scarborough/src/test/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/AbstractJavaScriptTestBase.java
myfaces/tobago/trunk/theme/scarborough/src/test/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/DateUnitTest.java
myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java
myfaces/tobago/trunk/theme/standard/src/test/java/org/apache/myfaces/tobago/renderkit/util/JQueryUtilsUnitTest.java
myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockApplication.java
myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockExternalContext.java
myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockPropertyResolver.java
myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockRenderKit.java
myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockResponseWriter.java
myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockValueBinding.java
myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockHttpServletRequest.java
myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockJspWriter.java
myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockPageContext.java
myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/taglib/component/GenericTestBase.java
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/config/TobagoConfig.java Sun May 2 09:27:03 2010
@@ -35,7 +35,8 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
-public class TobagoConfig {
+public class
+ TobagoConfig {
private static final Logger LOG = LoggerFactory.getLogger(TobagoConfig.class);
@@ -95,7 +96,7 @@ public class TobagoConfig {
checkThemeIsAvailable(name, theme);
supportedThemes.add(theme);
if (LOG.isDebugEnabled()) {
- LOG.debug("name = '{}'", name );
+ LOG.debug("name = '{}'", name);
LOG.debug("supportedThemes.last() = '{}'", supportedThemes.get(supportedThemes.size() - 1));
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectItem.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectItem.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectItem.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/internal/component/AbstractUISelectItem.java Sun May 2 09:27:03 2010
@@ -35,7 +35,7 @@ public class AbstractUISelectItem extend
public void onComponentPopulated(FacesContext facesContext, UIComponent parent) {
if (itemValueLiteral) {
Object converted = ComponentUtils.getConvertedValue(
- FacesContext.getCurrentInstance(), (javax.faces.component.UIInput) parent, (String)getItemValue());
+ FacesContext.getCurrentInstance(), (javax.faces.component.UIInput) parent, (String) getItemValue());
super.setItemValue(converted);
}
}
Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java (original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/util/ComponentUtils.java Sun May 2 09:27:03 2010
@@ -746,7 +746,7 @@ public class ComponentUtils {
if (renderer != null) {
if (component instanceof UISelectMany) {
final Object converted = renderer.getConvertedValue(facesContext, component, new String[]{stringValue});
- return ((Object[])converted)[0];
+ return ((Object[]) converted)[0];
} else {
return renderer.getConvertedValue(facesContext, component, stringValue);
}
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/UISheetUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/UISheetUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/UISheetUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/UISheetUnitTest.java Sun May 2 09:27:03 2010
@@ -26,7 +26,7 @@ import java.util.Arrays;
import java.util.List;
public class UISheetUnitTest {
- String[] nineRows =
+ private String[] nineRows =
{"one", "two", "three", "four", "five",
"six", "seven", "eight", "nine"};
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/context/MarkupUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/context/MarkupUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/context/MarkupUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/context/MarkupUnitTest.java Sun May 2 09:27:03 2010
@@ -29,7 +29,7 @@ public class MarkupUnitTest {
@Test
public void testString() {
- Assert.assertNull(Markup.valueOf((String)null));
+ Assert.assertNull(Markup.valueOf((String) null));
Assert.assertArrayEquals(new String[] {"accent"}, IteratorUtils.toArray(Markup.valueOf("accent").iterator()));
@@ -42,7 +42,7 @@ public class MarkupUnitTest {
@Test
public void testStringArray() {
- Assert.assertNull(Markup.valueOf((String[])null));
+ Assert.assertNull(Markup.valueOf((String[]) null));
Assert.assertNull(Markup.valueOf(new String[] {}));
@@ -53,13 +53,14 @@ public class MarkupUnitTest {
@Test
public void testObject() {
- Assert.assertNull(Markup.valueOf((Object)null));
+ Assert.assertNull(Markup.valueOf((Object) null));
- Assert.assertArrayEquals(AB, IteratorUtils.toArray(Markup.valueOf((Object)", \ta , ,\n b ,").iterator()));
+ Assert.assertArrayEquals(AB, IteratorUtils.toArray(Markup.valueOf((Object) ", \ta , ,\n b ,").iterator()));
- Assert.assertArrayEquals(AB, IteratorUtils.toArray(Markup.valueOf((Object)new String[] {"a", "b"}).iterator()));
+ Assert.assertArrayEquals(AB, IteratorUtils.toArray(Markup.valueOf((Object) new String[] {"a", "b"}).iterator()));
- Assert.assertArrayEquals(AB, IteratorUtils.toArray(Markup.valueOf((Object)new String[] {" a ", " b "}).iterator()));
+ Assert.assertArrayEquals(AB,
+ IteratorUtils.toArray(Markup.valueOf((Object) new String[] {" a ", " b "}).iterator()));
Assert.assertArrayEquals(AB, IteratorUtils.toArray(Markup.valueOf(new StringBuilder("a, b")).iterator()));
@@ -70,7 +71,7 @@ public class MarkupUnitTest {
@Test
public void testMarkup() {
- Assert.assertNull(Markup.valueOf((Markup)null));
+ Assert.assertNull(Markup.valueOf((Markup) null));
Markup accent = Markup.valueOf("accent");
Assert.assertSame(accent, Markup.valueOf(accent));
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/context/UserAgentUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/context/UserAgentUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/context/UserAgentUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/context/UserAgentUnitTest.java Sun May 2 09:27:03 2010
@@ -1,8 +1,5 @@
package org.apache.myfaces.tobago.context;
-import org.junit.Assert;
-import org.junit.Test;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,6 +17,10 @@ import org.junit.Test;
* limitations under the License.
*/
+
+import org.junit.Assert;
+import org.junit.Test;
+
public class UserAgentUnitTest {
private static final String IE_8_WINDOWS_XP
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/internal/context/ResponseWriterDividerUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/internal/context/ResponseWriterDividerUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/internal/context/ResponseWriterDividerUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/internal/context/ResponseWriterDividerUnitTest.java Sun May 2 09:27:03 2010
@@ -1,18 +1,5 @@
package org.apache.myfaces.tobago.internal.context;
-import org.apache.myfaces.test.mock.MockExternalContext;
-import org.apache.myfaces.test.mock.MockFacesContext;
-import org.apache.myfaces.test.mock.MockHttpServletRequest;
-import org.apache.myfaces.tobago.internal.webapp.TobagoResponseXmlWriterImpl;
-import org.junit.Assert;
-import org.junit.Test;
-
-import javax.faces.context.FacesContext;
-import javax.swing.tree.DefaultMutableTreeNode;
-import javax.swing.tree.TreeNode;
-import java.io.IOException;
-import java.io.StringWriter;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -30,6 +17,19 @@ import java.io.StringWriter;
* limitations under the License.
*/
+import org.apache.myfaces.test.mock.MockExternalContext;
+import org.apache.myfaces.test.mock.MockFacesContext;
+import org.apache.myfaces.test.mock.MockHttpServletRequest;
+import org.apache.myfaces.tobago.internal.webapp.TobagoResponseXmlWriterImpl;
+import org.junit.Assert;
+import org.junit.Test;
+
+import javax.faces.context.FacesContext;
+import javax.swing.tree.DefaultMutableTreeNode;
+import javax.swing.tree.TreeNode;
+import java.io.IOException;
+import java.io.StringWriter;
+
public class ResponseWriterDividerUnitTest {
@Test
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MeasureUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MeasureUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MeasureUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/MeasureUnitTest.java Sun May 2 09:27:03 2010
@@ -32,7 +32,7 @@ public class MeasureUnitTest {
public void testMinList() {
Assert.assertEquals(px(5), Measure.min(Arrays.asList(px(5), px(10), px(20))));
Assert.assertEquals(px(5), Measure.min(Arrays.asList(px(5), null, px(20))));
- Assert.assertEquals(Measure.MAX, Measure.min(Arrays.asList((Measure)null, null, null)));
+ Assert.assertEquals(Measure.MAX, Measure.min(Arrays.asList((Measure) null, null, null)));
Assert.assertEquals(Measure.MAX, Measure.min(Arrays.<Measure>asList()));
}
@@ -40,7 +40,7 @@ public class MeasureUnitTest {
public void testMaxList() {
Assert.assertEquals(px(20), Measure.max(Arrays.asList(px(5), px(10), px(20))));
Assert.assertEquals(px(20), Measure.max(Arrays.asList(px(5), null, px(20))));
- Assert.assertEquals(Measure.ZERO, Measure.max(Arrays.asList((Measure)null, null, null)));
+ Assert.assertEquals(Measure.ZERO, Measure.max(Arrays.asList((Measure) null, null, null)));
Assert.assertEquals(Measure.ZERO, Measure.max(Arrays.<Measure>asList()));
}
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/model/NodeUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/model/NodeUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/model/NodeUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/model/NodeUnitTest.java Sun May 2 09:27:03 2010
@@ -27,7 +27,7 @@ public class NodeUnitTest extends TestCa
private Node c;
private Node x;
private Node y;
- private Node Ï;
+ private Node pi;
/**
* * --o r (0)
@@ -52,7 +52,7 @@ public class NodeUnitTest extends TestCa
c = new Node();
x = new Node();
y = new Node();
- Ï = new Node();
+ pi = new Node();
r.add(a);
r.add(b);
@@ -61,7 +61,7 @@ public class NodeUnitTest extends TestCa
b.add(x);
b.add(y);
- y.add(Ï);
+ y.add(pi);
}
@@ -72,7 +72,7 @@ public class NodeUnitTest extends TestCa
assertFalse(c.isRoot());
assertFalse(x.isRoot());
assertFalse(y.isRoot());
- assertFalse(Ï.isRoot());
+ assertFalse(pi.isRoot());
}
public void testGetChildCount() {
@@ -82,7 +82,7 @@ public class NodeUnitTest extends TestCa
assertEquals(0, c.getChildCount());
assertEquals(0, x.getChildCount());
assertEquals(1, y.getChildCount());
- assertEquals(0, Ï.getChildCount());
+ assertEquals(0, pi.getChildCount());
}
public void testHasNextSibling() {
@@ -92,7 +92,7 @@ public class NodeUnitTest extends TestCa
assertFalse(c.hasNextSibling());
assertTrue(x.hasNextSibling());
assertFalse(y.hasNextSibling());
- assertFalse(Ï.hasNextSibling());
+ assertFalse(pi.hasNextSibling());
}
-}
\ No newline at end of file
+}
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/taglib/component/GenericComponentTagUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/taglib/component/GenericComponentTagUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/taglib/component/GenericComponentTagUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/taglib/component/GenericComponentTagUnitTest.java Sun May 2 09:27:03 2010
@@ -68,8 +68,9 @@ public class GenericComponentTagUnitTest
}
public void setUp() throws Exception {
- tldPaths = new String[1];
+ String[] tldPaths = new String[1];
tldPaths[0] = "META-INF/org/apache/myfaces/tobago/taglib/component/tobago.tld";
+ setTldPaths(tldPaths);
super.setUp();
MockServletContext servletContext = new MockServletContext();
@@ -126,7 +127,7 @@ public class GenericComponentTagUnitTest
}
public void testComponent()
- throws JspException, IllegalAccessException, InstantiationException, ClassNotFoundException {
+ throws JspException, IllegalAccessException, InstantiationException, ClassNotFoundException {
// TODO create new test
/*for (Tld tld : tlds) {
for (net.sf.maventaglib.checker.Tag tag : tld.getTags()) {
@@ -169,6 +170,7 @@ public class GenericComponentTagUnitTest
assertFalse(ComponentUtils.getBooleanAttribute(command, Attributes.HEIGHT));
}
}
+
private static class MockTheme implements Theme {
private String name;
private List<Theme> fallbackThemeList;
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/taglib/component/GenericTagUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/taglib/component/GenericTagUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/taglib/component/GenericTagUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/taglib/component/GenericTagUnitTest.java Sun May 2 09:27:03 2010
@@ -26,10 +26,11 @@ public class GenericTagUnitTest extends
}
protected void setUp() throws Exception {
- tldPaths = new String[1];
- tldPaths[0] = "META-INF/org/apache/myfaces/tobago/taglib/component/tobago.tld";
+ String[] tldPaths = new String[1];
+ tldPaths[0] = "META-INF/org/apache/myfaces/tobago/taglib/component/tobago.tld";
//TODO move to tobago-taglib-extension
//tldPaths[1] = "META-INF/org/apache/myfaces/tobago/taglib/extension/tobago-extension.tld";
+ setTldPaths(tldPaths);
super.setUp();
}
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/util/HtmlWriterUtilsUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/util/HtmlWriterUtilsUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/util/HtmlWriterUtilsUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/util/HtmlWriterUtilsUnitTest.java Sun May 2 09:27:03 2010
@@ -35,7 +35,7 @@ public class HtmlWriterUtilsUnitTest ext
// HTML 4.0, section B.7.1: ampersands followed by
// an open brace don't get escaped
- public final static String[] RAW_TEXTS = {
+ public static final String[] RAW_TEXTS = {
"oeffnende spitze klammern werden in attributen doch escaped <tagname >",
"& followed by an { -> &{ don't get escaped in attributes",
"abcdefghijklmnopqrstuvwxyz0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
@@ -47,19 +47,24 @@ public class HtmlWriterUtilsUnitTest ext
"\u00f0\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f7\u00f8\u00f9\u00fa\u00fb\u00fc\u00fd\u00fe\u00ff"
};
- public final static String[] ESCAPED_TEXTS = {
+ public static final String[] ESCAPED_TEXTS = {
"oeffnende spitze klammern werden in attributen doch escaped <tagname >",
"& followed by an { -> &{ don't get escaped in attributes",
RAW_TEXTS[2], // no escape needed
" ¡¢£¤¥¦§¨©ª«¬­®¯",
- "°±²³´µ¶·¸¹º»¼½¾¿",
- "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏ",
- "ÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß",
- "àáâãäåæçèéêëìíîï",
- "ðñòóôõö÷øùúûüýþÿ"
+ "°±²³´µ¶·¸¹º»¼½"
+ + "¾¿",
+ "ÀÁÂÃÄÅÆÇÈÉÊËÌÍ"
+ + "ÎÏ",
+ "ÐÑÒÓÔÕÖ×ØÙÚÛÜÝ"
+ + "Þß",
+ "àáâãäåæçèéêëìí"
+ + "îï",
+ "ðñòóôõö÷øùúûüý"
+ + "þÿ"
};
- public final static String[] ESCAPED_ATTRIBUTES = {
+ public static final String[] ESCAPED_ATTRIBUTES = {
"oeffnende spitze klammern werden in attributen doch escaped <tagname >",
"& followed by an { -> &{ don't get escaped in attributes",
RAW_TEXTS[2] // no escape needed
@@ -77,8 +82,7 @@ public class HtmlWriterUtilsUnitTest ext
}
}
- private void testText(HtmlWriterUtils writerUtil, CharArrayWriter writer,
- String text, String escaped) {
+ private void testText(HtmlWriterUtils writerUtil, CharArrayWriter writer, String text, String escaped) {
try {
writer.reset();
writerUtil.writeText(text);
@@ -90,8 +94,7 @@ public class HtmlWriterUtilsUnitTest ext
}
}
- private void testAttributeValue(HtmlWriterUtils writerUtil,
- CharArrayWriter writer, String text, String escaped) {
+ private void testAttributeValue(HtmlWriterUtils writerUtil, CharArrayWriter writer, String text, String escaped) {
try {
writer.reset();
writerUtil.writeAttributeValue(text);
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/util/LocaleUtilsUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/util/LocaleUtilsUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/util/LocaleUtilsUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/util/LocaleUtilsUnitTest.java Sun May 2 09:27:03 2010
@@ -1,5 +1,22 @@
package org.apache.myfaces.tobago.util;
+/*
+ * 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.
+ */
+
import org.junit.Assert;
import org.junit.Test;
@@ -35,6 +52,7 @@ public class LocaleUtilsUnitTest {
public void testLocaleSuffixList() {
Assert.assertArrayEquals(new String[]{'_' + S1, ""}, LocaleUtils.getLocaleSuffixList(D1).toArray());
Assert.assertArrayEquals(new String[]{'_' + S2, '_' + S1, ""}, LocaleUtils.getLocaleSuffixList(D2).toArray());
- Assert.assertArrayEquals(new String[]{'_' + S3, '_' + S2, '_' + S1, ""}, LocaleUtils.getLocaleSuffixList(D3).toArray());
+ Assert.assertArrayEquals(new String[]{'_' + S3, '_' + S2, '_' + S1, ""},
+ LocaleUtils.getLocaleSuffixList(D3).toArray());
}
}
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/util/RangeParserUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/util/RangeParserUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/util/RangeParserUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/util/RangeParserUnitTest.java Sun May 2 09:27:03 2010
@@ -24,7 +24,7 @@ public class RangeParserUnitTest extends
public void test() {
- int[] ints = {0,5,10};
+ int[] ints = {0, 5, 10};
String s = "0,5,10";
checkEquals(ints, StringUtils.getIndices(s));
s = "0, 5, 10";
@@ -32,7 +32,7 @@ public class RangeParserUnitTest extends
s = " 0 , 5 , 10 ";
checkEquals(ints, StringUtils.getIndices(s));
- ints = new int[] {3,4,5,6,7,15,16,17};
+ ints = new int[] {3, 4, 5, 6, 7, 15, 16, 17};
s = "3-7,15-17";
checkEquals(ints, StringUtils.getIndices(s));
s = "3-5,6,7,15,16-17";
@@ -40,7 +40,7 @@ public class RangeParserUnitTest extends
s = "3-5, 6, 7, 15, 16 - 17 ";
checkEquals(ints, StringUtils.getIndices(s));
- ints = new int[] {3,4,5,6,7,15,14,13};
+ ints = new int[] {3, 4, 5, 6, 7, 15, 14, 13};
s = "3-7,15-13";
checkEquals(ints, StringUtils.getIndices(s));
s = "3 - 7, 15 - 13";
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoMultipartFormdataRequestUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoMultipartFormdataRequestUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoMultipartFormdataRequestUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoMultipartFormdataRequestUnitTest.java Sun May 2 09:27:03 2010
@@ -27,27 +27,19 @@ import java.util.Arrays;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.Map;
import java.util.Set;
public class TobagoMultipartFormdataRequestUnitTest extends TestCase {
-// ///////////////////////////////////////////// constant
-
private static final String SNIP = "--";
private static final String BOUNDARY = "xxx";
private static final String NEWLINE = "\r\n";
-
-// ///////////////////////////////////////////// attribute
-
private TobagoMultipartFormdataRequest request;
-// ///////////////////////////////////////////// constructor
-
public TobagoMultipartFormdataRequestUnitTest(String reference)
throws UnsupportedEncodingException {
super(reference);
@@ -71,8 +63,6 @@ public class TobagoMultipartFormdataRequ
request = new TobagoMultipartFormdataRequest(mockRequest, System.getProperty("java.io.tmpdir"), 1024 * 1024);
}
-// ///////////////////////////////////////////// code
-
private String parameter(String key, String value) {
return SNIP + BOUNDARY + NEWLINE
+ "Content-Disposition: form-data; name=\"" + key + "\"" + NEWLINE
@@ -111,24 +101,18 @@ public class TobagoMultipartFormdataRequ
Set<String> actualSet;
expectedSet = new HashSet<String>(
- Arrays.asList(
- new String[]{
- "red", "green", "blue", "yellow"}));
+ Arrays.asList("red", "green", "blue", "yellow"));
actualSet
= new HashSet<String>(Arrays.asList(request.getParameterValues("color")));
assertEquals("color", expectedSet, actualSet);
expectedSet = new HashSet<String>(
- Arrays.asList(
- new String[]{
- "Amsterdam", "Bonn", "Pisa"}));
+ Arrays.asList("Amsterdam", "Bonn", "Pisa"));
actualSet = new HashSet<String>(Arrays.asList(request.getParameterValues("city")));
assertEquals("city", expectedSet, actualSet);
expectedSet = new HashSet<String>(
- Arrays.asList(
- new String[]{
- "Trinidad & Tobago"}));
+ Arrays.asList("Trinidad & Tobago"));
actualSet
= new HashSet<String>(Arrays.asList(request.getParameterValues("country")));
assertEquals("country", expectedSet, actualSet);
@@ -145,9 +129,7 @@ public class TobagoMultipartFormdataRequ
}
Set<String> expected = new HashSet<String>(
- Arrays.asList(
- new String[]{
- "color", "city", "country"}));
+ Arrays.asList("color", "city", "country"));
assertEquals(expected, actual);
}
@@ -156,7 +138,7 @@ public class TobagoMultipartFormdataRequ
Map actual = request.getParameterMap();
- Map<String,String[]> expected = new HashMap<String, String[]>();
+ Map<String, String[]> expected = new HashMap<String, String[]>();
expected.put("color", new String[]{"red", "green", "blue", "yellow"});
expected.put("city", new String[]{"Amsterdam", "Bonn", "Pisa"});
expected.put("country", new String[]{"Trinidad & Tobago"});
@@ -164,8 +146,8 @@ public class TobagoMultipartFormdataRequ
assertEquals(expected.keySet(), actual.keySet());
Set keys = actual.keySet();
- for (Iterator iterator = keys.iterator(); iterator.hasNext();) {
- String key = (String) iterator.next();
+ for (Object key1 : keys) {
+ String key = (String) key1;
String[] expectedStrings = expected.get(key);
String[] actualStrings = (String[]) actual.get(key);
assertEquals(expectedStrings.length, actualStrings.length);
Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java (original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/webapp/TobagoResponseWriterUnitTest.java Sun May 2 09:27:03 2010
@@ -39,9 +39,9 @@ public class TobagoResponseWriterUnitTes
writer.startDocument();
writer.endDocument();
assertEquals("content expected",
- "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n" +
- "<html\n" +
- "></html>", stringWriter.toString());
+ "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n"
+ + "<html\n"
+ + "></html>", stringWriter.toString());
}
public void testEmptyTag() throws IOException {
Modified: myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/MultiplePageDeclarationLanguageNavigationHandler.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/MultiplePageDeclarationLanguageNavigationHandler.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/MultiplePageDeclarationLanguageNavigationHandler.java (original)
+++ myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/MultiplePageDeclarationLanguageNavigationHandler.java Sun May 2 09:27:03 2010
@@ -40,8 +40,8 @@ public class MultiplePageDeclarationLang
LOG.info("outcome='"+ outcome + "'");
if (outcome != null) {
- PageDeclarationLanguageBean bean
- = (PageDeclarationLanguageBean) VariableResolverUtils.resolveVariable(facesContext, "pageDeclarationLanguage");
+ PageDeclarationLanguageBean bean = (PageDeclarationLanguageBean)
+ VariableResolverUtils.resolveVariable(facesContext, "pageDeclarationLanguage");
for (PageDeclarationLanguage renderTechnologie : PageDeclarationLanguage.values()) {
if (outcome.endsWith(renderTechnologie.getExtension())) {
Modified: myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/TobagoDemoController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/TobagoDemoController.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/TobagoDemoController.java (original)
+++ myfaces/tobago/trunk/example/demo/src/main/java/org/apache/myfaces/tobago/example/demo/TobagoDemoController.java Sun May 2 09:27:03 2010
@@ -352,7 +352,7 @@ public class TobagoDemoController {
SolarObject clicked = (SolarObject) ComponentUtils.findParameter(event.getComponent(), "luminary");
boolean add = false;
List<Integer> selectedRows = sheetState.getSelectedRows();
- for (int i = 0, solarListSize = solarList.size(); i < solarListSize; i++) {
+ for (int i = 0; i < solarList.size(); i++) {
if (clicked.getOrbit().equals(solarList.get(i).getOrbit())) {
add = !selectedRows.contains(i);
LOG.info(" add = " + add);
@@ -361,7 +361,7 @@ public class TobagoDemoController {
}
}
- for (int i = 0, solarListSize = solarList.size(); i < solarListSize; i++) {
+ for (int i = 0; i < solarList.size(); i++) {
if (clicked.getOrbit().equals(solarList.get(i).getOrbit())) {
if (add && !selectedRows.contains(i)) {
selectedRows.add(i);
Modified: myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/SelectItemModel.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/SelectItemModel.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/SelectItemModel.java (original)
+++ myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/SelectItemModel.java Sun May 2 09:27:03 2010
@@ -1,5 +1,22 @@
package org.apache.myfaces.tobago.example.test;
+/*
+ * 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.
+ */
+
import java.util.Currency;
public class SelectItemModel {
Modified: myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/TreeController.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/TreeController.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/TreeController.java (original)
+++ myfaces/tobago/trunk/example/test/src/main/java/org/apache/myfaces/tobago/example/test/TreeController.java Sun May 2 09:27:03 2010
@@ -1,9 +1,5 @@
package org.apache.myfaces.tobago.example.test;
-import org.apache.myfaces.tobago.example.data.CategoryTree;
-
-import javax.swing.tree.DefaultMutableTreeNode;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -21,6 +17,10 @@ import javax.swing.tree.DefaultMutableTr
* limitations under the License.
*/
+import org.apache.myfaces.tobago.example.data.CategoryTree;
+
+import javax.swing.tree.DefaultMutableTreeNode;
+
public class TreeController {
private DefaultMutableTreeNode tree = CategoryTree.createSample();
Modified: myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/test/Parameterized.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/test/Parameterized.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/test/Parameterized.java (original)
+++ myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/test/Parameterized.java Sun May 2 09:27:03 2010
@@ -46,17 +46,22 @@ public class Parameterized extends Suite
public static @interface Parameters {
}
- public Parameterized(Class<?> clazz) throws Throwable {
+ public Parameterized(Class<?> clazz) throws Exception {
super(clazz, new ArrayList<Runner>());
FrameworkMethod method = findMethod(getTestClass());
- List<Object[]> parametersList = (List<Object[]>) method.invokeExplosively(null);
+ List<Object[]> parametersList = null;
+ try {
+ parametersList = (List<Object[]>) method.invokeExplosively(null);
+ } catch (Throwable throwable) {
+ throw new Exception(throwable);
+ }
for (Object[] aParametersList : parametersList) {
getChildren().add(new ClassRunnerForParameters(getTestClass().getJavaClass(), aParametersList));
}
}
- private FrameworkMethod findMethod(TestClass clazz) throws Throwable {
+ private FrameworkMethod findMethod(TestClass clazz) throws Exception {
List<FrameworkMethod> methods = clazz.getAnnotatedMethods(Parameters.class);
for (FrameworkMethod method : methods) {
int modifiers = method.getMethod().getModifiers();
Modified: myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java (original)
+++ myfaces/tobago/trunk/example/test/src/test/java/org/apache/myfaces/tobago/example/test/SeleniumTest.java Sun May 2 09:27:03 2010
@@ -32,7 +32,7 @@ public abstract class SeleniumTest {
public static final String HAS_ERROR_SEVERITY = "has error severity";
public static final String IS_BROKEN = "is broken";
- protected DefaultSelenium selenium;
+ private DefaultSelenium selenium;
@Before
public void setUp() throws Exception {
@@ -45,10 +45,16 @@ public abstract class SeleniumTest {
selenium.stop();
}
+ public DefaultSelenium getSelenium() {
+ return selenium;
+ }
+
protected DefaultSelenium createSeleniumClient() throws Exception {
return new DefaultSelenium("localhost", 4444, "*firefox", "http://localhost:8080/");
}
+
+
protected void checkPage() {
Assert.assertFalse(
"Page '" + selenium.getLocation() + "' " + CONTAINS_A_404 + ". " + getHtmlSource(), pageNotFound());
Modified: myfaces/tobago/trunk/extension/message-fix/src/test/java/org/apache/myfaces/tobago/extension/fix/message/MessageFixFacesContextUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/extension/message-fix/src/test/java/org/apache/myfaces/tobago/extension/fix/message/MessageFixFacesContextUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/extension/message-fix/src/test/java/org/apache/myfaces/tobago/extension/fix/message/MessageFixFacesContextUnitTest.java (original)
+++ myfaces/tobago/trunk/extension/message-fix/src/test/java/org/apache/myfaces/tobago/extension/fix/message/MessageFixFacesContextUnitTest.java Sun May 2 09:27:03 2010
@@ -34,13 +34,13 @@ public class MessageFixFacesContextUnitT
}
public void testFacesContext() {
- String[] clientIds = { "_id1", "_id2", "_id3", null };
- FacesMessage [] messages =
- { new FacesMessage(),
- new FacesMessage("Test1"),
- new FacesMessage(FacesMessage.SEVERITY_WARN, "Test2a", "Test2a Detail"),
- new FacesMessage(FacesMessage.SEVERITY_INFO, "Test2b", "Test2b Detail"),
- new FacesMessage( "Global Message") };
+ String[] clientIds = {"_id1", "_id2", "_id3", null};
+ FacesMessage[] messages =
+ {new FacesMessage(),
+ new FacesMessage("Test1"),
+ new FacesMessage(FacesMessage.SEVERITY_WARN, "Test2a", "Test2a Detail"),
+ new FacesMessage(FacesMessage.SEVERITY_INFO, "Test2b", "Test2b Detail"),
+ new FacesMessage("Global Message")};
FacesContext facesContext = new MessageFixFacesContext(this.facesContext);
facesContext.addMessage(clientIds[0], messages[0]);
Modified: myfaces/tobago/trunk/sandbox/src/test/java/org/apache/myfaces/tobago/taglib/sandbox/SandboxGenericTagUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/sandbox/src/test/java/org/apache/myfaces/tobago/taglib/sandbox/SandboxGenericTagUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/sandbox/src/test/java/org/apache/myfaces/tobago/taglib/sandbox/SandboxGenericTagUnitTest.java (original)
+++ myfaces/tobago/trunk/sandbox/src/test/java/org/apache/myfaces/tobago/taglib/sandbox/SandboxGenericTagUnitTest.java Sun May 2 09:27:03 2010
@@ -1,7 +1,5 @@
package org.apache.myfaces.tobago.taglib.sandbox;
-import org.apache.myfaces.tobago.taglib.component.GenericTestBase;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -19,6 +17,7 @@ import org.apache.myfaces.tobago.taglib.
* limitations under the License.
*/
+import org.apache.myfaces.tobago.taglib.component.GenericTestBase;
public class SandboxGenericTagUnitTest extends GenericTestBase {
@@ -27,8 +26,9 @@ public class SandboxGenericTagUnitTest e
}
protected void setUp() throws Exception {
- tldPaths = new String[1];
- tldPaths[0] = "META-INF/org/apache/myfaces/tobago/taglib/sandbox/tobago-sandbox.tld";
+ String[] tldPaths = new String[1];
+ tldPaths[0] = "META-INF/org/apache/myfaces/tobago/taglib/sandbox/tobago-sandbox.tld";
+ setTldPaths(tldPaths);
super.setUp();
}
}
Modified: myfaces/tobago/trunk/theme/scarborough/src/test/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/AbstractJavaScriptTestBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/test/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/AbstractJavaScriptTestBase.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/test/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/AbstractJavaScriptTestBase.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/test/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/AbstractJavaScriptTestBase.java Sun May 2 09:27:03 2010
@@ -28,8 +28,8 @@ import java.io.IOException;
public abstract class AbstractJavaScriptTestBase extends TestCase {
- protected Context cx;
- protected Scriptable scope;
+ private Context cx;
+ private Scriptable scope;
protected void setUp() throws Exception {
super.setUp();
@@ -43,13 +43,13 @@ public abstract class AbstractJavaScript
public void testDummy() {
-}
+ }
- protected Object eval(String script) throws JavaScriptException {
+ protected Object eval(String script) {
return cx.evaluateString(scope, script, "test", 1, null);
}
- protected int evalInt(String script) throws JavaScriptException {
+ protected int evalInt(String script) {
Object o = eval(script);
if (o instanceof Number) {
return ((Number) o).intValue();
@@ -58,7 +58,7 @@ public abstract class AbstractJavaScript
+ o.getClass().getName() + " with value " + o, 0);
}
- protected long evalLong(String script) throws JavaScriptException {
+ protected long evalLong(String script) {
Object o = eval(script);
if (o instanceof Number) {
return ((Number) o).longValue();
@@ -67,7 +67,7 @@ public abstract class AbstractJavaScript
+ o.getClass().getName() + " with value " + o, 0);
}
- protected boolean evalBoolean(String script) throws JavaScriptException {
+ protected boolean evalBoolean(String script) {
Object o = eval(script);
if (o instanceof Boolean) {
return ((Boolean) o).booleanValue();
@@ -78,7 +78,7 @@ public abstract class AbstractJavaScript
// XXX directory handling + Maven reactor current dir problem
protected void loadScriptFile(String jsFile)
- throws IOException, JavaScriptException {
+ throws IOException {
String fileName
= "src/main/resources/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/script/" + jsFile;
File file = new File(fileName);
Modified: myfaces/tobago/trunk/theme/scarborough/src/test/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/DateUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/scarborough/src/test/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/DateUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/scarborough/src/test/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/DateUnitTest.java (original)
+++ myfaces/tobago/trunk/theme/scarborough/src/test/java/org/apache/myfaces/tobago/renderkit/html/scarborough/standard/DateUnitTest.java Sun May 2 09:27:03 2010
@@ -17,8 +17,6 @@ package org.apache.myfaces.tobago.render
* limitations under the License.
*/
-import org.mozilla.javascript.JavaScriptException;
-
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.ParseException;
@@ -54,9 +52,8 @@ public class DateUnitTest extends Abstra
loadScriptFile("dateConverter.js");
}
- public void testNumberOnlyDateFormats() throws IOException, JavaScriptException {
- for (int i = 0; i < DATES.size(); i++) {
- Date date = DATES.get(i);
+ public void testNumberOnlyDateFormats() throws IOException {
+ for (Date date : DATES) {
checkFormat("yyyyMMdd", date, YEAR_MONTH_DAY, Locale.ENGLISH);
checkFormat("ddMMyyyy", date, YEAR_MONTH_DAY, Locale.ENGLISH);
checkFormat("d.M.yyyy", date, YEAR_MONTH_DAY, Locale.ENGLISH);
@@ -111,7 +108,6 @@ public class DateUnitTest extends Abstra
private Object evalFormatDate(Date date, String format) {
// SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd");
- // System.out.println(simpleDateFormat.format(date) + " -> " + o);
return eval("new SimpleDateFormat(\"" + format + "\")"
+ ".format(new Date(" + date.getTime() + "))");
}
@@ -166,8 +162,7 @@ public class DateUnitTest extends Abstra
calendar1.setTime(date);
Calendar calendar2 = evalParseDate(
simpleDateFormat.format(date), format, locale);
- for (int i = 0; i < fields.length; i++) {
- int field = fields[i];
+ for (int field : fields) {
checkField(calendar1, calendar2, field);
}
}
Modified: myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java (original)
+++ myfaces/tobago/trunk/theme/standard/src/main/java/org/apache/myfaces/tobago/renderkit/html/util/HtmlRendererUtils.java Sun May 2 09:27:03 2010
@@ -53,7 +53,6 @@ import java.util.Locale;
import java.util.Map;
/*
- * User: weber
* Date: Jan 11, 2005
* Time: 4:59:36 PM
*/
@@ -392,7 +391,7 @@ public final class HtmlRendererUtils {
Object itemValue = item.getValue();
// when using selectItem tag with a literal value: use the converted value
if (itemValue instanceof String && values != null && values.length > 0 && !(values[0] instanceof String)) {
- itemValue = ComponentUtils.getConvertedValue(facesContext, component, (String)itemValue);
+ itemValue = ComponentUtils.getConvertedValue(facesContext, component, (String) itemValue);
}
String formattedValue = RenderUtil.getFormattedValue(facesContext, component, itemValue);
writer.writeAttribute(HtmlAttributes.VALUE, formattedValue, true);
Modified: myfaces/tobago/trunk/theme/standard/src/test/java/org/apache/myfaces/tobago/renderkit/util/JQueryUtilsUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/theme/standard/src/test/java/org/apache/myfaces/tobago/renderkit/util/JQueryUtilsUnitTest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/theme/standard/src/test/java/org/apache/myfaces/tobago/renderkit/util/JQueryUtilsUnitTest.java (original)
+++ myfaces/tobago/trunk/theme/standard/src/test/java/org/apache/myfaces/tobago/renderkit/util/JQueryUtilsUnitTest.java Sun May 2 09:27:03 2010
@@ -1,8 +1,5 @@
package org.apache.myfaces.tobago.renderkit.util;
-import org.junit.Assert;
-import org.junit.Test;
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -20,6 +17,9 @@ import org.junit.Test;
* limitations under the License.
*/
+import org.junit.Assert;
+import org.junit.Test;
+
public class JQueryUtilsUnitTest {
@Test
Modified: myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockApplication.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockApplication.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockApplication.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockApplication.java Sun May 2 09:27:03 2010
@@ -39,7 +39,6 @@ import java.util.Locale;
import java.util.Map;
public class MockApplication extends Application {
-// ----------------------------------------------------------------- attributes
private ViewHandler viewHandler;
private Map components = new HashMap();
@@ -48,7 +47,6 @@ public class MockApplication extends App
private VariableResolver variableResolver = null;
-// ----------------------------------------------------------- business methods
public void addComponent(String componentType, String componentClass) {
components.put(componentType, componentClass);
@@ -66,16 +64,16 @@ public class MockApplication extends App
public UIComponent createComponent(String componentType) throws FacesException {
String componentClass = (String) components.get(componentType);
try {
- Class clazz = Class.forName(componentClass);
- return ((UIComponent) clazz.newInstance());
+ Class clazz = Class.forName(componentClass);
+ return ((UIComponent) clazz.newInstance());
} catch (Exception e) {
- throw new FacesException("componentType=" + componentType, e);
+ throw new FacesException("componentType=" + componentType, e);
}
}
public UIComponent createComponent(ValueBinding valueBinding,
FacesContext facesContext, String reference) throws FacesException {
- throw new FacesException(new UnsupportedOperationException());
+ throw new FacesException(new UnsupportedOperationException());
}
public Converter createConverter(Class aClass) {
@@ -95,12 +93,12 @@ public class MockApplication extends App
return null;
}
- public ValueBinding createValueBinding(String reference){
- if (reference == null) {
+ public ValueBinding createValueBinding(String reference) {
+ if (reference == null) {
throw new NullPointerException();
- } else {
+ } else {
return (new MockValueBinding(this, reference));
- }
+ }
}
public ActionListener getActionListener() {
@@ -136,10 +134,10 @@ public class MockApplication extends App
}
public PropertyResolver getPropertyResolver() {
- if (propertyResolver == null) {
- propertyResolver = new MockPropertyResolver();
- }
- return (this.propertyResolver);
+ if (propertyResolver == null) {
+ propertyResolver = new MockPropertyResolver();
+ }
+ return (this.propertyResolver);
}
public StateManager getStateManager() {
@@ -155,10 +153,10 @@ public class MockApplication extends App
}
public VariableResolver getVariableResolver() {
- if (variableResolver == null) {
- variableResolver = new MockVariableResolver();
- }
- return (this.variableResolver);
+ if (variableResolver == null) {
+ variableResolver = new MockVariableResolver();
+ }
+ return (this.variableResolver);
}
public void setActionListener(ActionListener actionListener) {
@@ -182,11 +180,10 @@ public class MockApplication extends App
public void setSupportedLocales(Collection collection) {
}
-// ------------------------------------------------------------ getter + setter
public ViewHandler getViewHandler() {
if (null == viewHandler) {
- viewHandler = new MockViewHandler();
+ viewHandler = new MockViewHandler();
}
return viewHandler;
}
@@ -196,11 +193,11 @@ public class MockApplication extends App
}
public void setPropertyResolver(PropertyResolver propertyResolver) {
- this.propertyResolver = propertyResolver;
+ this.propertyResolver = propertyResolver;
}
public void setVariableResolver(VariableResolver variableResolver) {
- this.variableResolver = variableResolver;
+ this.variableResolver = variableResolver;
}
}
Modified: myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockExternalContext.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockExternalContext.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockExternalContext.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockExternalContext.java Sun May 2 09:27:03 2010
@@ -36,6 +36,9 @@ import java.util.Collections;
public class MockExternalContext extends ExternalContext {
+ private ServletContext context = null;
+ private ServletRequest request = null;
+ private ServletResponse response = null;
public MockExternalContext(ServletContext context,
ServletRequest request,
@@ -45,33 +48,26 @@ public class MockExternalContext extends
this.response = response;
}
-
- private ServletContext context = null;
- private ServletRequest request = null;
- private ServletResponse response = null;
-
-
public Object getSession(boolean create) {
if (sessionMap == null && create) {
- sessionMap = new MockSessionMap
- (((HttpServletRequest) request).getSession(true));
+ sessionMap = new MockSessionMap(((HttpServletRequest) request).getSession(true));
}
return sessionMap;
}
public Object getContext() {
- return (context);
+ return context;
}
public Object getRequest() {
- return (request);
+ return request;
}
public Object getResponse() {
- return (response);
+ return response;
}
@@ -81,7 +77,7 @@ public class MockExternalContext extends
if (applicationMap == null) {
applicationMap = new MockApplicationMap(context);
}
- return (applicationMap);
+ return applicationMap;
}
@@ -89,10 +85,9 @@ public class MockExternalContext extends
public Map getSessionMap() {
if (sessionMap == null) {
- sessionMap = new MockSessionMap
- (((HttpServletRequest) request).getSession(true));
+ sessionMap = new MockSessionMap(((HttpServletRequest) request).getSession(true));
}
- return (sessionMap);
+ return sessionMap;
}
@@ -102,7 +97,7 @@ public class MockExternalContext extends
if (requestMap == null) {
requestMap = new MockRequestMap(request);
}
- return (requestMap);
+ return requestMap;
}
@@ -147,12 +142,12 @@ public class MockExternalContext extends
public Locale getRequestLocale() {
- return (request.getLocale());
+ return request.getLocale();
}
public Iterator getRequestLocales() {
- return (new LocalesIterator(request.getLocales()));
+ return new LocalesIterator(request.getLocales());
}
@@ -233,19 +228,19 @@ public class MockExternalContext extends
public String getAuthType() {
- return (((HttpServletRequest) request).getAuthType());
+ return ((HttpServletRequest) request).getAuthType();
}
public String getRemoteUser() {
- return (((HttpServletRequest) request).getRemoteUser());
+ return ((HttpServletRequest) request).getRemoteUser();
}
public java.security.Principal getUserPrincipal() {
- return (((HttpServletRequest) request).getUserPrincipal());
+ return ((HttpServletRequest) request).getUserPrincipal();
}
public boolean isUserInRole(String role) {
- return (((HttpServletRequest) request).isUserInRole(role));
+ return ((HttpServletRequest) request).isUserInRole(role);
}
Modified: myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockPropertyResolver.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockPropertyResolver.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockPropertyResolver.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockPropertyResolver.java Sun May 2 09:27:03 2010
@@ -30,123 +30,115 @@ import java.util.Map;
* subset of expression evaluation functionality:</p>
* <ul>
* <li>Supports <code>getValue()</code> and <code>setValue()</code> methods
- * that take a String second argument.</li>
+ * that take a String second argument.</li>
* <li>Supports property getting and setting as provided by
- * <code>PropertyUtils.getSimpleProperty()</code> and
- * <code>PropertyUtils.setSimpleProperty()</code>.</li>
+ * <code>PropertyUtils.getSimpleProperty()</code> and
+ * <code>PropertyUtils.setSimpleProperty()</code>.</li>
* </ul>
*/
public class MockPropertyResolver extends PropertyResolver {
- // ------------------------------------------------------------ Constructors
+ public Object getValue(Object base, Object property)
+ throws EvaluationException {
-
- // ------------------------------------------------ PropertyResolver Methods
-
-
- public Object getValue(Object base, Object property)
- throws EvaluationException, PropertyNotFoundException {
-
- if (base == null) {
- throw new NullPointerException();
- }
- String name = property.toString();
- try {
- if (base instanceof Map) {
- Map map = (Map) base;
- if (map.containsKey(name)) {
- return (map.get(name));
- } else {
- throw new PropertyNotFoundException(name);
- }
- } else {
- return (PropertyUtils.getSimpleProperty(base, name));
- }
- } catch (IllegalAccessException e) {
- throw new EvaluationException(e);
- } catch (InvocationTargetException e) {
- throw new EvaluationException(e.getTargetException());
- } catch (NoSuchMethodException e) {
- throw new PropertyNotFoundException(name);
+ if (base == null) {
+ throw new NullPointerException();
+ }
+ String name = property.toString();
+ try {
+ if (base instanceof Map) {
+ Map map = (Map) base;
+ if (map.containsKey(name)) {
+ return map.get(name);
+ } else {
+ throw new PropertyNotFoundException(name);
}
-
+ } else {
+ return PropertyUtils.getSimpleProperty(base, name);
+ }
+ } catch (IllegalAccessException e) {
+ throw new EvaluationException(e);
+ } catch (InvocationTargetException e) {
+ throw new EvaluationException(e.getTargetException());
+ } catch (NoSuchMethodException e) {
+ throw new PropertyNotFoundException(name);
}
+ }
- public Object getValue(Object base, int index)
- throws PropertyNotFoundException {
- throw new UnsupportedOperationException();
+ public Object getValue(Object base, int index)
+ throws PropertyNotFoundException {
- }
+ throw new UnsupportedOperationException();
+ }
- public void setValue(Object base, Object property, Object value)
- throws PropertyNotFoundException {
- if (base == null) {
- throw new NullPointerException();
- }
- String name = property.toString();
- try {
- if (base instanceof Map) {
- ((Map) base).put(name, value);
- } else {
- PropertyUtils.setSimpleProperty(base, name, value);
- }
- } catch (IllegalAccessException e) {
- throw new EvaluationException(e);
- } catch (InvocationTargetException e) {
- throw new EvaluationException(e.getTargetException());
- } catch (NoSuchMethodException e) {
- throw new PropertyNotFoundException(name);
- }
+ public void setValue(Object base, Object property, Object value)
+ throws PropertyNotFoundException {
+ if (base == null) {
+ throw new NullPointerException();
+ }
+ String name = property.toString();
+ try {
+ if (base instanceof Map) {
+ ((Map) base).put(name, value);
+ } else {
+ PropertyUtils.setSimpleProperty(base, name, value);
+ }
+ } catch (IllegalAccessException e) {
+ throw new EvaluationException(e);
+ } catch (InvocationTargetException e) {
+ throw new EvaluationException(e.getTargetException());
+ } catch (NoSuchMethodException e) {
+ throw new PropertyNotFoundException(name);
}
+ }
- public void setValue(Object base, int index, Object value)
- throws PropertyNotFoundException {
-
- throw new UnsupportedOperationException();
- }
+ public void setValue(Object base, int index, Object value)
+ throws PropertyNotFoundException {
+ throw new UnsupportedOperationException();
- public boolean isReadOnly(Object base, Object property)
- throws PropertyNotFoundException {
+ }
- throw new UnsupportedOperationException();
- }
+ public boolean isReadOnly(Object base, Object property)
+ throws PropertyNotFoundException {
+ throw new UnsupportedOperationException();
- public boolean isReadOnly(Object base, int index)
- throws PropertyNotFoundException {
+ }
- throw new UnsupportedOperationException();
- }
+ public boolean isReadOnly(Object base, int index)
+ throws PropertyNotFoundException {
+ throw new UnsupportedOperationException();
- public Class getType(Object base, Object property)
- throws PropertyNotFoundException {
+ }
- throw new UnsupportedOperationException();
- }
+ public Class getType(Object base, Object property)
+ throws PropertyNotFoundException {
+ throw new UnsupportedOperationException();
- public Class getType(Object base, int index)
- throws PropertyNotFoundException {
+ }
- throw new UnsupportedOperationException();
- }
+ public Class getType(Object base, int index)
+ throws PropertyNotFoundException {
+ throw new UnsupportedOperationException();
+ }
}
Modified: myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockRenderKit.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockRenderKit.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockRenderKit.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockRenderKit.java Sun May 2 09:27:03 2010
@@ -49,7 +49,7 @@ public class MockRenderKit extends Rende
private Map<String, Renderer> renderers = new HashMap<String, Renderer>();
public void addRenderer(String family, String rendererType,
- Renderer renderer) {
+ Renderer renderer) {
if ((family == null) || (rendererType == null) || (renderer == null)) {
throw new NullPointerException();
}
@@ -65,8 +65,8 @@ public class MockRenderKit extends Rende
public ResponseWriter createResponseWriter(Writer writer,
- String contentTypeList,
- String characterEncoding) {
+ String contentTypeList,
+ String characterEncoding) {
return new MockResponseWriter(writer, characterEncoding);
}
@@ -115,13 +115,10 @@ public class MockRenderKit extends Rende
}
UIInput input = (UIInput) component;
String clientId = input.getClientId(context);
- // System.err.println("decode(" + clientId + ")");
// Decode incoming request parameters
Map params = context.getExternalContext().getRequestParameterMap();
if (params.containsKey(clientId)) {
- // System.err.println(" '" + input.currentValue(context) +
- // "' --> '" + params.get(clientId) + "'");
input.setSubmittedValue(params.get(clientId));
}
Modified: myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockResponseWriter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockResponseWriter.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockResponseWriter.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockResponseWriter.java Sun May 2 09:27:03 2010
@@ -24,114 +24,112 @@ import java.io.Writer;
public class MockResponseWriter extends ResponseWriter {
+ private Writer writer;
+ private String encoding;
- public MockResponseWriter(Writer writer, String encoding) {
- this.writer = writer;
- this.encoding = encoding;
- }
+ public MockResponseWriter(Writer writer, String encoding) {
+ this.writer = writer;
+ this.encoding = encoding;
+ }
- private Writer writer;
- private String encoding;
+ // ---------------------------------------------------------- Writer Methods
- // ---------------------------------------------------------- Writer Methods
+ public void close() throws IOException {
+ writer.close();
+ }
- public void close() throws IOException {
- writer.close();
- }
+ public void flush() throws IOException {
+ writer.flush();
+ }
- public void flush() throws IOException {
- writer.flush();
- }
+ public void write(char c) throws IOException {
+ writer.write(c);
+ }
- public void write(char c) throws IOException {
- writer.write(c);
- }
+ public void write(char[] cbuf, int off, int len) throws IOException {
+ writer.write(cbuf, off, len);
+ }
- public void write(char cbuf[], int off, int len) throws IOException {
- writer.write(cbuf, off, len);
- }
+ public void write(int c) throws IOException {
+ writer.write(c);
+ }
- public void write(int c) throws IOException {
- writer.write(c);
- }
+ public void write(String s) throws IOException {
+ writer.write(s);
+ }
- public void write(String s) throws IOException {
- writer.write(s);
- }
+ public void write(String s, int off, int len) throws IOException {
+ writer.write(s, off, len);
+ }
- public void write(String s, int off, int len) throws IOException {
- writer.write(s, off, len);
- }
+ // --------------------------------------------------- ResponseWrter Methods
+ public String getContentType() {
+ return "text/html";
+ }
- // --------------------------------------------------- ResponseWrter Methods
+ public String getCharacterEncoding() {
+ return (this.encoding);
+ }
- public String getContentType() {
- return "text/html";
- }
- public String getCharacterEncoding() {
- return (this.encoding);
- }
+ public void startDocument() throws IOException {
+ throw new UnsupportedOperationException();
+ }
- public void startDocument() throws IOException {
- throw new UnsupportedOperationException();
- }
+ public void endDocument() throws IOException {
+ throw new UnsupportedOperationException();
+ }
- public void endDocument() throws IOException {
- throw new UnsupportedOperationException();
- }
+ public void startElement(String name,
+ UIComponent component) throws IOException {
+ throw new UnsupportedOperationException();
+ }
- public void startElement(String name,
- UIComponent component) throws IOException {
- throw new UnsupportedOperationException();
- }
+ public void endElement(String name) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+ public void writeAttribute(String name, Object value,
+ String componentPropertyName) throws IOException {
+ throw new UnsupportedOperationException();
+ }
- public void endElement(String name) throws IOException {
- throw new UnsupportedOperationException();
- }
- public void writeAttribute(String name, Object value,
- String componentPropertyName) throws IOException {
- throw new UnsupportedOperationException();
- }
+ public void writeURIAttribute(String name, Object value, String componentPropertyName) throws IOException {
+ throw new UnsupportedOperationException();
+ }
- public void writeURIAttribute(String name, Object value, String componentPropertyName) throws IOException {
- throw new UnsupportedOperationException();
- }
+ public void writeComment(Object comment) throws IOException {
+ throw new UnsupportedOperationException();
+ }
- public void writeComment(Object comment) throws IOException {
- throw new UnsupportedOperationException();
- }
+ public void writeText(Object text, String componentProperty) throws IOException {
+ throw new UnsupportedOperationException();
+ }
+ public void writeText(char[] text, int off, int len) throws IOException {
+ throw new UnsupportedOperationException();
+ }
- public void writeText(Object text, String componentProperty) throws IOException {
- throw new UnsupportedOperationException();
- }
- public void writeText(char text[], int off, int len) throws IOException {
- throw new UnsupportedOperationException();
- }
-
-
- public ResponseWriter cloneWithWriter(Writer writer) {
- throw new UnsupportedOperationException();
- }
+ public ResponseWriter cloneWithWriter(Writer writer) {
+ throw new UnsupportedOperationException();
+ }
}
Modified: myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockValueBinding.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockValueBinding.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockValueBinding.java (original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/faces/MockValueBinding.java Sun May 2 09:27:03 2010
@@ -36,9 +36,9 @@ import java.util.Map;
* subset of expression evaluation functionality:</p>
* <ul>
* <li>Looking up the first name via the configured {@link javax.faces.el.VariableResolver}
- * (which is also limited in capability).</li>
+ * (which is also limited in capability).</li>
* <li>Resolving the "." operator via the configured
- * {@link javax.faces.el.PropertyResolver}.</li>
+ * {@link javax.faces.el.PropertyResolver}.</li>
* <li>Supports only <code>getValue()</code> and <code>setValue()</code>.</li>
* </ul>
*/
@@ -46,237 +46,205 @@ import java.util.Map;
public class MockValueBinding extends ValueBinding implements StateHolder {
- // ------------------------------------------------------------ Constructors
+ private transient Application application; // Restored as necessary
+ private String ref;
+ public MockValueBinding() {
- public MockValueBinding() {
+ this(null, null);
- this(null, null);
+ }
- }
-
-
- public MockValueBinding(Application application, String ref) {
-
- this.application = application;
- if (ref != null) {
- if (ref.startsWith("#{") && ref.endsWith("}")) {
- ref = ref.substring(2, ref.length() - 1);
- }
- }
- this.ref = ref;
+ public MockValueBinding(Application application, String ref) {
+ this.application = application;
+ if (ref != null) {
+ if (ref.startsWith("#{") && ref.endsWith("}")) {
+ ref = ref.substring(2, ref.length() - 1);
+ }
}
+ this.ref = ref;
+ }
- // ------------------------------------------------------ Instance Variables
-
-
- private transient Application application; // Restored as necessary
- private String ref;
-
-
- // ---------------------------------------------------- ValueBinding Methods
+ public Object getValue(FacesContext context)
+ throws EvaluationException {
+ if (context == null) {
+ throw new NullPointerException();
+ }
+ List names = parse(ref);
- public Object getValue(FacesContext context)
- throws EvaluationException, PropertyNotFoundException {
-
- if (context == null) {
- throw new NullPointerException();
- }
- // System.out.println("getValue(" + ref + ")");
- List names = parse(ref);
- // for (int i = 0; i < names.size(); i++) {
- // System.out.println(" names[" + i + "]=" + names.get(i));
- // }
-
- // Resolve the variable name
- VariableResolver vr = application().getVariableResolver();
- String name = (String) names.get(0);
- Object base = vr.resolveVariable(context, name);
- // System.out.println(" base=" + base);
- if (names.size() < 2) {
- return (base);
- }
-
- // Resolve the property names
- PropertyResolver pr = application().getPropertyResolver();
- for (int i = 1; i < names.size(); i++) {
- // System.out.println(" property=" + names.get(i));
- base = pr.getValue(base, (String) names.get(i));
- }
-
- // Return the resolved value
- // System.out.println(" result=" + base);
- return (base);
-
+ // Resolve the variable name
+ VariableResolver vr = application().getVariableResolver();
+ String name = (String) names.get(0);
+ Object base = vr.resolveVariable(context, name);
+ if (names.size() < 2) {
+ return (base);
}
+ // Resolve the property names
+ PropertyResolver pr = application().getPropertyResolver();
+ for (int i = 1; i < names.size(); i++) {
+ base = pr.getValue(base, (String) names.get(i));
+ }
- public void setValue(FacesContext context, Object value)
- throws EvaluationException, PropertyNotFoundException {
+ // Return the resolved value
+ return (base);
- if (context == null) {
- throw new NullPointerException();
- }
- // System.out.println("setValue(" + ref + "," + value + ")");
- List names = parse(ref);
- // for (int i = 0; i < names.size(); i++) {
- // System.out.println(" names[" + i + "]=" + names.get(i));
- // }
+ }
- // Resolve the variable name
- VariableResolver vr = application().getVariableResolver();
- String name = (String) names.get(0);
- Object base = vr.resolveVariable(context, name);
- // System.out.println(" base=" + base);
- if (names.size() < 2) {
- if ("applicationScope".equals(name) ||
- "requestScope".equals(name) ||
- "sessionScope".equals(name)) {
- throw new ReferenceSyntaxException("Cannot set '" +
- name + "'");
- }
- Map map = econtext().getRequestMap();
- if (map.containsKey(name)) {
- map.put(name, value);
- return;
- }
- map = econtext().getSessionMap();
- if ((map != null) && (map.containsKey(name))) {
- map.put(name, value);
- return;
- }
- map = econtext().getApplicationMap();
- if (map.containsKey(name)) {
- map.put(name, value);
- return;
- }
- econtext().getRequestMap().put(name, value);
- return;
- }
- // Resolve the property names
- PropertyResolver pr = application().getPropertyResolver();
- for (int i = 1; i < (names.size() - 1); i++) {
- // System.out.println(" property=" + names.get(i));
- base = pr.getValue(base, (String) names.get(i));
- }
+ public void setValue(FacesContext context, Object value)
+ throws EvaluationException {
- // Update the last property
- pr.setValue(base, (String) names.get(names.size() - 1), value);
+ if (context == null) {
+ throw new NullPointerException();
+ }
+ List names = parse(ref);
+ // Resolve the variable name
+ VariableResolver vr = application().getVariableResolver();
+ String name = (String) names.get(0);
+ Object base = vr.resolveVariable(context, name);
+ if (names.size() < 2) {
+ if ("applicationScope".equals(name) || "requestScope".equals(name) || "sessionScope".equals(name)) {
+ throw new ReferenceSyntaxException("Cannot set '" + name + "'");
+ }
+ Map map = econtext().getRequestMap();
+ if (map.containsKey(name)) {
+ map.put(name, value);
+ return;
+ }
+ map = econtext().getSessionMap();
+ if ((map != null) && (map.containsKey(name))) {
+ map.put(name, value);
+ return;
+ }
+ map = econtext().getApplicationMap();
+ if (map.containsKey(name)) {
+ map.put(name, value);
+ return;
+ }
+ econtext().getRequestMap().put(name, value);
+ return;
}
+ // Resolve the property names
+ PropertyResolver pr = application().getPropertyResolver();
+ for (int i = 1; i < (names.size() - 1); i++) {
+ base = pr.getValue(base, (String) names.get(i));
+ }
- public boolean isReadOnly(FacesContext context)
- throws PropertyNotFoundException {
+ // Update the last property
+ pr.setValue(base, (String) names.get(names.size() - 1), value);
- throw new UnsupportedOperationException();
+ }
- }
+ public boolean isReadOnly(FacesContext context)
+ throws PropertyNotFoundException {
- public Class getType(FacesContext context)
- throws PropertyNotFoundException {
+ throw new UnsupportedOperationException();
- throw new UnsupportedOperationException();
+ }
- }
- public String getExpressionString() {
- return "#{" + ref + "}";
- }
+ public Class getType(FacesContext context)
+ throws PropertyNotFoundException {
+ throw new UnsupportedOperationException();
+ }
+ public String getExpressionString() {
+ return "#{" + ref + "}";
+ }
- // ----------------------------------------------------- StateHolder Methods
+ // ----------------------------------------------------- StateHolder Methods
- public Object saveState(FacesContext context) {
- Object values[] = new Object[1];
- values[0] = ref;
- return (values);
- }
+ public Object saveState(FacesContext context) {
+ Object[] values = new Object[1];
+ values[0] = ref;
+ return values;
+ }
- public void restoreState(FacesContext context, Object state) {
- Object values[] = (Object[]) state;
- ref = (String) values[0];
- }
+ public void restoreState(FacesContext context, Object state) {
+ Object[] values = (Object[]) state;
+ ref = (String) values[0];
+ }
- private boolean transientFlag = false;
+ private boolean transientFlag = false;
- public boolean isTransient() {
- return (this.transientFlag);
- }
+ public boolean isTransient() {
+ return (this.transientFlag);
+ }
- public void setTransient(boolean transientFlag) {
- this.transientFlag = transientFlag;
- }
+ public void setTransient(boolean transientFlag) {
+ this.transientFlag = transientFlag;
+ }
- // ---------------------------------------------------------- Public Methods
+ // ---------------------------------------------------------- Public Methods
- public String ref(){
- return (this.ref);
- }
+ public String ref() {
+ return (this.ref);
+ }
- // --------------------------------------------------------- Private Methods
+ // --------------------------------------------------------- Private Methods
- private Application application() {
- if (application == null) {
- application = FacesContext.getCurrentInstance().getApplication();
- }
- return (application);
+ private Application application() {
+ if (application == null) {
+ application = FacesContext.getCurrentInstance().getApplication();
}
+ return (application);
+ }
- private ExternalContext econtext() {
- return (FacesContext.getCurrentInstance().getExternalContext());
+ private ExternalContext econtext() {
- }
+ return (FacesContext.getCurrentInstance().getExternalContext());
+ }
- private List parse(String ref) {
- String expr = ref;
- List names = new ArrayList();
- while (expr.length() > 0) {
- int period = expr.indexOf(".");
- if (period >= 0) {
- names.add(expr.substring(0, period));
- expr = expr.substring(period + 1);
- } else {
- names.add(expr);
- expr = "";
- }
- }
- if (names.size() < 1) {
- throw new ReferenceSyntaxException("No expression in '" +
- ref + "'");
- }
- for (int i = 0; i < names.size(); i++) {
- String name = (String) names.get(i);
- if (name.length() < 1) {
- throw new ReferenceSyntaxException("Invalid expression '" +
- ref + "'");
- }
- }
- return (names);
+ private List parse(String ref) {
+ String expr = ref;
+ List names = new ArrayList();
+ while (expr.length() > 0) {
+ int period = expr.indexOf(".");
+ if (period >= 0) {
+ names.add(expr.substring(0, period));
+ expr = expr.substring(period + 1);
+ } else {
+ names.add(expr);
+ expr = "";
+ }
}
+ if (names.size() < 1) {
+ throw new ReferenceSyntaxException("No expression in '" + ref + "'");
+ }
+ for (Object name1 : names) {
+ String name = (String) name1;
+ if (name.length() < 1) {
+ throw new ReferenceSyntaxException("Invalid expression '" + ref + "'");
+ }
+ }
+ return (names);
+
+ }
}