Search in sources :

Example 51 with Cluster

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

the class ComponentLocatorServiceTest method setUp.

@Before
public void setUp() {
    cluster = new Cluster();
    cluster.setBlueprint(new Blueprint());
    HostGroup hg1 = createHostGroup("hg1", "myhost1");
    HostGroup hg2 = createHostGroup("hg2", "myhost2");
    Set<String> hg1Components = set("RESOURCEMANAGER", "Service1", "HIVE_SERVER");
    Set<String> hg2Components = set("NAMENODE", "Service2", "Service3");
    when(hostGroupService.getByCluster(anyLong())).thenReturn(ImmutableSet.of(hg1, hg2));
    when(blueprintProcessor.getComponentsInHostGroup(eq("hg1"))).thenReturn(hg1Components);
    when(blueprintProcessor.getComponentsInHostGroup(eq("hg2"))).thenReturn(hg2Components);
    when(blueprintProcessorFactory.get(anyString())).thenReturn(blueprintProcessor);
}
Also used : Blueprint(com.sequenceiq.cloudbreak.domain.Blueprint) Cluster(com.sequenceiq.cloudbreak.domain.Cluster) HostGroup(com.sequenceiq.cloudbreak.domain.HostGroup) Matchers.anyString(org.mockito.Matchers.anyString) Before(org.junit.Before)

Example 52 with Cluster

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

the class AmbariClusterSetupServiceTest method testApiAvailableWhenPollerReturnTrueThenApiShouldBeAvailable.

@Test
public void testApiAvailableWhenPollerReturnTrueThenApiShouldBeAvailable() throws CloudbreakSecuritySetupException {
    Stack stack = TestUtil.stack();
    Cluster cluster = TestUtil.cluster();
    stack.setCluster(cluster);
    AmbariClient ambariClient = ambariClient();
    when(ambariPollingServiceProvider.isAmbariAvailable(stack, ambariClient)).thenReturn(true);
    when(clientFactory.getAmbariClient(stack, stack.getCluster())).thenReturn(ambariClient);
    boolean available = underTest.available(stack);
    verify(ambariPollingServiceProvider, times(1)).isAmbariAvailable(stack, ambariClient);
    verify(clientFactory, times(1)).getAmbariClient(stack, stack.getCluster());
    Assert.assertTrue(available);
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.Cluster) Stack(com.sequenceiq.cloudbreak.domain.Stack) AmbariClient(com.sequenceiq.ambari.client.AmbariClient) Test(org.junit.Test)

Example 53 with Cluster

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

the class AmbariSecurityConfigProviderTest method testGetAmbariPasswordNameWhenCloudbreakAmbariPasswordIsNullThenShouldReturnPassword.

@Test
public void testGetAmbariPasswordNameWhenCloudbreakAmbariPasswordIsNullThenShouldReturnPassword() {
    Cluster cluster = TestUtil.cluster();
    cluster.setCloudbreakAmbariPassword(null);
    cluster.setPassword("admin");
    String ambariPassword = underTest.getAmbariPassword(cluster);
    Assert.assertEquals("admin", ambariPassword);
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.Cluster) Test(org.junit.Test)

Example 54 with Cluster

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

the class AmbariSecurityConfigProviderTest method testGetAmbariSecurityMasterKeyWhenAmbariSecurityMasterKeyIsExistThenShouldReturnAmbariSecurityMasterKey.

@Test
public void testGetAmbariSecurityMasterKeyWhenAmbariSecurityMasterKeyIsExistThenShouldReturnAmbariSecurityMasterKey() {
    Cluster cluster = TestUtil.cluster();
    cluster.setAmbariSecurityMasterKey("masterkey");
    String ambariSecurityMasterKey = underTest.getAmbariSecurityMasterKey(cluster);
    Assert.assertEquals("masterkey", ambariSecurityMasterKey);
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.Cluster) Test(org.junit.Test)

Example 55 with Cluster

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

the class AmbariSecurityConfigProviderTest method testGetAmbariUserNameWhenCloudbreakAmbariUserNameIsNullThenShouldReturnUserName.

@Test
public void testGetAmbariUserNameWhenCloudbreakAmbariUserNameIsNullThenShouldReturnUserName() {
    Cluster cluster = TestUtil.cluster();
    cluster.setCloudbreakAmbariUser(null);
    cluster.setUserName("admin");
    String ambariUserName = underTest.getAmbariUserName(cluster);
    Assert.assertEquals("admin", ambariUserName);
}
Also used : Cluster(com.sequenceiq.cloudbreak.domain.Cluster) 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