Search in sources :

Example 1 with InstanceMetadataType

use of com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceMetadataType in project cloudbreak by hortonworks.

the class TestUtil method instanceMetaData.

public static InstanceMetaData instanceMetaData(Long serverNumber, Long instanceGroupId, InstanceStatus instanceStatus, boolean ambariServer, InstanceGroup instanceGroup, InstanceMetadataType instanceMetadataType) {
    InstanceMetaData instanceMetaData = new InstanceMetaData();
    instanceMetaData.setInstanceStatus(instanceStatus);
    instanceMetaData.setServer(ambariServer);
    instanceMetaData.setSshPort(22);
    instanceMetaData.setDiscoveryFQDN("test-" + instanceGroup.getGroupName() + "-" + instanceGroupId + '-' + serverNumber);
    instanceMetaData.setInstanceId("test-" + instanceGroupId + '-' + serverNumber);
    instanceMetaData.setPrivateIp("1.1." + instanceGroupId + '.' + serverNumber);
    instanceMetaData.setPublicIp("2.2." + instanceGroupId + '.' + serverNumber);
    instanceMetaData.setId(instanceGroupId + serverNumber);
    instanceMetaData.setInstanceGroup(instanceGroup);
    instanceMetaData.setStartDate(new Date().getTime());
    instanceMetaData.setLifeCycle(InstanceLifeCycle.SPOT);
    boolean gatewayInstanceGroup = instanceGroup.getInstanceGroupType().equals(InstanceGroupType.GATEWAY);
    InstanceMetadataType imType = gatewayInstanceGroup ? InstanceMetadataType.GATEWAY_PRIMARY : instanceMetadataType;
    instanceMetaData.setInstanceMetadataType(imType);
    return instanceMetaData;
}
Also used : InstanceMetaData(com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData) InstanceMetadataType(com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceMetadataType) Date(java.util.Date)

Aggregations

InstanceMetadataType (com.sequenceiq.cloudbreak.api.endpoint.v4.stacks.base.InstanceMetadataType)1 InstanceMetaData (com.sequenceiq.cloudbreak.domain.stack.instance.InstanceMetaData)1 Date (java.util.Date)1