Package org.openengsb.core.ekb.common.models

Examples of org.openengsb.core.ekb.common.models.RecursiveModel


    }

    @Test
    public void testRecursiveModelToEDBObjectConversion_shouldWork() throws Exception {
        // prepare
        RecursiveModel root = new RecursiveModel();
        root.setId("root");
        RecursiveModel rootChild = new RecursiveModel();
        rootChild.setId("root_child");
        RecursiveModel rootChildChild = new RecursiveModel();
        rootChildChild.setId("root_child_child");
        RecursiveModel rootChildChildChild = new RecursiveModel();
        rootChildChildChild.setId("root_child_child_child");

        root.setChild(rootChild);
        rootChild.setChild(rootChildChild);
        rootChildChild.setChild(rootChildChildChild);
        ConnectorInformation id = getTestConnectorInformation();
View Full Code Here


    }

    @Test
    public void testRecursiveModelWithCompositionToEDBObjectConversion_shouldWork() throws Exception {
        // prepare
        RecursiveModel root = new RecursiveModel("root");
        RecursiveModel rootChild1 = new RecursiveModel("root_child1");
        RecursiveModel rootChild2 = new RecursiveModel("root_child2");
        RecursiveModel child1Child1 = new RecursiveModel("child1_child1");
        RecursiveModel child2Child1 = new RecursiveModel("child2_child1");
        RecursiveModel child2Child2 = new RecursiveModel("child2_child2");
        List<RecursiveModel> rootChildren = Arrays.asList(new RecursiveModel[]{ rootChild1, rootChild2 });
        List<RecursiveModel> child2Children = Arrays.asList(new RecursiveModel[]{ child2Child1, child2Child2 });
        root.setChildren(rootChildren);
        rootChild1.setChild(child1Child1);
        rootChild2.setChildren(child2Children);
View Full Code Here

        when(mockedService.getObject(eq("child1"), anyLong())).thenReturn(child1);
        when(mockedService.getObject(eq("child2"), anyLong())).thenReturn(child2);
        when(mockedService.getObject(eq("child3"), anyLong())).thenReturn(child3);

        // test
        RecursiveModel mRoot = converter.convertEDBObjectToModel(RecursiveModel.class, root);
        // assert
        assertThat(mRoot.getId(), is("root"));

        RecursiveModel mChild1 = mRoot.getChild();
        assertThat(mChild1, notNullValue());
        assertThat(mChild1.getId(), is("child1"));
        RecursiveModel mChild2 = mChild1.getChild();
        assertThat(mChild2, notNullValue());
        assertThat(mChild2.getId(), is("child2"));
        RecursiveModel mChild3 = mChild2.getChild();
        assertThat(mChild3, notNullValue());
        assertThat(mChild3.getId(), is("child3"));
    }
View Full Code Here

        when(mockedService.getObject("child2")).thenReturn(child2);
        when(mockedService.getObject("child3")).thenReturn(child3);
        when(mockedService.getObject("child4")).thenReturn(child4);

        // test
        RecursiveModel mRoot = converter.convertEDBObjectToModel(RecursiveModel.class, root);

        // assert
        RecursiveModel mChild1;
        RecursiveModel mChild2;
        RecursiveModel mChild3;
        RecursiveModel mChild4;
        List<RecursiveModel> rootChildren;
        List<RecursiveModel> child1Children;

        assertThat(mRoot.getId(), is("root"));
        rootChildren = mRoot.getChildren();
        assertThat(rootChildren, notNullValue());
        assertThat(rootChildren.size(), is(2));

        mChild1 = rootChildren.get(0);
        mChild2 = rootChildren.get(1);

        assertThat(mChild1.getId(), is("child1"));
        assertThat(mChild2.getId(), is("child2"));

        child1Children = mChild1.getChildren();
        assertThat(child1Children, notNullValue());
        assertThat(child1Children.size(), is(2));

        mChild3 = child1Children.get(0);
        mChild4 = child1Children.get(1);

        assertThat(mChild3.getId(), is("child3"));
        assertThat(mChild4.getId(), is("child4"));
    }
View Full Code Here

TOP

Related Classes of org.openengsb.core.ekb.common.models.RecursiveModel

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.