Package org.javaee7.json.streaming.generate

Examples of org.javaee7.json.streaming.generate.StreamingGeneratorTest


    @Test
    public void saveParentWithChildrenThenDeleteOned() {

        Parent parent = new Parent();

        Child child1 = new Child();
        child1.setParent(parent);
        parent.getChildren().add(child1);

        Child child2 = new Child();
        child2.setParent(parent);
        parent.getChildren().add(child2);

        Child child3 = new Child();
        child3.setParent(parent);
        parent.getChildren().add(child3);

        // Save parent with 3 children
        parent = indexColumnTesterService.save(parent);
View Full Code Here


    @EJB
    private OrderColumnTesterService indexColumnTesterService;

    @Test
    public void saveInOneGo() {
        Parent parent = new Parent();

        Child child1 = new Child();
        child1.setParent(parent);

        Child child2 = new Child();
        child2.setParent(parent);

        parent.getChildren().add(child1);
        parent.getChildren().add(child2);

        parent = indexColumnTesterService.save(parent);

        // Reload parent fresh from data source again
        Parent savedParent = indexColumnTesterService.getParentById(parent.getId());

        assertEquals("2 children added to parent and saved, but after re-loading number of chilren different",
            2, savedParent.getChildren().size()
        );
    }
View Full Code Here

     *
     */
    @Test
    public void saveParentSeparatelyFirst() {

        Parent parent = indexColumnTesterService.save(new Parent());

        Child child1 = new Child();
        child1.setParent(parent);

        Child child2 = new Child();
        child2.setParent(parent);

        parent.getChildren().add(child1);
        parent.getChildren().add(child2);

        parent = indexColumnTesterService.save(parent);

        Parent savedParent = indexColumnTesterService.getParentById(parent.getId());

        assertEquals("2 children added to parent and saved, but after re-loading number of chilren different",
            2, savedParent.getChildren().size()
        );

    }
View Full Code Here

    }

    @Test
    public void saveParentWithOneChildFirst() {

        Parent parent = new Parent();
        Child child1 = new Child();
        child1.setParent(parent);
        parent.getChildren().add(child1);

        // Save parent with 1 child in one go
        parent = indexColumnTesterService.save(parent);

        Child child2 = new Child();
        child2.setParent(parent);
        parent.getChildren().add(child2);

        // Save parent again with second child
        parent = indexColumnTesterService.save(parent);

        Parent savedParent = indexColumnTesterService.getParentById(parent.getId());

        assertEquals("2 children added to parent and saved, but after re-loading number of chilren different",
            2, savedParent.getChildren().size()
        );
    }
View Full Code Here

    }

    @Test
    public void saveParentWithChildrenThenDeleteOned() {

        Parent parent = new Parent();

        Child child1 = new Child();
        child1.setParent(parent);
        parent.getChildren().add(child1);

        Child child2 = new Child();
        child2.setParent(parent);
        parent.getChildren().add(child2);

        Child child3 = new Child();
        child3.setParent(parent);
        parent.getChildren().add(child3);

        // Save parent with 3 children
        parent = indexColumnTesterService.save(parent);

        Parent savedParent = indexColumnTesterService.getParentById(parent.getId());

        assertEquals("3 children added to parent and saved, but after re-loading number of chilren different",
            3, savedParent.getChildren().size()
        );

        // Removing child at position 1 and saving again
        savedParent.getChildren().remove(1);

        savedParent = indexColumnTesterService.save(savedParent);
        savedParent = indexColumnTesterService.getParentById(savedParent.getId());

        assertEquals("2 children added to parent and saved, but after re-loading number of chilren different",
            2, savedParent.getChildren().size()
        );

    }
View Full Code Here

    @Test
    public void saveInOneGo() {

        Parent parent = new Parent();

        Child child1 = new Child();
        child1.setParent(parent);

        Child child2 = new Child();
        child2.setParent(parent);

        parent.getChildren().add(child1);
        parent.getChildren().add(child2);

        parent = indexColumnTesterService.save(parent);
View Full Code Here

    @Test
    public void saveParentSeparatelyFirst() {

        Parent parent = indexColumnTesterService.save(new Parent());

        Child child1 = new Child();
        child1.setParent(parent);

        Child child2 = new Child();
        child2.setParent(parent);

        parent.getChildren().add(child1);
        parent.getChildren().add(child2);

        parent = indexColumnTesterService.save(parent);
View Full Code Here

     *
     */
    @Test
    public void saveParentSeparatelyFirst() {

        Parent parent = indexColumnTesterService.save(new Parent());

        Child child1 = new Child();
        child1.setParent(parent);

        Child child2 = new Child();
        child2.setParent(parent);

        parent.getChildren().add(child1);
        parent.getChildren().add(child2);

        parent = indexColumnTesterService.save(parent);

        Parent savedParent = indexColumnTesterService.getParentById(parent.getId());

        assertEquals("2 children added to parent and saved, but after re-loading number of chilren different",
            2, savedParent.getChildren().size()
        );

    }
View Full Code Here

    private OrderColumnTesterService indexColumnTesterService;

    @Test
    public void saveInOneGo() {

        Parent parent = new Parent();

        Child child1 = new Child();
        child1.setParent(parent);

        Child child2 = new Child();
        child2.setParent(parent);

        parent.getChildren().add(child1);
        parent.getChildren().add(child2);

        parent = indexColumnTesterService.save(parent);

        Parent savedParent = indexColumnTesterService.getParentById(parent.getId());

        assertEquals("2 children added to parent and saved, but after re-loading number of chilren different",
            2, savedParent.getChildren().size()
        );
    }
View Full Code Here

     */
    @Test
    public void saveInOneGo() {

        Parent parent = new Parent();
        Child child1 = new Child();
        Child child2 = new Child();

        parent.getChildren().add(child1);
        parent.getChildren().add(child2);

        parent = indexColumnTesterService.save(parent);
View Full Code Here

TOP

Related Classes of org.javaee7.json.streaming.generate.StreamingGeneratorTest

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.