Package org.zanata.webtrans.shared.rpc

Examples of org.zanata.webtrans.shared.rpc.GetTargetForLocaleResult


                    .getTextFlowTarget(
                    action.getSourceTransUnitId().getId(),
                    action.getLocale().getId().getLocaleId());

            if (hTextFlowTarget == null) {
                return new GetTargetForLocaleResult(null);
            } else {
                String displayName = retrieveDisplayName(hTextFlowTarget.getLocale());
                TextFlowTarget textFlowTarget = new TextFlowTarget(
                        new TextFlowTargetId(hTextFlowTarget.getId()),
                        action.getLocale(), hTextFlowTarget.getContents().get(0),
                        displayName);

                return new GetTargetForLocaleResult(textFlowTarget);
            }
        } catch (Exception e) {
            log.error("Exception when fetching target: ", e);
            return new GetTargetForLocaleResult(null);
        }
    }
View Full Code Here


        when(textFlowTargetDAO.getTextFlowTarget(sourceTransUnitId.getId(),
                jaHLocale.getLocaleId())).thenReturn(getEm()
                .find(HTextFlowTarget.class, 61L));


        GetTargetForLocaleResult result = handler.execute(action, null);

        verify(identity).checkLoggedIn();

        assertThat(result.getTarget().getContent(), Matchers.equalTo(getEm()
                .find(HTextFlowTarget.class, 61L).getContents().get(0)));
    }
View Full Code Here

    public void testExecuteWhenTargetLangDoesNotExsist() throws Exception {
        when(textFlowTargetDAO.getTextFlowTarget(sourceTransUnitId.getId(),
                jaHLocale.getLocaleId())).thenReturn(null);


        GetTargetForLocaleResult result = handler.execute(action, null);

        verify(identity).checkLoggedIn();

        assertThat(result.getTarget(), Matchers.equalTo(null));
    }
View Full Code Here

TOP

Related Classes of org.zanata.webtrans.shared.rpc.GetTargetForLocaleResult

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.