// --------------------------------------------------------------------------------
residual = new Residual.ResidualProperties();
residual.setPath("/test");
ManagedHashMap map = new ManagedHashMap();
map.put("value1", "Value1");
map.put("value2", "Value2");
map.put("value3", "Value3");
map.put("value4", "Value4");
map.put("value5", Arrays.asList(new String[]{ "Value5-1", "Value5-2" }));
residual.setElements(map);
ocm.update(residual);
ocm.save();
// --------------------------------------------------------------------------------
// Get the object
// --------------------------------------------------------------------------------
residual = (Residual) ocm.getObject( "/test");
assertNotNull("Object is null", residual);
assertTrue("Incorrect number of values", residual.getElements().size() == 5);
assertTrue("Incorrect collection element", residual.getElements().get("value2").equals("Value2"));
assertNotNull("Missing collection element", residual.getElements().get("value5"));
assertTrue("Incorrect collection element type", (residual.getElements().get("value5") instanceof List));
assertEquals("Incorrect collection element list size", ((List) residual.getElements().get("value5")).size(), 2);
assertEquals("Incorrect collection element list value", ((List) residual.getElements().get("value5")).get(0), "Value5-1");
// --------------------------------------------------------------------------------
// Update the object
// --------------------------------------------------------------------------------
map = new ManagedHashMap();
map.put("value11", "Value11");
map.put("value12", "Value12");
map.put("value13", "Value13");
map.put("value14", "Value14");
map.put("value15", "Value15");
map.put("value16", Arrays.asList(new String[]{ "Value16-1", "Value16-2" }));
residual.setElements(map);
ocm.update(residual);
ocm.save();