}
@Test
public void testRequestInfoProps() throws Exception {
RequestBodyParser parser = new JsonRequestBodyParser();
RequestBody body = parser.parse(bodyWithRequestInfoProperties).iterator().next();
Set<NamedPropertySet> setProps = body.getNamedPropertySets();
assertEquals(1, setProps.size());
Map<String, Object> mapExpected = new HashMap<String, Object>();
mapExpected.put(PropertyHelper.getPropertyId("Services", "service_name"), "HDFS");
mapExpected.put(PropertyHelper.getPropertyId("Services", "display_name"), "HDFS");
mapExpected.put(PropertyHelper.getPropertyId("ServiceInfo", "cluster_name"), "tbmetrictest");
mapExpected.put(PropertyHelper.getPropertyId("Services", "description"), "Apache Hadoop Distributed File System");
mapExpected.put(PropertyHelper.getPropertyId("ServiceInfo", "state"), "STARTED");
mapExpected.put(PropertyHelper.getPropertyId("OuterCategory", "propName"), "100");
mapExpected.put(PropertyHelper.getPropertyId("OuterCategory/nested1/nested2", "innerPropName"), "innerPropValue");
mapExpected.put(PropertyHelper.getPropertyId(null, "topLevelProp"), "value");
assertEquals(mapExpected, setProps.iterator().next().getProperties());
assertEquals("foo=bar", body.getQueryString());
Map<String, String > mapRequestInfoProps = body.getRequestInfoProperties();
assertEquals(3, mapRequestInfoProps.size());
assertEquals("val1", mapRequestInfoProps.get("prop1"));
assertEquals("val2", mapRequestInfoProps.get("prop2"));
assertEquals("foo=bar", mapRequestInfoProps.get("query"));
//assert body is correct by checking that properties match
String b = body.getBody();
body = parser.parse(b).iterator().next();
Set<NamedPropertySet> setProps2 = body.getNamedPropertySets();
assertEquals(mapExpected, setProps2.iterator().next().getProperties());
}