UpgradeCatalog250 extends AbstractUpgradeCatalog { protected void updateAtlasConfigs() throws AmbariException { AmbariManagementController ambariManagementController = injector.getInstance(AmbariManagementController.class); Clusters clusters = ambariManagementController.getClusters(); if (clusters != null) { Map<String, Cluster> clusterMap = clusters.getClusters(); if (clusterMap != null && !clusterMap.isEmpty()) { for (final Cluster cluster : clusterMap.values()) { updateAtlasHookConfig(cluster, "HIVE", "hive-env", "hive.atlas.hook"); updateAtlasHookConfig(cluster, "STORM", "storm-env", "storm.atlas.hook"); updateAtlasHookConfig(cluster, "FALCON", "falcon-env", "falcon.atlas.hook"); updateAtlasHookConfig(cluster, "SQOOP", "sqoop-env", "sqoop.atlas.hook"); } } } } @Inject  UpgradeCatalog250(Injector injector); @Override String getTargetVersion(); @Override String getSourceVersion(); static final String COMPONENT_TABLE; static final String COMPONENT_VERSION_TABLE; static final String COMPONENT_VERSION_PK; static final String COMPONENT_VERSION_FK_COMPONENT; static final String COMPONENT_VERSION_FK_REPO_VERSION; }
@Test public void testUpdateAtlasConfigs() throws Exception { Map<String, String> oldHiveProperties = new HashMap<String, String>(); Map<String, String> newHiveProperties = new HashMap<String, String>(); oldHiveProperties.put("hive.atlas.hook", "false"); newHiveProperties.put("hive.atlas.hook", "true"); testUpdateAtlasHookConfig(oldHiveProperties, newHiveProperties, "hive-env"); Map<String, String> oldStormProperties = new HashMap<String, String>(); Map<String, String> newStormProperties = new HashMap<String, String>(); oldStormProperties.put("storm.atlas.hook", "false"); newStormProperties.put("storm.atlas.hook", "true"); testUpdateAtlasHookConfig(oldStormProperties, newStormProperties, "storm-env"); Map<String, String> oldFalconProperties = new HashMap<String, String>(); Map<String, String> newFalconProperties = new HashMap<String, String>(); oldFalconProperties.put("falcon.atlas.hook", "false"); newFalconProperties.put("falcon.atlas.hook", "true"); testUpdateAtlasHookConfig(oldFalconProperties, newFalconProperties, "falcon-env"); Map<String, String> oldSqoopProperties = new HashMap<String, String>(); Map<String, String> newSqoopProperties = new HashMap<String, String>(); oldSqoopProperties.put("sqoop.atlas.hook", "false"); newSqoopProperties.put("sqoop.atlas.hook", "true"); testUpdateAtlasHookConfig(oldSqoopProperties, newSqoopProperties, "sqoop-env"); }