Examples of readAllByParent()


Examples of com.philip.journal.home.dao.BranchDAO.readAllByParent()

        final Entry entry1 = new Entry("Entry Title 1", "Entry Desc 1", testBranch1);
        final Entry entry2 = new Entry("Entry Title 2", "Entry Desc 2", testBranch1);
        final Entry entry3 = new Entry("Entry Title 3", "Entry Desc 3", testSubBranch1);

        when(branchDAO.readAllByParent(Constant.ROOT_ID)).thenReturn(Arrays.asList(new Branch[] { testBranch1 }));
        when(branchDAO.readAllByParent(TEST_ID_RTBRANCH1)).thenReturn(Arrays.asList(new Branch[] { testSubBranch1 }));
        when(entryDAO.readAllByBranch(TEST_ID_RTBRANCH1)).thenReturn(Arrays.asList(new Entry[] {
                entry1,
                entry2 }));
        when(entryDAO.readAllByBranch(TEST_ID_SUBBRANCH1)).thenReturn(Arrays.asList(new Entry[] { entry3 }));
View Full Code Here

Examples of com.philip.journal.home.dao.BranchDAO.readAllByParent()

        final Entry entry1 = new Entry("Entry Title 1", "Entry Desc 1", testBranch1);
        final Entry entry2 = new Entry("Entry Title 2", "Entry Desc 2", testBranch1);
        final Entry entry3 = new Entry("Entry Title 3", "Entry Desc 3", testSubBranch1);

        when(branchDAO.readAllByParent(Constant.ROOT_ID)).thenReturn(Arrays.asList(new Branch[] { testBranch1 }));
        when(branchDAO.readAllByParent(TEST_ID_RTBRANCH1)).thenReturn(Arrays.asList(new Branch[] { testSubBranch1 }));
        when(entryDAO.readAllByBranch(TEST_ID_RTBRANCH1)).thenReturn(Arrays.asList(new Entry[] {
                entry1,
                entry2 }));
        when(entryDAO.readAllByBranch(TEST_ID_SUBBRANCH1)).thenReturn(Arrays.asList(new Entry[] { entry3 }));
View Full Code Here

Examples of com.philip.journal.home.dao.BranchDAO.readAllByParent()

    public final void testExtractNodeFromDocumentCase2()
    {
        try {
            final BranchDAO branchDAO = getDaoFacade().getBranchDAO();

            final int rootBranchCount = branchDAO.readAllByParent(Constant.ROOT_ID).size();
            final int branchCount = branchDAO.readAllByParent(TEST_ID_RTBRANCH1).size();

            when(mockXPath.evaluate(eq(XmlHelper.TAG_BRANCHES), eq(testBranchEl1), eq(XPathConstants.NODE)))
                    .thenReturn(testBranchesEl1);
            when(mockXPath.evaluate(eq(XmlHelper.TAG_BRANCHES), eq(testSubBranchEl1), eq(XPathConstants.NODE)))
View Full Code Here

Examples of com.philip.journal.home.dao.BranchDAO.readAllByParent()

    {
        try {
            final BranchDAO branchDAO = getDaoFacade().getBranchDAO();

            final int rootBranchCount = branchDAO.readAllByParent(Constant.ROOT_ID).size();
            final int branchCount = branchDAO.readAllByParent(TEST_ID_RTBRANCH1).size();

            when(mockXPath.evaluate(eq(XmlHelper.TAG_BRANCHES), eq(testBranchEl1), eq(XPathConstants.NODE)))
                    .thenReturn(testBranchesEl1);
            when(mockXPath.evaluate(eq(XmlHelper.TAG_BRANCHES), eq(testSubBranchEl1), eq(XPathConstants.NODE)))
                    .thenReturn(testSubBranchesEl1);
View Full Code Here

Examples of com.philip.journal.home.dao.BranchDAO.readAllByParent()

        when(getDaoFacade().getBranchDAO().read(TEST_SUBBRANCH1_ID)).thenReturn(testSubBranch1);
        when(getDaoFacade().getBranchDAO().read(TEST_SUBBRANCH2_ID)).thenReturn(testSubBranch2);
        when(getDaoFacade().getBranchDAO().read(TEST_SUBBRANCH11_ID)).thenReturn(testSubBranch11);

        final BranchDAO mockBranchDAO = getDaoFacade().getBranchDAO();
        when(mockBranchDAO.readAllByParent(Constant.ROOT_ID)).thenAnswer(new Answer<List<Branch>>() {

            @Override
            public List<Branch> answer(final InvocationOnMock invocation) throws Throwable
            {
                final List<Branch> retval = new ArrayList<Branch>();
View Full Code Here

Examples of com.philip.journal.home.dao.BranchDAO.readAllByParent()

            public Object answer(final InvocationOnMock invocation) throws Throwable
            {
                final Branch param = (Branch) invocation.getArguments()[0];
                final Branch parent = param.getParent();
                if (parent != null) {//not Root.
                    final List<Branch> siblings = mockBranchDAO.readAllByParent(parent.getBranchId());
                    for (final Branch branch : siblings) {
                        if (branch.getBranchId() != param.getBranchId() && branch.getName().equals(param.getName())) {
                            throw new JournalException(JournalTestCommon.TEST_JRNL_ERRORMSG);
                        }
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.