Search in sources :

Example 1 with ServerAddressGenerator

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);
    });
}
Also used : InstanceAuthentication(com.sequenceiq.cloudbreak.cloud.model.InstanceAuthentication) CloudInstanceMetaData(com.sequenceiq.cloudbreak.cloud.model.CloudInstanceMetaData) CloudVmMetaDataStatus(com.sequenceiq.cloudbreak.cloud.model.CloudVmMetaDataStatus) CloudVmInstanceStatus(com.sequenceiq.cloudbreak.cloud.model.CloudVmInstanceStatus) CloudInstance(com.sequenceiq.cloudbreak.cloud.model.CloudInstance) ServerAddressGenerator(com.sequenceiq.it.util.ServerAddressGenerator) InstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate)

Example 2 with ServerAddressGenerator

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);
    });
}
Also used : InstanceAuthentication(com.sequenceiq.cloudbreak.cloud.model.InstanceAuthentication) CloudInstanceMetaData(com.sequenceiq.cloudbreak.cloud.model.CloudInstanceMetaData) CloudVmMetaDataStatus(com.sequenceiq.cloudbreak.cloud.model.CloudVmMetaDataStatus) CloudVmInstanceStatus(com.sequenceiq.cloudbreak.cloud.model.CloudVmInstanceStatus) CloudInstance(com.sequenceiq.cloudbreak.cloud.model.CloudInstance) ServerAddressGenerator(com.sequenceiq.it.util.ServerAddressGenerator) InstanceTemplate(com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate)

Aggregations

CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)2 CloudInstanceMetaData (com.sequenceiq.cloudbreak.cloud.model.CloudInstanceMetaData)2 CloudVmInstanceStatus (com.sequenceiq.cloudbreak.cloud.model.CloudVmInstanceStatus)2 CloudVmMetaDataStatus (com.sequenceiq.cloudbreak.cloud.model.CloudVmMetaDataStatus)2 InstanceAuthentication (com.sequenceiq.cloudbreak.cloud.model.InstanceAuthentication)2 InstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate)2 ServerAddressGenerator (com.sequenceiq.it.util.ServerAddressGenerator)2