use of com.sequenceiq.it.util.ServerAddressGenerator in project cloudbreak by hortonworks.
the class MockInstanceUtil method addInstance.
public void addInstance(Map<String, CloudVmMetaDataStatus> instanceMap, int numberOfAddedInstances) {
ServerAddressGenerator serverAddressGenerator = new ServerAddressGenerator(numberOfAddedInstances);
serverAddressGenerator.setFrom(instanceMap.size());
serverAddressGenerator.iterateOver((address, number) -> {
String instanceId = "instance-" + address;
InstanceTemplate instanceTemplate = new InstanceTemplate("medium", "group", Integer.toUnsignedLong(number), new ArrayList<>(), InstanceStatus.CREATED, null, 0L);
InstanceAuthentication instanceAuthentication = new InstanceAuthentication("sshkey", "", "cloudbreak");
CloudInstance cloudInstanceWithId = new CloudInstance(instanceId, instanceTemplate, instanceAuthentication);
CloudVmInstanceStatus cloudVmInstanceStatus = new CloudVmInstanceStatus(cloudInstanceWithId, InstanceStatus.STARTED);
CloudInstanceMetaData cloudInstanceMetaData = new CloudInstanceMetaData(address, mockServerAddress, sshPort, "MOCK");
CloudVmMetaDataStatus cloudVmMetaDataStatus = new CloudVmMetaDataStatus(cloudVmInstanceStatus, cloudInstanceMetaData);
instanceMap.put(instanceId, cloudVmMetaDataStatus);
});
}
use of com.sequenceiq.it.util.ServerAddressGenerator in project cloudbreak by hortonworks.
the class MockServer method addInstance.
public void addInstance(int numberOfAddedInstances) {
ServerAddressGenerator serverAddressGenerator = new ServerAddressGenerator(numberOfAddedInstances);
serverAddressGenerator.setFrom(instanceMap.size());
serverAddressGenerator.iterateOver((address, number) -> {
String instanceId = "instance-" + address;
InstanceTemplate instanceTemplate = new InstanceTemplate("medium", "group", Integer.toUnsignedLong(number), new ArrayList<>(), InstanceStatus.CREATED, null, 0L);
InstanceAuthentication instanceAuthentication = new InstanceAuthentication("sshkey", "", "cloudbreak");
CloudInstance cloudInstanceWithId = new CloudInstance(instanceId, instanceTemplate, instanceAuthentication);
CloudVmInstanceStatus cloudVmInstanceStatus = new CloudVmInstanceStatus(cloudInstanceWithId, InstanceStatus.STARTED);
CloudInstanceMetaData cloudInstanceMetaData = new CloudInstanceMetaData(address, mockServerAddress, sshPort, "MOCK");
CloudVmMetaDataStatus cloudVmMetaDataStatus = new CloudVmMetaDataStatus(cloudVmInstanceStatus, cloudInstanceMetaData);
instanceMap.put(instanceId, cloudVmMetaDataStatus);
});
}
Aggregations