You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@turbine.apache.org by gk...@apache.org on 2018/10/17 10:20:30 UTC

svn commit: r1844081 [2/2] - in /turbine/fulcrum/trunk/json: ./ api/ api/src/java/org/apache/fulcrum/json/ dist/ jackson/ jackson2/ jackson2/src/java/org/apache/fulcrum/json/jackson/ jackson2/src/test/org/apache/fulcrum/json/ jackson2/src/test/org/apac...

Modified: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperTest.java?rev=1844081&r1=1844080&r2=1844081&view=diff
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperTest.java (original)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JacksonMapperTest.java Wed Oct 17 10:20:29 2018
@@ -18,13 +18,11 @@ package org.apache.fulcrum.json.jackson;
  * specific language governing permissions and limitations
  * under the License.
  */
+
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Collection;
 import java.util.Date;
@@ -36,21 +34,20 @@ import org.apache.avalon.framework.activ
 import org.apache.avalon.framework.logger.ConsoleLogger;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.fulcrum.json.JsonService;
-import org.apache.fulcrum.json.Rectangle;
-import org.apache.fulcrum.json.TestClass;
+import org.apache.fulcrum.json.jackson.example.Bean;
+import org.apache.fulcrum.json.jackson.example.Rectangle;
+import org.apache.fulcrum.json.jackson.example.TestClass;
+import org.apache.fulcrum.json.jackson.mixins.BeanMixin;
+import org.apache.fulcrum.json.jackson.mixins.RectangleMixin;
+import org.apache.fulcrum.json.jackson.mixins.RectangleMixin2;
 import org.apache.fulcrum.testcontainer.BaseUnit4Test;
+import org.json.JSONArray;
+import org.json.JSONObject;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.SerializationFeature;
-
-
+import com.fasterxml.jackson.datatype.jsonorg.JsonOrgModule;
 
 /**
  * Jackson2 JSON Test
@@ -102,151 +99,51 @@ public class JacksonMapperTest extends B
     }
     @Test
     public void testSerializeWithCustomFilter() throws Exception {
-        Bean bean = new Bean();
-        bean.setName("joe");
-        bean.setAge(12);
-        String filteredBean  = sc.serializeOnlyFilter(bean, Bean.class, "name");
-        assertEquals("Ser filtered Bean failed ", "{\"name\":\"joe\"}", filteredBean);
-
-        Rectangle rectangle = new Rectangle(5, 10);
-        rectangle.setName("jim");
-        String filteredRectangle  = sc.serializeOnlyFilter(rectangle,
+        Bean filteredBean = new Bean();
+        filteredBean.setName("joe");
+        String bean = sc.serializeOnlyFilter(filteredBean, Bean.class, "name");
+        assertEquals("Ser filtered Bean failed ", "{\"name\":\"joe\"}", bean);
+
+        Rectangle filteredRectangle = new Rectangle(5, 10);
+        filteredRectangle.setName("jim");
+        String rectangle = sc.serializeOnlyFilter(filteredRectangle,
                 Rectangle.class, "w", "name");
         assertEquals("Ser filtered Rectangle failed ",
-                "{\"w\":5,\"name\":\"jim\"}", filteredRectangle);
+                "{\"w\":5,\"name\":\"jim\"}", rectangle);
+
     }
-    
     @Test
     public void testSerializationCollectionWithFilter() throws Exception {
 
         List<Bean> beanList = new ArrayList<Bean>();
         for (int i = 0; i < 10; i++) {
-            Bean bean = new Bean();
-            bean.setName("joe" + i);
-            bean.setAge(i);
-            beanList.add(bean);
+            Bean filteredBean = new Bean();
+            filteredBean.setName("joe" + i);
+            filteredBean.setAge(i);
+            beanList.add(filteredBean);
         }
-        String filteredResult = sc.serializeOnlyFilter(beanList, Bean.class, "name",
+        String result = sc.serializeOnlyFilter(beanList, Bean.class, "name",
                 "age");
         assertEquals(
                 "Serialization of beans failed ",
                 "[{'name':'joe0','age':0},{'name':'joe1','age':1},{'name':'joe2','age':2},{'name':'joe3','age':3},{'name':'joe4','age':4},{'name':'joe5','age':5},{'name':'joe6','age':6},{'name':'joe7','age':7},{'name':'joe8','age':8},{'name':'joe9','age':9}]",
-                filteredResult.replace('"', '\''));
+                result.replace('"', '\''));
     }
     
     @Test
-    public void testTwoSerializationCollectionWithTwoDifferentFilter() throws Exception {
-
-        List<Bean> beanList = new ArrayList<Bean>();
-        for (int i = 0; i < 10; i++) {
-            Bean bean = new Bean();
-            bean.setName("joe" + i);
-            bean.setAge(i);
-            beanList.add(bean);
-        }
-        String filteredResult = sc.serializeOnlyFilter(beanList, Bean.class, "name",
-                "age");
-        System.out.println( filteredResult );
-        assertEquals("Serialization of beans failed ",
-                "[{'name':'joe0','age':0},{'name':'joe1','age':1},{'name':'joe2','age':2},{'name':'joe3','age':3},{'name':'joe4','age':4},{'name':'joe5','age':5},{'name':'joe6','age':6},{'name':'joe7','age':7},{'name':'joe8','age':8},{'name':'joe9','age':9}]",
-        filteredResult.replace('"', '\''));
-        filteredResult = sc.serializeOnlyFilter(beanList, Bean.class, "name");
-        System.out.println( filteredResult );
-        assertEquals("Serialization of beans failed ",
-                     "[{'name':'joe0'},{'name':'joe1'},{'name':'joe2'},{'name':'joe3'},{'name':'joe4'},{'name':'joe5'},{'name':'joe6'},{'name':'joe7'},{'name':'joe8'},{'name':'joe9'}]",
-             filteredResult.replace('"', '\''));
-    }
-    
-    /** This may be a bug in jackson, the filter is not exchanged if the same class is matched again
-    * 
-    * first it may be com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap.Empty.serializerFor(Class<?>)
-    * and then 
-    * com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap.Single.serializerFor(Class<?>)
-    * which returns a serializer
-    * **/
-    @Test
-    public void testTwoSerializationCollectionNoAndWithFilter() throws Exception {
-        List<Bean> beanList = new ArrayList<Bean>();
-        for (int i = 0; i < 4; i++) {
-            Bean bean = new Bean();
-            bean.setName("joe" + i);
-            bean.setAge(i);
-            beanList.add(bean);
-        }
-        String filteredResult = sc.ser(beanList, Bean.class);//unfiltered
-        System.out.println( filteredResult );
-        assertEquals("First unfiltered serialization of beans failed ",
-                "[{'name':'joe0','age':0,'profession':''},{'name':'joe1','age':1,'profession':''},{'name':'joe2','age':2,'profession':''},{'name':'joe3','age':3,'profession':''}]",
-        filteredResult.replace('"', '\''));
-        
-        filteredResult = sc.serializeOnlyFilter(beanList, Bean.class, "name");
-        System.out.println( filteredResult );
-        // this may be a bug in jackson, serializer is reused, if not cleaned up
-        assertNotEquals("[{'name':'joe0'},{'name':'joe1'},{'name':'joe2'},{'name':'joe3'}]",
-        filteredResult.replace('"', '\''));
-        
-        // cleaning requires, that you have to provide some other type, which is different from the (typed) source object, 
-        // providing just new ArrayList<Bean>() only will not help, but an anonymous class may be sufficient.
-        // A simple object will do it, this resets to an unknown serializer, which eventaully does clean up  the serializer cache.
-        sc.serializeOnlyFilter(new Object(), new String[]{});
-        filteredResult = sc.serializeOnlyFilter(beanList, Bean.class, "name");
-        System.out.println( filteredResult );
-        assertEquals("Second filtered serialization of beans failed ", "[{'name':'joe0'},{'name':'joe1'},{'name':'joe2'},{'name':'joe3'}]",
-        filteredResult.replace('"', '\''));
-    }
-    
-    @Test
-    public void testSetMixin() {
-        Bean src = new Bean();
-        src.setName("joe");
-        src.setAge( 99 );
-        src.setProfession("runner");
-        //
-        // profession was already set to ignore, does not change
-        String result = null;
-        try
-        {
-            result = ((Jackson2MapperService)sc).withMixinModule(src, "mixinbean", Bean.class, BeanMixin.class );
-            assertEquals(
-                         "Ser filtered Bean failed ",
-                         "{\"name\":\"joe\"}",
-                         result);
-            // clean up buffer is not sufficient..
-            sc.serializeOnlyFilter(new Object(), new String[]{});
-            
-            // .. this assert result is not to be expected!!!
-            result = ((Jackson2MapperService)sc).withMixinModule(src, "mixin2bean", Bean.class, BeanMixin2.class );
-            assertEquals(
-                         "Ser filtered Bean failed ",
-                         "{\"name\":\"joe\"}",
-                         result);
-            // clean up of mixin and buffer required
-            
-            // clean up mixins 
-             ((Jackson2MapperService)sc).setMixins(Bean.class, BeanMixin2.class );
-             
-             // clean up buffer 
-             sc.serializeOnlyFilter(new Object(), new String[]{});
-             
-//           Map<Class<?>, Class<?>> sourceMixins = new HashMap<Class<?>, Class<?>>(1);
-//           sourceMixins.put( Bean.class,BeanMixin2.class );
-//           ((Jackson2MapperService)sc).getMapper().setMixIns( sourceMixins  );
-             result =sc.ser( src, Bean.class );
-             assertEquals(
-                     "Ser filtered Bean failed ",
-                     "{\"age\":99,\"profession\":\"runner\"}",
-                     result);
-        }
-        catch ( JsonProcessingException e )
-        {
-            logger.error( "err",e );
-           fail();
-        }
-        catch ( Throwable e )
-        {
-            logger.error( "err",e );
-            fail();
-        }
+    public void serializeMapWithListandString() throws Exception {
+        Map<String,Object> wrapper = new HashMap();
+        List myList = new ArrayList();
+        myList.add(new TestClass() );
+        wrapper.put( "list",myList );
+        if (wrapper != null) {
+            wrapper.put( "testkey", "xxxxx" );
+            logger.info( String.format("list has size: %s", wrapper.size()));
+        }
+        String serialized =  sc.ser( wrapper ); // sc.ser( wrapper, TestClass.class );
+        // {"testkey":"xxxxx","list":[{"container":"","configurationName":"Config.xml","name":""}]}
+        // {"testkey":"xxxxx","list":[{"container":"","configurationName":"Config.xml","name":""}]}
+        logger.info( String.format("serialized results: %s",serialized) );
 
     }
 
@@ -255,15 +152,15 @@ public class JacksonMapperTest extends B
 
         List<Bean> beanList = new ArrayList<Bean>();
         for (int i = 0; i < 10; i++) {
-            Bean bean = new Bean();
-            bean.setName("joe" + i);
-            bean.setAge(i);
-            beanList.add(bean);
+            Bean filteredBean = new Bean();
+            filteredBean.setName("joe" + i);
+            filteredBean.setAge(i);
+            beanList.add(filteredBean);
         }
-        String filteredResult = sc.serializeOnlyFilter(beanList, Bean.class, "name",
+        String result = sc.serializeOnlyFilter(beanList, Bean.class, "name",
                 "age");
         List<Bean> beanList2 = (List<Bean>) ((Jackson2MapperService) sc)
-                .deSerCollectionWithType(filteredResult, List.class, Bean.class);
+                .deSerCollectionWithType(result, List.class, Bean.class);
         assertTrue("DeSer failed ", beanList2.size() == 10);
         for (Bean bean : beanList2) {
             assertEquals("DeSer failed ", Bean.class, bean.getClass());
@@ -275,14 +172,14 @@ public class JacksonMapperTest extends B
 
         List<Bean> beanList = new ArrayList<Bean>();
         for (int i = 0; i < 10; i++) {
-            Bean bean = new Bean();
-            bean.setName("joe" + i);
-            bean.setAge(i);
-            beanList.add(bean);
+            Bean filteredBean = new Bean();
+            filteredBean.setName("joe" + i);
+            filteredBean.setAge(i);
+            beanList.add(filteredBean);
         }
-        String filteredResult = sc.serializeOnlyFilter(beanList, Bean.class, "name",
+        String result = sc.serializeOnlyFilter(beanList, Bean.class, "name",
                 "age");
-        Object beanList2 = sc.deSer(filteredResult, List.class);
+        Object beanList2 = sc.deSer(result, List.class);
         assertTrue("DeSer failed ", beanList2 instanceof List);
         assertTrue("DeSer failed ", ((List) beanList2).size() == 10);
         for (int i = 0; i < ((List) beanList2).size(); i++) {
@@ -295,56 +192,95 @@ public class JacksonMapperTest extends B
         }
     }
     
+    // support for org.json mapping 
+    @Test
+    public void testDeSerToORGJSONCollectionObject() throws Exception {
+        // test array
+         List<Bean> beanResults = new ArrayList<Bean> ( );
+         Bean tu = new Bean();
+         tu.setName("jim jar");
+         beanResults.add(tu);
+         Bean tu2 = new Bean();
+         tu2.setName("jim2 jar2");
+         tu2.setAge(45);
+         beanResults.add(tu2);
+         
+         String[] filterAttr = {"name", "age" };   
+         String filteredSerList = sc.serializeOnlyFilter(beanResults, Bean.class, filterAttr);
+         logger.debug("serList: "+ filteredSerList);
+   
+         sc.addAdapter(null, null,new JsonOrgModule());
+         //((Jackson2MapperService)sc).registerModule(new JsonOrgModule());
+         
+         JSONArray jsonOrgResult = sc.deSer(filteredSerList, JSONArray.class);//readValue(serList, JSONArray.class);
+         logger.debug("jsonOrgResult: "+ jsonOrgResult.toString(2));
+         assertEquals("DeSer failed ", "jim jar", ((JSONObject)(jsonOrgResult.get(0))).get("name") );
+         assertEquals("DeSer failed ", 45, ((JSONObject)(jsonOrgResult.get(1))).get("age") );      
+    }
+    
+    // support for org.json mapping 
+    @Test
+    public void testSerToORGJSONCollectionObject() throws Exception {
+  
+        // test array
+         List<Bean> userResults = new ArrayList<Bean> ( );
+         Bean tu = new Bean();
+         tu.setName("jim jar");
+         userResults.add(tu);
+         Bean tu2 = new Bean();
+         tu2.setName("jim2 jar2");
+         tu2.setAge(45);
+         userResults.add(tu2);
+         
+         String[] filterAttr = {"name", "age" };
+         
+         sc.addAdapter(null, null,new JsonOrgModule());
+         //((Jackson2MapperService)sc).registerModule(new JsonOrgModule());
+         String filteredSerList = sc.serializeOnlyFilter(userResults, Bean.class, filterAttr);
+         logger.debug("serList: "+ filteredSerList);
+         
+    }
+    
     @Test
     public void testSerializeWithMixin() throws Exception {
-        Rectangle rectangle = new Rectangle(5, 10);
-        rectangle.setName("jim");
-        String filteredRectangle = sc
-                .addAdapter("M4RMixin", Rectangle.class, Mixin.class).ser(rectangle);
-        assertEquals("Ser failed ", "{\"width\":5}", filteredRectangle);
+        Rectangle filteredRectangle = new Rectangle(5, 10);
+        filteredRectangle.setName("jim");
+        String serRect = sc
+                .addAdapter("M4RMixin", Rectangle.class, RectangleMixin.class).ser(
+                        filteredRectangle);
+        assertEquals("Ser failed ", "{\"width\":5}", serRect);
     }
     @Test
     public void testSerializeWith2Mixins() throws Exception {
-        Bean bean = new Bean();
-        bean.setName("joe");
+        Bean filteredBean = new Bean();
+        filteredBean.setName("joe");
         Rectangle filteredRectangle = new Rectangle(5, 10);
         filteredRectangle.setName("jim");
 
         String serRect = sc.addAdapter("M4RMixin2", Rectangle.class,
-                Mixin2.class).ser(filteredRectangle);
+                RectangleMixin2.class).ser(filteredRectangle);
         assertEquals("Ser failed ", "{\"name\":\"jim\",\"width\":5}", serRect);
 
-        String filteredBean = sc.serializeOnlyFilter(bean, Bean.class, "name");
-        assertEquals("Ser filtered Bean failed ", "{\"name\":\"joe\"}", filteredBean);
+        String bean = sc.serializeOnlyFilter(filteredBean, Bean.class, "name");
+        assertEquals("Ser filtered Bean failed ", "{\"name\":\"joe\"}", bean);
     }
     @Test
     public void testSerializationCollectionWithMixin() throws Exception {
 
         List<Bean> beanList = new ArrayList<Bean>();
         for (int i = 0; i < 10; i++) {
-            Bean bean = new Bean();
-            bean.setName("joe" + i);
-            bean.setAge(i);
-            beanList.add(bean);
+            Bean filteredBean = new Bean();
+            filteredBean.setName("joe" + i);
+            filteredBean.setAge(i);
+            beanList.add(filteredBean);
         }
-        String filterResult = sc.addAdapter("M4RMixin", Bean.class, BeanMixin.class)
+        String result = sc.addAdapter("M4RMixin", Bean.class, BeanMixin.class)
                 .ser(beanList);
         assertEquals(
                 "Serialization of beans failed ",
                 "[{'name':'joe0'},{'name':'joe1'},{'name':'joe2'},{'name':'joe3'},{'name':'joe4'},{'name':'joe5'},{'name':'joe6'},{'name':'joe7'},{'name':'joe8'},{'name':'joe9'}]",
-                filterResult.replace('"', '\''));
+                result.replace('"', '\''));
     }
-    
-    @Test
-    public void testSerializationBeanWithMixin() throws Exception {
-        Bean bean = new Bean();
-        bean.setName("joe1");
-        bean.setAge(1);
-        String filterResult = sc.addAdapter("M4RMixin", Bean.class, BeanMixin.class)
-                .ser(bean);
-        logger.debug("filterResult: "+ filterResult.toString());
-    }
-    
     @Test
     public void testDeSerUnQuotedObject() throws Exception {
         String jsonString = "{name:\"joe\"}";
@@ -371,14 +307,14 @@ public class JacksonMapperTest extends B
 
         List<Bean> beanList = new ArrayList<Bean>();
         for (int i = 0; i < 10; i++) {
-            Bean bean = new Bean();
-            bean.setName("joe" + i);
-            bean.setAge(i);
-            beanList.add(bean);
+            Bean filteredBean = new Bean();
+            filteredBean.setName("joe" + i);
+            filteredBean.setAge(i);
+            beanList.add(filteredBean);
         }
-        String filterResult = sc.addAdapter("M4RMixin", Bean.class, BeanMixin.class)
+        String result = sc.addAdapter("M4RMixin", Bean.class, BeanMixin.class)
                 .ser(beanList);
-        Object beanList2 = sc.deSer(filterResult,
+        Object beanList2 = sc.deSer(result,
                 List.class);
         assertTrue("DeSer failed ", beanList2 instanceof List);
         assertTrue("DeSer failed ", ((List) beanList2).size() == 10);
@@ -403,7 +339,7 @@ public class JacksonMapperTest extends B
             components.add(filteredBean);
         }
 
-        sc.addAdapter("M4RMixin", Rectangle.class, Mixin.class).addAdapter(
+        sc.addAdapter("M4RMixin", Rectangle.class, RectangleMixin.class).addAdapter(
                 "M4BeanRMixin", Bean.class, BeanMixin.class);
         String serRect = sc.ser(components);
         assertEquals(
@@ -414,7 +350,7 @@ public class JacksonMapperTest extends B
         // adding h and name for first two items, adding width for beans
         String deSerTest = "[{\"width\":25,\"age\":99, \"h\":50,\"name\":\"rect1\"},{\"width\":250,\"name\":\"rect2\"},{\"name\":\"joe0\"},{\"name\":\"joe1\"},{\"name\":\"joe2\"}]";
         
-        List typeRectList = new ArrayList(); //empty
+        List<Rectangle> typeRectList = new ArrayList<>(); //empty
         // could not use Mixins here, but Adapters are still set
         Collection<Rectangle> resultList0 =  sc.deSerCollection(deSerTest, typeRectList, Rectangle.class);
         logger.debug("resultList0 class:" +resultList0.getClass());
@@ -430,7 +366,7 @@ public class JacksonMapperTest extends B
             logger.debug("resultList1 "+i+ " name:"+((List<Bean>)resultList1).get(i).getName());
             // name should NOT be null, age should be ignored, cft. BeanMixin
             assertTrue(((List<Bean>)resultList1).get(i).getName()!=null);
-            assertTrue(((List<Bean>)resultList1).get(i).getAge()==0);
+            assertTrue(((List<Bean>)resultList1).get(i).getAge()==-1);
         }
         ((Initializable)sc).initialize();// reinit to default settings
         Collection<Rectangle> resultList3 =  sc.deSerCollection(deSerTest, typeRectList, Rectangle.class);
@@ -441,127 +377,5 @@ public class JacksonMapperTest extends B
             assertTrue(((List<Rectangle>)resultList3).get(i).getName()!=null);
         }
     }
-    
-    @Test
-    public void testSerializeListWithWrapper()  {
-        try
-        {
-            Bean bean = new Bean();
-            bean.setName("joe");
-            bean.setAge(12);
-            String filteredBean  = sc.serializeOnlyFilter(bean, Bean.class, "name");
-            assertEquals("Ser filtered Bean failed ", "{\"name\":\"joe\"}", filteredBean);
-
-            Rectangle rectangle = new Rectangle(5, 10);
-            rectangle.setName("quadro");
-            String filteredRectangle  = sc.serializeOnlyFilter(rectangle,
-                    Rectangle.class, "w", "name");
-            assertEquals("Ser filtered Rectangle failed ",
-                    "{\"w\":5,\"name\":\"quadro\"}", filteredRectangle);
-            
-            Bean bean2 = new Bean();
-            bean2.setName("jim");
-            bean2.setAge(92);
-            List<Bean> beans = Arrays.asList( bean, bean2 );
-            List<Rectangle> rectangles = Arrays.asList( rectangle );
-            List wrapper = new ArrayList();
-            wrapper.addAll( beans ); wrapper.addAll( rectangles );
-            
-            //String wrappedLists =  sc.serializeOnlyFilter( wrapper, "name" );
-            String jsonResult =  sc.ser( wrapper );
-            // res:wrappedLists:[{"name":"joe","age":12,"profession":""},{"w":5,"h":10,"name":"jim","size":50}]
-            logger.debug( "jsonResult provided wrapper:" +jsonResult );
-            List listResult = (List) ((Jackson2MapperService)sc).deSerCollectionWithType( jsonResult, ArrayList.class,Object.class );
-            logger.debug( " provided wrapper lists:" +listResult );
-            
-            String jsonResult2 =  ((Jackson2MapperService)sc).ser( false, bean, bean2, rectangle );
-            logger.debug( "jsonResult2 bean, rectangle / no collection:" +jsonResult2 );
-            List listResult2 = (List) ((Jackson2MapperService)sc).deSerCollectionWithType( jsonResult2, ArrayList.class,Object.class );
-            logger.debug( "bean, rectangle / no collection lists:" +listResult2 );
-            assertTrue( jsonResult.equals( jsonResult2 ) );
-            listResult2.removeAll( listResult );
-            assertTrue( listResult2.isEmpty() );
-            
-            String jsonResult3 =  ((Jackson2MapperService)sc).ser( false, (Collection)beans, (Collection)rectangles );
-            // this wrape anything
-            logger.debug( "jsonResult3 raw lists:" +jsonResult3 ); 
-            List<List> listResult3 = (List) ((Jackson2MapperService)sc).deSerCollectionWithType( jsonResult3, ArrayList.class,List.class );
-            logger.debug( "raw lists:" +listResult3 );
-            listResult3.get( 0 ).removeAll( listResult );
-            listResult3.get( 1 ).removeAll( listResult );
-            assertTrue( listResult3.get( 0 ).isEmpty() );
-            assertTrue( listResult3.get( 1 ).isEmpty() );
-            
-            // this does not get any information, just to demonstrate
-            TypeReference<List<?>> typeRef = new TypeReference<List<?>>(){};
-            String jsonResult4 = ((Jackson2MapperService)sc).serCollectionWithTypeReference(wrapper,typeRef, false);
-            logger.debug( "jsonResult4 typereference:" +jsonResult4 );
-            List<Object> listResult4 = (List) ((Jackson2MapperService)sc).deSerCollectionWithType( jsonResult4, ArrayList.class,Object.class );
-            logger.debug( "typereference lists:" +listResult4 );
-            listResult4.removeAll( listResult );
-            assertTrue( listResult4.isEmpty() );
-
-            ((Jackson2MapperService)sc).getMapper().enable(SerializationFeature.WRAP_ROOT_VALUE);
-            String jsonResult5 =  sc.ser( wrapper );
-            // res:wrappedLists:[{"name":"joe","age":12,"profession":""},{"w":5,"h":10,"name":"jim","size":50}]
-            logger.debug( "jsonResult5 wrap root:" +jsonResult5 );
-            
-            ((Jackson2MapperService)sc).getMapper().configure(DeserializationFeature.ACCEPT_SINGLE_VALUE_AS_ARRAY, true);
-            List<Object> listResult5 = (List) ((Jackson2MapperService)sc)
-                            .deSerCollectionWithType( jsonResult4, ArrayList.class,Object.class );
-            logger.debug( "wrap root lists:" +listResult5 );
-            listResult5.removeAll( listResult );
-            assertTrue( listResult5.isEmpty() );
-            List<Object> listResult51 = (List) ((Jackson2MapperService)sc)
-                            .deSerCollectionWithTypeReference( jsonResult5, new TypeReference<List<?>>() {} );
-            logger.debug( "wrap root lists typereferenced:" +listResult51 );
-            ((Map<String, List>)listResult51.get( 0 )).values().iterator().next().removeAll( listResult );
-            assertTrue( ((Map<String, List>)listResult51.get( 0 )).values().iterator().next().isEmpty() );
-            
-            
-        }
-        catch ( Exception e )
-        {
-            e.printStackTrace();
-           fail();
-        } 
-    }
-
-
-    public static abstract class Mixin2 {
-        void MixIn2(int w, int h) {
-        }
-
-        @JsonProperty("width")
-        abstract int getW(); // rename property
-
-        @JsonIgnore
-        abstract int getH();
-
-        @JsonIgnore
-        abstract int getSize(); // exclude
-
-        abstract String getName();
-    }
-
-    public static abstract class BeanMixin {
-        BeanMixin() {
-        }
-
-        @JsonIgnore
-        abstract int getAge();
-
-        @JsonIgnore
-        String profession; // exclude
-
-        @JsonProperty
-        abstract String getName();//
-    }
-    public static abstract class BeanMixin2 extends Bean {
-        BeanMixin2() {
-        }
-        @JsonIgnore
-        public abstract String getName();//
-    }
 
 }

Modified: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JsonOrgJacksonMapperTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JsonOrgJacksonMapperTest.java?rev=1844081&r1=1844080&r2=1844081&view=diff
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JsonOrgJacksonMapperTest.java (original)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JsonOrgJacksonMapperTest.java Wed Oct 17 10:20:29 2018
@@ -29,6 +29,7 @@ import java.util.Map;
 import org.apache.avalon.framework.logger.ConsoleLogger;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.fulcrum.json.JsonService;
+import org.apache.fulcrum.json.jackson.example.Bean;
 import org.apache.fulcrum.testcontainer.BaseUnit4Test;
 import org.json.JSONArray;
 import org.json.JSONObject;

Modified: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JsonPathJacksonTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JsonPathJacksonTest.java?rev=1844081&r1=1844080&r2=1844081&view=diff
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JsonPathJacksonTest.java (original)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/JsonPathJacksonTest.java Wed Oct 17 10:20:29 2018
@@ -33,8 +33,9 @@ import java.util.Map;
 import org.apache.avalon.framework.logger.ConsoleLogger;
 import org.apache.avalon.framework.logger.Logger;
 import org.apache.fulcrum.json.JsonService;
-import org.apache.fulcrum.json.Rectangle;
-import org.apache.fulcrum.json.TestClass;
+import org.apache.fulcrum.json.jackson.example.Bean;
+import org.apache.fulcrum.json.jackson.example.Rectangle;
+import org.apache.fulcrum.json.jackson.example.TestClass;
 import org.apache.fulcrum.testcontainer.BaseUnit4Test;
 import org.json.JSONArray;
 import org.json.JSONObject;
@@ -79,6 +80,7 @@ public class JsonPathJacksonTest extends
                 fail(e.getMessage());
             }
         }
+
     }
 
     @Test

Modified: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/concurrent/JSONConcurrentTest.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/concurrent/JSONConcurrentTest.java?rev=1844081&r1=1844080&r2=1844081&view=diff
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/concurrent/JSONConcurrentTest.java (original)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/concurrent/JSONConcurrentTest.java Wed Oct 17 10:20:29 2018
@@ -34,9 +34,9 @@ import java.util.concurrent.CountDownLat
 
 import org.apache.avalon.framework.component.ComponentException;
 import org.apache.fulcrum.json.JsonService;
-import org.apache.fulcrum.json.jackson.Bean;
 import org.apache.fulcrum.json.jackson.Jackson2MapperService;
 import org.apache.fulcrum.json.jackson.SimpleNameIntrospector;
+import org.apache.fulcrum.json.jackson.example.Bean;
 import org.apache.fulcrum.testcontainer.BaseUnit4Test;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -64,12 +64,10 @@ public class JSONConcurrentTest extends
    private static volatile Thread fTwo = null;
    private static volatile Thread fThree = null;
    private static JsonService jsonService = null;
-    
 
 //    
     public JSONConcurrentTest( )
                     throws Exception {}
-      
 
     @BeforeClass
     public static void setUp() throws Exception
@@ -93,13 +91,12 @@ public class JSONConcurrentTest extends
        
          @Before
          public void init() throws ComponentException {
-
              fSynchronizer = new CountDownLatch(N);
          }
          @Test
          public void one() throws InterruptedException {
              String result = doJob("name");
-             assertTrue("Result does contain type", !result.contains( "org.apache.fulcrum.json.jackson.Bean" )  );
+             assertTrue("Result does contain type", !result.contains( "org.apache.fulcrum.json.jackson.example.Bean" )  );
              assertTrue("Result does contain type", !result.contains( "java.util.ArrayList" )  );
              fSynchronizer.countDown();
              //assertTrue("waiting failed", fSynchronizer.await(TIMEOUT, TimeUnit.SECONDS));
@@ -110,7 +107,7 @@ public class JSONConcurrentTest extends
           public void two() throws InterruptedException {
               String result = doJob( "name", "age");
               
-              assertTrue("Result does contain type", !result.contains( "org.apache.fulcrum.json.jackson.Bean" )  );
+              assertTrue("Result does contain type", !result.contains( "org.apache.fulcrum.json.jackson.example.Bean" )  );
               assertTrue("Result does contain type", !result.contains( "java.util.ArrayList" )  );
               fSynchronizer.countDown();
               //assertTrue("waiting failed", fSynchronizer.await(TIMEOUT, TimeUnit.SECONDS));
@@ -123,7 +120,8 @@ public class JSONConcurrentTest extends
               //((Jackson2MapperService) jsonService).setMapper(mapper);
               //String result = doTaskJob("name", "age","profession");
               String result = doFilteredJob(mapper, new String[]{"age","profession"});
-              assertTrue("Result does not contain type, which it should", result.contains( "org.apache.fulcrum.json.jackson.Bean" )  );
+              assertTrue("Result does not contain type, which it should", result.contains( "org.apache"
+                  + ".fulcrum.json.jackson.example.Bean" )  );
               assertTrue("Result does not contain type, which it should", result.contains( "java.util.ArrayList" )  );
               assertTrue("Result should not contain attribute name", !result.contains( "\"name\"" )  );
               fSynchronizer.countDown();
@@ -173,7 +171,7 @@ public class JSONConcurrentTest extends
               return mapper.writer(filter).writeValueAsString(list);
           }
           
-          private ObjectMapper customMapper(boolean withType) {
+          private ObjectMapper customMapper(boolean withType) {              
               ObjectMapper objectMapper = new ObjectMapper(
                       new MappingJsonFactory(((Jackson2MapperService) jsonService).getMapper()));
               if (withType) objectMapper.enableDefaultTypingAsProperty(
@@ -231,7 +229,7 @@ public class JSONConcurrentTest extends
     
     public static String getFailures(Result result) {
         List<Failure> failures = result.getFailures() ;
-        StringBuilder sb = new StringBuilder();
+        StringBuffer sb = new StringBuffer();
         for (Failure failure : failures) {
             sb.append(failure.getMessage()); 
             //System.out.println(failure.getMessage());
@@ -242,7 +240,7 @@ public class JSONConcurrentTest extends
     
     public static String getTrace(Result result) {
         List<Failure> failures = result.getFailures() ;
-        StringBuilder sb = new StringBuilder();
+        StringBuffer sb = new StringBuffer();
         for (Failure failure : failures) {
             failure.getException().printStackTrace();
             if (failure.getException().getCause() != null) 

Added: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/Bean.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/Bean.java?rev=1844081&view=auto
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/Bean.java (added)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/Bean.java Wed Oct 17 10:20:29 2018
@@ -0,0 +1,48 @@
+package org.apache.fulcrum.json.jackson.example;
+/*
+ * 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.
+ */
+public class Bean {
+    private String name;
+    private int age = -1;
+    public String profession;
+
+    public Bean() {
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public int getAge() {
+        return age;
+    }
+
+    public void setAge(int age) {
+        this.age = age;
+    }
+    public void setProfession( String profession )
+    {
+        this.profession = profession;
+        
+    }
+}

Propchange: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/Bean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/BeanChild.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/BeanChild.java?rev=1844081&view=auto
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/BeanChild.java (added)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/BeanChild.java Wed Oct 17 10:20:29 2018
@@ -0,0 +1,39 @@
+package org.apache.fulcrum.json.jackson.example;
+
+
+/*
+ * 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.
+ */
+public class BeanChild extends Bean {
+    private String name;
+    private int height;
+    public String type;
+
+    public BeanChild() {
+    }
+
+    @Override
+    public String getName() {
+        return name;
+    }
+
+    @Override
+    public void setName(String name) {
+        this.name = name;
+    }
+}

Propchange: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/BeanChild.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/Rectangle.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/Rectangle.java?rev=1844081&view=auto
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/Rectangle.java (added)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/Rectangle.java Wed Oct 17 10:20:29 2018
@@ -0,0 +1,58 @@
+package org.apache.fulcrum.json.jackson.example;
+/*
+ * 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.
+ */
+public final class Rectangle {
+    private int w, h;
+    private String name;
+ 
+    public Rectangle() {
+        // may be this is needed for deserialization, if not set otherwise
+    }
+    
+    public Rectangle(int w, int h) {
+        this.w = w;
+        this.h = h;
+    }
+
+    public Rectangle(int w, int h, String name) {
+        this.w = w;
+        this.h = h;
+        this.name = name;
+    }
+
+    public int getW() {
+        return w;
+    }
+
+    public int getH() {
+        return h;
+    }
+
+    public int getSize() {
+        return w * h;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}
\ No newline at end of file

Propchange: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/Rectangle.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/TestClass.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/TestClass.java?rev=1844081&view=auto
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/TestClass.java (added)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/TestClass.java Wed Oct 17 10:20:29 2018
@@ -0,0 +1,68 @@
+package org.apache.fulcrum.json.jackson.example;
+/*
+ * 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.HashMap;
+import java.util.Map;
+
+public class TestClass
+
+{
+    /** Container for the components */
+    private Map<String, Object> container;
+    /** Setup our default configurationFileName */
+    private String configurationName = "Config.xml";
+
+    public Map<String, Object> getContainer() {
+        return container;
+    }
+
+    public void setContainer(Map<String, Object> container) {
+        this.container = container;
+    }
+
+    /** Setup our default parameterFileName */
+    private String name = null;
+
+    public TestClass() {
+        // TODO Auto-generated constructor stub
+    }
+
+    public TestClass(String name) {
+        this.name = name;
+        this.container = new HashMap<String, Object>();
+        this.container.put("cf", configurationName);
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getConfigurationName() {
+        return configurationName;
+    }
+
+    public void setConfigurationName(String configurationName) {
+        this.configurationName = configurationName;
+    }
+
+}

Propchange: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/example/TestClass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/BeanMixin.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/BeanMixin.java?rev=1844081&view=auto
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/BeanMixin.java (added)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/BeanMixin.java Wed Oct 17 10:20:29 2018
@@ -0,0 +1,35 @@
+package org.apache.fulcrum.json.jackson.mixins;
+/*
+ * 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 com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public abstract class BeanMixin {
+    BeanMixin() {
+    }
+
+    @JsonIgnore
+    abstract int getAge();
+
+    @JsonIgnore
+    String profession; // exclude
+
+    @JsonProperty
+    abstract String getName();//
+}
\ No newline at end of file

Propchange: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/BeanMixin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/BeanMixin2.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/BeanMixin2.java?rev=1844081&view=auto
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/BeanMixin2.java (added)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/BeanMixin2.java Wed Oct 17 10:20:29 2018
@@ -0,0 +1,13 @@
+package org.apache.fulcrum.json.jackson.mixins;
+
+import org.apache.fulcrum.json.jackson.example.Bean;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
+public abstract class BeanMixin2 extends Bean {
+    BeanMixin2() {
+    }
+    @Override
+    @JsonIgnore
+    public abstract String getName();//
+}

Propchange: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/BeanMixin2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/RectangleMixin.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/RectangleMixin.java?rev=1844081&view=auto
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/RectangleMixin.java (added)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/RectangleMixin.java Wed Oct 17 10:20:29 2018
@@ -0,0 +1,39 @@
+package org.apache.fulcrum.json.jackson.mixins;
+
+/*
+ * 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 com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public abstract class RectangleMixin {
+    void MixIn(int w, int h) {
+    }
+
+    @JsonProperty("width")
+    abstract int getW(); // rename property
+
+    @JsonIgnore
+    abstract int getH();
+
+    @JsonIgnore
+    abstract int getSize(); // exclude
+
+    @JsonIgnore
+    abstract String getName();
+}

Propchange: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/RectangleMixin.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/RectangleMixin2.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/RectangleMixin2.java?rev=1844081&view=auto
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/RectangleMixin2.java (added)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/RectangleMixin2.java Wed Oct 17 10:20:29 2018
@@ -0,0 +1,39 @@
+package org.apache.fulcrum.json.jackson.mixins;
+
+/*
+ * 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 com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonProperty;
+
+public abstract class RectangleMixin2 {
+    
+    void MixIn2(int w, int h) {
+    }
+
+    @JsonProperty("width")
+    abstract int getW(); // rename property
+
+    @JsonIgnore
+    abstract int getH();
+
+    @JsonIgnore
+    abstract int getSize(); // exclude
+
+    abstract String getName();
+}

Propchange: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/RectangleMixin2.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/TypedRectangle.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/TypedRectangle.java?rev=1844081&view=auto
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/TypedRectangle.java (added)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/TypedRectangle.java Wed Oct 17 10:20:29 2018
@@ -0,0 +1,70 @@
+package org.apache.fulcrum.json.jackson.mixins;
+
+/*
+ * 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 com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.annotation.JsonTypeInfo.As;
+import com.fasterxml.jackson.annotation.JsonTypeInfo.Id;
+
+
+@JsonTypeInfo(include=As.PROPERTY, use=Id.CLASS, property="type")
+public final class TypedRectangle {
+
+// This is only need if no DefaultTyping is set; you have then assign this to object if using collections
+    @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "type")
+    public static class Mixins {    }
+    
+    private int w, h;
+    private String name;
+ 
+    public TypedRectangle() {
+        // may be is needed for deserialization, if not set otherwise
+    }
+    
+    public TypedRectangle(int w, int h) {
+        this.w = w;
+        this.h = h;
+    }
+
+    public TypedRectangle(int w, int h, String name) {
+        this.w = w;
+        this.h = h;
+        this.name = name;
+    }
+
+    public int getW() {
+        return w;
+    }
+
+    public int getH() {
+        return h;
+    }
+
+    public int getSize() {
+        return w * h;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+}
\ No newline at end of file

Propchange: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/mixins/TypedRectangle.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestDeserializer.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestDeserializer.java?rev=1844081&view=auto
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestDeserializer.java (added)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestDeserializer.java Wed Oct 17 10:20:29 2018
@@ -0,0 +1,72 @@
+package org.apache.fulcrum.json.jackson.serializers;
+
+/*
+ * 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.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.fulcrum.json.jackson.example.Rectangle;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+
+public class TestDeserializer extends StdDeserializer<List<Rectangle>> {
+
+    /**
+	 * 
+	 */
+    private static final long serialVersionUID = 1L;
+
+    public TestDeserializer() {
+        super(List.class);
+    }
+
+    @Override
+    public List<Rectangle> deserialize(JsonParser jp,
+            DeserializationContext ctxt) throws IOException,
+            JsonProcessingException {
+
+        ArrayList<Rectangle> list = new ArrayList<Rectangle>();
+        // if (jp.getCurrentToken() == JsonToken.START_OBJECT)
+        // jp.nextToken(); //
+        // START_OBJECT
+        while ((jp.nextToken() != JsonToken.END_OBJECT)) {
+            String name = null;
+            Number size = null;
+            int value = 0;
+            if (jp.getCurrentToken() == JsonToken.FIELD_NAME) {
+                name = jp.getText(); // FIELD_NAME
+                jp.nextToken();
+
+            }
+            if (jp.getCurrentToken() == JsonToken.VALUE_NUMBER_INT) {
+                size = jp.getNumberValue();// size VALUE_NUMBER_INT
+                value = (int) Math.sqrt(size.intValue());
+            }
+            list.add(new Rectangle(value, value, name));
+        }
+        return list;
+    }
+
+}

Propchange: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestDeserializer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestDummyWrapperDeserializer.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestDummyWrapperDeserializer.java?rev=1844081&view=auto
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestDummyWrapperDeserializer.java (added)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestDummyWrapperDeserializer.java Wed Oct 17 10:20:29 2018
@@ -0,0 +1,55 @@
+package org.apache.fulcrum.json.jackson.serializers;
+
+/*
+ * 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.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.JsonToken;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+
+public class TestDummyWrapperDeserializer<T> extends StdDeserializer<List<T>> {
+
+    /**
+	 * 
+	 */
+    private static final long serialVersionUID = 1L;
+
+
+    public TestDummyWrapperDeserializer( Class<T> vc )
+    {
+        super( vc );
+    }
+    
+    @Override
+    public List<T> deserialize( JsonParser jp, DeserializationContext ctxt )
+        throws IOException, JsonProcessingException
+    {
+        ArrayList<T> list = new ArrayList<T>();
+        while ((jp.nextToken() != JsonToken.END_OBJECT)) {
+          list.add( (T) jp.getCurrentToken() );
+        }
+      return list;
+    }
+}

Propchange: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestDummyWrapperDeserializer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestJsonSerializer.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestJsonSerializer.java?rev=1844081&view=auto
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestJsonSerializer.java (added)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestJsonSerializer.java Wed Oct 17 10:20:29 2018
@@ -0,0 +1,52 @@
+package org.apache.fulcrum.json.jackson.serializers;
+
+
+/*
+ * 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.io.IOException;
+
+import org.apache.fulcrum.json.jackson.example.TestClass;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+
+public class TestJsonSerializer extends StdSerializer<TestClass> {
+
+    public TestJsonSerializer() {
+        super(TestClass.class, false);
+    }
+
+    @Override
+    public void serialize(TestClass value, JsonGenerator jgen,
+            SerializerProvider provider) throws IOException,
+            JsonGenerationException {
+        jgen.writeStartObject();
+        jgen.writeFieldName("n");
+        jgen.writeString(value.getName());
+        jgen.writeFieldName("p");
+        jgen.writeString(value.getConfigurationName());
+        jgen.writeArrayFieldStart("c");
+        jgen.writeEndArray();
+        jgen.writeEndObject();
+    }
+
+}
\ No newline at end of file

Propchange: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestJsonSerializer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestSerializer.java
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestSerializer.java?rev=1844081&view=auto
==============================================================================
--- turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestSerializer.java (added)
+++ turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestSerializer.java Wed Oct 17 10:20:29 2018
@@ -0,0 +1,50 @@
+package org.apache.fulcrum.json.jackson.serializers;
+
+/*
+ * 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.io.IOException;
+import java.util.List;
+
+import org.apache.fulcrum.json.jackson.example.Rectangle;
+
+import com.fasterxml.jackson.core.JsonGenerationException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+
+public class TestSerializer extends StdSerializer<List<Rectangle>> {
+
+    public TestSerializer() {
+        super(List.class, false);
+    }
+
+    @Override
+    public void serialize(List<Rectangle> data, JsonGenerator jgen,
+            SerializerProvider provider) throws IOException,
+            JsonGenerationException {
+        jgen.writeStartObject();
+        for (int i = 0; i < data.size(); i++) {
+            jgen.writeFieldName(data.get(i).getName());
+            jgen.writeNumber(data.get(i).getSize());
+        }
+        jgen.writeEndObject();
+
+    }
+}

Propchange: turbine/fulcrum/trunk/json/jackson2/src/test/org/apache/fulcrum/json/jackson/serializers/TestSerializer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: turbine/fulcrum/trunk/json/pom.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/pom.xml?rev=1844081&r1=1844080&r2=1844081&view=diff
==============================================================================
--- turbine/fulcrum/trunk/json/pom.xml (original)
+++ turbine/fulcrum/trunk/json/pom.xml Wed Oct 17 10:20:29 2018
@@ -27,7 +27,7 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>org.apache.fulcrum</groupId>
     <artifactId>fulcrum-json-parent</artifactId>
-    <version>1.1.2-SNAPSHOT</version>
+    <version>2.0.0-SNAPSHOT</version>
     <packaging>pom</packaging>
     <name>Fulcrum JSON Master Build</name>
     <url>http://turbine.apache.org/fulcrum/fulcrum-json/</url>
@@ -36,7 +36,6 @@
       <developerConnection>scm:svn:https://svn.apache.org/repos/asf/turbine/fulcrum/trunk/json/</developerConnection>
       <url>http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/</url>
     </scm>
-    
 
     <!-- Required for staging to work -->
      <distributionManagement>
@@ -144,10 +143,13 @@
     </profiles>
 
   <properties>
+    <maven.compiler.source>1.8</maven.compiler.source>
+    <maven.compiler.target>1.8</maven.compiler.target>
+    <java.version>1.8</java.version>
     <turbine.site.path>fulcrum/fulcrum-json</turbine.site.path>
-        <turbine.scmPubCheckoutDirectory>${turbine.site.cache}/fulcrum/json</turbine.scmPubCheckoutDirectory>
-        <turbine.site.cache>${project.build.directory}/turbine-sites</turbine.site.cache>
-        <siteContent.path>${project.build.directory}/staging</siteContent.path><!-- default stagingSiteURL --> 
+    <turbine.scmPubCheckoutDirectory>${turbine.site.cache}/fulcrum/json</turbine.scmPubCheckoutDirectory>
+    <turbine.site.cache>${project.build.directory}/turbine-sites</turbine.site.cache>
+    <siteContent.path>${project.build.directory}/staging</siteContent.path><!-- default stagingSiteURL --> 
   </properties> 
     
 </project>

Modified: turbine/fulcrum/trunk/json/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/turbine/fulcrum/trunk/json/src/changes/changes.xml?rev=1844081&r1=1844080&r2=1844081&view=diff
==============================================================================
--- turbine/fulcrum/trunk/json/src/changes/changes.xml (original)
+++ turbine/fulcrum/trunk/json/src/changes/changes.xml Wed Oct 17 10:20:29 2018
@@ -24,7 +24,16 @@
   </properties>
 
   <body>
-  <release version="1.1.2" date="in SVN">
+  <release version="2.0.0" date="in SVN">
+    <action type="update" dev="gk">
+        Java 8 compatiblity, updated SNAPSHOT version 1.1.2-SNAPSHOT to 2.0.0-SNAPSHOT
+      </action>
+    <action type="update" dev="gk">
+        Jackson 2: Update to version 2.9.6, use non deprecated methods, add tests, cleanup test packages
+      </action>
+      <action type="update" dev="painter">
+        Dependency Updates
+      </action>
   </release>
   <release version="1.1.1" date="2017-08-15">
      <action type="update" dev="gk">