ActiveCollectionUtil { public static byte[] serializeQuerySpec(QuerySpec qs) throws Exception { byte[] ret=null; java.io.ByteArrayOutputStream baos=new java.io.ByteArrayOutputStream(); MAPPER.writeValue(baos, qs); ret = baos.toByteArray(); baos.close(); return (ret); } private  ActiveCollectionUtil(); static byte[] serializeACS(java.util.List<ActiveCollectionSource> acs); @SuppressWarnings("unchecked") static java.util.List<ActiveCollectionSource> deserializeACS(byte[] acs); static byte[] serializeQuerySpec(QuerySpec qs); static QuerySpec deserializeQuerySpec(byte[] qs);  }
@Test public void testSerializeQuerySpec() { QuerySpec qs=new QuerySpec(); qs.setCollection("OrderService"); qs.setParent("ServiceResponseTime"); qs.setPredicate(new MVEL( "serviceType == \"{urn:switchyard-quickstart-demo:orders:0.1.0}OrderService\" && " +"operation == \"submitOrder\"")); qs.setMaxItems(5000); qs.setTruncate(Truncate.End); qs.setStyle(Style.Reversed); try { System.out.println("QUERY SPEC=" +new String(ActiveCollectionUtil.serializeQuerySpec(qs))); } catch(Exception e) { fail("Failed to serialize: "+e); } }