Search in sources :

Example 71 with Cluster

use of com.sequenceiq.cloudbreak.domain.Cluster 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 72 with Cluster

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

the class ClusterProxyDecoratorTest method testNothingProvided.

@Test
public void testNothingProvided() {
    Cluster result = clusterProxyDecorator.prepareProxyConfig(cluster, identityUser, null, stack);
    assertNull(result.getProxyConfig());
    Mockito.verify(service, Mockito.times(0)).create(any(IdentityUser.class), any(ProxyConfig.class));
    Mockito.verify(service, Mockito.times(0)).getPublicProxyConfig(anyString(), eq(identityUser));
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) ProxyConfig(com.sequenceiq.cloudbreak.domain.ProxyConfig) Test(org.junit.Test)

Example 73 with Cluster

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

the class ClusterProxyDecoratorTest method testProxyNameProvided.

@Test
public void testProxyNameProvided() {
    Cluster result = clusterProxyDecorator.prepareProxyConfig(cluster, identityUser, "test", stack);
    assertNotNull(result.getProxyConfig());
    Mockito.verify(service, Mockito.times(1)).getPublicProxyConfig(anyString(), eq(identityUser));
    Mockito.verify(service, Mockito.times(0)).create(any(IdentityUser.class), any(ProxyConfig.class));
}
Also used : IdentityUser(com.sequenceiq.cloudbreak.common.model.user.IdentityUser) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) ProxyConfig(com.sequenceiq.cloudbreak.domain.ProxyConfig) Test(org.junit.Test)

Example 74 with Cluster

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

the class ProxyConfigProviderTest method init.

@Before
public void init() {
    cluster = new Cluster();
    servicePillar = new HashMap<>();
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.Cluster) Before(org.junit.Before)

Example 75 with Cluster

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

the class BlueprintTemplateProcessorTest method testMustacheGeneratorForHiveRDS.

@Test
public void testMustacheGeneratorForHiveRDS() throws Exception {
    String testBlueprint = FileReaderUtils.readFileFromClasspath("blueprints-jackson/bp-mustache-test.bp");
    Cluster cluster = cluster();
    BlueprintStackInfo blueprintStackInfo = new BlueprintStackInfo("hdp", "2.4");
    BlueprintPreparationObject blueprintPreparationObject = BlueprintPreparationObject.Builder.builder().withRdsConfigs(cluster.getRdsConfigs()).withGateway(cluster.getGateway()).withLdapConfig(cluster.getLdapConfig()).withGeneralClusterConfigs(generalClusterConfigs()).withBlueprintView(new BlueprintView(testBlueprint, blueprintStackInfo.getVersion(), blueprintStackInfo.getType())).build();
    String result = underTest.process(testBlueprint, blueprintPreparationObject, Maps.newHashMap());
    assertTrue(result.contains("\"javax.jdo.option.ConnectionURL\": \"jdbc:postgresql://10.1.1.1:5432/hive\""));
    assertTrue(result.contains("\"javax.jdo.option.ConnectionUserName\": \"heyitsme\""));
    assertTrue(result.contains("\"javax.jdo.option.ConnectionPassword\": \"iamsoosecure\""));
    assertTrue(result.contains("\"javax.jdo.option.ConnectionDriverName\": \"org.postgresql.Driver\""));
    assertTrue(result.contains("\"hive_database_type\": \"postgres\""));
    assertTrue(result.contains("\"hive_database\": \"Existing postgresql Database\","));
}
Also used : BlueprintStackInfo(com.sequenceiq.cloudbreak.blueprint.templates.BlueprintStackInfo) BlueprintView(com.sequenceiq.cloudbreak.blueprint.template.views.BlueprintView) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) BlueprintPreparationObject(com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject) Test(org.junit.Test)

Aggregations

Cluster (com.sequenceiq.cloudbreak.domain.Cluster)144 Stack (com.sequenceiq.cloudbreak.domain.Stack)68 Test (org.junit.Test)64 AmbariClient (com.sequenceiq.ambari.client.AmbariClient)31 HostGroup (com.sequenceiq.cloudbreak.domain.HostGroup)26 Blueprint (com.sequenceiq.cloudbreak.domain.Blueprint)22 CloudbreakException (com.sequenceiq.cloudbreak.service.CloudbreakException)22 HashMap (java.util.HashMap)22 HashSet (java.util.HashSet)15 List (java.util.List)15 ArrayList (java.util.ArrayList)13 HttpClientConfig (com.sequenceiq.cloudbreak.client.HttpClientConfig)12 BadRequestException (com.sequenceiq.cloudbreak.controller.BadRequestException)12 BlueprintPreparationObject (com.sequenceiq.cloudbreak.blueprint.BlueprintPreparationObject)11 Matchers.anyString (org.mockito.Matchers.anyString)11 CancellationException (com.sequenceiq.cloudbreak.cloud.scheduler.CancellationException)10 InstanceMetaData (com.sequenceiq.cloudbreak.domain.InstanceMetaData)10 InstanceGroup (com.sequenceiq.cloudbreak.domain.InstanceGroup)9 Json (com.sequenceiq.cloudbreak.domain.json.Json)9 PollingResult (com.sequenceiq.cloudbreak.service.PollingResult)9