You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by sk...@apache.org on 2008/06/12 15:43:09 UTC

svn commit: r667086 - in /myfaces/orchestra/trunk/sandbox/src/test: ./ java/ java/org/ java/org/apache/ java/org/apache/myfaces/ java/org/apache/myfaces/orchestra/ java/org/apache/myfaces/orchestra/dynaForm/ java/org/apache/myfaces/orchestra/dynaForm/a...

Author: skitching
Date: Thu Jun 12 06:43:08 2008
New Revision: 667086

URL: http://svn.apache.org/viewvc?rev=667086&view=rev
Log:
Add unit tests for AsmHelper and ClassHelperFactory.

Added:
    myfaces/orchestra/trunk/sandbox/src/test/
    myfaces/orchestra/trunk/sandbox/src/test/java/
    myfaces/orchestra/trunk/sandbox/src/test/java/org/
    myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/
    myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/
    myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/
    myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/
    myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/annot/
    myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/annot/ui/
    myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/jsf/
    myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/jsf/component/
    myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/
    myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/
    myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/
    myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/Bean.java   (with props)
    myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/TestAsmHelper.java   (with props)
    myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/TestClassHelperFactory.java   (with props)

Added: myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/Bean.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/Bean.java?rev=667086&view=auto
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/Bean.java (added)
+++ myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/Bean.java Thu Jun 12 06:43:08 2008
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.orchestra.dynaForm.metadata.impl.ejb;
+
+/**
+ * A dummy bean that can be introspected to find its properties.
+ * <p>
+ * Note that the order of the props and methods is deliberately
+ * mixed up, to ensure that introspection is finding them in the
+ * order that they are declared (not alphabetical or similar).
+ */
+public class Bean
+{
+    private int propInt;
+    private String propString;
+    private boolean propBool;
+    public Double propDouble;
+
+    public void doNothing()
+    {
+    }
+
+    public String toUpper(String src)
+    {
+        return src.toUpperCase();
+    }
+
+    public boolean isPropBool()
+    {
+        return propBool;
+    }
+
+    public int getPropInt()
+    {
+        return propInt;
+    }
+
+    public void setPropInt(int propInt)
+    {
+        this.propInt = propInt;
+    }
+
+    public String getPropString()
+    {
+        return propString;
+    }
+
+    public void setPropString(String propString)
+    {
+        this.propString = propString;
+    }
+
+    public void setPropBool(boolean propBool)
+    {
+        this.propBool = propBool;
+    }
+
+    public Double getPropDouble()
+    {
+        return propDouble;
+    }
+
+    public void setPropDouble(Double propDouble)
+    {
+        this.propDouble = propDouble;
+    }
+}
\ No newline at end of file

Propchange: myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/Bean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/TestAsmHelper.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/TestAsmHelper.java?rev=667086&view=auto
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/TestAsmHelper.java (added)
+++ myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/TestAsmHelper.java Thu Jun 12 06:43:08 2008
@@ -0,0 +1,53 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.orchestra.dynaForm.metadata.impl.ejb;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+
+import junit.framework.TestCase;
+
+/**
+ * Test various aspects of the conversation handling
+ */
+public class TestAsmHelper extends TestCase
+{
+	public void testSimple()
+	{
+	    AsmHelper asmHelper = new AsmHelper();
+
+	    Field[] fields = asmHelper.getFields(Bean.class);
+	    assertEquals(4, fields.length);
+	    assertEquals("propInt", fields[0].getName());
+        assertEquals("propString", fields[1].getName());
+        assertEquals("propBool", fields[2].getName());
+        assertEquals("propDouble", fields[3].getName());
+
+        Method[] methods = asmHelper.getMethods(Bean.class);
+        assertEquals(8, methods.length);
+        assertEquals("isPropBool", methods[0].getName());
+        assertEquals("getPropInt", methods[1].getName());
+        assertEquals("setPropInt", methods[2].getName());
+        assertEquals("getPropString", methods[3].getName());
+        assertEquals("setPropString", methods[4].getName());
+        assertEquals("setPropBool", methods[5].getName());
+        assertEquals("getPropDouble", methods[6].getName());
+        assertEquals("setPropDouble", methods[7].getName());
+	}
+}
\ No newline at end of file

Propchange: myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/TestAsmHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/TestClassHelperFactory.java
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/TestClassHelperFactory.java?rev=667086&view=auto
==============================================================================
--- myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/TestClassHelperFactory.java (added)
+++ myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/TestClassHelperFactory.java Thu Jun 12 06:43:08 2008
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.orchestra.dynaForm.metadata.impl.ejb;
+
+import junit.framework.TestCase;
+
+/**
+ * Test various aspects of the conversation handling
+ */
+public class TestClassHelperFactory extends TestCase
+{
+	public void testSimple()
+	{
+	    ClassHelper h = ClassHelperFactory.newClassHelper();
+	    assertEquals(AsmHelper.class.getName(), h.getClass().getName());
+	}
+}
\ No newline at end of file

Propchange: myfaces/orchestra/trunk/sandbox/src/test/java/org/apache/myfaces/orchestra/dynaForm/metadata/impl/ejb/TestClassHelperFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native