This is an automated email from the ASF dual-hosted git repository.

gk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/turbine-fulcrum-intake.git


The following commit(s) were added to refs/heads/master by this push:
     new 5850e427 Add test for getObjects - todo: is not working, reformat 
intake1.xml
5850e427 is described below

commit 5850e427172912b58acf1fd1d549f1ca043a5545
Author: Georg Kallidis <g...@apache.org>
AuthorDate: Fri Feb 23 12:04:55 2024 +0100

    Add test for getObjects - todo: is not working, reformat intake1.xml
---
 src/test/intake1.xml                               | 122 ++++++++++-----------
 src/test/org/apache/fulcrum/intake/IntakeTest.java |  32 ++++++
 2 files changed, 93 insertions(+), 61 deletions(-)

diff --git a/src/test/intake1.xml b/src/test/intake1.xml
index d78b6301..6f1ba22b 100644
--- a/src/test/intake1.xml
+++ b/src/test/intake1.xml
@@ -21,11 +21,11 @@
     basePackage="org.apache.fulcrum.intake.test." 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
     xsi:schemaLocation="http://turbine.apache.org/schema/intake/4.0 
intake.xsd">
-       <group name="LoginGroup" key="loginGroupKey" mapToObject="LoginForm">
-               <field name="Username" key="loginUsernameKey" type="String"
-                       mapToProperty="Username">
-               </field>
-       </group>
+    <group name="LoginGroup" key="loginGroupKey" mapToObject="LoginForm">
+      <field name="Username" key="loginUsernameKey" type="String"
+      mapToProperty="Username">
+      </field>
+    </group>
 
     <group name="LoginIfcGroup" key="loginIfcGroupKey" 
mapToObject="LoginFormInterface">
         <field name="Username" key="loginUsernameKey" type="String"
@@ -65,65 +65,65 @@
             <rule name="maxLength" value="10">Too long</rule>
             <rule name="mask" value="[A-Z]+">Uppercase letters only</rule>
         </field>
-               <field name="BooleanTestField" key="btf" type="boolean">
-            <rule name="required" value="true">Required</rule>
-               </field>
-               <field name="BigDecimalTestField" key="bdtf" type="BigDecimal">
-            <rule name="required" value="true">Required</rule>
-            <rule name="invalidNumber" value="">Not a number</rule>
-            <rule name="minValue" value="3.0">Too small</rule>
-            <rule name="maxValue" value="30.4">Too big</rule>
-               </field>
-               <field name="IntegerTestField" key="itf" type="int">
-            <rule name="required" value="true">Required</rule>
-            <rule name="invalidNumber" value="">Not a number</rule>
-            <rule name="minValue" value="3">Too small</rule>
-            <rule name="maxValue" value="30">Too big</rule>
-               </field>
-        <field name="IntegerToTestField" key="ittf" type="int" 
validator="IntegerRangeValidator">
-            <rule name="required" value="true">Required</rule>
-            <rule name="invalidNumber" value="">Not a number</rule>
-            <rule name="greater-than" value="IntegerTestField">To-int must be 
greater than From-int</rule>
+        <field name="BooleanTestField" key="btf" type="boolean">
+                <rule name="required" value="true">Required</rule>
         </field>
-               <field name="FloatTestField" key="ftf" type="float">
-            <rule name="required" value="true">Required</rule>
-            <rule name="invalidNumber" value="">Not a number</rule>
-            <rule name="minValue" value="3.0">Too small</rule>
-            <rule name="maxValue" value="30.4">Too big</rule>
-        </field>
-               <field name="FileItemTestField" key="fitf" type="FileItem">
-            <rule name="required" value="true">Required</rule>
-        </field>
-               <field name="DateStringTestField" key="dstf" type="DateString">
-            <rule name="required" value="true">Required</rule>
-            <rule name="format" value="MM/dd/yyyy">Bad format</rule>
-            <rule name="format1" value="dd.MM.yyyy">Bad format</rule>
-            <rule name="flexible" value="true" />
-        </field>
-           <field name="DateToTestField" key="dttf" type="DateString" 
validator="DateRangeValidator">
-            <rule name="required" value="true">Required</rule>
-            <rule name="format" value="MM/dd/yyyy">Bad format</rule>
-               <rule name="greater-than" value="DateStringTestField">To-Date 
must be greater than From-Date</rule>
-           </field>
-               <field name="DoubleTestField" key="dtf" type="double">
-            <rule name="required" value="true">Required</rule>
-            <rule name="invalidNumber" value="">Not a number</rule>
-            <rule name="minValue" value="3.0">Too small</rule>
-            <rule name="maxValue" value="30.4">Too big</rule>
+        <field name="BigDecimalTestField" key="bdtf" type="BigDecimal">
+                <rule name="required" value="true">Required</rule>
+                <rule name="invalidNumber" value="">Not a number</rule>
+                <rule name="minValue" value="3.0">Too small</rule>
+                <rule name="maxValue" value="30.4">Too big</rule>
         </field>
-               <field name="ShortTestField" key="shtf" type="short">
-            <rule name="required" value="true">Required</rule>
-            <rule name="invalidNumber" value="">Not a number</rule>
-            <rule name="minValue" value="3">Too small</rule>
-            <rule name="maxValue" value="30">Too big</rule>
-        </field>
-               <field name="LongTestField" key="ltf" type="long">
-            <rule name="required" value="true">Required</rule>
-            <rule name="invalidNumber" value="">Not a number</rule>
-            <rule name="minValue" value="3">Too small</rule>
-            <rule name="maxValue" value="30">Too big</rule>
+        <field name="IntegerTestField" key="itf" type="int">
+                <rule name="required" value="true">Required</rule>
+                <rule name="invalidNumber" value="">Not a number</rule>
+                <rule name="minValue" value="3">Too small</rule>
+                <rule name="maxValue" value="30">Too big</rule>
         </field>
-               <field name="CustomTestField" key="ctf" type="custom" 
+            <field name="IntegerToTestField" key="ittf" type="int" 
validator="IntegerRangeValidator">
+                <rule name="required" value="true">Required</rule>
+                <rule name="invalidNumber" value="">Not a number</rule>
+                <rule name="greater-than" value="IntegerTestField">To-int must 
be greater than From-int</rule>
+            </field>
+        <field name="FloatTestField" key="ftf" type="float">
+                <rule name="required" value="true">Required</rule>
+                <rule name="invalidNumber" value="">Not a number</rule>
+                <rule name="minValue" value="3.0">Too small</rule>
+                <rule name="maxValue" value="30.4">Too big</rule>
+            </field>
+        <field name="FileItemTestField" key="fitf" type="FileItem">
+                <rule name="required" value="true">Required</rule>
+            </field>
+        <field name="DateStringTestField" key="dstf" type="DateString">
+                <rule name="required" value="true">Required</rule>
+                <rule name="format" value="MM/dd/yyyy">Bad format</rule>
+                <rule name="format1" value="dd.MM.yyyy">Bad format</rule>
+                <rule name="flexible" value="true" />
+            </field>
+          <field name="DateToTestField" key="dttf" type="DateString" 
validator="DateRangeValidator">
+                <rule name="required" value="true">Required</rule>
+                <rule name="format" value="MM/dd/yyyy">Bad format</rule>
+              <rule name="greater-than" value="DateStringTestField">To-Date 
must be greater than From-Date</rule>
+          </field>
+        <field name="DoubleTestField" key="dtf" type="double">
+                <rule name="required" value="true">Required</rule>
+                <rule name="invalidNumber" value="">Not a number</rule>
+                <rule name="minValue" value="3.0">Too small</rule>
+                <rule name="maxValue" value="30.4">Too big</rule>
+            </field>
+        <field name="ShortTestField" key="shtf" type="short">
+                <rule name="required" value="true">Required</rule>
+                <rule name="invalidNumber" value="">Not a number</rule>
+                <rule name="minValue" value="3">Too small</rule>
+                <rule name="maxValue" value="30">Too big</rule>
+            </field>
+        <field name="LongTestField" key="ltf" type="long">
+                <rule name="required" value="true">Required</rule>
+                <rule name="invalidNumber" value="">Not a number</rule>
+                <rule name="minValue" value="3">Too small</rule>
+                <rule name="maxValue" value="30">Too big</rule>
+            </field>
+        <field name="CustomTestField" key="ctf" type="custom" 
                    fieldClass="org.apache.fulcrum.intake.test.MyField">
             <rule name="required" value="true">Required</rule>
         </field>
diff --git a/src/test/org/apache/fulcrum/intake/IntakeTest.java 
b/src/test/org/apache/fulcrum/intake/IntakeTest.java
index ca29b23c..b4889fb9 100644
--- a/src/test/org/apache/fulcrum/intake/IntakeTest.java
+++ b/src/test/org/apache/fulcrum/intake/IntakeTest.java
@@ -28,6 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assertions.fail;
 
 import java.util.Arrays;
+import java.util.List;
 import java.util.Locale;
 
 import org.apache.fulcrum.intake.model.Field;
@@ -313,4 +314,35 @@ public class IntakeTest extends BaseUnit5Test
             assertEquals("Not a number", ve.getMessage(), "Entry was not a 
valid BigDecimal");
         }
     }
+    
+    /**
+     * @throws Exception generic exception
+     *
+     *  TODO getObjects is not working, deprecated?
+     */
+    @Test
+    public void testObjects() throws Exception
+    {
+        IntakeService is = (IntakeService) this.lookup( IntakeService.ROLE );
+        Group group = is.getGroup("ValidationTest");
+        assertNotNull(group);
+        
+        ParserService ps = (ParserService) this.lookup( ParserService.ROLE );
+        ValueParser pp = ps.getParser(DefaultParameterParser.class);
+
+        pp.setString("vt_0itf", "15");
+//        pp.setString("Username", "Joe");
+        
+        //  object leak in the init() method in IntakeTool?
+        group.init(pp);
+        
+        String html = group.getHtmlFormInput();
+        
+        List<Group> foundGroups = group.getObjects(pp);
+
+        System.out.println("foundGroups should not be null: " + foundGroups);
+        //assertTrue(foundGroups.size()>0, "The size should be > 0");
+        
+    }
+
 }

Reply via email to