EventProcessor { public java.util.Map<String,Object> getParameters() { return (_parameters); }  java.util.Map<String,Service> getServices(); void setServices(java.util.Map<String,Service> services); java.util.Map<String,Object> getParameters(); void setParameters(java.util.Map<String,Object> parameters); boolean getAsynchronous(); void setAsynchronous(boolean async); @JsonIgnore void setResultHandler(ResultHandler handler); void init(); abstract java.io.Serializable process(String source,
                java.io.Serializable event, int retriesLeft); void close();  }
@Test public void testEventProcessorSerialization() { ObjectMapper mapper=new ObjectMapper(); TestEventProcessor ep=new TestEventProcessor(); ep.getParameters().put("testparam1", "hello"); ep.getParameters().put("testparam2", 5); try { String result=mapper.writeValueAsString(ep); TestEventProcessor epresult=mapper.readValue(result, TestEventProcessor.class); if (epresult == null) { fail("Result is null"); } if (!epresult.getParameters().get("testparam1").equals("hello")) { fail("Test param 1 is incorrect: "+epresult.getParameters().get("testparam1")); } int val=(Integer)epresult.getParameters().get("testparam2"); if (val != 5) { fail("Test param 2 is not 5: "+val); } } catch (Exception e) { fail("Failed to serialize ep: "+e); } }
@Test public void testEventProcessorSerializationUnknownType() { ObjectMapper mapper=new ObjectMapper(); TestEventProcessor ep=new TestEventProcessor(); ep.getParameters().put("testparam1", "hello"); ep.getParameters().put("testparam2", new TestObject()); try { String result=mapper.writeValueAsString(ep); TestEventProcessor epresult=mapper.readValue(result, TestEventProcessor.class); if (epresult == null) { fail("Result 1 is null"); } if (!epresult.getParameters().get("testparam1").equals("hello")) { fail("Test param 1 is incorrect: "+epresult.getParameters().get("testparam1")); } Object obj=epresult.getParameters().get("testparam2"); if (obj == null) { fail("Result 2 is null"); } @SuppressWarnings("unchecked") java.util.Map<String,Object> map=(java.util.Map<String,Object>)obj; String val2=(String)map.get("val"); if (!val2.equals("TestValue")) { fail("Incorrect value: "+val2); } } catch (Exception e) { fail("Failed to serialize ep: "+e); } }