public static void setUpZanataDetails( ZanataDetails zanataDetailsMock, String serverUrl, String project, String version, String username, String token) { given(zanataDetailsMock.getServer()).willReturn(serverUrl); given(zanataDetailsMock.getProject()).willReturn(project); given(zanataDetailsMock.getVersion()).willReturn(version); given(zanataDetailsMock.getUsername()).willReturn(username); given(zanataDetailsMock.getToken()).willReturn(token); }
protected ZanataDetails createZanataDetails( final CSTranslationDetail translationDetails, final String username, final String apikey) { if (translationDetails == null || translationDetails.getTranslationServer() == null) { throw new BadRequestException( "No Zanata Server has been configured for the Content Specification"); } // Create the zanata details final TranslationServer translationServer = translationDetails.getTranslationServer(); final ZanataDetails zanataDetails = new ZanataDetails(); zanataDetails.setServer(translationServer.getUrl()); zanataDetails.setProject(translationDetails.getProject()); zanataDetails.setVersion(translationDetails.getProjectVersion()); zanataDetails.setUsername(username); zanataDetails.setToken(apikey); return zanataDetails; }