public void testBeanProxy() {
try {
ObjectContentManager ocm = this.getObjectContentManager();
Detail detail = new Detail();
detail.setField("FieldValue");
Detail proxyDetail = new Detail();
proxyDetail.setField("ProxyFieldValue");
Main main = new Main();
main.setPath("/test");
main.setDetail(detail);
main.setProxyDetail(proxyDetail);
ocm.insert(main);
ocm.save();
//---------------------------------------------------------------------------------------------------------
// Retrieve the main object
//---------------------------------------------------------------------------------------------------------
main = (Main) ocm.getObject( "/test");
assertNotNull("detail is null", main.getDetail());
assertTrue("Invalid detail bean", main.getDetail().getField().equals("FieldValue"));
assertNotNull("proxydetail is null", main.getProxyDetail());
Object proxyObject = main.getProxyDetail();
assertTrue("Invalid class specify for the proxy bean", proxyObject instanceof Detail);
assertTrue("Invalid proxy detail bean",proxyDetail .getField().equals("ProxyFieldValue"));
Detail nullDetail = main.getNullDetail();
assertNull("nulldetail is not null",nullDetail );
//---------------------------------------------------------------------------------------------------------
// Update
//---------------------------------------------------------------------------------------------------------
detail = new Detail();
detail.setField("AnotherFieldValue");
proxyDetail = new Detail();
proxyDetail.setField("AnotherProxyFieldValue");
main.setDetail(detail);
main.setProxyDetail(proxyDetail);