myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bom...@apache.org
Subject svn commit: r940176 [2/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...
Date Sun, 02 May 2010 09:27:06 GMT
Modified: myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockHttpServletRequest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockHttpServletRequest.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockHttpServletRequest.java
(original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockHttpServletRequest.java
Sun May  2 09:27:03 2010
@@ -196,7 +196,7 @@ public class MockHttpServletRequest impl
   }
 
   public String getParameter(String name) {
-    String values[] = (String[]) parameters.get(name);
+    String[] values = (String[]) parameters.get(name);
     if (values != null) {
       return (values[0]);
     } else {
@@ -283,7 +283,7 @@ public class MockHttpServletRequest impl
 
 // ----------------------------------------------------------- business methods
 
-  public void addParameter(String name, String values[]) {
+  public void addParameter(String name, String[] values) {
     parameters.put(name, values);
   }
 

Modified: myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockJspWriter.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockJspWriter.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockJspWriter.java
(original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockJspWriter.java
Sun May  2 09:27:03 2010
@@ -58,7 +58,7 @@ public class MockJspWriter extends JspWr
     out.print(d);
   }
 
-  public void print(char s[]) {
+  public void print(char[] s) {
     out.print(s);
   }
 
@@ -98,7 +98,7 @@ public class MockJspWriter extends JspWr
     out.println(x);
   }
 
-  public void println(char x[]) {
+  public void println(char[] x) {
     out.println(x);
   }
 
@@ -114,7 +114,7 @@ public class MockJspWriter extends JspWr
     out.write(c);
   }
 
-  public void write(char cbuf[]) throws IOException {
+  public void write(char[] cbuf) throws IOException {
     out.write(cbuf);
   }
 
@@ -122,7 +122,7 @@ public class MockJspWriter extends JspWr
     out.write(str);
   }
 
-  public void write(char cbuf[], int off, int len) throws IOException {
+  public void write(char[] cbuf, int off, int len) throws IOException {
     out.write(cbuf, off, len);
   }
 

Modified: myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockPageContext.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockPageContext.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockPageContext.java
(original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/mock/servlet/MockPageContext.java
Sun May  2 09:27:03 2010
@@ -37,10 +37,10 @@ import java.util.Map;
 
 public class MockPageContext extends PageContext {
 
-  ServletRequest request = null;
-  JspWriter out = new MockJspWriter(new PrintWriter(System.out));
-  ServletContext servletContext = new MockServletContext();
-  Map attributes = new HashMap();
+  private ServletRequest request = null;
+  private JspWriter out = new MockJspWriter(new PrintWriter(System.out));
+  private ServletContext servletContext = new MockServletContext();
+  private Map attributes = new HashMap();
 
 
   public MockPageContext() {
@@ -67,8 +67,9 @@ public class MockPageContext extends Pag
       case PageContext.REQUEST_SCOPE:
         return getRequest().getAttribute(name);
       // other not supported
+      default:
+        return null;
     }
-    return null;
   }
 
   public Enumeration getAttributeNamesInScope(int i) {
@@ -120,7 +121,8 @@ public class MockPageContext extends Pag
   public void include(String s) throws ServletException, IOException {
   }
 
-  public void initialize(Servlet servlet, ServletRequest request, ServletResponse response,
String s, boolean b, int i, boolean b1) throws IOException, IllegalStateException, IllegalArgumentException
{
+  public void initialize(Servlet servlet, ServletRequest request, ServletResponse response,
String s, boolean b, int i,
+      boolean b1) throws IOException, IllegalStateException, IllegalArgumentException {
   }
 
   public void release() {
@@ -142,12 +144,12 @@ public class MockPageContext extends Pag
       case PageContext.REQUEST_SCOPE:
         getRequest().setAttribute(s, o);
         break;
-      // other not supported
+      default:
+        // other not supported
     }
   }
 
-  public void include(String reference, boolean b) throws ServletException,
-      IOException {
+  public void include(String reference, boolean b) throws ServletException, IOException {
   }
 
   public ExpressionEvaluator getExpressionEvaluator() {
@@ -159,6 +161,6 @@ public class MockPageContext extends Pag
   }
 
   public ELContext getELContext() {
-    return null;  //To change body of implemented methods use File | Settings | File Templates.
+    return null;
   }
 }

Modified: myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/taglib/component/GenericTestBase.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/taglib/component/GenericTestBase.java?rev=940176&r1=940175&r2=940176&view=diff
==============================================================================
--- myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/taglib/component/GenericTestBase.java
(original)
+++ myfaces/tobago/trunk/tobago-jsf-compat/src/test/java/org/apache/myfaces/tobago/taglib/component/GenericTestBase.java
Sun May  2 09:27:03 2010
@@ -56,9 +56,9 @@ import java.util.HashMap;
 public abstract class GenericTestBase extends TestCase {
   private static final Logger LOG = LoggerFactory.getLogger(GenericTestBase.class);
 
-  protected Tld[] tlds;
-  protected String[] tldPaths;
-   private Application application;
+  private Tld[] tlds;
+  private String[] tldPaths;
+  private Application application;
   private MockFacesContext facesContext;
 
   public GenericTestBase(String name) {
@@ -145,35 +145,43 @@ public abstract class GenericTestBase ex
       NoSuchMethodException, InvocationTargetException, ClassNotFoundException {
     PropertyDescriptor propertyDescriptor
         = PropertyUtils.getPropertyDescriptor(tagObject, name);
-    assertNotNull("setter '" + name + "' of class " + tagObject.getClass().getName() + "
has " +
-        "property descriptor.", propertyDescriptor);
+    assertNotNull("setter '" + name + "' of class " + tagObject.getClass().getName() + "
has "
+        + "property descriptor.", propertyDescriptor);
     //assertNotNull("setter '" + name + "' of class " + tagObject.getClass().getName() +
" exists.",
     //    propertyDescriptor.getWriteMethod());
   }
 
+  public void setTlds(Tld[] tlds) {
+    this.tlds = tlds;
+  }
+
+  public void setTldPaths(String[] tldPaths) {
+    this.tldPaths = tldPaths;
+  }
+
   private void checkRelease(javax.servlet.jsp.tagext.Tag tag) throws NoSuchMethodException,
       IllegalAccessException, InvocationTargetException, IOException,
       SAXException {
     tag.setPageContext(new MockPageContext());
 
-    HashMap initialValues = new HashMap();
-    PropertyDescriptor descriptors[] =
+    HashMap<String, Object> initialValues = new HashMap<String, Object>();
+    PropertyDescriptor[] descriptors =
         PropertyUtils.getPropertyDescriptors(tag);
 
     // store initial values
-    for (int i = 0; i < descriptors.length; i++) {
-      if (isTagProperty(descriptors[i])) {
-        String name = descriptors[i].getName();
+    for (PropertyDescriptor descriptor : descriptors) {
+      if (isTagProperty(descriptor)) {
+        String name = descriptor.getName();
         Object value = PropertyUtils.getSimpleProperty(tag, name);
         initialValues.put(name, value);
       }
     }
 
     // set new values
-    for (int i = 0; i < descriptors.length; i++) {
-      if (isTagProperty(descriptors[i])) {
-        String name = descriptors[i].getName();
-        Class propertyType = descriptors[i].getPropertyType();
+    for (PropertyDescriptor descriptor : descriptors) {
+      if (isTagProperty(descriptor)) {
+        String name = descriptor.getName();
+        Class propertyType = descriptor.getPropertyType();
         Object value = null;
         if (propertyType == String.class) {
           value = new String("bla");
@@ -192,11 +200,13 @@ public abstract class GenericTestBase ex
     tag.release();
 
     // check released values
-    for (int i = 0; i < descriptors.length; i++) {
-      if (isTagProperty(descriptors[i])) {
-        String name = descriptors[i].getName();
+    for (PropertyDescriptor descriptor : descriptors) {
+      if (isTagProperty(descriptor)) {
+        String name = descriptor.getName();
         // XXX: who releases id?
-        if (name.equals("id")) continue;
+        if (name.equals("id")) {
+          continue;
+        }
         try {
           Object newValue = PropertyUtils.getSimpleProperty(tag, name);
           Object oldValue = initialValues.get(name);
@@ -231,7 +241,8 @@ public abstract class GenericTestBase ex
 
   private static class Resolver implements EntityResolver {
     public InputSource resolveEntity(String publicId, String systemId) throws SAXException,
IOException {
-      InputSource inputSource = new InputSource(GenericTestBase.class.getResourceAsStream("/web-jsptaglibrary_1_2.dtd"));
+      InputSource inputSource =
+          new InputSource(GenericTestBase.class.getResourceAsStream("/web-jsptaglibrary_1_2.dtd"));
       inputSource.setSystemId(systemId);
       return inputSource;
     }



Mime
View raw message