Package org.apache.jackrabbit.ocm.testmodel

Examples of org.apache.jackrabbit.ocm.testmodel.Residual$ResidualNodes


            // --------------------------------------------------------------------------------
            // Create and store an object graph in the repository with null values
            // --------------------------------------------------------------------------------

            Residual residual = new Residual.ResidualNodes();
            residual.setPath("/test");
            ocm.insert(residual);
            ocm.save();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------          
            residual = (Residual) ocm.getObject( "/test");
            assertNotNull("Object is null", residual);
            assertNull("Map is not null", residual.getElements());
           
            // --------------------------------------------------------------------------------
            // Update an object graph in the repository
            // --------------------------------------------------------------------------------
            residual = new Residual.ResidualNodes();
            residual.setPath("/test");
           
            ManagedHashMap map = new ManagedHashMap();
            map.put("value1", new Paragraph("Value1"));
            map.put("value2", new Paragraph("Value2"));
            map.put("value3", new Paragraph("Value3"));
            map.put("value4", new Paragraph("Value4"));
            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() == 4);           
            assertTrue("Incorrect collection element type", (residual.getElements().get("value2") instanceof Paragraph));
            assertEquals("Incorrect collection element text", ((Paragraph) residual.getElements().get("value2")).getText(), "Value2");
           
            // --------------------------------------------------------------------------------
            // Update the object
            // --------------------------------------------------------------------------------
            map = new ManagedHashMap();
            map.put("value11", new Paragraph("Value11"));
            map.put("value12", new Paragraph("Value12"));
            map.put("value13", new Paragraph("Value13"));
            map.put("value14", new Paragraph("Value14"));
            map.put("value15", new Paragraph("Value15"));
            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);
            assertNull("Unexpected collection element", residual.getElements().get("value2"));
            assertTrue("Incorrect collection element type", (residual.getElements().get("value15") instanceof Paragraph));
            assertEquals("Incorrect collection element text", ((Paragraph) residual.getElements().get("value15")).getText(), "Value15");
        }
        catch (Exception e)
        {
            e.printStackTrace();
            fail("Exception occurs during the unit test : " + e);
View Full Code Here


            // --------------------------------------------------------------------------------
            // Create and store an object graph in the repository with a null hashmap
            // --------------------------------------------------------------------------------

            Residual residual = new Residual.ResidualProperties();
            residual.setPath("/test");
                       
            ocm.insert(residual);
            ocm.save();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------          
            residual = (Residual) ocm.getObject( "/test");
            assertNotNull("Object is null", residual);
            assertNull("Hashmap is not null", residual.getElements());
           
            // --------------------------------------------------------------------------------
            // Update an object graph in the repository
            // --------------------------------------------------------------------------------

            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();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------          

            residual = (Residual) ocm.getObject( "/test");
            assertNotNull("Object is null", residual);
            assertTrue("Incorrect number of values", residual.getElements().size() == 6);
            assertNull("Unexpected collection element", residual.getElements().get("value2"));
            assertNull("Unexpected collection element", residual.getElements().get("value5"));
            assertTrue("Incorrect collection element", residual.getElements().get("value15").equals("Value15"));
            assertNotNull("Missing collection element", residual.getElements().get("value16"));
            assertTrue("Incorrect collection element type", (residual.getElements().get("value16") instanceof List));
            assertEquals("Incorrect collection element list size", ((List) residual.getElements().get("value16")).size(), 2);
            assertEquals("Incorrect collection element list value", ((List) residual.getElements().get("value16")).get(0), "Value16-1");
        }
        catch (Exception e)
        {
            e.printStackTrace();
            fail("Exception occurs during the unit test : " + e);
View Full Code Here

            // --------------------------------------------------------------------------------
            // Create and store an object graph in the repository with a null hashmap
            // --------------------------------------------------------------------------------

            Residual residual = new Residual.ResidualProperties();
            residual.setPath("/test");
                       
            ocm.insert(residual);
            ocm.save();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------          
            residual = (Residual) ocm.getObject( "/test");
            assertNotNull("Object is null", residual);
            assertNull("Hashmap is not null", residual.getElements());
           
            // --------------------------------------------------------------------------------
            // Update an object graph in the repository
            // --------------------------------------------------------------------------------

            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();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------          

            residual = (Residual) ocm.getObject( "/test");
            assertNotNull("Object is null", residual);
            assertTrue("Incorrect number of values", residual.getElements().size() == 6);
            assertNull("Unexpected collection element", residual.getElements().get("value2"));
            assertNull("Unexpected collection element", residual.getElements().get("value5"));
            assertTrue("Incorrect collection element", residual.getElements().get("value15").equals("Value15"));
            assertNotNull("Missing collection element", residual.getElements().get("value16"));
            assertTrue("Incorrect collection element type", (residual.getElements().get("value16") instanceof List));
            assertEquals("Incorrect collection element list size", ((List) residual.getElements().get("value16")).size(), 2);
            assertEquals("Incorrect collection element list value", ((List) residual.getElements().get("value16")).get(0), "Value16-1");
        }
        catch (Exception e)
        {
            e.printStackTrace();
            fail("Exception occurs during the unit test : " + e);
View Full Code Here

            // --------------------------------------------------------------------------------
            // Create and store an object graph in the repository with null values
            // --------------------------------------------------------------------------------

            Residual residual = new Residual.ResidualNodes();
            residual.setPath("/test");
            ocm.insert(residual);
            ocm.save();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------          
            residual = (Residual) ocm.getObject( "/test");
            assertNotNull("Object is null", residual);
            assertNull("Map is not null", residual.getElements());
           
            // --------------------------------------------------------------------------------
            // Update an object graph in the repository
            // --------------------------------------------------------------------------------
            residual = new Residual.ResidualNodes();
            residual.setPath("/test");
           
            ManagedHashMap map = new ManagedHashMap();
            map.put("value1", new Paragraph("Value1"));
            map.put("value2", new Paragraph("Value2"));
            map.put("value3", new Paragraph("Value3"));
            map.put("value4", new Paragraph("Value4"));
            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() == 4);           
            assertTrue("Incorrect collection element type", (residual.getElements().get("value2") instanceof Paragraph));
            assertEquals("Incorrect collection element text", ((Paragraph) residual.getElements().get("value2")).getText(), "Value2");
           
            // --------------------------------------------------------------------------------
            // Update the object
            // --------------------------------------------------------------------------------
            map = new ManagedHashMap();
            map.put("value11", new Paragraph("Value11"));
            map.put("value12", new Paragraph("Value12"));
            map.put("value13", new Paragraph("Value13"));
            map.put("value14", new Paragraph("Value14"));
            map.put("value15", new Paragraph("Value15"));
            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);
            assertNull("Unexpected collection element", residual.getElements().get("value2"));
            assertTrue("Incorrect collection element type", (residual.getElements().get("value15") instanceof Paragraph));
            assertEquals("Incorrect collection element text", ((Paragraph) residual.getElements().get("value15")).getText(), "Value15");
        }
        catch (Exception e)
        {
            e.printStackTrace();
            fail("Exception occurs during the unit test : " + e);
View Full Code Here

            // --------------------------------------------------------------------------------
            // Create and store an object graph in the repository with null values
            // --------------------------------------------------------------------------------

            Residual residual = new Residual.ResidualNodes();
            residual.setPath("/test");
            ocm.insert(residual);
            ocm.save();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------
            residual = (Residual) ocm.getObject( "/test");
            assertNotNull("Object is null", residual);
            assertNull("Map is not null", residual.getElements());

            // --------------------------------------------------------------------------------
            // Update an object graph in the repository
            // --------------------------------------------------------------------------------
            residual = new Residual.ResidualNodes();
            residual.setPath("/test");

            HashMap<String, Paragraph> map = new HashMap<String, Paragraph>();
            map.put("value1", new Paragraph("Value1"));
            map.put("value2", new Paragraph("Value2"));
            map.put("value3", new Paragraph("Value3"));
            map.put("value4", new Paragraph("Value4"));
            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() == 4);
            assertTrue("Incorrect collection element type", (residual.getElements().get("value2") instanceof Paragraph));
            assertEquals("Incorrect collection element text", ((Paragraph) residual.getElements().get("value2")).getText(), "Value2");

            // --------------------------------------------------------------------------------
            // Update the object
            // --------------------------------------------------------------------------------
            map = new HashMap<String, Paragraph>();
            map.put("value11", new Paragraph("Value11"));
            map.put("value12", new Paragraph("Value12"));
            map.put("value13", new Paragraph("Value13"));
            map.put("value14", new Paragraph("Value14"));
            map.put("value15", new Paragraph("Value15"));
            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);
            assertNull("Unexpected collection element", residual.getElements().get("value2"));
            assertTrue("Incorrect collection element type", (residual.getElements().get("value15") instanceof Paragraph));
            assertEquals("Incorrect collection element text", ((Paragraph) residual.getElements().get("value15")).getText(), "Value15");
        }
        catch (Exception e)
        {
            e.printStackTrace();
            fail("Exception occurs during the unit test : " + e);
View Full Code Here

            // --------------------------------------------------------------------------------
            // Create and store an object graph in the repository with a null hashmap
            // --------------------------------------------------------------------------------

            Residual residual = new Residual.ResidualProperties();
            residual.setPath("/test");

            ocm.insert(residual);
            ocm.save();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------
            residual = (Residual) ocm.getObject( "/test");
            assertNotNull("Object is null", residual);
            assertNull("Hashmap is not null", residual.getElements());

            // --------------------------------------------------------------------------------
            // Update an object graph in the repository
            // --------------------------------------------------------------------------------

            residual = new Residual.ResidualProperties();
            residual.setPath("/test");

            HashMap<String, Object> map = new HashMap<String, Object>();
            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 HashMap<String, Object>();
            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();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------

            residual = (Residual) ocm.getObject( "/test");
            assertNotNull("Object is null", residual);
            assertTrue("Incorrect number of values", residual.getElements().size() == 6);
            assertNull("Unexpected collection element", residual.getElements().get("value2"));
            assertNull("Unexpected collection element", residual.getElements().get("value5"));
            assertTrue("Incorrect collection element", residual.getElements().get("value15").equals("Value15"));
            assertNotNull("Missing collection element", residual.getElements().get("value16"));
            assertTrue("Incorrect collection element type", (residual.getElements().get("value16") instanceof List));
            assertEquals("Incorrect collection element list size", ((List) residual.getElements().get("value16")).size(), 2);
            assertEquals("Incorrect collection element list value", ((List) residual.getElements().get("value16")).get(0), "Value16-1");
        }
        catch (Exception e)
        {
            e.printStackTrace();
            fail("Exception occurs during the unit test : " + e);
View Full Code Here

            // --------------------------------------------------------------------------------
            // Create and store an object graph in the repository with null values
            // --------------------------------------------------------------------------------

            Residual residual = new Residual.ResidualNodes();
            residual.setPath("/test");
            ocm.insert(residual);
            ocm.save();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------
            residual = (Residual) ocm.getObject( "/test");
            assertNotNull("Object is null", residual);
            assertNull("Map is not null", residual.getElements());

            // --------------------------------------------------------------------------------
            // Update an object graph in the repository
            // --------------------------------------------------------------------------------
            residual = new Residual.ResidualNodes();
            residual.setPath("/test");

            HashMap<String,Paragraph> map = new HashMap<String,Paragraph>();
            map.put("value1", new Paragraph("Value1"));
            map.put("value2", new Paragraph("Value2"));
            map.put("value3", new Paragraph("Value3"));
            map.put("value4", new Paragraph("Value4"));
            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() == 4);
            assertTrue("Incorrect collection element type", (residual.getElements().get("value2") instanceof Paragraph));
            assertEquals("Incorrect collection element text", ((Paragraph) residual.getElements().get("value2")).getText(), "Value2");

            // --------------------------------------------------------------------------------
            // Update the object
            // --------------------------------------------------------------------------------
            map = new HashMap<String,Paragraph>();
            map.put("value11", new Paragraph("Value11"));
            map.put("value12", new Paragraph("Value12"));
            map.put("value13", new Paragraph("Value13"));
            map.put("value14", new Paragraph("Value14"));
            map.put("value15", new Paragraph("Value15"));
            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);
            assertNull("Unexpected collection element", residual.getElements().get("value2"));
            assertTrue("Incorrect collection element type", (residual.getElements().get("value15") instanceof Paragraph));
            assertEquals("Incorrect collection element text", ((Paragraph) residual.getElements().get("value15")).getText(), "Value15");
        }
        catch (Exception e)
        {
            e.printStackTrace();
            fail("Exception occurs during the unit test : " + e);
View Full Code Here

            // --------------------------------------------------------------------------------
            // Create and store an object graph in the repository with a null hashmap
            // --------------------------------------------------------------------------------

            Residual residual = new Residual.ResidualProperties();
            residual.setPath("/test");

            ocm.insert(residual);
            ocm.save();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------
            residual = (Residual) ocm.getObject( "/test");
            assertNotNull("Object is null", residual);
            assertNull("Hashmap is not null", residual.getElements());

            // --------------------------------------------------------------------------------
            // Update an object graph in the repository
            // --------------------------------------------------------------------------------

            residual = new Residual.ResidualProperties();
            residual.setPath("/test");

            HashMap<String, Object> map = new HashMap<String, Object>();
            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 HashMap<String, Object>();
            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();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------

            residual = (Residual) ocm.getObject( "/test");
            assertNotNull("Object is null", residual);
            assertTrue("Incorrect number of values", residual.getElements().size() == 6);
            assertNull("Unexpected collection element", residual.getElements().get("value2"));
            assertNull("Unexpected collection element", residual.getElements().get("value5"));
            assertTrue("Incorrect collection element", residual.getElements().get("value15").equals("Value15"));
            assertNotNull("Missing collection element", residual.getElements().get("value16"));
            assertTrue("Incorrect collection element type", (residual.getElements().get("value16") instanceof List));
            assertEquals("Incorrect collection element list size", ((List) residual.getElements().get("value16")).size(), 2);
            assertEquals("Incorrect collection element list value", ((List) residual.getElements().get("value16")).get(0), "Value16-1");
        }
        catch (Exception e)
        {
            e.printStackTrace();
            fail("Exception occurs during the unit test : " + e);
View Full Code Here

            // --------------------------------------------------------------------------------
            // Create and store an object graph in the repository with null values
            // --------------------------------------------------------------------------------

            Residual residual = new Residual.ResidualNodes();
            residual.setPath("/test");
            ocm.insert(residual);
            ocm.save();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------
            residual = (Residual) ocm.getObject( "/test");
            assertNotNull("Object is null", residual);
            assertNull("Map is not null", residual.getElements());

            // --------------------------------------------------------------------------------
            // Update an object graph in the repository
            // --------------------------------------------------------------------------------
            residual = new Residual.ResidualNodes();
            residual.setPath("/test");

            HashMap<String, Paragraph> map = new HashMap<String, Paragraph>();
            map.put("value1", new Paragraph("Value1"));
            map.put("value2", new Paragraph("Value2"));
            map.put("value3", new Paragraph("Value3"));
            map.put("value4", new Paragraph("Value4"));
            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() == 4);
            assertTrue("Incorrect collection element type", (residual.getElements().get("value2") instanceof Paragraph));
            assertEquals("Incorrect collection element text", ((Paragraph) residual.getElements().get("value2")).getText(), "Value2");

            // --------------------------------------------------------------------------------
            // Update the object
            // --------------------------------------------------------------------------------
            map = new HashMap<String, Paragraph>();
            map.put("value11", new Paragraph("Value11"));
            map.put("value12", new Paragraph("Value12"));
            map.put("value13", new Paragraph("Value13"));
            map.put("value14", new Paragraph("Value14"));
            map.put("value15", new Paragraph("Value15"));
            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);
            assertNull("Unexpected collection element", residual.getElements().get("value2"));
            assertTrue("Incorrect collection element type", (residual.getElements().get("value15") instanceof Paragraph));
            assertEquals("Incorrect collection element text", ((Paragraph) residual.getElements().get("value15")).getText(), "Value15");
        }
        catch (Exception e)
        {
            e.printStackTrace();
            fail("Exception occurs during the unit test : " + e);
View Full Code Here

            // --------------------------------------------------------------------------------
            // Create and store an object graph in the repository with a null hashmap
            // --------------------------------------------------------------------------------

            Residual residual = new Residual.ResidualProperties();
            residual.setPath("/test");

            ocm.insert(residual);
            ocm.save();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------
            residual = (Residual) ocm.getObject( "/test");
            assertNotNull("Object is null", residual);
            assertNull("Hashmap is not null", residual.getElements());

            // --------------------------------------------------------------------------------
            // Update an object graph in the repository
            // --------------------------------------------------------------------------------

            residual = new Residual.ResidualProperties();
            residual.setPath("/test");

            HashMap<String, Object> map = new HashMap<String, Object>();
            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 HashMap<String, Object>();
            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();

            // --------------------------------------------------------------------------------
            // Get the object
            // --------------------------------------------------------------------------------

            residual = (Residual) ocm.getObject( "/test");
            assertNotNull("Object is null", residual);
            assertTrue("Incorrect number of values", residual.getElements().size() == 6);
            assertNull("Unexpected collection element", residual.getElements().get("value2"));
            assertNull("Unexpected collection element", residual.getElements().get("value5"));
            assertTrue("Incorrect collection element", residual.getElements().get("value15").equals("Value15"));
            assertNotNull("Missing collection element", residual.getElements().get("value16"));
            assertTrue("Incorrect collection element type", (residual.getElements().get("value16") instanceof List));
            assertEquals("Incorrect collection element list size", ((List) residual.getElements().get("value16")).size(), 2);
            assertEquals("Incorrect collection element list value", ((List) residual.getElements().get("value16")).get(0), "Value16-1");
        }
        catch (Exception e)
        {
            e.printStackTrace();
            fail("Exception occurs during the unit test : " + e);
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.ocm.testmodel.Residual$ResidualNodes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.