Search in sources :

Example 6 with ProxyConfig

use of com.sequenceiq.cloudbreak.domain.ProxyConfig in project cloudbreak by hortonworks.

the class ProxyConfigService method delete.

public void delete(Long id, IdentityUser user) {
    ProxyConfig proxyConfig = proxyConfigRepository.findByIdAndAccount(id, user.getAccount());
    if (proxyConfig == null) {
        throw new NotFoundException(String.format("Proxy configuration '%s' not found.", id));
    }
    authorizationService.hasWritePermission(proxyConfig);
    delete(proxyConfig);
}
Also used : NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException) ProxyConfig(com.sequenceiq.cloudbreak.domain.ProxyConfig)

Example 7 with ProxyConfig

use of com.sequenceiq.cloudbreak.domain.ProxyConfig in project cloudbreak by hortonworks.

the class ProxyConfigService method get.

public ProxyConfig get(Long id) {
    ProxyConfig proxyConfig = proxyConfigRepository.findOne(id);
    if (proxyConfig == null) {
        throw new NotFoundException(String.format("Proxy configuration '%s' not found.", id));
    }
    authorizationService.hasReadPermission(proxyConfig);
    return proxyConfig;
}
Also used : NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException) ProxyConfig(com.sequenceiq.cloudbreak.domain.ProxyConfig)

Example 8 with ProxyConfig

use of com.sequenceiq.cloudbreak.domain.ProxyConfig in project cloudbreak by hortonworks.

the class ProxyConfigService method delete.

public void delete(String name, IdentityUser user) {
    ProxyConfig proxyConfig = proxyConfigRepository.findByNameBasedOnAccount(name, user.getAccount(), user.getUserId());
    if (proxyConfig == null) {
        throw new NotFoundException(String.format("Proxy configuration '%s' not found.", name));
    }
    authorizationService.hasWritePermission(proxyConfig);
    delete(proxyConfig);
}
Also used : NotFoundException(com.sequenceiq.cloudbreak.controller.NotFoundException) ProxyConfig(com.sequenceiq.cloudbreak.domain.ProxyConfig)

Example 9 with ProxyConfig

use of com.sequenceiq.cloudbreak.domain.ProxyConfig in project cloudbreak by hortonworks.

the class ClusterProxyDecoratorTest method setUp.

@Before
public void setUp() {
    when(mapper.mapRequestToEntity(any(ProxyConfigRequest.class), anyBoolean())).thenReturn(new ProxyConfig());
    when(service.create(any(IdentityUser.class), any(ProxyConfig.class))).thenReturn(new ProxyConfig());
    when(service.getPublicProxyConfig(anyString(), eq(identityUser))).thenReturn(new ProxyConfig());
    cluster = new Cluster();
    stack.setPublicInAccount(true);
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) ProxyConfigRequest(com.sequenceiq.cloudbreak.api.model.proxy.ProxyConfigRequest) ProxyConfig(com.sequenceiq.cloudbreak.domain.ProxyConfig) Before(org.junit.Before)

Example 10 with ProxyConfig

use of com.sequenceiq.cloudbreak.domain.ProxyConfig in project cloudbreak by hortonworks.

the class ProxyConfigProviderTest method testWithoutAuthUsernameSetProxy.

@Test
public void testWithoutAuthUsernameSetProxy() {
    ProxyConfig proxyConfig = new ProxyConfig();
    proxyConfig.setUserName("test");
    Map<String, Object> properties = testProxyCore(proxyConfig);
    assertFalse(properties.containsKey("user"));
    assertFalse(properties.containsKey("password"));
}
Also used : ProxyConfig(com.sequenceiq.cloudbreak.domain.ProxyConfig) Test(org.junit.Test)

Aggregations

ProxyConfig (com.sequenceiq.cloudbreak.domain.ProxyConfig)19 IdentityUser (com.sequenceiq.cloudbreak.common.model.user.IdentityUser)5 NotFoundException (com.sequenceiq.cloudbreak.controller.NotFoundException)5 Test (org.junit.Test)4 Cluster (com.sequenceiq.cloudbreak.domain.Cluster)2 ProxyConfigRequest (com.sequenceiq.cloudbreak.api.model.proxy.ProxyConfigRequest)1 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)1 Stack (com.sequenceiq.cloudbreak.domain.Stack)1 SaltPillarProperties (com.sequenceiq.cloudbreak.orchestrator.model.SaltPillarProperties)1 HashMap (java.util.HashMap)1 Transactional (javax.transaction.Transactional)1 Before (org.junit.Before)1