test_class.declarator: cloudCis
test_class.modifier: private
test_class.original_string: private Map<String, CmsCI> cloudCis;
test_class.type: Map<String, CmsCI>
test_class.var_name: cloudCis
test_class.declarator: clouds = {"c1", "c2", "c3", "c4"}
test_class.modifier: private final
test_class.original_string: private final String[] clouds = {"c1", "c2", "c3", "c4"};
test_class.type: String[]
test_class.var_name: clouds
test_class.file: transistor/src/test/java/com/oneops/transistor/service/BomManagerImplTest.java
test_class.identifier: BomManagerImplTest
test_case.body: @Test(expectedExceptions = {})
      public void passPackCloudWhiteList() {
          CmsCmProcessor cmProcessor = mock(CmsCmProcessor.class);
          BomManagerImpl impl = getInstance(cmProcessor);
          impl.gson = new Gson();
  
          CmsCI platform = platform();
          CmsCI cloud = cloud();
  
          CmsVar var = new CmsVar();
          var.setName(BomManagerImpl.PACK_CLOUD_NS_WHITELIST_CMS_VAR_NAME);
  
          // Whitelist is not configured
          doAnswer(invocation -> null).when(cmProcessor).getCmSimpleVar(BomManagerImpl.PACK_CLOUD_NS_WHITELIST_CMS_VAR_NAME);
          impl.checkPackCloudWhiteList(platform, cloud);
  
          // pack does not match
          var.setValue("{\"oneops/java\":{\"location:azure\": [\"/blah\"]}}");
          doAnswer(invocation -> var).when(cmProcessor).getCmSimpleVar(BomManagerImpl.PACK_CLOUD_NS_WHITELIST_CMS_VAR_NAME);
          impl.checkPackCloudWhiteList(platform, cloud);
  
          // cloud does not match
          var.setValue("{\"oneops/tomcat\":{\"location:openstack\": [\"/blah\"]}}");
          doAnswer(invocation -> var).when(cmProcessor).getCmSimpleVar(BomManagerImpl.PACK_CLOUD_NS_WHITELIST_CMS_VAR_NAME);
          impl.checkPackCloudWhiteList(platform, cloud);
  
          // org is white-listed, match cloud by attribute value
          var.setValue("{\"oneops/tomcat\":{\"location:azure\": [\"/cool-org\"]}}");
          doAnswer(invocation -> var).when(cmProcessor).getCmSimpleVar(BomManagerImpl.PACK_CLOUD_NS_WHITELIST_CMS_VAR_NAME);
          impl.checkPackCloudWhiteList(platform, cloud);
  
          // org is white-listed, match cloud by ciName
          var.setValue("{\"oneops/tomcat\":{\"c1\": [\"/cool-org\"]}}");
          doAnswer(invocation -> var).when(cmProcessor).getCmSimpleVar(BomManagerImpl.PACK_CLOUD_NS_WHITELIST_CMS_VAR_NAME);
          impl.checkPackCloudWhiteList(platform, cloud);
  
          // assembly is white-listed, match cloud by ciName
          var.setValue("{\"oneops/tomcat\":{\"c1\": [\"/cool-org/a1\"]}}");
          doAnswer(invocation -> var).when(cmProcessor).getCmSimpleVar(BomManagerImpl.PACK_CLOUD_NS_WHITELIST_CMS_VAR_NAME);
          impl.checkPackCloudWhiteList(platform, cloud);
      }
test_case.class_method_signature: BomManagerImplTest.passPackCloudWhiteList()
test_case.full_signature: @Test(expectedExceptions = {}) public void passPackCloudWhiteList()
test_case.identifier: passPackCloudWhiteList
test_case.invocations: mock getInstance platform cloud setName getCmSimpleVar when doAnswer checkPackCloudWhiteList setValue getCmSimpleVar when doAnswer checkPackCloudWhiteList setValue getCmSimpleVar when doAnswer checkPackCloudWhiteList setValue getCmSimpleVar when doAnswer checkPackCloudWhiteList setValue getCmSimpleVar when doAnswer checkPackCloudWhiteList setValue getCmSimpleVar when doAnswer checkPackCloudWhiteList
test_case.modifiers: @Test(expectedExceptions = {}) public
test_case.parameters: ()
test_case.return: void
test_case.signature: void passPackCloudWhiteList()
focal_class.declarator: logger = Logger.getLogger(BomManagerImpl.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger logger = Logger.getLogger(BomManagerImpl.class);
focal_class.type: Logger
focal_class.var_name: logger
focal_class.declarator: checkSecondary = Boolean.valueOf(getProperty("transistor.checkSecondary", "true"))
focal_class.modifier: private static final
focal_class.original_string: private static final boolean checkSecondary = Boolean.valueOf(getProperty("transistor.checkSecondary", "true"));
focal_class.type: boolean
focal_class.var_name: checkSecondary
focal_class.declarator: check4Services = Boolean.valueOf(getProperty("transistor.checkServices", "true"))
focal_class.modifier: private static final
focal_class.original_string: private static final boolean check4Services = Boolean.valueOf(getProperty("transistor.checkServices", "true"));
focal_class.type: boolean
focal_class.var_name: check4Services
focal_class.declarator: PACK_CLOUD_NS_WHITELIST_CMS_VAR_NAME = "PACK_CLOUD_NS_WHITELIST"
focal_class.modifier: static final
focal_class.original_string: static final String PACK_CLOUD_NS_WHITELIST_CMS_VAR_NAME = "PACK_CLOUD_NS_WHITELIST";
focal_class.type: String
focal_class.var_name: PACK_CLOUD_NS_WHITELIST_CMS_VAR_NAME
focal_class.declarator: cmProcessor
focal_class.modifier: private
focal_class.original_string: private CmsCmProcessor cmProcessor;
focal_class.type: CmsCmProcessor
focal_class.var_name: cmProcessor
focal_class.declarator: manifestRfcProcessor
focal_class.modifier: private
focal_class.original_string: private CmsRfcProcessor manifestRfcProcessor;
focal_class.type: CmsRfcProcessor
focal_class.var_name: manifestRfcProcessor
focal_class.declarator: bomRfcProcessor
focal_class.modifier: private
focal_class.original_string: private CmsRfcProcessor bomRfcProcessor;
focal_class.type: CmsRfcProcessor
focal_class.var_name: bomRfcProcessor
focal_class.declarator: bomGenerationProcessor
focal_class.modifier: private
focal_class.original_string: private BomRfcBulkProcessor bomGenerationProcessor;
focal_class.type: BomRfcBulkProcessor
focal_class.var_name: bomGenerationProcessor
focal_class.declarator: trUtil
focal_class.modifier: private
focal_class.original_string: private TransUtil trUtil;
focal_class.type: TransUtil
focal_class.var_name: trUtil
focal_class.declarator: dpmtProcessor
focal_class.modifier: private
focal_class.original_string: private CmsDpmtProcessor dpmtProcessor;
focal_class.type: CmsDpmtProcessor
focal_class.var_name: dpmtProcessor
focal_class.declarator: cmsUtil
focal_class.modifier: private
focal_class.original_string: private CmsUtil cmsUtil;
focal_class.type: CmsUtil
focal_class.var_name: cmsUtil
focal_class.declarator: cloudUtil
focal_class.modifier: private
focal_class.original_string: private CloudUtil cloudUtil;
focal_class.type: CloudUtil
focal_class.var_name: cloudUtil
focal_class.declarator: gson = new Gson()
focal_class.original_string: Gson gson = new Gson();
focal_class.type: Gson
focal_class.var_name: gson
focal_class.file: transistor/src/main/java/com/oneops/transistor/service/BomManagerImpl.java
focal_class.identifier: BomManagerImpl
focal_class.interfaces: implements BomManager
focal_class.class_method_signature: BomManagerImpl.setCloudUtil(CloudUtil cloudUtil)
focal_class.full_signature: public void setCloudUtil(CloudUtil cloudUtil)
focal_class.identifier: setCloudUtil
focal_class.modifiers: public
focal_class.parameters: (CloudUtil cloudUtil)
focal_class.return: void
focal_class.signature: void setCloudUtil(CloudUtil cloudUtil)
focal_class.class_method_signature: BomManagerImpl.setCmsUtil(CmsUtil cmsUtil)
focal_class.full_signature: public void setCmsUtil(CmsUtil cmsUtil)
focal_class.identifier: setCmsUtil
focal_class.modifiers: public
focal_class.parameters: (CmsUtil cmsUtil)
focal_class.return: void
focal_class.signature: void setCmsUtil(CmsUtil cmsUtil)
focal_class.class_method_signature: BomManagerImpl.setTrUtil(TransUtil trUtil)
focal_class.full_signature: public void setTrUtil(TransUtil trUtil)
focal_class.identifier: setTrUtil
focal_class.modifiers: public
focal_class.parameters: (TransUtil trUtil)
focal_class.return: void
focal_class.signature: void setTrUtil(TransUtil trUtil)
focal_class.class_method_signature: BomManagerImpl.setCmProcessor(CmsCmProcessor cmProcessor)
focal_class.full_signature: public void setCmProcessor(CmsCmProcessor cmProcessor)
focal_class.identifier: setCmProcessor
focal_class.modifiers: public
focal_class.parameters: (CmsCmProcessor cmProcessor)
focal_class.return: void
focal_class.signature: void setCmProcessor(CmsCmProcessor cmProcessor)
focal_class.class_method_signature: BomManagerImpl.setManifestRfcProcessor(CmsRfcProcessor manifestRfcProcessor)
focal_class.full_signature: public void setManifestRfcProcessor(CmsRfcProcessor manifestRfcProcessor)
focal_class.identifier: setManifestRfcProcessor
focal_class.modifiers: public
focal_class.parameters: (CmsRfcProcessor manifestRfcProcessor)
focal_class.return: void
focal_class.signature: void setManifestRfcProcessor(CmsRfcProcessor manifestRfcProcessor)
focal_class.class_method_signature: BomManagerImpl.setBomRfcProcessor(CmsRfcProcessor bomRfcProcessor)
focal_class.full_signature: public void setBomRfcProcessor(CmsRfcProcessor bomRfcProcessor)
focal_class.identifier: setBomRfcProcessor
focal_class.modifiers: public
focal_class.parameters: (CmsRfcProcessor bomRfcProcessor)
focal_class.return: void
focal_class.signature: void setBomRfcProcessor(CmsRfcProcessor bomRfcProcessor)
focal_class.class_method_signature: BomManagerImpl.setBomGenerationProcessor(BomRfcBulkProcessor bomGenerationProcessor)
focal_class.full_signature: public void setBomGenerationProcessor(BomRfcBulkProcessor bomGenerationProcessor)
focal_class.identifier: setBomGenerationProcessor
focal_class.modifiers: public
focal_class.parameters: (BomRfcBulkProcessor bomGenerationProcessor)
focal_class.return: void
focal_class.signature: void setBomGenerationProcessor(BomRfcBulkProcessor bomGenerationProcessor)
focal_class.class_method_signature: BomManagerImpl.setDpmtProcessor(CmsDpmtProcessor dpmtProcessor)
focal_class.full_signature: public void setDpmtProcessor(CmsDpmtProcessor dpmtProcessor)
focal_class.identifier: setDpmtProcessor
focal_class.modifiers: public
focal_class.parameters: (CmsDpmtProcessor dpmtProcessor)
focal_class.return: void
focal_class.signature: void setDpmtProcessor(CmsDpmtProcessor dpmtProcessor)
focal_class.class_method_signature: BomManagerImpl.generateAndDeployBom(long envId, String userId, Set<Long> excludePlats, CmsDeployment dpmt, boolean commit)
focal_class.full_signature: @Override public Map<String, Object> generateAndDeployBom(long envId, String userId, Set<Long> excludePlats, CmsDeployment dpmt, boolean commit)
focal_class.identifier: generateAndDeployBom
focal_class.modifiers: @Override public
focal_class.parameters: (long envId, String userId, Set<Long> excludePlats, CmsDeployment dpmt, boolean commit)
focal_class.return: Map<String, Object>
focal_class.signature: Map<String, Object> generateAndDeployBom(long envId, String userId, Set<Long> excludePlats, CmsDeployment dpmt, boolean commit)
focal_class.class_method_signature: BomManagerImpl.generateBom(long envId, String userId, Set<Long> excludePlats, String desc, boolean commit)
focal_class.full_signature: @Override public Map<String, Object> generateBom(long envId, String userId, Set<Long> excludePlats, String desc, boolean commit)
focal_class.identifier: generateBom
focal_class.modifiers: @Override public
focal_class.parameters: (long envId, String userId, Set<Long> excludePlats, String desc, boolean commit)
focal_class.return: Map<String, Object>
focal_class.signature: Map<String, Object> generateBom(long envId, String userId, Set<Long> excludePlats, String desc, boolean commit)
focal_class.class_method_signature: BomManagerImpl.generateBomForClouds(long envId, String userId, Set<Long> excludePlats, String desc, boolean commit)
focal_class.full_signature: private Map<String, Object> generateBomForClouds(long envId, String userId, Set<Long> excludePlats, String desc, boolean commit)
focal_class.identifier: generateBomForClouds
focal_class.modifiers: private
focal_class.parameters: (long envId, String userId, Set<Long> excludePlats, String desc, boolean commit)
focal_class.return: Map<String, Object>
focal_class.signature: Map<String, Object> generateBomForClouds(long envId, String userId, Set<Long> excludePlats, String desc, boolean commit)
focal_class.class_method_signature: BomManagerImpl.generateBomForActiveClouds(EnvBomGenerationContext context)
focal_class.full_signature: private int generateBomForActiveClouds(EnvBomGenerationContext context)
focal_class.identifier: generateBomForActiveClouds
focal_class.modifiers: private
focal_class.parameters: (EnvBomGenerationContext context)
focal_class.return: int
focal_class.signature: int generateBomForActiveClouds(EnvBomGenerationContext context)
focal_class.class_method_signature: BomManagerImpl.getPlatformIds(Map<Integer, List<CmsCI>> platsToProcess)
focal_class.full_signature: private Set<Long> getPlatformIds(Map<Integer, List<CmsCI>> platsToProcess)
focal_class.identifier: getPlatformIds
focal_class.modifiers: private
focal_class.parameters: (Map<Integer, List<CmsCI>> platsToProcess)
focal_class.return: Set<Long>
focal_class.signature: Set<Long> getPlatformIds(Map<Integer, List<CmsCI>> platsToProcess)
focal_class.class_method_signature: BomManagerImpl.check4Secondary(PlatformBomGenerationContext context, List<CmsCIRelation> platformCloudRels)
focal_class.full_signature:  void check4Secondary(PlatformBomGenerationContext context, List<CmsCIRelation> platformCloudRels)
focal_class.identifier: check4Secondary
focal_class.parameters: (PlatformBomGenerationContext context, List<CmsCIRelation> platformCloudRels)
focal_class.return: void
focal_class.signature: void check4Secondary(PlatformBomGenerationContext context, List<CmsCIRelation> platformCloudRels)
focal_class.class_method_signature: BomManagerImpl.generateBomForOfflineClouds(EnvBomGenerationContext context, int startingExecOrder)
focal_class.full_signature: private int generateBomForOfflineClouds(EnvBomGenerationContext context, int startingExecOrder)
focal_class.identifier: generateBomForOfflineClouds
focal_class.modifiers: private
focal_class.parameters: (EnvBomGenerationContext context, int startingExecOrder)
focal_class.return: int
focal_class.signature: int generateBomForOfflineClouds(EnvBomGenerationContext context, int startingExecOrder)
focal_class.class_method_signature: BomManagerImpl.getMaxExecOrder(Map<Integer, List<CmsCI>> platsToProcess)
focal_class.full_signature: private Integer getMaxExecOrder(Map<Integer, List<CmsCI>> platsToProcess)
focal_class.identifier: getMaxExecOrder
focal_class.modifiers: private
focal_class.parameters: (Map<Integer, List<CmsCI>> platsToProcess)
focal_class.return: Integer
focal_class.signature: Integer getMaxExecOrder(Map<Integer, List<CmsCI>> platsToProcess)
focal_class.class_method_signature: BomManagerImpl.getOrderedClouds(List<CmsCIRelation> cloudRels, boolean reverse)
focal_class.full_signature:  SortedMap<Integer, SortedMap<Integer, List<CmsCIRelation>>> getOrderedClouds(List<CmsCIRelation> cloudRels, boolean reverse)
focal_class.identifier: getOrderedClouds
focal_class.parameters: (List<CmsCIRelation> cloudRels, boolean reverse)
focal_class.return: SortedMap<Integer, SortedMap<Integer, List<CmsCIRelation>>>
focal_class.signature: SortedMap<Integer, SortedMap<Integer, List<CmsCIRelation>>> getOrderedClouds(List<CmsCIRelation> cloudRels, boolean reverse)
focal_class.class_method_signature: BomManagerImpl.submitDeployment(long releaseId, String userId, String desc)
focal_class.full_signature: @Override public long submitDeployment(long releaseId, String userId, String desc)
focal_class.identifier: submitDeployment
focal_class.modifiers: @Override public
focal_class.parameters: (long releaseId, String userId, String desc)
focal_class.return: long
focal_class.signature: long submitDeployment(long releaseId, String userId, String desc)
focal_class.class_method_signature: BomManagerImpl.updateParentReleaseId(String nsPath, String manifestNsPath, String bomReleaseState)
focal_class.full_signature: private CmsRelease updateParentReleaseId(String nsPath, String manifestNsPath, String bomReleaseState)
focal_class.identifier: updateParentReleaseId
focal_class.modifiers: private
focal_class.parameters: (String nsPath, String manifestNsPath, String bomReleaseState)
focal_class.return: CmsRelease
focal_class.signature: CmsRelease updateParentReleaseId(String nsPath, String manifestNsPath, String bomReleaseState)
focal_class.class_method_signature: BomManagerImpl.getOrderedPlatforms(EnvBomGenerationContext context)
focal_class.full_signature:  Map<Integer, List<CmsCI>> getOrderedPlatforms(EnvBomGenerationContext context)
focal_class.identifier: getOrderedPlatforms
focal_class.parameters: (EnvBomGenerationContext context)
focal_class.return: Map<Integer, List<CmsCI>>
focal_class.signature: Map<Integer, List<CmsCI>> getOrderedPlatforms(EnvBomGenerationContext context)
focal_class.class_method_signature: BomManagerImpl.processPlatformsOrder(long startPlatId, Map<Long, Integer> platExecOrderMap, List<CmsCIRelation> allLinksToRels)
focal_class.full_signature: private void processPlatformsOrder(long startPlatId, Map<Long, Integer> platExecOrderMap, List<CmsCIRelation> allLinksToRels)
focal_class.identifier: processPlatformsOrder
focal_class.modifiers: private
focal_class.parameters: (long startPlatId, Map<Long, Integer> platExecOrderMap, List<CmsCIRelation> allLinksToRels)
focal_class.return: void
focal_class.signature: void processPlatformsOrder(long startPlatId, Map<Long, Integer> platExecOrderMap, List<CmsCIRelation> allLinksToRels)
focal_class.class_method_signature: BomManagerImpl.commitManifestRelease(String manifestNsPath, String bomNsPath, String userId, String desc)
focal_class.full_signature: private void commitManifestRelease(String manifestNsPath, String bomNsPath, String userId, String desc)
focal_class.identifier: commitManifestRelease
focal_class.modifiers: private
focal_class.parameters: (String manifestNsPath, String bomNsPath, String userId, String desc)
focal_class.return: void
focal_class.signature: void commitManifestRelease(String manifestNsPath, String bomNsPath, String userId, String desc)
focal_class.class_method_signature: BomManagerImpl.check4openDeployment(String nsPath)
focal_class.full_signature: @Override public void check4openDeployment(String nsPath)
focal_class.identifier: check4openDeployment
focal_class.modifiers: @Override public
focal_class.parameters: (String nsPath)
focal_class.return: void
focal_class.signature: void check4openDeployment(String nsPath)
focal_class.class_method_signature: BomManagerImpl.checkPackCloudWhiteList(CmsCI platform, CmsCI cloud)
focal_class.full_signature:  void checkPackCloudWhiteList(CmsCI platform, CmsCI cloud)
focal_class.identifier: checkPackCloudWhiteList
focal_class.parameters: (CmsCI platform, CmsCI cloud)
focal_class.return: void
focal_class.signature: void checkPackCloudWhiteList(CmsCI platform, CmsCI cloud)
focal_method.body: void checkPackCloudWhiteList(CmsCI platform, CmsCI cloud) {
  		CmsVar cmsVar = cmProcessor.getCmSimpleVar(PACK_CLOUD_NS_WHITELIST_CMS_VAR_NAME);
  		if (cmsVar == null ) return;
  		String json = cmsVar.getValue();
  		if (json == null || json.isEmpty()) return;
  
  		try {
  			Map<String, Map<String, List<String>>> whitelist = gson.fromJson(json, (new TypeToken<Map<String, Map<String, List<String>>>>() {}).getType());
  			String packKey = platform.getAttribute("source").getDfValue() + "/" + platform.getAttribute("pack").getDfValue();
  			Map<String, List<String>> packWhiteList = whitelist.containsKey(packKey) ? whitelist.get(packKey) :
  					whitelist.get(packKey + ":" + platform.getAttribute("version").getDfValue());
  			if (packWhiteList == null) return;
  			List<String> namespaces = packWhiteList.keySet().stream()
  			.filter(c -> {
  				// It could be either a simple value to match against ciName or ':' delimited tokens specifying attribute name and value.
  				String[] split = c.split(":");
  				String matchValue = split[split.length > 1 ? 1 : 0].toLowerCase();
  				String cloudValue;
  				if (split.length > 1) {
  					CmsCIAttribute attribute = cloud.getAttribute(split[0]);
  					if (attribute == null) return false;
  					cloudValue = attribute.getDfValue();
  				} else {
  					cloudValue = cloud.getCiName();
  				}
  				return cloudValue != null && cloudValue.toLowerCase().contains(matchValue);
  			})
  			.map(packWhiteList::get)
  			.findFirst().orElse(null);
  			if (namespaces == null || namespaces.isEmpty()) return;
  			String platformNsPath = platform.getNsPath();
  			boolean ok = namespaces.stream().anyMatch(platformNsPath::startsWith);
  			if (!ok) {
  				String message = "platform '" + platform.getCiName() + "' can not be deployed to cloud '" + cloud.getCiName();
  				throw new TransistorException(CmsError.TRANSISTOR_CANNOT_DEPLOY_PACK_TO_CLOUD, message);
  			}
  
  		} catch (JsonSyntaxException e) {
  			logger.warn("Failed to parse PACK_CLOUD_NS_WHITELIST json: " + json + ". Exception: " + e.getMessage());
  		}
  	}
focal_method.class_method_signature: BomManagerImpl.checkPackCloudWhiteList(CmsCI platform, CmsCI cloud)
focal_method.full_signature:  void checkPackCloudWhiteList(CmsCI platform, CmsCI cloud)
focal_method.identifier: checkPackCloudWhiteList
focal_method.invocations: getCmSimpleVar getValue isEmpty fromJson getType getDfValue getAttribute getDfValue getAttribute containsKey get get getDfValue getAttribute orElse findFirst map filter stream keySet split toLowerCase getAttribute getDfValue getCiName contains toLowerCase isEmpty getNsPath anyMatch stream getCiName getCiName warn getMessage
focal_method.parameters: (CmsCI platform, CmsCI cloud)
focal_method.return: void
focal_method.signature: void checkPackCloudWhiteList(CmsCI platform, CmsCI cloud)