use of com.sequenceiq.environment.api.v1.proxy.model.response.ProxyResponse in project cloudbreak by hortonworks.
the class EnvironmentServiceIntegrationTest method testProxyCreate.
@Test
public void testProxyCreate() throws Exception {
ProxyRequest request = getProxyRequest();
request.setPort(8080);
ProxyResponse result = client.proxyV1Endpoint().post(request);
assertEquals(request.getName(), result.getName());
Optional<ProxyConfig> saved = proxyConfigRepository.findByNameInAccount(request.getName(), TEST_ACCOUNT_ID);
assertTrue(saved.isPresent());
}
use of com.sequenceiq.environment.api.v1.proxy.model.response.ProxyResponse in project cloudbreak by hortonworks.
the class EnvironmentServiceIntegrationTest method testProxyDeleteByCrnName.
@Test
public void testProxyDeleteByCrnName() {
proxyConfigRepository.save(getProxyConfig());
ProxyResponse results = client.proxyV1Endpoint().deleteByCrn(getProxyConfig().getResourceCrn());
assertTrue(results.getCrn().equals(getProxyConfig().getResourceCrn()), String.format("Result should have proxy with resource crn: %s", getProxyConfig().getResourceCrn()));
}
use of com.sequenceiq.environment.api.v1.proxy.model.response.ProxyResponse in project cloudbreak by hortonworks.
the class ProxyConfigToProxyResponseConverterTest method testConvertCredentials.
@Test
void testConvertCredentials() {
when(stringToSecretResponseConverter.convert(ProxyTestSource.USERNAME)).thenReturn(ProxyTestSource.USERNAME_SECRET);
when(stringToSecretResponseConverter.convert(ProxyTestSource.PASSWORD)).thenReturn(ProxyTestSource.PASSWORD_SECRET);
ProxyResponse result = convertEncodedProxyConfig();
Assertions.assertEquals(ProxyTestSource.USERNAME, result.getUserName().getSecretPath());
Assertions.assertEquals(ProxyTestSource.PASSWORD, result.getPassword().getSecretPath());
}
use of com.sequenceiq.environment.api.v1.proxy.model.response.ProxyResponse in project cloudbreak by hortonworks.
the class EnvironmentServiceIntegrationTest method testProxyGetByName.
@Test
public void testProxyGetByName() {
proxyConfigRepository.save(getProxyConfig());
ProxyResponse results = client.proxyV1Endpoint().getByName(getProxyRequest().getName());
assertTrue(results.getName().equals(getProxyConfig().getName()), String.format("Result should have proxy with name: %s", getProxyConfig().getName()));
}
use of com.sequenceiq.environment.api.v1.proxy.model.response.ProxyResponse in project cloudbreak by hortonworks.
the class ProxyConfigDtoServiceTest method testGetWhenProxyConfigUserPasswordEmpty.
@ParameterizedTest
@MethodSource("invalidUserPasswords")
void testGetWhenProxyConfigUserPasswordEmpty(String user, String password) {
String name = "aProxyConfig";
String host = "https://test.cloudera.com";
Integer port = 8443;
String decryptedSecretValue = "decrypted-secret-value";
SecretResponse secretResponse = new SecretResponse();
ProxyResponse proxyResponse = new ProxyResponse();
proxyResponse.setName(name);
proxyResponse.setHost(host);
proxyResponse.setPort(port);
proxyResponse.setUserName(secretResponse);
proxyResponse.setPassword(secretResponse);
when(regionAwareInternalCrnGenerator.getInternalCrnForServiceAsString()).thenReturn("crn");
when(regionAwareInternalCrnGeneratorFactory.iam()).thenReturn(regionAwareInternalCrnGenerator);
when(environmentServiceCrnClient.withCrn(anyString()).proxyV1Endpoint()).thenReturn(proxyEndpoint);
when(proxyEndpoint.getByResourceCrn(anyString())).thenReturn(proxyResponse);
when(secretService.getByResponse(any(SecretResponse.class))).thenReturn(user).thenReturn(password);
ProxyConfig proxyConfig = underTest.getByCrn("crn:cdp:environments:us-west-1:cloudera:proxyconfig:a2f0bee2-059e-433f-a9d0-2893c53419ad");
assertFalse(proxyConfig.getProxyAuthentication().isPresent());
}
Aggregations