use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.
the class ServiceTestUtils method createBlueprint.
public static Blueprint createBlueprint(BlueprintRequest blueprintRequest) {
Blueprint blueprint = new Blueprint();
blueprint.setName(blueprintRequest.getName());
blueprint.setBlueprintText(blueprintRequest.getAmbariBlueprint());
return blueprint;
}
use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.
the class BlueprintLoaderServiceTest method testLoadBlueprintsForTheSpecifiedUserWhenOneNewDefaultExistThenRepositoryShouldUpdateOnlyOneBlueprint.
@Test
public void testLoadBlueprintsForTheSpecifiedUserWhenOneNewDefaultExistThenRepositoryShouldUpdateOnlyOneBlueprint() {
Map<String, Blueprint> stringBlueprintMap = generateCacheData(3, 1);
Set<Blueprint> blueprints = generateDatabaseData(3);
ArgumentCaptor<Set> argumentCaptor = ArgumentCaptor.forClass(Set.class);
Blueprint blueprint = stringBlueprintMap.get("multi-node-hdfs-yarn3");
Set<Blueprint> resultList = new HashSet<>();
resultList.add(blueprint);
when(blueprintRepository.save(resultList)).thenReturn(resultList);
Collection<Blueprint> resultSet = underTest.loadBlueprintsForTheSpecifiedUser(identityUser(), blueprints);
verify(blueprintRepository).save(argumentCaptor.capture());
Assert.assertEquals(1, argumentCaptor.getAllValues().size());
Assert.assertEquals(4, resultSet.size());
}
use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.
the class BlueprintLoaderServiceTest method generateCacheData.
private Map<String, Blueprint> generateCacheData(int cacheSize, int startIndex) {
Map<String, Blueprint> cacheData = new HashMap<>();
for (int i = startIndex; i < cacheSize + startIndex; i++) {
Blueprint blueprint = createBlueprint(DEFAULT, i);
cacheData.put(blueprint.getName(), blueprint);
}
when(blueprintCache.defaultBlueprints()).thenReturn(cacheData);
return cacheData;
}
use of com.sequenceiq.cloudbreak.domain.Blueprint 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);
}
use of com.sequenceiq.cloudbreak.domain.Blueprint in project cloudbreak by hortonworks.
the class AmbariDecommissionerTest method testVerifyNodeCountWithoutReplicationFactory.
@Test
public void testVerifyNodeCountWithoutReplicationFactory() throws CloudbreakSecuritySetupException {
String hostGroupName = "hostGroupName";
String hostname = "hostname";
String ipAddress = "192.18.256.1";
int gatewayPort = 1234;
String ambariName = "ambari-name";
Map<String, List<String>> blueprintMap = new HashMap<>();
blueprintMap.put(hostGroupName, Collections.singletonList("NODEMANAGER"));
Blueprint blueprint = new Blueprint();
blueprint.setName(ambariName);
blueprint.setAmbariName(ambariName);
Cluster cluster = new Cluster();
cluster.setAmbariIp(ipAddress);
cluster.setBlueprint(blueprint);
Stack stack = new Stack();
stack.setGatewayPort(gatewayPort);
stack.setId(100L);
HostGroup hostGroup = new HostGroup();
hostGroup.setName(hostGroupName);
hostGroup.setHostMetadata(Collections.singleton(getHostMetadata(0L)));
AmbariClient ambariClient = mock(AmbariClient.class);
HttpClientConfig config = new HttpClientConfig(ipAddress);
when(tlsSecurityService.buildTLSClientConfigForPrimaryGateway(stack.getId(), cluster.getAmbariIp())).thenReturn(config);
when(ambariClientProvider.getAmbariClient(config, stack.getGatewayPort(), cluster)).thenReturn(ambariClient);
when(hostGroupService.getByClusterAndHostName(cluster, hostname)).thenReturn(hostGroup);
when(ambariClient.getBlueprintMap(ambariName)).thenReturn(blueprintMap);
underTest.verifyNodeCount(stack, cluster, hostname);
verify(configurationService, times(0)).getConfiguration(ambariClient, hostGroupName);
}
Aggregations