/** * This method tests the blank proxy details */ @Test public void testEmrAwsDtoBlankProxy() throws Exception { // Set the proxy as blank too to get the EMR client without proxy AwsParamsDto awsParamsDto = emrHelper.getAwsParamsDto(); awsParamsDto.setHttpProxyHost(""); emrDao.getEmrClient(awsParamsDto); }
@Test public void getEmrClientAssertClientConfigurationSet() throws Exception { String httpProxyHost = "httpProxyHost"; Integer httpProxyPort = 1234; AwsParamsDto awsParamsDto = getAwsParamsDto(); awsParamsDto.setHttpProxyHost(httpProxyHost); awsParamsDto.setHttpProxyPort(httpProxyPort); AmazonElasticMapReduceClient amazonElasticMapReduceClient = emrDao.getEmrClient(awsParamsDto); ClientConfiguration clientConfiguration = (ClientConfiguration) ReflectionTestUtils.getField(amazonElasticMapReduceClient, "clientConfiguration"); assertNotNull(clientConfiguration); assertEquals(httpProxyHost, clientConfiguration.getProxyHost()); assertEquals(httpProxyPort.intValue(), clientConfiguration.getProxyPort()); }
@Test public void getEmrClientAssertClientConfigurationNotSetWhenProxyHostIsBlank() throws Exception { String httpProxyHost = ""; Integer httpProxyPort = 1234; AwsParamsDto awsParamsDto = getAwsParamsDto(); awsParamsDto.setHttpProxyHost(httpProxyHost); awsParamsDto.setHttpProxyPort(httpProxyPort); AmazonElasticMapReduceClient amazonElasticMapReduceClient = emrDao.getEmrClient(awsParamsDto); ClientConfiguration clientConfiguration = (ClientConfiguration) ReflectionTestUtils.getField(amazonElasticMapReduceClient, "clientConfiguration"); assertNotNull(clientConfiguration); assertNull(clientConfiguration.getProxyHost()); }
@Test public void getEmrClientAssertClientConfigurationNotSetWhenProxyPortIsNull() throws Exception { String httpProxyHost = "httpProxyHost"; Integer httpProxyPort = null; AwsParamsDto awsParamsDto = getAwsParamsDto(); awsParamsDto.setHttpProxyHost(httpProxyHost); awsParamsDto.setHttpProxyPort(httpProxyPort); AmazonElasticMapReduceClient amazonElasticMapReduceClient = emrDao.getEmrClient(awsParamsDto); ClientConfiguration clientConfiguration = (ClientConfiguration) ReflectionTestUtils.getField(amazonElasticMapReduceClient, "clientConfiguration"); assertNotNull(clientConfiguration); assertNull(clientConfiguration.getProxyHost()); }