use of com.sequenceiq.cloudbreak.domain.Topology in project cloudbreak by hortonworks.
the class HostGroupAssociationBuilder method getTopologyMapping.
private Map<String, String> getTopologyMapping(HostGroup hg) {
Map<String, String> result = new HashMap<>();
LOGGER.info("Computing hypervisor - rack mapping based on topology");
Topology topology = hg.getCluster().getStack().getCredential().getTopology();
if (topology == null) {
return result;
}
List<TopologyRecord> records = topology.getRecords();
if (records != null) {
for (TopologyRecord t : records) {
result.put(t.getHypervisor(), t.getRack());
}
}
return result;
}
use of com.sequenceiq.cloudbreak.domain.Topology in project cloudbreak by hortonworks.
the class TopologyService method delete.
public void delete(Long topologyId, IdentityUser user) {
Topology topology = topologyRepository.findByIdInAccount(topologyId, user.getAccount());
if (topology == null) {
throw new NotFoundException(String.format(TOPOLOGY_NOT_FOUND_MSG, topologyId));
}
delete(topology);
}
use of com.sequenceiq.cloudbreak.domain.Topology in project cloudbreak by hortonworks.
the class CredentialServiceTest method testModifyMapAllField.
@Test
public void testModifyMapAllField() throws Exception {
Credential credential = new Credential();
credential.setCloudPlatform(PLATFORM);
credential.setTopology(new Topology());
credential.setAttributes(new Json("other"));
credential.setDescription("mod-desc");
Credential modify = credentialService.modify(user, credential);
assertEquals(credential.getTopology(), modify.getTopology());
assertEquals(credential.getAttributes(), modify.getAttributes());
assertEquals(credential.getDescription(), modify.getDescription());
assertNotEquals(originalTopology, modify.getTopology());
assertNotEquals(originalAttributes, modify.getAttributes());
assertNotEquals(originalAttributes, modify.getDescription());
assertEquals(credential.cloudPlatform(), modify.cloudPlatform());
}
use of com.sequenceiq.cloudbreak.domain.Topology in project cloudbreak by hortonworks.
the class TopologyController method postPublic.
@Override
public TopologyResponse postPublic(TopologyRequest topologyRequest) {
IdentityUser user = authenticatedUserService.getCbUser();
Topology topology = conversionService.convert(topologyRequest, Topology.class);
topology = topologyService.create(user, topology);
notify(user, ResourceEvent.TOPOLOGY_CREATED);
return conversionService.convert(topology, TopologyResponse.class);
}
use of com.sequenceiq.cloudbreak.domain.Topology in project cloudbreak by hortonworks.
the class TopologyController method getPublics.
@Override
public Set<TopologyResponse> getPublics() {
IdentityUser user = authenticatedUserService.getCbUser();
Set<Topology> stacks = topologyRepository.findAllInAccount(user.getAccount());
return convert(stacks);
}
Aggregations