Search in sources :

Example 6 with StackAuthentication

use of com.sequenceiq.freeipa.entity.StackAuthentication in project cloudbreak by hortonworks.

the class CreateFreeIpaRequestToStackConverterTest method testConvertForInstanceGroupsWhenAwsNativeIsPresent.

@Test
void testConvertForInstanceGroupsWhenAwsNativeIsPresent() {
    CreateFreeIpaRequest source = new CreateFreeIpaRequest();
    source.setEnvironmentCrn("envCrn");
    source.setName("dummyName");
    source.setVariant("AWS_NATIVE");
    source.setAuthentication(new StackAuthenticationRequest());
    source.setTelemetry(new TelemetryRequest());
    source.setInstanceGroups(List.of(new InstanceGroupRequest()));
    FreeIpaServerRequest freeIpaServerRequest = new FreeIpaServerRequest();
    freeIpaServerRequest.setDomain("dummyDomain");
    freeIpaServerRequest.setHostname("dummyHostName");
    source.setNetwork(new NetworkRequest());
    source.setFreeIpa(freeIpaServerRequest);
    DetailedEnvironmentResponse environmentResponse = new DetailedEnvironmentResponse();
    environmentResponse.setAws(AwsEnvironmentParameters.builder().withAwsDiskEncryptionParameters(AwsDiskEncryptionParameters.builder().withEncryptionKeyArn("dummyEncryptionKeyArn").build()).build());
    Future<String> owner = CompletableFuture.completedFuture("dummyUser");
    when(crnService.createCrn(ACCOUNT_ID, CrnResourceDescriptor.FREEIPA)).thenReturn("resourceCrn");
    when(stackAuthenticationConverter.convert(source.getAuthentication())).thenReturn(new StackAuthentication());
    when(instanceGroupConverter.convert(any(), any(), any(), any(), any(), any(), mapCaptorForEncryption.capture())).thenReturn(new InstanceGroup());
    when(networkConverter.convert(any(NetworkRequest.class))).thenReturn(new Network());
    when(telemetryConverter.convert(source.getTelemetry())).thenReturn(new Telemetry());
    when(backupConverter.convert(source.getTelemetry())).thenReturn(new Backup());
    when(entitlementService.internalTenant(ACCOUNT_ID)).thenReturn(Boolean.FALSE);
    when(costTagging.prepareDefaultTags(any())).thenReturn(new HashMap<>());
    Stack stack = underTest.convert(source, environmentResponse, ACCOUNT_ID, owner, "crn1", CloudPlatform.AWS.name());
    assertEquals(stack.getPlatformvariant(), "AWS_NATIVE");
    assertNull(mapCaptorForEncryption.getValue().get(GCP_KMS_ENCRYPTION_KEY));
    assertNull(mapCaptorForEncryption.getValue().get(DISK_ENCRYPTION_SET_ID));
}
Also used : StackAuthenticationRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.security.StackAuthenticationRequest) StackAuthentication(com.sequenceiq.freeipa.entity.StackAuthentication) InstanceGroupRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupRequest) CreateFreeIpaRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.create.CreateFreeIpaRequest) Backup(com.sequenceiq.freeipa.api.model.Backup) NetworkRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.NetworkRequest) Telemetry(com.sequenceiq.common.api.telemetry.model.Telemetry) InstanceGroup(com.sequenceiq.freeipa.entity.InstanceGroup) Stack(com.sequenceiq.freeipa.entity.Stack) TelemetryRequest(com.sequenceiq.common.api.telemetry.request.TelemetryRequest) Network(com.sequenceiq.freeipa.entity.Network) DetailedEnvironmentResponse(com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse) FreeIpaServerRequest(com.sequenceiq.freeipa.api.v1.freeipa.stack.model.FreeIpaServerRequest) Test(org.junit.jupiter.api.Test)

Example 7 with StackAuthentication

use of com.sequenceiq.freeipa.entity.StackAuthentication in project cloudbreak by hortonworks.

the class StackToDescribeFreeIpaResponseConverterTest method createStack.

private Stack createStack(Tunnel tunnel) {
    Stack stack = new Stack();
    stack.setEnvironmentCrn(ENV_CRN);
    stack.setName(NAME);
    stack.setResourceCrn(RESOURCE_CRN);
    stack.setStackStatus(createStackStatus());
    stack.setCloudPlatform(CLOUD_PLATFORM);
    stack.setStackAuthentication(new StackAuthentication());
    stack.setAppVersion(APP_VERSION);
    stack.setPlatformvariant(VARIANT);
    stack.setGatewayport(GATEWAY_PORT);
    stack.setTunnel(tunnel);
    return stack;
}
Also used : StackAuthentication(com.sequenceiq.freeipa.entity.StackAuthentication) Stack(com.sequenceiq.freeipa.entity.Stack)

Aggregations

StackAuthentication (com.sequenceiq.freeipa.entity.StackAuthentication)7 InstanceGroup (com.sequenceiq.freeipa.entity.InstanceGroup)5 Telemetry (com.sequenceiq.common.api.telemetry.model.Telemetry)4 Backup (com.sequenceiq.freeipa.api.model.Backup)4 CreateFreeIpaRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.create.CreateFreeIpaRequest)4 Stack (com.sequenceiq.freeipa.entity.Stack)4 DetailedEnvironmentResponse (com.sequenceiq.environment.api.v1.environment.model.response.DetailedEnvironmentResponse)3 Test (org.junit.jupiter.api.Test)3 TelemetryRequest (com.sequenceiq.common.api.telemetry.request.TelemetryRequest)2 FreeIpaServerRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.FreeIpaServerRequest)2 InstanceGroupRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceGroupRequest)2 NetworkRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.network.NetworkRequest)2 StackAuthenticationRequest (com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.security.StackAuthenticationRequest)2 Network (com.sequenceiq.freeipa.entity.Network)2 Template (com.sequenceiq.freeipa.entity.Template)2 CloudInstance (com.sequenceiq.cloudbreak.cloud.model.CloudInstance)1 InstanceAuthentication (com.sequenceiq.cloudbreak.cloud.model.InstanceAuthentication)1 InstanceStatus (com.sequenceiq.cloudbreak.cloud.model.InstanceStatus)1 InstanceTemplate (com.sequenceiq.cloudbreak.cloud.model.InstanceTemplate)1 StackTags (com.sequenceiq.cloudbreak.cloud.model.StackTags)1