use of com.sequenceiq.cloudbreak.workspace.model.Tenant in project cloudbreak by hortonworks.
the class ServiceEndpointCollectorTest method createClusterWithComponents.
private Cluster createClusterWithComponents(ExposedService[] topology1Services, ExposedService[] topology2Services, GatewayType gatewayType) {
Cluster cluster = clusterkWithOrchestrator("ANY");
GatewayTopology topology1 = gatewayTopology("topology1", topology1Services);
topology1.setGateway(cluster.getGateway());
GatewayTopology topology2 = gatewayTopology("topology2", topology2Services);
topology2.setGateway(cluster.getGateway());
cluster.getGateway().setTopologies(Sets.newHashSet(topology1, topology2));
cluster.getGateway().setGatewayType(gatewayType);
Workspace workspace = new Workspace();
Tenant tenant = new Tenant();
tenant.setName("tenant");
workspace.setTenant(tenant);
cluster.setWorkspace(workspace);
return cluster;
}
use of com.sequenceiq.cloudbreak.workspace.model.Tenant in project cloudbreak by hortonworks.
the class StackImageUpdateActionsTest method setup.
@Before
public void setup() throws CloudbreakImageNotFoundException {
MockitoAnnotations.initMocks(this);
when(stateContext.getMessageHeader(HEADERS.FLOW_PARAMETERS.name())).thenReturn(new FlowParameters("flowId", "usercrn", null));
when(stateContext.getExtendedState()).thenReturn(extendedState);
when(stateContext.getStateMachine()).thenReturn(stateMachine);
when(stateMachine.getState()).thenReturn(state);
when(extendedState.getVariables()).thenReturn(variables);
when(runningFlows.getFlowChainId(anyString())).thenReturn("flowchainid");
when(reactorEventFactory.createEvent(any(Map.class), any(Object.class))).thenReturn(new Event("dummy"));
when(imageService.getImage(anyLong())).thenReturn(image);
when(tracer.buildSpan(anyString())).thenReturn(spanBuilder);
when(spanBuilder.addReference(anyString(), any())).thenReturn(spanBuilder);
when(spanBuilder.ignoreActiveSpan()).thenReturn(spanBuilder);
when(spanBuilder.start()).thenReturn(span);
when(tracer.activateSpan(span)).thenReturn(scope);
when(span.context()).thenReturn(spanContext);
User user = new User();
user.setUserId("horton@hortonworks.com");
user.setUserCrn("testCrn");
user.setUserName("Alma ur");
Tenant tenant = new Tenant();
tenant.setName("hortonworks");
tenant.setId(1L);
Workspace workspace = new Workspace();
workspace.setId(1L);
workspace.setTenant(tenant);
Stack stack = new Stack();
stack.setCreator(user);
stack.setWorkspace(workspace);
stack.setId(1L);
stack.setRegion("region");
stack.setAvailabilityZone("az");
stack.setResourceCrn("crn:cdp:datalake:us-west-1:tenant:cluster:1234");
when(stackService.getByIdWithListsInTransaction(anyLong())).thenReturn(stack);
when(stackService.getById(anyLong())).thenReturn(stack);
when(stackUtil.getCloudCredential(stack)).thenReturn(cloudCredential);
variables.clear();
}
use of com.sequenceiq.cloudbreak.workspace.model.Tenant in project cloudbreak by hortonworks.
the class StackToTemplatePreparationObjectConverterTest method setUp.
@BeforeEach
public void setUp() throws IOException, TransactionService.TransactionExecutionException {
MockitoAnnotations.initMocks(this);
doAnswer(invocation -> {
invocation.getArgument(0, Runnable.class).run();
return null;
}).when(transactionService).required(any(Runnable.class));
User user = new User();
user.setUserName("applebob@apple.com");
user.setUserCrn("user-crn");
Tenant tenant = new Tenant();
tenant.setId(1L);
tenant.setName("account");
user.setTenant(tenant);
when(stackMock.getCreator()).thenReturn(user);
when(stackMock.getEnvironmentCrn()).thenReturn("env");
when(stackMock.getCloudPlatform()).thenReturn(TEST_CLOUD_PLATFORM);
when(stackMock.cloudPlatform()).thenReturn(TEST_CLOUD_PLATFORM);
when(stackMock.getType()).thenReturn(StackType.DATALAKE);
when(stackMock.getRegion()).thenReturn(REGION);
when(stackMock.getAvailabilityZone()).thenReturn(AVAILABILITY_ZONE);
when(stackMock.getName()).thenReturn("stackname");
when(sourceCluster.getId()).thenReturn(TEST_CLUSTER_ID);
when(cluster.getId()).thenReturn(TEST_CLUSTER_ID);
when(instanceGroupMetadataCollector.collectMetadata(stackMock)).thenReturn(groupInstances);
when(cluster.getBlueprint()).thenReturn(blueprint);
when(blueprint.getBlueprintText()).thenReturn(TEST_BLUEPRINT_TEXT);
when(blueprint.getStackVersion()).thenReturn("7.2.11");
when(stackMock.getInputs()).thenReturn(stackInputs);
when(stackInputs.get(StackInputs.class)).thenReturn(null);
when(stackMock.getEnvironmentCrn()).thenReturn(TestConstants.CRN);
when(stackMock.getCluster()).thenReturn(sourceCluster);
when(sourceCluster.getCustomConfigurations()).thenReturn(customConfigurations);
when(customConfigurations.getCrn()).thenReturn("test-custom-configs-crn");
when(stackMock.getResourceCrn()).thenReturn("crn:cdp:datahub:us-west-1:account:cluster:cluster");
when(clusterService.findOneWithCustomConfigurations(anyLong())).thenReturn(sourceCluster);
when(accountTagClientService.list()).thenReturn(new HashMap<>());
when(entitlementService.internalTenant(anyString())).thenReturn(true);
when(loadBalancerConfigService.getLoadBalancerUserFacingFQDN(anyLong())).thenReturn(null);
Credential credential = Credential.builder().crn("aCredentialCRN").attributes(new Json("")).build();
DetailedEnvironmentResponse environmentResponse = DetailedEnvironmentResponse.builder().withIdBrokerMappingSource(IdBrokerMappingSource.MOCK).withCredential(new CredentialResponse()).withAdminGroupName(ADMIN_GROUP_NAME).withCrn(TestConstants.CRN).build();
when(credentialToCloudCredentialConverter.convert(credential)).thenReturn(cloudCredential);
when(environmentClientService.getByCrn(anyString())).thenReturn(environmentResponse);
when(credentialConverter.convert(any(CredentialResponse.class))).thenReturn(credential);
when(awsMockAccountMappingService.getGroupMappings(REGION, cloudCredential, ADMIN_GROUP_NAME)).thenReturn(MOCK_GROUP_MAPPINGS);
when(awsMockAccountMappingService.getUserMappings(REGION, cloudCredential)).thenReturn(MOCK_USER_MAPPINGS);
when(ldapConfigService.get(anyString(), anyString())).thenReturn(Optional.empty());
when(clusterService.getById(anyLong())).thenReturn(cluster);
when(customConfigurationsService.getByNameOrCrn(any(NameOrCrn.class))).thenReturn(customConfigurations);
when(exposedServiceCollector.getAllKnoxExposed(any())).thenReturn(Set.of());
when(resourceService.getAllByStackId(anyLong())).thenReturn(Collections.EMPTY_LIST);
IdBroker idbroker = idBrokerConverterUtil.generateIdBrokerSignKeys(cluster);
when(idBrokerService.getByCluster(any(Cluster.class))).thenReturn(idbroker);
when(idBrokerService.save(any(IdBroker.class))).thenReturn(idbroker);
when(grpcUmsClient.listServicePrincipalCloudIdentities(anyString(), anyString(), any(Optional.class))).thenReturn(Collections.EMPTY_LIST);
when(dbCertificateProvider.getSslCertsFilePath()).thenReturn(SSL_CERTS_FILE_PATH);
when(stackMock.getId()).thenReturn(1L);
when(generalClusterConfigsProvider.generalClusterConfigs(any(Stack.class), any(Cluster.class))).thenReturn(new GeneralClusterConfigs());
}
use of com.sequenceiq.cloudbreak.workspace.model.Tenant in project cloudbreak by hortonworks.
the class UserProfileToUserProfileV4ResponseConverterTest method setUp.
@Before
public void setUp() {
underTest = new UserProfileToUserProfileV4ResponseConverter();
tenant = new Tenant();
tenant.setName("someTenant");
user = new User();
user.setTenant(tenant);
user.setUserId("c1234d47-4ec4-4ad2-91x2-d44kef15d67s");
}
use of com.sequenceiq.cloudbreak.workspace.model.Tenant in project cloudbreak by hortonworks.
the class ClusterCreationEnvironmentValidatorTest method getStack.
private Stack getStack() {
Stack stack = new Stack();
stack.setRegion("region1");
stack.setCloudPlatform("aws");
Workspace workspace = new Workspace();
workspace.setId(1L);
Tenant tenant = new Tenant();
tenant.setName("test-tenant-name");
workspace.setTenant(tenant);
stack.setWorkspace(workspace);
stack.setEnvironmentCrn("");
return stack;
}
Aggregations