use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.
the class KnoxGatewayConfigProviderTest method roleConfigsWithGateway.
@Test
public void roleConfigsWithGateway() {
GatewayTopology topology = new GatewayTopology();
topology.setTopologyName("my-topology");
topology.setExposedServices(Json.silent(new ExposedServices()));
Gateway gateway = new Gateway();
gateway.setKnoxMasterSecret("admin");
gateway.setPath("/a/b/c");
gateway.setTopologies(Set.of(topology));
GeneralClusterConfigs generalClusterConfigs = new GeneralClusterConfigs();
generalClusterConfigs.setAccountId(Optional.of("1234"));
IdBroker idBroker = new IdBroker();
idBroker.setMasterSecret("supersecret");
BlueprintTextProcessor blueprintTextProcessor = mock(BlueprintTextProcessor.class);
BlueprintView blueprintView = new BlueprintView("text", "7.2.11", "CDH", blueprintTextProcessor);
TemplatePreparationObject source = Builder.builder().withGateway(gateway, "key", new HashSet<>()).withGeneralClusterConfigs(generalClusterConfigs).withBlueprintView(blueprintView).withVirtualGroupView(new VirtualGroupRequest(TestConstants.CRN, "")).withProductDetails(new ClouderaManagerRepo().withVersion("7.4.2"), List.of(new ClouderaManagerProduct().withVersion("7.2.10").withName("CDH"))).withIdBroker(idBroker).build();
when(virtualGroupService.createOrGetVirtualGroup(source.getVirtualGroupRequest(), UmsVirtualGroupRight.KNOX_ADMIN)).thenReturn("");
when(entitlementService.isOjdbcTokenDhOneHour(anyString())).thenReturn(true);
assertEquals(List.of(config("idbroker_master_secret", "supersecret"), config("idbroker_gateway_knox_admin_groups", ""), config("idbroker_gateway_signing_keystore_name", "signing.jks"), config("idbroker_gateway_signing_keystore_type", "JKS"), config("idbroker_gateway_signing_key_alias", "signing-identity")), underTest.getRoleConfigs(KnoxRoles.IDBROKER, source));
assertEquals(List.of(config("gateway_master_secret", gateway.getKnoxMasterSecret()), config("gateway_default_topology_name", gateway.getTopologies().iterator().next().getTopologyName()), config("gateway_knox_admin_groups", ""), config("gateway_auto_discovery_enabled", "false"), config("gateway_path", gateway.getPath()), config("gateway_signing_keystore_name", "signing.jks"), config("gateway_signing_keystore_type", "JKS"), config("gateway_signing_key_alias", "signing-identity"), config("gateway_dispatch_whitelist", "^*.*$"), config("gateway_service_tokenstate_impl", "org.apache.knox.gateway.services.token.impl.JDBCTokenStateService")), ThreadBasedUserCrnProvider.doAs(TEST_USER_CRN, () -> underTest.getRoleConfigs(KnoxRoles.KNOX_GATEWAY, source)));
assertEquals(List.of(), underTest.getRoleConfigs("NAMENODE", source));
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.
the class CmInstalledComponentFinderServiceTest method testFindParcelComponents.
@Test
void testFindParcelComponents() {
Set<Image> candidateImages = Set.of(mock(Image.class));
Set<ClouderaManagerProduct> candidateCmProduct = Set.of(new ClouderaManagerProduct());
Set<ParcelInfo> queriedParcelInfo = Set.of(new ParcelInfo("", ""));
Set<ClouderaManagerProduct> chosenClouderaManagerProducts = Set.of(new ClouderaManagerProduct());
when(stack.isDatalake()).thenReturn(true);
when(imageReaderService.getParcels(candidateImages, true)).thenReturn(candidateCmProduct);
when(cmInfoRetriever.queryActiveParcels(eq(stack))).thenReturn(queriedParcelInfo);
when(cmProductChooserService.chooseParcelProduct(queriedParcelInfo, candidateCmProduct)).thenReturn(chosenClouderaManagerProducts);
CmParcelSyncOperationResult cmParcelSyncOperationResult = underTest.findParcelComponents(stack, candidateImages);
assertThat(cmParcelSyncOperationResult.getActiveParcels(), hasSize(1));
verify(imageReaderService).getParcels(candidateImages, true);
verify(cmInfoRetriever).queryActiveParcels(stack);
verify(cmProductChooserService).chooseParcelProduct(queriedParcelInfo, candidateCmProduct);
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.
the class CmProductChooserServiceTest method testChooseParcelProductWhenDifferentNameButSameVersionThenEmptyResult.
@Test
void testChooseParcelProductWhenDifferentNameButSameVersionThenEmptyResult() {
Set<ParcelInfo> activeParcels = Set.of(new ParcelInfo(PARCEL_NAME_2, PARCEL_VERSION_1));
Set<ClouderaManagerProduct> candidateProducts = Set.of(new ClouderaManagerProduct().withName(PARCEL_NAME_1).withVersion(PARCEL_VERSION_1));
Set<ClouderaManagerProduct> foundProducts = underTest.chooseParcelProduct(activeParcels, candidateProducts);
assertThat(foundProducts, hasSize(0));
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.
the class CmProductChooserServiceTest method testChooseParcelProductWhenMultipleMatchingNameAndVersionThenReturnsAllMatches.
@Test
void testChooseParcelProductWhenMultipleMatchingNameAndVersionThenReturnsAllMatches() {
Set<ParcelInfo> activeParcels = Set.of(new ParcelInfo(PARCEL_NAME_1, PARCEL_VERSION_1), new ParcelInfo(PARCEL_NAME_2, PARCEL_VERSION_2));
Set<ClouderaManagerProduct> candidateProducts = Set.of(new ClouderaManagerProduct().withName(PARCEL_NAME_1).withVersion(PARCEL_VERSION_1), new ClouderaManagerProduct().withName(PARCEL_NAME_2).withVersion(PARCEL_VERSION_2));
Set<ClouderaManagerProduct> foundProducts = underTest.chooseParcelProduct(activeParcels, candidateProducts);
assertThat(foundProducts, hasSize(2));
List<ClouderaManagerProduct> foundProductList = new ArrayList<>(foundProducts);
foundProductList.sort(Comparator.comparing(ClouderaManagerProduct::getName));
assertEquals(PARCEL_NAME_1, foundProductList.get(0).getName());
assertEquals(PARCEL_VERSION_1, foundProductList.get(0).getVersion());
assertEquals(PARCEL_NAME_2, foundProductList.get(1).getName());
assertEquals(PARCEL_VERSION_2, foundProductList.get(1).getVersion());
}
use of com.sequenceiq.cloudbreak.cloud.model.ClouderaManagerProduct in project cloudbreak by hortonworks.
the class CmProductChooserServiceTest method testChooseParcelProductWhenMatchingNameAndVersionThenReturns.
@Test
void testChooseParcelProductWhenMatchingNameAndVersionThenReturns() {
Set<ParcelInfo> activeParcels = Set.of(new ParcelInfo(PARCEL_NAME_1, PARCEL_VERSION_1));
Set<ClouderaManagerProduct> candidateProducts = Set.of(new ClouderaManagerProduct().withName(PARCEL_NAME_1).withVersion(PARCEL_VERSION_1));
Set<ClouderaManagerProduct> foundProducts = underTest.chooseParcelProduct(activeParcels, candidateProducts);
assertThat(foundProducts, hasSize(1));
ClouderaManagerProduct foundProduct = foundProducts.iterator().next();
assertEquals(PARCEL_NAME_1, foundProduct.getName());
assertEquals(PARCEL_VERSION_1, foundProduct.getVersion());
}
Aggregations