@Test public void testSomeFilteredResponses() { WSGoogleMTAdapter mtAdapter = spy(new WSGoogleMTAdapter()); doReturn(connector).when(mtAdapter).getMTConnector(); when(connector.getParameters()).thenReturn(parameters); when(wsLanguage.getLocale()).thenReturn(Locale.ENGLISH); when(connector.batchQueryText(anyList())).thenReturn(getBatchQueryResults( "First segment", "Third segment" )); WSMTRequest[] requests = getWSMTRequestStabs("First segment", "Second segment", "Third segment"); mtAdapter.translate(wsContext, requests, wsLanguage, wsLanguage); assertEquals(1, requests[0].getMTResults().length); assertEquals(0, requests[1].getMTResults().length); assertEquals(1, requests[2].getMTResults().length); assertEquals(requests[0].getMTResults()[0].getTranslation(), "First segment"); assertEquals(requests[2].getMTResults()[0].getTranslation(), "Third segment"); }
@Override protected GoogleMTv2Connector getMTConnector() { if (connector == null) { connector = new GoogleMTv2Connector(); WSGoogleMTAdapterConfigurationData configurationData = getConfigurationData(); connector.getParameters().setApiKey(configurationData.getApiKey()); connector.getParameters().setRetryCount(configurationData.getRetryCount()); connector.getParameters().setRetryIntervalMs(configurationData.getRetryInterval()); } return connector; }
WSGoogleMTAdapter extends WSBaseMTAdapter { @Override protected GoogleMTv2Connector getMTConnector() { if (connector == null) { connector = new GoogleMTv2Connector(); WSGoogleMTAdapterConfigurationData configurationData = getConfigurationData(); connector.getParameters().setApiKey(configurationData.getApiKey()); connector.getParameters().setRetryCount(configurationData.getRetryCount()); connector.getParameters().setRetryIntervalMs(configurationData.getRetryInterval()); } return connector; } }
WSGoogleMTAdapter extends WSBaseMTAdapter { @Override protected GoogleMTv2Connector getMTConnector() { if (connector == null) { connector = new GoogleMTv2Connector(); WSGoogleMTAdapterConfigurationData configurationData = getConfigurationData(); connector.getParameters().setApiKey(configurationData.getApiKey()); connector.getParameters().setRetryCount(configurationData.getRetryCount()); connector.getParameters().setRetryIntervalMs(configurationData.getRetryInterval()); } return connector; }  }
WSGoogleMTAdapter extends WSBaseMTAdapter { @Override protected GoogleMTv2Connector getMTConnector() { if (connector == null) { connector = new GoogleMTv2Connector(); WSGoogleMTAdapterConfigurationData configurationData = getConfigurationData(); connector.getParameters().setApiKey(configurationData.getApiKey()); connector.getParameters().setRetryCount(configurationData.getRetryCount()); connector.getParameters().setRetryIntervalMs(configurationData.getRetryInterval()); } return connector; }  String getName(); String getDescription(); @Override String getVersion(); @Override WSComponentConfigurationUI getConfigurationUI(); @Override WSLanguagePair[] getSupportedLanguagePairs(WSContext wsContext); }
WSGoogleMTAdapter extends WSBaseMTAdapter { @Override protected GoogleMTv2Connector getMTConnector() { if (connector == null) { connector = new GoogleMTv2Connector(); WSGoogleMTAdapterConfigurationData configurationData = getConfigurationData(); connector.getParameters().setApiKey(configurationData.getApiKey()); connector.getParameters().setRetryCount(configurationData.getRetryCount()); connector.getParameters().setRetryIntervalMs(configurationData.getRetryInterval()); } return connector; }  String getName(); String getDescription(); @Override String getVersion(); @Override WSComponentConfigurationUI getConfigurationUI(); @Override WSLanguagePair[] getSupportedLanguagePairs(WSContext wsContext);  }