arrayListElement = new ArrayListElement();
list = new ArrayList<Element>();
customList = new CustomList();
Element e1 = new Element();
e1.setId("e1");
e1.setText("Element 1");
arrayListElement.addObject(e1);
list.add(e1);
customList.add(e1);
Element e2 = new Element();
e2.setId("e2");
e2.setText("Element 2");
arrayListElement.addObject(e2);
list.add(e2);
customList.add(e2);
main.setArrayListElement(arrayListElement);
main.setList(list);
main.setCustomList(customList);
ocm.update(main);
ocm.save();
// --------------------------------------------------------------------------------
// Get the object
// --------------------------------------------------------------------------------
main = (Main) ocm.getObject( "/test");
arrayListElement = main.getArrayListElement();
list = main.getList();
assertNotNull("main.getArrayListElemnt is null", arrayListElement );
assertNotNull("main.getList is null", list );
assertNotNull("main.getCustomeList is null", customList );
Collection<Element> objects = (Collection<Element>) arrayListElement.getObjects();
Element[] elements = (Element[]) objects.toArray(new Element[objects.size()]);
assertTrue("Incorrect para element", elements[0].getText().equals("Element 1"));
assertTrue("Incorrect para element", list.get(0).getText().equals("Element 1"));
assertTrue("Incorrect para element", customList.get(0).getText().equals("Element 1"));
// --------------------------------------------------------------------------------
// Update the object
// --------------------------------------------------------------------------------
arrayListElement = new ArrayListElement();
list = new ArrayList<Element>();
customList = new CustomList();
e1 = new Element();
e1.setId("e1");
e1.setText("Element 1");
arrayListElement.addObject(e1);
list.add(e1);
customList.add(e1);
e2 = new Element();
e2.setId("e3");
e2.setText("Element 3");
arrayListElement.addObject(e2);
list.add(e2);
customList.add(e2);
Element e3 = new Element();
e3.setId("e4");
e3.setText("Element 4");
arrayListElement.addObject(e3);
list.add(e3);
customList.add(e3);
main.setArrayListElement(arrayListElement);