http://git-wip-us.apache.org/repos/asf/ambari/blob/a9cda4f1/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java index 1d6345d..b763bd7 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessorTest.java @@ -58,8 +58,10 @@ import org.apache.ambari.server.topology.HostGroup; import org.apache.ambari.server.topology.HostGroupImpl; import org.apache.ambari.server.topology.HostGroupInfo; import org.apache.ambari.server.topology.InvalidTopologyException; +import org.apache.ambari.server.topology.TopologyRequest; import org.apache.commons.lang.StringUtils; import org.easymock.EasyMockRule; +import org.easymock.EasyMockSupport; import org.easymock.Mock; import org.easymock.MockType; import org.junit.After; @@ -77,10 +79,10 @@ import com.google.common.collect.Maps; /** * BlueprintConfigurationProcessor unit tests. */ -public class BlueprintConfigurationProcessorTest { +public class BlueprintConfigurationProcessorTest extends EasyMockSupport { private static final Configuration EMPTY_CONFIG = new Configuration(Collections.<String, Map<String, String>>emptyMap(), Collections.<String, Map<String, Map<String, String>>>emptyMap()); - private final Map<String, Collection<String>> serviceComponents = new HashMap<String, Collection<String>>(); + private final Map<String, Collection<String>> serviceComponents = new HashMap<>(); @Rule public EasyMockRule mocks = new EasyMockRule(this); @@ -97,6 +99,9 @@ public class BlueprintConfigurationProcessorTest { @Mock(type = MockType.NICE) private Stack stack; + @Mock + private TopologyRequest topologyRequestMock; + @Before public void init() throws Exception { expect(bp.getStack()).andReturn(stack).anyTimes(); @@ -109,76 +114,76 @@ public class BlueprintConfigurationProcessorTest { expect(stack.getConfigurationPropertiesWithMetadata(anyObject(String.class), anyObject(String.class))).andReturn(Collections.<String, Stack.ConfigProperty>emptyMap()).anyTimes(); expect(serviceInfo.getRequiredProperties()).andReturn( - Collections.<String, org.apache.ambari.server.state.PropertyInfo>emptyMap()).anyTimes(); + Collections.<String, org.apache.ambari.server.state.PropertyInfo>emptyMap()).anyTimes(); expect(serviceInfo.getRequiredServices()).andReturn(Collections.<String>emptyList()).anyTimes(); - Collection<String> hdfsComponents = new HashSet<String>(); + Collection<String> hdfsComponents = new HashSet<>(); hdfsComponents.add("NAMENODE"); hdfsComponents.add("SECONDARY_NAMENODE"); hdfsComponents.add("DATANODE"); hdfsComponents.add("HDFS_CLIENT"); serviceComponents.put("HDFS", hdfsComponents); - Collection<String> yarnComponents = new HashSet<String>(); + Collection<String> yarnComponents = new HashSet<>(); yarnComponents.add("RESOURCEMANAGER"); yarnComponents.add("NODEMANAGER"); yarnComponents.add("YARN_CLIENT"); yarnComponents.add("APP_TIMELINE_SERVER"); serviceComponents.put("YARN", yarnComponents); - Collection<String> mrComponents = new HashSet<String>(); + Collection<String> mrComponents = new HashSet<>(); mrComponents.add("MAPREDUCE2_CLIENT"); mrComponents.add("HISTORY_SERVER"); serviceComponents.put("MAPREDUCE2", mrComponents); - Collection<String> zkComponents = new HashSet<String>(); + Collection<String> zkComponents = new HashSet<>(); zkComponents.add("ZOOKEEPER_SERVER"); zkComponents.add("ZOOKEEPER_CLIENT"); serviceComponents.put("ZOOKEEPER", zkComponents); - Collection<String> hiveComponents = new HashSet<String>(); + Collection<String> hiveComponents = new HashSet<>(); hiveComponents.add("MYSQL_SERVER"); hiveComponents.add("HIVE_METASTORE"); hiveComponents.add("HIVE_SERVER"); serviceComponents.put("HIVE", hiveComponents); - Collection<String> falconComponents = new HashSet<String>(); + Collection<String> falconComponents = new HashSet<>(); falconComponents.add("FALCON_SERVER"); falconComponents.add("FALCON_CLIENT"); serviceComponents.put("FALCON", falconComponents); - Collection<String> gangliaComponents = new HashSet<String>(); + Collection<String> gangliaComponents = new HashSet<>(); gangliaComponents.add("GANGLIA_SERVER"); gangliaComponents.add("GANGLIA_CLIENT"); serviceComponents.put("GANGLIA", gangliaComponents); - Collection<String> kafkaComponents = new HashSet<String>(); + Collection<String> kafkaComponents = new HashSet<>(); kafkaComponents.add("KAFKA_BROKER"); serviceComponents.put("KAFKA", kafkaComponents); - Collection<String> knoxComponents = new HashSet<String>(); + Collection<String> knoxComponents = new HashSet<>(); knoxComponents.add("KNOX_GATEWAY"); serviceComponents.put("KNOX", knoxComponents); - Collection<String> oozieComponents = new HashSet<String>(); + Collection<String> oozieComponents = new HashSet<>(); oozieComponents.add("OOZIE_SERVER"); oozieComponents.add("OOZIE_CLIENT"); serviceComponents.put("OOZIE", oozieComponents); - Collection<String> hbaseComponents = new HashSet<String>(); + Collection<String> hbaseComponents = new HashSet<>(); hbaseComponents.add("HBASE_MASTER"); serviceComponents.put("HBASE", hbaseComponents); - Collection<String> atlasComponents = new HashSet<String>(); + Collection<String> atlasComponents = new HashSet<>(); atlasComponents.add("ATLAS_SERVER"); atlasComponents.add("ATLAS_CLIENT"); serviceComponents.put("ATLAS", atlasComponents); - Collection<String> amsComponents = new HashSet<String>(); + Collection<String> amsComponents = new HashSet<>(); amsComponents.add("METRICS_COLLECTOR"); serviceComponents.put("AMBARI_METRICS", amsComponents); - Collection<String> stormComponents = new HashSet<String>(); + Collection<String> stormComponents = new HashSet<>(); stormComponents.add("NIMBUS"); serviceComponents.put("STORM", stormComponents); @@ -202,26 +207,26 @@ public class BlueprintConfigurationProcessorTest { @Test public void testDoUpdateForBlueprintExport_SingleHostProperty() throws Exception { - Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); - Map<String, String> typeProps = new HashMap<String, String>(); + Map<String, Map<String, String>> properties = new HashMap<>(); + Map<String, String> typeProps = new HashMap<>(); typeProps.put("yarn.resourcemanager.hostname", "testhost"); properties.put("yarn-site", typeProps); Configuration clusterConfig = new Configuration(properties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); - Collection<String> hgComponents = new HashSet<String>(); + Collection<String> hgComponents = new HashSet<>(); hgComponents.add("NAMENODE"); hgComponents.add("SECONDARY_NAMENODE"); hgComponents.add("RESOURCEMANAGER"); TestHostGroup group1 = new TestHostGroup("group1", hgComponents, Collections.singleton("testhost")); - Collection<String> hgComponents2 = new HashSet<String>(); + Collection<String> hgComponents2 = new HashSet<>(); hgComponents2.add("DATANODE"); hgComponents2.add("HDFS_CLIENT"); TestHostGroup group2 = new TestHostGroup("group2", hgComponents2, Collections.singleton("testhost2")); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group1); hostGroups.add(group2); @@ -235,9 +240,9 @@ public class BlueprintConfigurationProcessorTest { @Test public void testDoUpdateForBlueprintExport_FilterProperties() throws Exception { - Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); + Map<String, Map<String, String>> properties = new HashMap<>(); - Map<String, String> kerberosEnvProps = new HashMap<String, String>(); + Map<String, String> kerberosEnvProps = new HashMap<>(); kerberosEnvProps.put("admin_server_host", "test"); kerberosEnvProps.put("kdc_hosts", "test"); kerberosEnvProps.put("realm", "test"); @@ -246,11 +251,11 @@ public class BlueprintConfigurationProcessorTest { kerberosEnvProps.put("container_dn", "test"); properties.put("kerberos-env", kerberosEnvProps); - Map<String, String> krb5ConfProps = new HashMap<String, String>(); + Map<String, String> krb5ConfProps = new HashMap<>(); krb5ConfProps.put("domains", "test"); properties.put("krb5-conf", krb5ConfProps); - Map<String, String> tezSiteConfProps = new HashMap<String, String>(); + Map<String, String> tezSiteConfProps = new HashMap<>(); tezSiteConfProps.put("tez.tez-ui.history-url.base", "test"); properties.put("tez-site", tezSiteConfProps); @@ -258,18 +263,18 @@ public class BlueprintConfigurationProcessorTest { Configuration clusterConfig = new Configuration(properties, Collections.<String, Map<String, Map<String, String>>>emptyMap()); - Collection<String> hgComponents = new HashSet<String>(); + Collection<String> hgComponents = new HashSet<>(); hgComponents.add("NAMENODE"); hgComponents.add("SECONDARY_NAMENODE"); hgComponents.add("RESOURCEMANAGER"); TestHostGroup group1 = new TestHostGroup("group1", hgComponents, Collections.singleton("testhost")); - Collection<String> hgComponents2 = new HashSet<String>(); + Collection<String> hgComponents2 = new HashSet<>(); hgComponents2.add("DATANODE"); hgComponents2.add("HDFS_CLIENT"); TestHostGroup group2 = new TestHostGroup("group2", hgComponents2, Collections.singleton("testhost2")); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group1); hostGroups.add(group2); @@ -295,7 +300,7 @@ public class BlueprintConfigurationProcessorTest { ImmutableMap.of("admin-properties", rangerAdminProperties); - Configuration clusterConfig = new Configuration(properties, ImmutableMap.<String, Map<String,Map<String,String>>>of()); + Configuration clusterConfig = new Configuration(properties, ImmutableMap.<String, Map<String, Map<String, String>>>of()); Collection<String> hostGroup1Components = ImmutableSet.of("RANGER_ADMIN"); TestHostGroup group1 = new TestHostGroup("group1", hostGroup1Components, Collections.singleton("testhost1")); @@ -320,34 +325,34 @@ public class BlueprintConfigurationProcessorTest { @Test public void testDoUpdateForBlueprintExport_SingleHostProperty_specifiedInParentConfig() throws Exception { - Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); - Map<String, String> yarnSiteProps = new HashMap<String, String>(); + Map<String, Map<String, String>> properties = new HashMap<>(); + Map<String, String> yarnSiteProps = new HashMap<>(); yarnSiteProps.put("yarn.resourcemanager.hostname", "testhost"); properties.put("yarn-site", yarnSiteProps); - Map<String, Map<String, String>> parentProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> parentYarnSiteProps = new HashMap<String, String>(); + Map<String, Map<String, String>> parentProperties = new HashMap<>(); + Map<String, String> parentYarnSiteProps = new HashMap<>(); parentYarnSiteProps.put("yarn.resourcemanager.resource-tracker.address", "testhost"); parentProperties.put("yarn-site", parentYarnSiteProps); Configuration parentClusterConfig = new Configuration(parentProperties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); Configuration clusterConfig = new Configuration(properties, - Collections.<String, Map<String, Map<String, String>>>emptyMap(), parentClusterConfig); + Collections.<String, Map<String, Map<String, String>>>emptyMap(), parentClusterConfig); - Collection<String> hgComponents = new HashSet<String>(); + Collection<String> hgComponents = new HashSet<>(); hgComponents.add("NAMENODE"); hgComponents.add("SECONDARY_NAMENODE"); hgComponents.add("RESOURCEMANAGER"); TestHostGroup group1 = new TestHostGroup("group1", hgComponents, Collections.singleton("testhost")); - Collection<String> hgComponents2 = new HashSet<String>(); + Collection<String> hgComponents2 = new HashSet<>(); hgComponents2.add("DATANODE"); hgComponents2.add("HDFS_CLIENT"); TestHostGroup group2 = new TestHostGroup("group2", hgComponents2, Collections.singleton("testhost2")); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group1); hostGroups.add(group2); @@ -361,40 +366,40 @@ public class BlueprintConfigurationProcessorTest { @Test public void testDoUpdateForBlueprintExport_SingleHostProperty_hostGroupConfiguration() throws Exception { - Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); - Map<String, String> typeProps = new HashMap<String, String>(); + Map<String, Map<String, String>> properties = new HashMap<>(); + Map<String, String> typeProps = new HashMap<>(); typeProps.put("yarn.resourcemanager.hostname", "testhost"); properties.put("yarn-site", typeProps); Configuration clusterConfig = new Configuration(properties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); - Collection<String> hgComponents = new HashSet<String>(); + Collection<String> hgComponents = new HashSet<>(); hgComponents.add("NAMENODE"); hgComponents.add("SECONDARY_NAMENODE"); hgComponents.add("RESOURCEMANAGER"); TestHostGroup group1 = new TestHostGroup("group1", hgComponents, Collections.singleton("testhost")); - Collection<String> hgComponents2 = new HashSet<String>(); + Collection<String> hgComponents2 = new HashSet<>(); hgComponents2.add("DATANODE"); hgComponents2.add("HDFS_CLIENT"); - Map<String, Map<String, String>> group2Properties = new HashMap<String, Map<String, String>>(); - Map<String, String> group2YarnSiteProps = new HashMap<String, String>(); + Map<String, Map<String, String>> group2Properties = new HashMap<>(); + Map<String, String> group2YarnSiteProps = new HashMap<>(); group2YarnSiteProps.put("yarn.resourcemanager.resource-tracker.address", "testhost"); group2Properties.put("yarn-site", group2YarnSiteProps); // host group config -> BP config -> cluster scoped config Configuration group2BPConfiguration = new Configuration(Collections.<String, Map<String, String>>emptyMap(), - Collections.<String, Map<String, Map<String, String>>>emptyMap(), clusterConfig); + Collections.<String, Map<String, Map<String, String>>>emptyMap(), clusterConfig); Configuration group2Configuration = new Configuration(group2Properties, - Collections.<String, Map<String, Map<String, String>>>emptyMap(), group2BPConfiguration); + Collections.<String, Map<String, Map<String, String>>>emptyMap(), group2BPConfiguration); // set config on hostgroup TestHostGroup group2 = new TestHostGroup("group2", hgComponents2, - Collections.singleton("testhost2"), group2Configuration); + Collections.singleton("testhost2"), group2Configuration); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group1); hostGroups.add(group2); @@ -404,30 +409,30 @@ public class BlueprintConfigurationProcessorTest { assertEquals("%HOSTGROUP::group1%", properties.get("yarn-site").get("yarn.resourcemanager.hostname")); assertEquals("%HOSTGROUP::group1%", - group2Configuration.getPropertyValue("yarn-site", "yarn.resourcemanager.resource-tracker.address")); + group2Configuration.getPropertyValue("yarn-site", "yarn.resourcemanager.resource-tracker.address")); } @Test public void testDoUpdateForBlueprintExport_SingleHostProperty__withPort() throws Exception { - Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); - Map<String, String> typeProps = new HashMap<String, String>(); + Map<String, Map<String, String>> properties = new HashMap<>(); + Map<String, String> typeProps = new HashMap<>(); typeProps.put("fs.defaultFS", "testhost:8020"); properties.put("core-site", typeProps); Configuration clusterConfig = new Configuration(properties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); - Collection<String> hgComponents = new HashSet<String>(); + Collection<String> hgComponents = new HashSet<>(); hgComponents.add("NAMENODE"); hgComponents.add("SECONDARY_NAMENODE"); TestHostGroup group1 = new TestHostGroup("group1", hgComponents, Collections.singleton("testhost")); - Collection<String> hgComponents2 = new HashSet<String>(); + Collection<String> hgComponents2 = new HashSet<>(); hgComponents2.add("DATANODE"); hgComponents2.add("HDFS_CLIENT"); TestHostGroup group2 = new TestHostGroup("group2", hgComponents2, Collections.singleton("testhost2")); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group1); hostGroups.add(group2); @@ -441,26 +446,26 @@ public class BlueprintConfigurationProcessorTest { @Test public void testDoUpdateForBlueprintExport_SingleHostProperty__ExternalReference() throws Exception { - Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); - Map<String, String> typeProps = new HashMap<String, String>(); + Map<String, Map<String, String>> properties = new HashMap<>(); + Map<String, String> typeProps = new HashMap<>(); typeProps.put("yarn.resourcemanager.hostname", "external-host"); properties.put("yarn-site", typeProps); Configuration clusterConfig = new Configuration(properties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); - Collection<String> hgComponents = new HashSet<String>(); + Collection<String> hgComponents = new HashSet<>(); hgComponents.add("NAMENODE"); hgComponents.add("SECONDARY_NAMENODE"); hgComponents.add("RESOURCEMANAGER"); TestHostGroup group1 = new TestHostGroup("group1", hgComponents, Collections.singleton("testhost")); - Collection<String> hgComponents2 = new HashSet<String>(); + Collection<String> hgComponents2 = new HashSet<>(); hgComponents2.add("DATANODE"); hgComponents2.add("HDFS_CLIENT"); TestHostGroup group2 = new TestHostGroup("group2", hgComponents2, Collections.singleton("testhost2")); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group1); hostGroups.add(group2); @@ -473,39 +478,39 @@ public class BlueprintConfigurationProcessorTest { @Test public void testDoUpdateForBlueprintExport_MultiHostProperty() throws Exception { - Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); - Map<String, String> typeProps = new HashMap<String, String>(); + Map<String, Map<String, String>> properties = new HashMap<>(); + Map<String, String> typeProps = new HashMap<>(); typeProps.put("hbase.zookeeper.quorum", "testhost,testhost2,testhost2a,testhost2b"); properties.put("hbase-site", typeProps); Configuration clusterConfig = new Configuration(properties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); - Collection<String> hgComponents = new HashSet<String>(); + Collection<String> hgComponents = new HashSet<>(); hgComponents.add("NAMENODE"); hgComponents.add("SECONDARY_NAMENODE"); hgComponents.add("ZOOKEEPER_SERVER"); TestHostGroup group1 = new TestHostGroup("group1", hgComponents, Collections.singleton("testhost")); - Collection<String> hgComponents2 = new HashSet<String>(); + Collection<String> hgComponents2 = new HashSet<>(); hgComponents2.add("DATANODE"); hgComponents2.add("HDFS_CLIENT"); hgComponents2.add("ZOOKEEPER_SERVER"); - Set<String> hosts2 = new HashSet<String>(); + Set<String> hosts2 = new HashSet<>(); hosts2.add("testhost2"); hosts2.add("testhost2a"); hosts2.add("testhost2b"); TestHostGroup group2 = new TestHostGroup("group2", hgComponents2, hosts2); - Collection<String> hgComponents3 = new HashSet<String>(); + Collection<String> hgComponents3 = new HashSet<>(); hgComponents2.add("HDFS_CLIENT"); hgComponents2.add("ZOOKEEPER_CLIENT"); - Set<String> hosts3 = new HashSet<String>(); + Set<String> hosts3 = new HashSet<>(); hosts3.add("testhost3"); hosts3.add("testhost3a"); TestHostGroup group3 = new TestHostGroup("group3", hgComponents3, hosts3); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group1); hostGroups.add(group2); hostGroups.add(group3); @@ -520,39 +525,39 @@ public class BlueprintConfigurationProcessorTest { @Test public void testDoUpdateForBlueprintExport_MultiHostProperty__WithPorts() throws Exception { - Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); - Map<String, String> typeProps = new HashMap<String, String>(); + Map<String, Map<String, String>> properties = new HashMap<>(); + Map<String, String> typeProps = new HashMap<>(); typeProps.put("templeton.zookeeper.hosts", "testhost:5050,testhost2:9090,testhost2a:9090,testhost2b:9090"); properties.put("webhcat-site", typeProps); Configuration clusterConfig = new Configuration(properties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); - Collection<String> hgComponents = new HashSet<String>(); + Collection<String> hgComponents = new HashSet<>(); hgComponents.add("NAMENODE"); hgComponents.add("SECONDARY_NAMENODE"); hgComponents.add("ZOOKEEPER_SERVER"); TestHostGroup group1 = new TestHostGroup("group1", hgComponents, Collections.singleton("testhost")); - Collection<String> hgComponents2 = new HashSet<String>(); + Collection<String> hgComponents2 = new HashSet<>(); hgComponents2.add("DATANODE"); hgComponents2.add("HDFS_CLIENT"); hgComponents2.add("ZOOKEEPER_SERVER"); - Set<String> hosts2 = new HashSet<String>(); + Set<String> hosts2 = new HashSet<>(); hosts2.add("testhost2"); hosts2.add("testhost2a"); hosts2.add("testhost2b"); TestHostGroup group2 = new TestHostGroup("group2", hgComponents2, hosts2); - Collection<String> hgComponents3 = new HashSet<String>(); + Collection<String> hgComponents3 = new HashSet<>(); hgComponents2.add("HDFS_CLIENT"); hgComponents2.add("ZOOKEEPER_CLIENT"); - Set<String> hosts3 = new HashSet<String>(); + Set<String> hosts3 = new HashSet<>(); hosts3.add("testhost3"); hosts3.add("testhost3a"); TestHostGroup group3 = new TestHostGroup("group3", hgComponents3, hosts3); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group1); hostGroups.add(group2); hostGroups.add(group3); @@ -567,8 +572,8 @@ public class BlueprintConfigurationProcessorTest { @Test public void testDoUpdateForBlueprintExport_MultiHostProperty__YAML() throws Exception { - Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); - Map<String, String> typeProps = new HashMap<String, String>(); + Map<String, Map<String, String>> properties = new HashMap<>(); + Map<String, String> typeProps = new HashMap<>(); typeProps.put("storm.zookeeper.servers", "['testhost:5050','testhost2:9090','testhost2a:9090','testhost2b:9090']"); typeProps.put("drpc_server_host", "['testhost:5050']"); typeProps.put("storm_ui_server_host", "['testhost:5050']"); @@ -577,9 +582,9 @@ public class BlueprintConfigurationProcessorTest { properties.put("storm-site", typeProps); Configuration clusterConfig = new Configuration(properties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); - Collection<String> hgComponents = new HashSet<String>(); + Collection<String> hgComponents = new HashSet<>(); hgComponents.add("NAMENODE"); hgComponents.add("SECONDARY_NAMENODE"); hgComponents.add("ZOOKEEPER_SERVER"); @@ -588,26 +593,26 @@ public class BlueprintConfigurationProcessorTest { hgComponents.add("SUPERVISOR"); TestHostGroup group1 = new TestHostGroup("group1", hgComponents, Collections.singleton("testhost")); - Collection<String> hgComponents2 = new HashSet<String>(); + Collection<String> hgComponents2 = new HashSet<>(); hgComponents2.add("DATANODE"); hgComponents2.add("HDFS_CLIENT"); hgComponents2.add("ZOOKEEPER_SERVER"); hgComponents2.add("SUPERVISOR"); - Set<String> hosts2 = new HashSet<String>(); + Set<String> hosts2 = new HashSet<>(); hosts2.add("testhost2"); hosts2.add("testhost2a"); hosts2.add("testhost2b"); TestHostGroup group2 = new TestHostGroup("group2", hgComponents2, hosts2); - Collection<String> hgComponents3 = new HashSet<String>(); + Collection<String> hgComponents3 = new HashSet<>(); hgComponents2.add("HDFS_CLIENT"); hgComponents2.add("ZOOKEEPER_CLIENT"); - Set<String> hosts3 = new HashSet<String>(); + Set<String> hosts3 = new HashSet<>(); hosts3.add("testhost3"); hosts3.add("testhost3a"); TestHostGroup group3 = new TestHostGroup("group3", hgComponents3, hosts3); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group1); hostGroups.add(group2); hostGroups.add(group3); @@ -631,27 +636,27 @@ public class BlueprintConfigurationProcessorTest { @Test public void testDoUpdateForBlueprintExport_DBHostProperty() throws Exception { - Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); - Map<String, String> hiveSiteProps = new HashMap<String, String>(); + Map<String, Map<String, String>> properties = new HashMap<>(); + Map<String, String> hiveSiteProps = new HashMap<>(); hiveSiteProps.put("javax.jdo.option.ConnectionURL", "jdbc:mysql://testhost/hive?createDatabaseIfNotExist=true"); properties.put("hive-site", hiveSiteProps); Configuration clusterConfig = new Configuration(properties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); - Collection<String> hgComponents = new HashSet<String>(); + Collection<String> hgComponents = new HashSet<>(); hgComponents.add("NAMENODE"); hgComponents.add("SECONDARY_NAMENODE"); hgComponents.add("RESOURCEMANAGER"); hgComponents.add("MYSQL_SERVER"); TestHostGroup group1 = new TestHostGroup("group1", hgComponents, Collections.singleton("testhost")); - Collection<String> hgComponents2 = new HashSet<String>(); + Collection<String> hgComponents2 = new HashSet<>(); hgComponents2.add("DATANODE"); hgComponents2.add("HDFS_CLIENT"); TestHostGroup group2 = new TestHostGroup("group2", hgComponents2, Collections.singleton("testhost2")); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group1); hostGroups.add(group2); @@ -665,26 +670,26 @@ public class BlueprintConfigurationProcessorTest { @Test public void testDoUpdateForBlueprintExport_DBHostProperty__External() throws Exception { - Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); - Map<String, String> typeProps = new HashMap<String, String>(); + Map<String, Map<String, String>> properties = new HashMap<>(); + Map<String, String> typeProps = new HashMap<>(); typeProps.put("javax.jdo.option.ConnectionURL", "jdbc:mysql://external-host/hive?createDatabaseIfNotExist=true"); properties.put("hive-site", typeProps); Configuration clusterConfig = new Configuration(properties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); - Collection<String> hgComponents = new HashSet<String>(); + Collection<String> hgComponents = new HashSet<>(); hgComponents.add("NAMENODE"); hgComponents.add("SECONDARY_NAMENODE"); hgComponents.add("RESOURCEMANAGER"); TestHostGroup group1 = new TestHostGroup("group1", hgComponents, Collections.singleton("testhost")); - Collection<String> hgComponents2 = new HashSet<String>(); + Collection<String> hgComponents2 = new HashSet<>(); hgComponents2.add("DATANODE"); hgComponents2.add("HDFS_CLIENT"); TestHostGroup group2 = new TestHostGroup("group2", hgComponents2, Collections.singleton("testhost2")); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group1); hostGroups.add(group2); @@ -697,8 +702,8 @@ public class BlueprintConfigurationProcessorTest { @Test public void testDoUpdateForBlueprintExport_PasswordFilterApplied() throws Exception { - Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); - Map<String, String> typeProps = new HashMap<String, String>(); + Map<String, Map<String, String>> properties = new HashMap<>(); + Map<String, String> typeProps = new HashMap<>(); typeProps.put("REPOSITORY_CONFIG_PASSWORD", "test-password-one"); typeProps.put("SSL_KEYSTORE_PASSWORD", "test-password-two"); typeProps.put("SSL_TRUSTSTORE_PASSWORD", "test-password-three"); @@ -707,12 +712,12 @@ public class BlueprintConfigurationProcessorTest { typeProps.put("test.password.should.be.included", "test-another-pwd"); //Checking functionality for fields marked as SECRET - Map<String, String> secretProps = new HashMap<String, String>(); + Map<String, String> secretProps = new HashMap<>(); secretProps.put("knox_master_secret", "test-secret-one"); secretProps.put("test.secret.should.be.included", "test-another-secret"); // create a custom config type, to verify that the filters can // be applied across all config types - Map<String, String> customProps = new HashMap<String, String>(); + Map<String, String> customProps = new HashMap<>(); customProps.put("my_test_PASSWORD", "should be excluded"); customProps.put("PASSWORD_mytest", "should be included"); @@ -725,18 +730,18 @@ public class BlueprintConfigurationProcessorTest { Configuration clusterConfig = new Configuration(properties, Collections.<String, Map<String, Map<String, String>>>emptyMap()); - Collection<String> hgComponents = new HashSet<String>(); + Collection<String> hgComponents = new HashSet<>(); hgComponents.add("NAMENODE"); hgComponents.add("SECONDARY_NAMENODE"); hgComponents.add("RESOURCEMANAGER"); TestHostGroup group1 = new TestHostGroup("group1", hgComponents, Collections.singleton("testhost")); - Collection<String> hgComponents2 = new HashSet<String>(); + Collection<String> hgComponents2 = new HashSet<>(); hgComponents2.add("DATANODE"); hgComponents2.add("HDFS_CLIENT"); TestHostGroup group2 = new TestHostGroup("group2", hgComponents2, Collections.singleton("testhost2")); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group1); hostGroups.add(group2); @@ -756,7 +761,7 @@ public class BlueprintConfigurationProcessorTest { assertFalse("Password property should have been excluded", properties.get("ranger-yarn-plugin-properties").containsKey("REPOSITORY_CONFIG_PASSWORD")); assertFalse("Password property should have been excluded", - properties.get("ranger-yarn-plugin-properties").containsKey("SSL_KEYSTORE_PASSWORD")); + properties.get("ranger-yarn-plugin-properties").containsKey("SSL_KEYSTORE_PASSWORD")); assertFalse("Password property should have been excluded", properties.get("ranger-yarn-plugin-properties").containsKey("SSL_TRUSTSTORE_PASSWORD")); assertFalse("Password property should have been excluded", @@ -771,10 +776,10 @@ public class BlueprintConfigurationProcessorTest { // verify that the following password properties matching the "*_SECRET" rule have been excluded assertFalse("Secret property should have been excluded", - properties.get("secret-test-properties").containsKey("knox_master_secret")); + properties.get("secret-test-properties").containsKey("knox_master_secret")); // verify that the property that does not match the "*_SECRET" rule is still included assertTrue("Expected secret property not found", - properties.get("secret-test-properties").containsKey("test.secret.should.be.included")); + properties.get("secret-test-properties").containsKey("test.secret.should.be.included")); // verify the custom properties map has been modified by the filters assertEquals("custom-test-properties type was not properly exported", 2, properties.get("custom-test-properties").size()); @@ -798,8 +803,8 @@ public class BlueprintConfigurationProcessorTest { final String expectedPortNum = "808080"; final String expectedHostGroupName = "host_group_1"; - Map<String, Map<String, String>> configProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> falconStartupProperties = new HashMap<String, String>(); + Map<String, Map<String, String>> configProperties = new HashMap<>(); + Map<String, String> falconStartupProperties = new HashMap<>(); configProperties.put("falcon-startup.properties", falconStartupProperties); // setup properties that include host information @@ -808,19 +813,19 @@ public class BlueprintConfigurationProcessorTest { falconStartupProperties.put("*.falcon.http.authentication.kerberos.principal", "HTTP/" + expectedHostName + "@EXAMPLE.COM"); Configuration clusterConfig = new Configuration(configProperties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); // note: test hostgroups may not accurately reflect the required components for the config properties // which are mapped to them. Only the hostgroup name is used for hostgroup resolution an the components // are not validated - Collection<String> groupComponents = new HashSet<String>(); + Collection<String> groupComponents = new HashSet<>(); groupComponents.add("FALCON_SERVER"); - Collection<String> hosts = new ArrayList<String>(); + Collection<String> hosts = new ArrayList<>(); hosts.add(expectedHostName); hosts.add("serverTwo"); TestHostGroup group = new TestHostGroup(expectedHostGroupName, groupComponents, hosts); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group); ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups); @@ -828,13 +833,13 @@ public class BlueprintConfigurationProcessorTest { configProcessor.doUpdateForBlueprintExport(); assertEquals("Falcon Broker URL property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), falconStartupProperties.get("*.broker.url")); + createExportedAddress(expectedPortNum, expectedHostGroupName), falconStartupProperties.get("*.broker.url")); assertEquals("Falcon Kerberos Principal property not properly exported", "falcon/" + "%HOSTGROUP::" + expectedHostGroupName + "%" + "@EXAMPLE.COM", falconStartupProperties.get("*.falcon.service.authentication.kerberos.principal")); assertEquals("Falcon Kerberos HTTP Principal property not properly exported", - "HTTP/" + "%HOSTGROUP::" + expectedHostGroupName + "%" + "@EXAMPLE.COM", falconStartupProperties.get("*.falcon.http.authentication.kerberos.principal")); + "HTTP/" + "%HOSTGROUP::" + expectedHostGroupName + "%" + "@EXAMPLE.COM", falconStartupProperties.get("*.falcon.http.authentication.kerberos.principal")); } @Test @@ -842,8 +847,8 @@ public class BlueprintConfigurationProcessorTest { final String expectedHostName = "c6401.apache.ambari.org"; final String expectedHostGroupName = "host_group_1"; - Map<String, Map<String, String>> configProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> tezSiteProperties = new HashMap<String, String>(); + Map<String, Map<String, String>> configProperties = new HashMap<>(); + Map<String, String> tezSiteProperties = new HashMap<>(); configProperties.put("tez-site", tezSiteProperties); // set the UI property, to simulate the case of a UI-created cluster with TEZ @@ -855,14 +860,14 @@ public class BlueprintConfigurationProcessorTest { // note: test hostgroups may not accurately reflect the required components for the config properties // which are mapped to them. Only the hostgroup name is used for hostgroup resolution an the components // are not validated - Collection<String> groupComponents = new HashSet<String>(); + Collection<String> groupComponents = new HashSet<>(); groupComponents.add("TEZ_CLIENT"); - Collection<String> hosts = new ArrayList<String>(); + Collection<String> hosts = new ArrayList<>(); hosts.add(expectedHostName); hosts.add("serverTwo"); TestHostGroup group = new TestHostGroup(expectedHostGroupName, groupComponents, hosts); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group); ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups); @@ -885,9 +890,9 @@ public class BlueprintConfigurationProcessorTest { final String expectedHostName = "c6401.apache.ambari.org"; final String expectedHostGroupName = "host_group_1"; - Map<String, Map<String, String>> configProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> kerberosEnvProperties = new HashMap<String, String>(); - Map<String, String> coreSiteProperties = new HashMap<String, String>(); + Map<String, Map<String, String>> configProperties = new HashMap<>(); + Map<String, String> kerberosEnvProperties = new HashMap<>(); + Map<String, String> coreSiteProperties = new HashMap<>(); configProperties.put("kerberos-env", kerberosEnvProperties); configProperties.put("core-site", coreSiteProperties); @@ -904,15 +909,15 @@ public class BlueprintConfigurationProcessorTest { // note: test hostgroups may not accurately reflect the required components for the config properties // which are mapped to them. Only the hostgroup name is used for hostgroup resolution an the components // are not validated - Collection<String> groupComponents = new HashSet<String>(); + Collection<String> groupComponents = new HashSet<>(); groupComponents.add("TEZ_CLIENT"); groupComponents.add("RESOURCEMANAGER"); - Collection<String> hosts = new ArrayList<String>(); + Collection<String> hosts = new ArrayList<>(); hosts.add(expectedHostName); hosts.add("serverTwo"); TestHostGroup group = new TestHostGroup(expectedHostGroupName, groupComponents, hosts); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group); ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups); @@ -925,7 +930,7 @@ public class BlueprintConfigurationProcessorTest { assertFalse("kdc_hosts should not be present in exported blueprint in kerberos-env", kerberosEnvProperties.containsKey("kdc_hosts")); assertFalse("master_kdc should not be present in exported blueprint in kerberos-env", - kerberosEnvProperties.containsKey("master_kdc")); + kerberosEnvProperties.containsKey("master_kdc")); assertEquals("hadoop.proxyuser.yarn.hosts was not exported correctly", createExportedHostName("host_group_1"), coreSiteProperties.get("hadoop.proxyuser.yarn.hosts")); } @@ -939,10 +944,10 @@ public class BlueprintConfigurationProcessorTest { final String expectedNodeTwo = "nn2"; final String expectedHostGroupName = "host_group_1"; - Map<String, Map<String, String>> configProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> hdfsSiteProperties = new HashMap<String, String>(); - Map<String, String> coreSiteProperties = new HashMap<String, String>(); - Map<String, String> hbaseSiteProperties = new HashMap<String, String>(); + Map<String, Map<String, String>> configProperties = new HashMap<>(); + Map<String, String> hdfsSiteProperties = new HashMap<>(); + Map<String, String> coreSiteProperties = new HashMap<>(); + Map<String, String> hbaseSiteProperties = new HashMap<>(); configProperties.put("hdfs-site", hdfsSiteProperties); configProperties.put("core-site", coreSiteProperties); @@ -962,19 +967,19 @@ public class BlueprintConfigurationProcessorTest { hdfsSiteProperties.put("dfs.namenode.rpc-address." + expectedNameService + "." + expectedNodeTwo, expectedHostName + ":" + expectedPortNum); Configuration clusterConfig = new Configuration(configProperties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); // note: test hostgroups may not accurately reflect the required components for the config properties // which are mapped to them. Only the hostgroup name is used for hostgroup resolution an the components // are not validated - Collection<String> groupComponents = new HashSet<String>(); + Collection<String> groupComponents = new HashSet<>(); groupComponents.add("NAMENODE"); - Collection<String> hosts = new ArrayList<String>(); + Collection<String> hosts = new ArrayList<>(); hosts.add(expectedHostName); hosts.add("serverTwo"); TestHostGroup group = new TestHostGroup(expectedHostGroupName, groupComponents, hosts); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group); ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups); @@ -982,19 +987,19 @@ public class BlueprintConfigurationProcessorTest { configProcessor.doUpdateForBlueprintExport(); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address." + expectedNameService + "." + expectedNodeOne)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address." + expectedNameService + "." + expectedNodeOne)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address." + expectedNameService + "." + expectedNodeTwo)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address." + expectedNameService + "." + expectedNodeTwo)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address." + expectedNameService + "." + expectedNodeOne)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address." + expectedNameService + "." + expectedNodeOne)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address." + expectedNameService + "." + expectedNodeTwo)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address." + expectedNameService + "." + expectedNodeTwo)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.rpc-address." + expectedNameService + "." + expectedNodeOne)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.rpc-address." + expectedNameService + "." + expectedNodeOne)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.rpc-address." + expectedNameService + "." + expectedNodeTwo)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.rpc-address." + expectedNameService + "." + expectedNodeTwo)); } @Test @@ -1035,19 +1040,19 @@ public class BlueprintConfigurationProcessorTest { hadoopEnvProperties.put("dfs_ha_initial_namenode_standby", expectedHostName); Configuration clusterConfig = new Configuration(configProperties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); // note: test hostgroups may not accurately reflect the required components for the config properties // which are mapped to them. Only the hostgroup name is used for hostgroup resolution an the components // are not validated - Collection<String> groupComponents = new HashSet<String>(); + Collection<String> groupComponents = new HashSet<>(); groupComponents.add("NAMENODE"); - Collection<String> hosts = new ArrayList<String>(); + Collection<String> hosts = new ArrayList<>(); hosts.add(expectedHostName); hosts.add("serverTwo"); TestHostGroup group = new TestHostGroup(expectedHostGroupName, groupComponents, hosts); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group); ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups); @@ -1055,19 +1060,19 @@ public class BlueprintConfigurationProcessorTest { configProcessor.doUpdateForBlueprintExport(); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address." + expectedNameService + "." + expectedNodeOne)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address." + expectedNameService + "." + expectedNodeOne)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address." + expectedNameService + "." + expectedNodeTwo)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address." + expectedNameService + "." + expectedNodeTwo)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address." + expectedNameService + "." + expectedNodeOne)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address." + expectedNameService + "." + expectedNodeOne)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address." + expectedNameService + "." + expectedNodeTwo)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address." + expectedNameService + "." + expectedNodeTwo)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.rpc-address." + expectedNameService + "." + expectedNodeOne)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.rpc-address." + expectedNameService + "." + expectedNodeOne)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.rpc-address." + expectedNameService + "." + expectedNodeTwo)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.rpc-address." + expectedNameService + "." + expectedNodeTwo)); assertNull("Initial NameNode HA property exported although should not have", hadoopEnvProperties.get("dfs_ha_initial_namenode_active")); assertNull("Initial NameNode HA property exported although should not have", hadoopEnvProperties.get("dfs_ha_initial_namenode_standby")); @@ -1078,10 +1083,10 @@ public class BlueprintConfigurationProcessorTest { final String expectedNameService = "mynameservice"; final String expectedHostName = "c6401.apache.ambari.org"; - Map<String, Map<String, String>> configProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> coreSiteProperties = new HashMap<String, String>(); - Map<String, String> hbaseSiteProperties = new HashMap<String, String>(); - Map<String, String> accumuloSiteProperties = new HashMap<String, String>(); + Map<String, Map<String, String>> configProperties = new HashMap<>(); + Map<String, String> coreSiteProperties = new HashMap<>(); + Map<String, String> hbaseSiteProperties = new HashMap<>(); + Map<String, String> accumuloSiteProperties = new HashMap<>(); configProperties.put("core-site", coreSiteProperties); configProperties.put("hbase-site", hbaseSiteProperties); @@ -1095,19 +1100,19 @@ public class BlueprintConfigurationProcessorTest { accumuloSiteProperties.put("instance.volumes", "hdfs://" + expectedNameService + "/apps/accumulo/data"); Configuration clusterConfig = new Configuration(configProperties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); // note: test hostgroups may not accurately reflect the required components for the config properties // which are mapped to them. Only the hostgroup name is used for hostgroup resolution an the components // are not validated - Collection<String> groupComponents = new HashSet<String>(); + Collection<String> groupComponents = new HashSet<>(); groupComponents.add("RESOURCEMANAGER"); - Collection<String> hosts = new ArrayList<String>(); + Collection<String> hosts = new ArrayList<>(); hosts.add(expectedHostName); hosts.add("serverTwo"); TestHostGroup group = new TestHostGroup("group1", groupComponents, hosts); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group); ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups); @@ -1116,34 +1121,34 @@ public class BlueprintConfigurationProcessorTest { // verify that any properties that include nameservices are not removed from the exported blueprint's configuration assertEquals("Property containing an HA nameservice (fs.defaultFS), was not correctly exported by the processor", - "hdfs://" + expectedNameService, coreSiteProperties.get("fs.defaultFS")); + "hdfs://" + expectedNameService, coreSiteProperties.get("fs.defaultFS")); assertEquals("Property containing an HA nameservice (hbase.rootdir), was not correctly exported by the processor", - "hdfs://" + expectedNameService + "/apps/hbase/data", hbaseSiteProperties.get("hbase.rootdir")); + "hdfs://" + expectedNameService + "/apps/hbase/data", hbaseSiteProperties.get("hbase.rootdir")); assertEquals("Property containing an HA nameservice (instance.volumes), was not correctly exported by the processor", - "hdfs://" + expectedNameService + "/apps/accumulo/data", accumuloSiteProperties.get("instance.volumes")); + "hdfs://" + expectedNameService + "/apps/accumulo/data", accumuloSiteProperties.get("instance.volumes")); } @Test public void testDoNameNodeHighAvailabilityExportWithHANotEnabled() throws Exception { // hdfs-site config for this test will not include an HA values - Map<String, Map<String, String>> configProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> hdfsSiteProperties = new HashMap<String, String>(); + Map<String, Map<String, String>> configProperties = new HashMap<>(); + Map<String, String> hdfsSiteProperties = new HashMap<>(); configProperties.put("hdfs-site", hdfsSiteProperties); assertEquals("Incorrect initial state for hdfs-site config", - 0, hdfsSiteProperties.size()); + 0, hdfsSiteProperties.size()); Configuration clusterConfig = new Configuration(configProperties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); // note: test hostgroups may not accurately reflect the required components for the config properties // which are mapped to them. Only the hostgroup name is used for hostgroup resolution an the components // are not validated - Collection<String> groupComponents = new HashSet<String>(); + Collection<String> groupComponents = new HashSet<>(); groupComponents.add("NAMENODE"); TestHostGroup group = new TestHostGroup("group1", groupComponents, Collections.singleton("host1")); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group); ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups); @@ -1151,7 +1156,7 @@ public class BlueprintConfigurationProcessorTest { configProcessor.doUpdateForBlueprintExport(); assertEquals("Incorrect state for hdfs-site config after HA call in non-HA environment, should be zero", - 0, hdfsSiteProperties.size()); + 0, hdfsSiteProperties.size()); } @Test @@ -1166,8 +1171,8 @@ public class BlueprintConfigurationProcessorTest { final String expectedNodeTwo = "nn2"; final String expectedHostGroupName = "host_group_1"; - Map<String, Map<String, String>> configProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> hdfsSiteProperties = new HashMap<String, String>(); + Map<String, Map<String, String>> configProperties = new HashMap<>(); + Map<String, String> hdfsSiteProperties = new HashMap<>(); configProperties.put("hdfs-site", hdfsSiteProperties); // setup hdfs config for test @@ -1193,20 +1198,20 @@ public class BlueprintConfigurationProcessorTest { hdfsSiteProperties.put("dfs.namenode.rpc-address." + expectedNameServiceTwo + "." + expectedNodeTwo, expectedHostNameTwo + ":" + expectedPortNum); Configuration clusterConfig = new Configuration(configProperties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); // note: test hostgroups may not accurately reflect the required components for the config properties // which are mapped to them. Only the hostgroup name is used for hostgroup resolution an the components // are not validated - Collection<String> groupComponents = new HashSet<String>(); - groupComponents.add("RESOURCEMANAGER"); - Collection<String> hosts = new ArrayList<String>(); + Collection<String> groupComponents = new HashSet<>(); + groupComponents.add("NAMENODE"); + Collection<String> hosts = new ArrayList<>(); hosts.add(expectedHostNameOne); hosts.add(expectedHostNameTwo); - hosts.add("serverTwo"); +// hosts.add("serverTwo"); TestHostGroup group = new TestHostGroup(expectedHostGroupName, groupComponents, hosts); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group); ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups); @@ -1215,36 +1220,36 @@ public class BlueprintConfigurationProcessorTest { // verify results for name service one assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address." + expectedNameServiceOne + "." + expectedNodeOne)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address." + expectedNameServiceOne + "." + expectedNodeOne)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address." + expectedNameServiceOne + "." + expectedNodeTwo)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address." + expectedNameServiceOne + "." + expectedNodeTwo)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address." + expectedNameServiceOne + "." + expectedNodeOne)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address." + expectedNameServiceOne + "." + expectedNodeOne)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address." + expectedNameServiceOne + "." + expectedNodeTwo)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address." + expectedNameServiceOne + "." + expectedNodeTwo)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.rpc-address." + expectedNameServiceOne + "." + expectedNodeOne)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.rpc-address." + expectedNameServiceOne + "." + expectedNodeOne)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.rpc-address." + expectedNameServiceOne + "." + expectedNodeTwo)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.rpc-address." + expectedNameServiceOne + "." + expectedNodeTwo)); // verify results for name service two assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address." + expectedNameServiceTwo + "." + expectedNodeOne)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address." + expectedNameServiceTwo + "." + expectedNodeOne)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address." + expectedNameServiceTwo + "." + expectedNodeTwo)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address." + expectedNameServiceTwo + "." + expectedNodeTwo)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address." + expectedNameServiceTwo + "." + expectedNodeOne)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address." + expectedNameServiceTwo + "." + expectedNodeOne)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address." + expectedNameServiceTwo + "." + expectedNodeTwo)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address." + expectedNameServiceTwo + "." + expectedNodeTwo)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.rpc-address." + expectedNameServiceTwo + "." + expectedNodeOne)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.rpc-address." + expectedNameServiceTwo + "." + expectedNodeOne)); assertEquals("HTTPS address HA property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.rpc-address." + expectedNameServiceTwo + "." + expectedNodeTwo)); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.rpc-address." + expectedNameServiceTwo + "." + expectedNodeTwo)); } @Test @@ -1253,12 +1258,12 @@ public class BlueprintConfigurationProcessorTest { final String expectedPortNum = "808080"; final String expectedHostGroupName = "host_group_1"; - Map<String, Map<String, String>> configProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> yarnSiteProperties = new HashMap<String, String>(); + Map<String, Map<String, String>> configProperties = new HashMap<>(); + Map<String, String> yarnSiteProperties = new HashMap<>(); configProperties.put("yarn-site", yarnSiteProperties); // setup properties that include host information - yarnSiteProperties.put("yarn.log.server.url", "http://" + expectedHostName +":19888/jobhistory/logs"); + yarnSiteProperties.put("yarn.log.server.url", "http://" + expectedHostName + ":19888/jobhistory/logs"); yarnSiteProperties.put("yarn.resourcemanager.hostname", expectedHostName); yarnSiteProperties.put("yarn.resourcemanager.resource-tracker.address", expectedHostName + ":" + expectedPortNum); yarnSiteProperties.put("yarn.resourcemanager.webapp.address", expectedHostName + ":" + expectedPortNum); @@ -1271,19 +1276,19 @@ public class BlueprintConfigurationProcessorTest { yarnSiteProperties.put("yarn.log.server.web-service.url", expectedHostName + ":" + expectedPortNum); Configuration clusterConfig = new Configuration(configProperties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); // note: test hostgroups may not accurately reflect the required components for the config properties // which are mapped to them. Only the hostgroup name is used for hostgroup resolution an the components // are not validated - Collection<String> groupComponents = new HashSet<String>(); + Collection<String> groupComponents = new HashSet<>(); groupComponents.add("RESOURCEMANAGER"); - Collection<String> hosts = new ArrayList<String>(); + Collection<String> hosts = new ArrayList<>(); hosts.add(expectedHostName); hosts.add("serverTwo"); TestHostGroup group = new TestHostGroup(expectedHostGroupName, groupComponents, hosts); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group); ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups); @@ -1297,21 +1302,21 @@ public class BlueprintConfigurationProcessorTest { assertEquals("Yarn ResourceManager tracker address was incorrectly exported", createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.resource-tracker.address")); assertEquals("Yarn ResourceManager webapp address was incorrectly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.webapp.address")); + createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.webapp.address")); assertEquals("Yarn ResourceManager scheduler address was incorrectly exported", createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.scheduler.address")); assertEquals("Yarn ResourceManager address was incorrectly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.address")); + createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.address")); assertEquals("Yarn ResourceManager admin address was incorrectly exported", createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.admin.address")); assertEquals("Yarn ResourceManager timeline-service address was incorrectly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.timeline-service.address")); + createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.timeline-service.address")); assertEquals("Yarn ResourceManager timeline webapp address was incorrectly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.timeline-service.webapp.address")); + createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.timeline-service.webapp.address")); assertEquals("Yarn ResourceManager timeline webapp HTTPS address was incorrectly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.timeline-service.webapp.https.address")); + createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.timeline-service.webapp.https.address")); assertEquals("Yarn ResourceManager timeline web service url was incorrectly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.log.server.web-service.url")); + createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.log.server.web-service.url")); } @Test @@ -1320,12 +1325,12 @@ public class BlueprintConfigurationProcessorTest { final String expectedPortNum = "808080"; final String expectedHostGroupName = "host_group_1"; - Map<String, Map<String, String>> configProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> yarnSiteProperties = new HashMap<String, String>(); + Map<String, Map<String, String>> configProperties = new HashMap<>(); + Map<String, String> yarnSiteProperties = new HashMap<>(); configProperties.put("yarn-site", yarnSiteProperties); // setup properties that include host information - yarnSiteProperties.put("yarn.log.server.url", "http://" + expectedHostName +":19888/jobhistory/logs"); + yarnSiteProperties.put("yarn.log.server.url", "http://" + expectedHostName + ":19888/jobhistory/logs"); yarnSiteProperties.put("yarn.resourcemanager.hostname", expectedHostName); yarnSiteProperties.put("yarn.resourcemanager.resource-tracker.address", expectedHostName + ":" + expectedPortNum); yarnSiteProperties.put("yarn.resourcemanager.webapp.address", expectedHostName + ":" + expectedPortNum); @@ -1337,19 +1342,19 @@ public class BlueprintConfigurationProcessorTest { yarnSiteProperties.put("yarn.timeline-service.webapp.https.address", "0.0.0.0" + ":" + expectedPortNum); Configuration clusterConfig = new Configuration(configProperties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); // note: test hostgroups may not accurately reflect the required components for the config properties // which are mapped to them. Only the hostgroup name is used for hostgroup resolution an the components // are not validated - Collection<String> groupComponents = new HashSet<String>(); + Collection<String> groupComponents = new HashSet<>(); groupComponents.add("RESOURCEMANAGER"); - Collection<String> hosts = new ArrayList<String>(); + Collection<String> hosts = new ArrayList<>(); hosts.add(expectedHostName); hosts.add("serverTwo"); TestHostGroup group = new TestHostGroup(expectedHostGroupName, groupComponents, hosts); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group); ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups); @@ -1357,25 +1362,25 @@ public class BlueprintConfigurationProcessorTest { configProcessor.doUpdateForBlueprintExport(); assertEquals("Yarn Log Server URL was incorrectly exported", - "http://" + "%HOSTGROUP::" + expectedHostGroupName + "%" +":19888/jobhistory/logs", yarnSiteProperties.get("yarn.log.server.url")); + "http://" + "%HOSTGROUP::" + expectedHostGroupName + "%" + ":19888/jobhistory/logs", yarnSiteProperties.get("yarn.log.server.url")); assertEquals("Yarn ResourceManager hostname was incorrectly exported", - createExportedHostName(expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.hostname")); + createExportedHostName(expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.hostname")); assertEquals("Yarn ResourceManager tracker address was incorrectly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.resource-tracker.address")); + createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.resource-tracker.address")); assertEquals("Yarn ResourceManager webapp address was incorrectly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.webapp.address")); + createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.webapp.address")); assertEquals("Yarn ResourceManager scheduler address was incorrectly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.scheduler.address")); + createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.scheduler.address")); assertEquals("Yarn ResourceManager address was incorrectly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.address")); + createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.address")); assertEquals("Yarn ResourceManager admin address was incorrectly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.admin.address")); + createExportedAddress(expectedPortNum, expectedHostGroupName), yarnSiteProperties.get("yarn.resourcemanager.admin.address")); assertEquals("Yarn ResourceManager timeline-service address was incorrectly exported", - "0.0.0.0" + ":" + expectedPortNum, yarnSiteProperties.get("yarn.timeline-service.address")); + "0.0.0.0" + ":" + expectedPortNum, yarnSiteProperties.get("yarn.timeline-service.address")); assertEquals("Yarn ResourceManager timeline webapp address was incorrectly exported", - "0.0.0.0" + ":" + expectedPortNum, yarnSiteProperties.get("yarn.timeline-service.webapp.address")); + "0.0.0.0" + ":" + expectedPortNum, yarnSiteProperties.get("yarn.timeline-service.webapp.address")); assertEquals("Yarn ResourceManager timeline webapp HTTPS address was incorrectly exported", - "0.0.0.0" + ":" + expectedPortNum, yarnSiteProperties.get("yarn.timeline-service.webapp.https.address")); + "0.0.0.0" + ":" + expectedPortNum, yarnSiteProperties.get("yarn.timeline-service.webapp.https.address")); } @Test @@ -1384,11 +1389,11 @@ public class BlueprintConfigurationProcessorTest { final String expectedPortNum = "808080"; final String expectedHostGroupName = "host_group_1"; - Map<String, Map<String, String>> configProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> hdfsSiteProperties = new HashMap<String, String>(); - Map<String, String> coreSiteProperties = new HashMap<String, String>(); - Map<String, String> hbaseSiteProperties = new HashMap<String, String>(); - Map<String, String> accumuloSiteProperties = new HashMap<String, String>(); + Map<String, Map<String, String>> configProperties = new HashMap<>(); + Map<String, String> hdfsSiteProperties = new HashMap<>(); + Map<String, String> coreSiteProperties = new HashMap<>(); + Map<String, String> hbaseSiteProperties = new HashMap<>(); + Map<String, String> accumuloSiteProperties = new HashMap<>(); configProperties.put("hdfs-site", hdfsSiteProperties); configProperties.put("core-site", coreSiteProperties); @@ -1412,20 +1417,20 @@ public class BlueprintConfigurationProcessorTest { accumuloSiteProperties.put("instance.volumes", "hdfs://" + expectedHostName + ":" + expectedPortNum + "/apps/accumulo/data"); Configuration clusterConfig = new Configuration(configProperties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); // note: test hostgroups may not accurately reflect the required components for the config properties // which are mapped to them. Only the hostgroup name is used for hostgroup resolution an the components // are not validated - Collection<String> groupComponents = new HashSet<String>(); + Collection<String> groupComponents = new HashSet<>(); groupComponents.add("NAMENODE"); groupComponents.add("SECONDARY_NAMENODE"); - Collection<String> hosts = new ArrayList<String>(); + Collection<String> hosts = new ArrayList<>(); hosts.add(expectedHostName); hosts.add("serverTwo"); TestHostGroup group = new TestHostGroup(expectedHostGroupName, groupComponents, hosts); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group); ClusterTopology topology = createClusterTopology(bp, clusterConfig, hostGroups); @@ -1435,28 +1440,28 @@ public class BlueprintConfigurationProcessorTest { assertEquals("hdfs config property not exported properly", createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.http.address")); assertEquals("hdfs config property not exported properly", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.https.address")); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.https.address")); assertEquals("hdfs config property not exported properly", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address")); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.http-address")); assertEquals("hdfs config property not exported properly", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address")); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.https-address")); assertEquals("hdfs config property not exported properly", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.secondary.http.address")); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.secondary.http.address")); assertEquals("hdfs config property not exported properly", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.secondary.http-address")); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.secondary.http-address")); assertEquals("hdfs config property not exported properly", - createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.shared.edits.dir")); + createExportedAddress(expectedPortNum, expectedHostGroupName), hdfsSiteProperties.get("dfs.namenode.shared.edits.dir")); assertEquals("hdfs config in core-site not exported properly", - createExportedAddress(expectedPortNum, expectedHostGroupName), coreSiteProperties.get("fs.default.name")); + createExportedAddress(expectedPortNum, expectedHostGroupName), coreSiteProperties.get("fs.default.name")); assertEquals("hdfs config in core-site not exported properly", - "hdfs://" + createExportedAddress(expectedPortNum, expectedHostGroupName), coreSiteProperties.get("fs.defaultFS")); + "hdfs://" + createExportedAddress(expectedPortNum, expectedHostGroupName), coreSiteProperties.get("fs.defaultFS")); assertEquals("hdfs config in hbase-site not exported properly", - "hdfs://" + createExportedAddress(expectedPortNum, expectedHostGroupName) + "/apps/hbase/data", hbaseSiteProperties.get("hbase.rootdir")); + "hdfs://" + createExportedAddress(expectedPortNum, expectedHostGroupName) + "/apps/hbase/data", hbaseSiteProperties.get("hbase.rootdir")); assertEquals("hdfs config in accumulo-site not exported properly", - "hdfs://" + createExportedAddress(expectedPortNum, expectedHostGroupName) + "/apps/accumulo/data", accumuloSiteProperties.get("instance.volumes")); + "hdfs://" + createExportedAddress(expectedPortNum, expectedHostGroupName) + "/apps/accumulo/data", accumuloSiteProperties.get("instance.volumes")); } @Test @@ -1467,11 +1472,11 @@ public class BlueprintConfigurationProcessorTest { final String expectedHostGroupName = "host_group_1"; final String expectedHostGroupNameTwo = "host_group_2"; - Map<String, Map<String, String>> configProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> hiveSiteProperties = new HashMap<String, String>(); - Map<String, String> hiveEnvProperties = new HashMap<String, String>(); - Map<String, String> webHCatSiteProperties = new HashMap<String, String>(); - Map<String, String> coreSiteProperties = new HashMap<String, String>(); + Map<String, Map<String, String>> configProperties = new HashMap<>(); + Map<String, String> hiveSiteProperties = new HashMap<>(); + Map<String, String> hiveEnvProperties = new HashMap<>(); + Map<String, String> webHCatSiteProperties = new HashMap<>(); + Map<String, String> coreSiteProperties = new HashMap<>(); configProperties.put("hive-site", hiveSiteProperties); configProperties.put("hive-env", hiveEnvProperties); @@ -1492,26 +1497,26 @@ public class BlueprintConfigurationProcessorTest { coreSiteProperties.put("hadoop.proxyuser.hcat.hosts", expectedHostName + "," + expectedHostNameTwo); Configuration clusterConfig = new Configuration(configProperties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); // note: test hostgroups may not accurately reflect the required components for the config properties // which are mapped to them. Only the hostgroup name is used for hostgroup resolution an the components // are not validated - Collection<String> groupComponents = new HashSet<String>(); + Collection<String> groupComponents = new HashSet<>(); groupComponents.add("HIVE_SERVER"); - Collection<String> hosts = new ArrayList<String>(); + Collection<String> hosts = new ArrayList<>(); hosts.add(expectedHostName); hosts.add("serverTwo"); TestHostGroup group = new TestHostGroup(expectedHostGroupName, groupComponents, hosts); - Collection<String> groupComponents2 = new HashSet<String>(); + Collection<String> groupComponents2 = new HashSet<>(); groupComponents2.add("HIVE_CLIENT"); - Collection<String> hosts2 = new ArrayList<String>(); + Collection<String> hosts2 = new ArrayList<>(); hosts2.add(expectedHostNameTwo); hosts2.add("serverFour"); TestHostGroup group2 = new TestHostGroup(expectedHostGroupNameTwo, groupComponents2, hosts2); - Collection<TestHostGroup> hostGroups = new HashSet<TestHostGroup>(); + Collection<TestHostGroup> hostGroups = new HashSet<>(); hostGroups.add(group); hostGroups.add(group2); @@ -1522,31 +1527,31 @@ public class BlueprintConfigurationProcessorTest { configProcessor.doUpdateForBlueprintExport(); assertEquals("hive property not properly exported", - "thrift://" + createExportedAddress(expectedPortNum, expectedHostGroupName), hiveSiteProperties.get("hive.metastore.uris")); + "thrift://" + createExportedAddress(expectedPortNum, expectedHostGroupName), hiveSiteProperties.get("hive.metastore.uris")); assertEquals("hive property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName), hiveSiteProperties.get("javax.jdo.option.ConnectionURL")); + createExportedAddress(expectedPortNum, expectedHostGroupName), hiveSiteProperties.get("javax.jdo.option.ConnectionURL")); assertEquals("hive property not properly exported", - createExportedHostName(expectedHostGroupName) + "," + createExportedHostName(expectedHostGroupNameTwo), - webHCatSiteProperties.get("templeton.hive.properties")); + createExportedHostName(expectedHostGroupName) + "," + createExportedHostName(expectedHostGroupNameTwo), + webHCatSiteProperties.get("templeton.hive.properties")); assertEquals("hive property not properly exported", - createExportedHostName(expectedHostGroupName), webHCatSiteProperties.get("templeton.kerberos.principal")); + createExportedHostName(expectedHostGroupName), webHCatSiteProperties.get("templeton.kerberos.principal")); assertEquals("hive property not properly exported", - createExportedHostName(expectedHostGroupName) + "," + createExportedHostName(expectedHostGroupNameTwo), coreSiteProperties.get("hadoop.proxyuser.hive.hosts")); + createExportedHostName(expectedHostGroupName) + "," + createExportedHostName(expectedHostGroupNameTwo), coreSiteProperties.get("hadoop.proxyuser.hive.hosts")); assertEquals("hive property not properly exported", - createExportedHostName(expectedHostGroupName) + "," + createExportedHostName(expectedHostGroupNameTwo), coreSiteProperties.get("hadoop.proxyuser.HTTP.hosts")); + createExportedHostName(expectedHostGroupName) + "," + createExportedHostName(expectedHostGroupNameTwo), coreSiteProperties.get("hadoop.proxyuser.HTTP.hosts")); assertEquals("hive property not properly exported", - createExportedHostName(expectedHostGroupName) + "," + createExportedHostName(expectedHostGroupNameTwo), coreSiteProperties.get("hadoop.proxyuser.hcat.hosts")); + createExportedHostName(expectedHostGroupName) + "," + createExportedHostName(expectedHostGroupNameTwo), coreSiteProperties.get("hadoop.proxyuser.hcat.hosts")); assertEquals("hive zookeeper quorum property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName) + "," + createExportedAddress(expectedPortNum, expectedHostGroupNameTwo), - hiveSiteProperties.get("hive.zookeeper.quorum")); + createExportedAddress(expectedPortNum, expectedHostGroupName) + "," + createExportedAddress(expectedPortNum, expectedHostGroupNameTwo), + hiveSiteProperties.get("hive.zookeeper.quorum")); assertEquals("hive zookeeper connectString property not properly exported", - createExportedAddress(expectedPortNum, expectedHostGroupName) + "," + createExportedAddress(expectedPortNum, expectedHostGroupNameTwo), - hiveSiteProperties.get("hive.cluster.delegation.token.store.zookeeper.connectString")); + createExportedAddress(expectedPortNum, expectedHostGroupName) + "," + createExportedAddress(expectedPortNum, expectedHostGroupNameTwo), + hiveSiteProperties.get("hive.cluster.delegation.token.store.zookeeper.connectString")); } @@ -1559,16 +1564,16 @@ public class BlueprintConfigurationProcessorTest { final String expectedHostGroupNameTwo = "host_group_2"; Map<String, Map<String, String>> configProperties = - new HashMap<String, Map<String, String>>(); + new HashMap<>(); Map<String, String> hiveSiteProperties = - new HashMap<String, String>(); + new HashMap<>(); Map<String, String> hiveEnvProperties = - new HashMap<String, String>(); + new HashMap<>(); Map<String, String> webHCatSiteProperties = - new HashMap<String, String>(); + new HashMap<>(); Map<String, String> coreSiteProperties = - new HashMap<String, String>(); + new HashMap<>(); configProperties.put("hive-site", hiveSiteProperties); configProperties.put("hive-env", hiveEnvProperties); @@ -1590,23 +1595,23 @@ public class BlueprintConfigurationProcessorTest { coreSiteProperties.put("hadoop.proxyuser.hcat.hosts", expectedHostName + "," + expectedHostNameTwo); Configuration clusterConfig = new Configuration(configProperties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.<String, Map<String, Map<String, String>>>emptyMap()); - Collection<String> groupComponents = new HashSet<String>(); + Collection<String> groupComponents = new HashSet<>(); groupComponents.add("NAMENODE"); - Collection<String> hosts = new ArrayList<String>(); + Collection<String> hosts = new ArrayList<>(); hosts.add(expectedHostName); hosts.add("serverTwo"); TestHostGroup g
<TRUNCATED>