use of com.sequenceiq.it.cloudbreak.CloudbreakClient in project cloudbreak by hortonworks.
the class ClusterTemplateTest method validateDefaultCount.
private ClusterTemplateTestDto validateDefaultCount(TestContext tc, ClusterTemplateTestDto entity, CloudbreakClient cc) {
try {
assertNotNull(entity);
assertNotNull(entity.getResponses());
long defaultCount = entity.getResponses().stream().filter(template -> ResourceStatus.DEFAULT.equals(template.getStatus())).count();
long expectedCount = 602;
assertEquals("Should have " + expectedCount + " of default cluster templates.", expectedCount, defaultCount);
} catch (Exception e) {
throw new TestFailException(String.format("Failed to validate default count of cluster templates: %s", e.getMessage()), e);
}
return entity;
}
use of com.sequenceiq.it.cloudbreak.CloudbreakClient in project cloudbreak by hortonworks.
the class TestContext method as.
public TestContext as(CloudbreakUser cloudbreakUser) {
checkShutdown();
LOGGER.info(" Acting user as: \ndisplay name: {} \naccess key: {} \nsecret key: {} \ncrn: {} \nadmin: {} ", cloudbreakUser.getDisplayName(), cloudbreakUser.getAccessKey(), cloudbreakUser.getSecretKey(), cloudbreakUser.getCrn(), cloudbreakUser.getAdmin());
Log.as(LOGGER, cloudbreakUser.toString());
setActingUser(cloudbreakUser);
if (clients.get(cloudbreakUser.getAccessKey()) == null) {
CloudbreakClient cloudbreakClient = CloudbreakClient.createProxyCloudbreakClient(testParameter, cloudbreakUser, regionAwareInternalCrnGeneratorFactory.iam());
FreeIpaClient freeIpaClient = FreeIpaClient.createProxyFreeIpaClient(testParameter, cloudbreakUser, regionAwareInternalCrnGeneratorFactory.iam());
EnvironmentClient environmentClient = EnvironmentClient.createProxyEnvironmentClient(testParameter, cloudbreakUser, regionAwareInternalCrnGeneratorFactory.iam());
SdxClient sdxClient = SdxClient.createProxySdxClient(testParameter, cloudbreakUser);
UmsClient umsClient = UmsClient.createProxyUmsClient(tracer, umsHost);
SdxSaasItClient sdxSaasItClient = SdxSaasItClient.createProxySdxSaasClient(tracer, umsHost, regionAwareInternalCrnGeneratorFactory);
RedbeamsClient redbeamsClient = RedbeamsClient.createProxyRedbeamsClient(testParameter, cloudbreakUser);
Map<Class<? extends MicroserviceClient>, MicroserviceClient> clientMap = Map.of(CloudbreakClient.class, cloudbreakClient, FreeIpaClient.class, freeIpaClient, EnvironmentClient.class, environmentClient, SdxClient.class, sdxClient, RedbeamsClient.class, redbeamsClient, UmsClient.class, umsClient, SdxSaasItClient.class, sdxSaasItClient);
clients.put(cloudbreakUser.getAccessKey(), clientMap);
cloudbreakClient.setWorkspaceId(0L);
}
return this;
}
use of com.sequenceiq.it.cloudbreak.CloudbreakClient in project cloudbreak by hortonworks.
the class DistroXTestDto method deleteForCleanup.
@Override
public void deleteForCleanup() {
try {
CloudbreakClient clientForCleanup = getClientForCleanup();
clientForCleanup.getDefaultClient().distroXV1Endpoint().deleteByCrn(getCrn(), true);
awaitWithClient(STACK_DELETED, clientForCleanup);
} catch (NotFoundException nfe) {
LOGGER.info("resource not found, thus cleanup not needed.");
}
}
use of com.sequenceiq.it.cloudbreak.CloudbreakClient in project cloudbreak by hortonworks.
the class BlueprintV4Action method getAll.
public static void getAll(IntegrationTestContext integrationTestContext, Entity entity) {
BlueprintTestDto blueprintEntity = (BlueprintTestDto) entity;
CloudbreakClient client;
client = integrationTestContext.getContextParam(CloudbreakClient.CLOUDBREAK_CLIENT, CloudbreakClient.class);
Long workspaceId = integrationTestContext.getContextParam(CloudbreakTest.WORKSPACE_ID, Long.class);
Log.log(" getByName all private blueprints. ");
Collection<BlueprintV4ViewResponse> blueprints = client.getDefaultClient().blueprintV4Endpoint().list(workspaceId, true).getResponses();
Set<BlueprintV4Response> detailedBlueprints = blueprints.stream().map(bp -> client.getDefaultClient().blueprintV4Endpoint().getByName(workspaceId, bp.getName())).collect(Collectors.toSet());
blueprintEntity.setResponses(detailedBlueprints);
}
use of com.sequenceiq.it.cloudbreak.CloudbreakClient in project cloudbreak by hortonworks.
the class BlueprintV4Action method delete.
public static void delete(IntegrationTestContext integrationTestContext, Entity entity) {
BlueprintTestDto blueprintEntity = (BlueprintTestDto) entity;
CloudbreakClient client;
client = integrationTestContext.getContextParam(CloudbreakClient.CLOUDBREAK_CLIENT, CloudbreakClient.class);
Long workspaceId = integrationTestContext.getContextParam(CloudbreakTest.WORKSPACE_ID, Long.class);
Log.log(" deleteByName ".concat(blueprintEntity.getName()).concat(" private blueprint with Name. "));
client.getDefaultClient().blueprintV4Endpoint().deleteByName(workspaceId, blueprintEntity.getName());
}
Aggregations