use of com.sequenceiq.environment.proxy.domain.ProxyConfig 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.proxy.domain.ProxyConfig in project cloudbreak by hortonworks.
the class EnvironmentCreationService method initializeEnvironment.
private Environment initializeEnvironment(EnvironmentCreationDto creationDto) {
Environment environment = environmentDtoConverter.creationDtoToEnvironment(creationDto);
environment.setResourceCrn(creationDto.getCrn());
Credential credential = environmentResourceService.getCredentialFromRequest(creationDto.getCredential(), creationDto.getAccountId());
environment.setCredential(credential);
Optional<ProxyConfig> proxyConfig = environmentResourceService.getProxyConfig(creationDto.getProxyConfigName(), creationDto.getAccountId());
proxyConfig.ifPresent(pc -> environment.setProxyConfig(pc));
environment.setCloudPlatform(credential.getCloudPlatform());
environment.setAuthentication(authenticationDtoConverter.dtoToAuthentication(creationDto.getAuthentication()));
environment.setEnvironmentServiceVersion(environmentServiceVersion);
LOGGER.info("Environment is initialized for creation.");
return environment;
}
use of com.sequenceiq.environment.proxy.domain.ProxyConfig in project cloudbreak by hortonworks.
the class ProxyTestSource method getProxyConfig.
public static ProxyConfig getProxyConfig() {
ProxyConfig testSource = new ProxyConfig();
testSource.setPassword(PASSWORD);
testSource.setUserName(USERNAME);
testSource.setName(NAME);
testSource.setDescription(DESCRIPTION);
testSource.setAccountId(ACCOUNT_ID);
testSource.setCreator(CREATOR);
testSource.setId(ID);
testSource.setProtocol(PROTOCOL);
testSource.setServerHost(SERVER_HOST);
testSource.setResourceCrn(RESCRN);
testSource.setServerPort(SERVER_PORT);
testSource.setNoProxyHosts(NO_PROXY_HOSTS);
return testSource;
}
use of com.sequenceiq.environment.proxy.domain.ProxyConfig in project cloudbreak by hortonworks.
the class ProxyConfigToProxyResponseConverterTest method convertEncodedProxyConfig.
private ProxyResponse convertEncodedProxyConfig() {
ProxyConfig source = mock(ProxyConfig.class);
when(source.getPasswordSecret()).thenReturn(ProxyTestSource.PASSWORD);
when(source.getUserNameSecret()).thenReturn(ProxyTestSource.USERNAME);
return underTest.convert(source);
}
use of com.sequenceiq.environment.proxy.domain.ProxyConfig in project cloudbreak by hortonworks.
the class ProxyController method post.
@Override
@CheckPermissionByAccount(action = AuthorizationResourceAction.POWERUSER_ONLY)
public ProxyResponse post(ProxyRequest request) {
String accountId = ThreadBasedUserCrnProvider.getAccountId();
String creator = ThreadBasedUserCrnProvider.getUserCrn();
ProxyConfig proxyConfig = proxyRequestToProxyConfigConverter.convert(request);
notify(ResourceEvent.PROXY_CONFIG_CREATED);
return proxyConfigToProxyResponseConverter.convert(proxyConfigService.create(proxyConfig, accountId, creator));
}
Aggregations