http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationTest.java index 6a52762..b4aac40 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationTest.java @@ -34,16 +34,16 @@ import org.junit.Test; */ public class ConfigurationTest { - private static final Map<String, Map<String, String>> EMPTY_PROPERTIES = new HashMap<String, Map<String, String>>(); - private static final Map<String, Map<String, Map<String, String>>> EMPTY_ATTRIBUTES = new HashMap<String, Map<String, Map<String, String>>>(); + private static final Map<String, Map<String, String>> EMPTY_PROPERTIES = new HashMap<>(); + private static final Map<String, Map<String, Map<String, String>>> EMPTY_ATTRIBUTES = new HashMap<>(); @Test public void testGetProperties_noParent() { - Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); - Map<String, String> typeProperties1 = new HashMap<String, String>(); + Map<String, Map<String, String>> properties = new HashMap<>(); + Map<String, String> typeProperties1 = new HashMap<>(); typeProperties1.put("prop1", "val1"); typeProperties1.put("prop2", "val2"); - Map<String, String> typeProperties2 = new HashMap<String, String>(); + Map<String, String> typeProperties2 = new HashMap<>(); typeProperties2.put("prop1", "val1"); typeProperties2.put("prop3", "val3"); @@ -57,11 +57,11 @@ public class ConfigurationTest { @Test public void testGetFullProperties_noParent() { - Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); - Map<String, String> typeProperties1 = new HashMap<String, String>(); + Map<String, Map<String, String>> properties = new HashMap<>(); + Map<String, String> typeProperties1 = new HashMap<>(); typeProperties1.put("prop1", "val1"); typeProperties1.put("prop2", "val2"); - Map<String, String> typeProperties2 = new HashMap<String, String>(); + Map<String, String> typeProperties2 = new HashMap<>(); typeProperties2.put("prop1", "val1"); typeProperties2.put("prop3", "val3"); @@ -75,21 +75,21 @@ public class ConfigurationTest { @Test public void testGetProperties_withParent() { - Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); - Map<String, String> typeProperties1 = new HashMap<String, String>(); + Map<String, Map<String, String>> properties = new HashMap<>(); + Map<String, String> typeProperties1 = new HashMap<>(); typeProperties1.put("prop1", "val1"); typeProperties1.put("prop2", "val2"); - Map<String, String> typeProperties2 = new HashMap<String, String>(); + Map<String, String> typeProperties2 = new HashMap<>(); typeProperties2.put("prop1", "val1"); typeProperties2.put("prop3", "val3"); properties.put("type1", typeProperties1); properties.put("type2", typeProperties2); - Map<String, Map<String, String>> parentProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> parentTypeProperties1 = new HashMap<String, String>(); + Map<String, Map<String, String>> parentProperties = new HashMap<>(); + Map<String, String> parentTypeProperties1 = new HashMap<>(); parentTypeProperties1.put("prop5", "val5"); - Map<String, String> parentTypeProperties3 = new HashMap<String, String>(); + Map<String, String> parentTypeProperties3 = new HashMap<>(); parentTypeProperties3.put("prop6", "val6"); parentProperties.put("type1", parentTypeProperties1); @@ -195,12 +195,12 @@ public class ConfigurationTest { @Test public void testGetAttributes_noParent() { - Map<String, Map<String, Map<String, String>>> attributes = new HashMap<String, Map<String, Map<String, String>>>(); - Map<String, Map<String, String>> attributeProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> properties1 = new HashMap<String, String>(); + Map<String, Map<String, Map<String, String>>> attributes = new HashMap<>(); + Map<String, Map<String, String>> attributeProperties = new HashMap<>(); + Map<String, String> properties1 = new HashMap<>(); properties1.put("prop1", "val1"); properties1.put("prop2", "val2"); - Map<String, String> properties2 = new HashMap<String, String>(); + Map<String, String> properties2 = new HashMap<>(); properties2.put("prop1", "val3"); attributeProperties.put("attribute1", properties1); attributeProperties.put("attribute2", properties2); @@ -362,12 +362,12 @@ public class ConfigurationTest { private Configuration createConfigurationWithParents_PropsOnly() { // parents parent config properties - Map<String, Map<String, String>> parentParentProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> parentParentTypeProperties1 = new HashMap<String, String>(); + Map<String, Map<String, String>> parentParentProperties = new HashMap<>(); + Map<String, String> parentParentTypeProperties1 = new HashMap<>(); parentParentTypeProperties1.put("prop1", "val1.1"); parentParentTypeProperties1.put("prop2", "val2.1"); parentParentTypeProperties1.put("prop3", "val3.1"); - Map<String, String> parentParentTypeProperties2 = new HashMap<String, String>(); + Map<String, String> parentParentTypeProperties2 = new HashMap<>(); parentParentTypeProperties2.put("prop4", "val4.1"); parentParentTypeProperties2.put("prop5", "val5.1"); @@ -376,12 +376,12 @@ public class ConfigurationTest { Configuration parentParentConfiguration = new Configuration(parentParentProperties, EMPTY_ATTRIBUTES); // parent config properties - Map<String, Map<String, String>> parentProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> parentTypeProperties1 = new HashMap<String, String>(); // override + Map<String, Map<String, String>> parentProperties = new HashMap<>(); + Map<String, String> parentTypeProperties1 = new HashMap<>(); // override parentTypeProperties1.put("prop1", "val1.2"); // override parent parentTypeProperties1.put("prop2", "val2.2"); // override parent parentTypeProperties1.put("prop6", "val6.2"); // new - Map<String, String> parentTypeProperties3 = new HashMap<String, String>(); // new + Map<String, String> parentTypeProperties3 = new HashMap<>(); // new parentTypeProperties3.put("prop7", "val7.2"); // new parentTypeProperties3.put("prop8", "val8.2"); // new @@ -390,15 +390,15 @@ public class ConfigurationTest { Configuration parentConfiguration = new Configuration(parentProperties, EMPTY_ATTRIBUTES, parentParentConfiguration); // leaf config properties - Map<String, Map<String, String>> properties = new HashMap<String, Map<String, String>>(); - Map<String, String> typeProperties1 = new HashMap<String, String>(); + Map<String, Map<String, String>> properties = new HashMap<>(); + Map<String, String> typeProperties1 = new HashMap<>(); typeProperties1.put("prop1", "val1.3"); // overrides both parent and parents parent typeProperties1.put("prop9", "val9.3"); // new - Map<String, String> typeProperties2 = new HashMap<String, String>(); // overrides + Map<String, String> typeProperties2 = new HashMap<>(); // overrides typeProperties2.put("prop4", "val4.3"); // overrides parents parent value - Map<String, String> typeProperties3 = new HashMap<String, String>(); // overrides + Map<String, String> typeProperties3 = new HashMap<>(); // overrides typeProperties3.put("prop7", "val7.3"); // overrides parents parent value - Map<String, String> typeProperties4 = new HashMap<String, String>(); // new + Map<String, String> typeProperties4 = new HashMap<>(); // new typeProperties4.put("prop10", "val10.3"); // new typeProperties4.put("prop11", "val11.3"); // new @@ -411,75 +411,75 @@ public class ConfigurationTest { private Configuration createConfigurationWithParents_AttributesOnly() { // parents parent config attributes. - Map<String, Map<String, Map<String, String>>> parentParentAttributes = new HashMap<String, Map<String, Map<String, String>>>(); - Map<String, Map<String, String>> parentParentTypeAttributes1 = new HashMap<String, Map<String, String>>(); - Map<String, Map<String, String>> parentParentTypeAttributes2 = new HashMap<String, Map<String, String>>(); + Map<String, Map<String, Map<String, String>>> parentParentAttributes = new HashMap<>(); + Map<String, Map<String, String>> parentParentTypeAttributes1 = new HashMap<>(); + Map<String, Map<String, String>> parentParentTypeAttributes2 = new HashMap<>(); parentParentAttributes.put("type1", parentParentTypeAttributes1); parentParentAttributes.put("type2", parentParentTypeAttributes2); - Map<String, String> parentParentAttributeProperties1 = new HashMap<String, String>(); + Map<String, String> parentParentAttributeProperties1 = new HashMap<>(); parentParentAttributeProperties1.put("prop1", "val1.1"); parentParentAttributeProperties1.put("prop2", "val2.1"); parentParentAttributeProperties1.put("prop3", "val3.1"); - Map<String, String> parentParentAttributeProperties2 = new HashMap<String, String>(); + Map<String, String> parentParentAttributeProperties2 = new HashMap<>(); parentParentAttributeProperties2.put("prop4", "val4.1"); parentParentAttributeProperties2.put("prop5", "val5.1"); parentParentTypeAttributes1.put("attribute1", parentParentAttributeProperties1); parentParentTypeAttributes1.put("attribute2", parentParentAttributeProperties2); - Map<String, String> parentParentAttributeProperties100 = new HashMap<String, String>(); + Map<String, String> parentParentAttributeProperties100 = new HashMap<>(); parentParentAttributeProperties100.put("prop100", "val100.1"); parentParentAttributeProperties100.put("prop101", "val101.1"); - Map<String, String> parentParentAttributeProperties101 = new HashMap<String, String>(); + Map<String, String> parentParentAttributeProperties101 = new HashMap<>(); parentParentAttributeProperties101.put("prop100", "val100.1"); parentParentAttributeProperties101.put("prop101", "val101.1"); parentParentTypeAttributes2.put("attribute100", parentParentAttributeProperties100); parentParentTypeAttributes2.put("attribute101", parentParentAttributeProperties101); Configuration parentParentConfiguration = new Configuration(EMPTY_PROPERTIES, - new HashMap<String, Map<String, Map<String, String>>>(parentParentAttributes)); + new HashMap<>(parentParentAttributes)); // parent config attributes - Map<String, Map<String, Map<String, String>>> parentAttributes = new HashMap<String, Map<String, Map<String, String>>>(); - Map<String, Map<String, String>> parentTypeAttributes1 = new HashMap<String, Map<String, String>>(); - Map<String, Map<String, String>> parentTypeAttributes2 = new HashMap<String, Map<String, String>>(); + Map<String, Map<String, Map<String, String>>> parentAttributes = new HashMap<>(); + Map<String, Map<String, String>> parentTypeAttributes1 = new HashMap<>(); + Map<String, Map<String, String>> parentTypeAttributes2 = new HashMap<>(); parentAttributes.put("type1", parentTypeAttributes1); parentAttributes.put("type2", parentTypeAttributes2); - Map<String, String> parentAttributeProperties1 = new HashMap<String, String>(); // override + Map<String, String> parentAttributeProperties1 = new HashMap<>(); // override parentAttributeProperties1.put("prop1", "val1.2"); // override parent parentAttributeProperties1.put("prop2", "val2.2"); // override parent parentAttributeProperties1.put("prop6", "val6.2"); // new - Map<String, String> parentAttributeProperties3 = new HashMap<String, String>(); // new + Map<String, String> parentAttributeProperties3 = new HashMap<>(); // new parentAttributeProperties3.put("prop7", "val7.2"); // new parentAttributeProperties3.put("prop8", "val8.2"); // new parentTypeAttributes1.put("attribute1", parentAttributeProperties1); parentTypeAttributes1.put("attribute3", parentAttributeProperties3); - Map<String, String> parentAttributeProperties101 = new HashMap<String, String>(); + Map<String, String> parentAttributeProperties101 = new HashMap<>(); parentAttributeProperties101.put("prop100", "val100.2"); parentTypeAttributes2.put("attribute101", parentAttributeProperties101); Configuration parentConfiguration = new Configuration(EMPTY_PROPERTIES, - new HashMap<String, Map<String, Map<String, String>>>(parentAttributes), parentParentConfiguration); + new HashMap<>(parentAttributes), parentParentConfiguration); // leaf config attributes - Map<String, Map<String, Map<String, String>>> attributes = new HashMap<String, Map<String, Map<String, String>>>(); - Map<String, Map<String, String>> typeAttributes1 = new HashMap<String, Map<String, String>>(); - Map<String, Map<String, String>> typeAttributes2 = new HashMap<String, Map<String, String>>(); + Map<String, Map<String, Map<String, String>>> attributes = new HashMap<>(); + Map<String, Map<String, String>> typeAttributes1 = new HashMap<>(); + Map<String, Map<String, String>> typeAttributes2 = new HashMap<>(); attributes.put("type1", typeAttributes1); attributes.put("type2", typeAttributes2); - Map<String, String> attributeProperties1 = new HashMap<String, String>(); + Map<String, String> attributeProperties1 = new HashMap<>(); attributeProperties1.put("prop1", "val1.3"); // overrides both parent and parents parent attributeProperties1.put("prop9", "val9.3"); // new - Map<String, String> attributeProperties2 = new HashMap<String, String>(); // overrides + Map<String, String> attributeProperties2 = new HashMap<>(); // overrides attributeProperties2.put("prop4", "val4.3"); // overrides parents parent value - Map<String, String> attributeProperties3 = new HashMap<String, String>(); // overrides + Map<String, String> attributeProperties3 = new HashMap<>(); // overrides attributeProperties3.put("prop7", "val7.3"); // overrides parents parent value - Map<String, String> attributeProperties4 = new HashMap<String, String>(); // new + Map<String, String> attributeProperties4 = new HashMap<>(); // new attributeProperties4.put("prop10", "val10.3"); // new attributeProperties4.put("prop11", "val11.3"); // new @@ -488,13 +488,13 @@ public class ConfigurationTest { typeAttributes1.put("attribute3", attributeProperties3); typeAttributes1.put("attribute4", attributeProperties4); - Map<String, String> attributeProperties100 = new HashMap<String, String>(); // overrides parents parent + Map<String, String> attributeProperties100 = new HashMap<>(); // overrides parents parent attributeProperties100.put("prop100", "val100.3"); // overrides parents parent attributeProperties100.put("prop102", "val102.3"); // new typeAttributes1.put("attribute1", attributeProperties1); typeAttributes2.put("attribute100", attributeProperties100); return new Configuration(EMPTY_PROPERTIES, - new HashMap<String, Map<String, Map<String, String>>>(attributes), parentConfiguration); + new HashMap<>(attributes), parentConfiguration); } }
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/topology/RequiredPasswordValidatorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/RequiredPasswordValidatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/RequiredPasswordValidatorTest.java index a077a7e..4c88247 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/RequiredPasswordValidatorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/RequiredPasswordValidatorTest.java @@ -58,18 +58,18 @@ public class RequiredPasswordValidatorTest { private static Configuration topoGroup1Config; private static Configuration topoGroup2Config; - private static final Map<String, HostGroup> hostGroups = new HashMap<String, HostGroup>(); - private static final Map<String, HostGroupInfo> hostGroupInfo = new HashMap<String, HostGroupInfo>(); - - private static final Collection<String> group1Components = new HashSet<String>(); - private static final Collection<String> group2Components = new HashSet<String>(); - private static final Collection<String> service1Components = new HashSet<String>(); - private static final Collection<String> service2Components = new HashSet<String>(); - private static final Collection<String> service3Components = new HashSet<String>(); - - private static final Collection<Stack.ConfigProperty> service1RequiredPwdConfigs = new HashSet<Stack.ConfigProperty>(); - private static final Collection<Stack.ConfigProperty> service2RequiredPwdConfigs = new HashSet<Stack.ConfigProperty>(); - private static final Collection<Stack.ConfigProperty> service3RequiredPwdConfigs = new HashSet<Stack.ConfigProperty>(); + private static final Map<String, HostGroup> hostGroups = new HashMap<>(); + private static final Map<String, HostGroupInfo> hostGroupInfo = new HashMap<>(); + + private static final Collection<String> group1Components = new HashSet<>(); + private static final Collection<String> group2Components = new HashSet<>(); + private static final Collection<String> service1Components = new HashSet<>(); + private static final Collection<String> service2Components = new HashSet<>(); + private static final Collection<String> service3Components = new HashSet<>(); + + private static final Collection<Stack.ConfigProperty> service1RequiredPwdConfigs = new HashSet<>(); + private static final Collection<Stack.ConfigProperty> service2RequiredPwdConfigs = new HashSet<>(); + private static final Collection<Stack.ConfigProperty> service3RequiredPwdConfigs = new HashSet<>(); @Before http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/topology/SettingTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/SettingTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/SettingTest.java index e17b1d6..0007acf 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/SettingTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/SettingTest.java @@ -80,16 +80,16 @@ public class SettingTest { Set<HashMap<String, String>> setting2 = new HashSet<>(); // Setting 1: Property1 - HashMap<String, String> setting1Properties1 = new HashMap<String, String>(); + HashMap<String, String> setting1Properties1 = new HashMap<>(); setting1Properties1.put(Setting.SETTING_NAME_RECOVERY_ENABLED, "true"); setting1.add(setting1Properties1); // Setting 2: Property1 and Property2 - HashMap<String, String> setting2Properties1 = new HashMap<String, String>(); + HashMap<String, String> setting2Properties1 = new HashMap<>(); setting2Properties1.put(Setting.SETTING_NAME_NAME, "HDFS"); setting2Properties1.put(Setting.SETTING_NAME_RECOVERY_ENABLED, "false"); - HashMap<String, String> setting2Properties2 = new HashMap<String, String>(); + HashMap<String, String> setting2Properties2 = new HashMap<>(); setting2Properties2.put(Setting.SETTING_NAME_NAME, "TEZ"); setting2Properties2.put(Setting.SETTING_NAME_RECOVERY_ENABLED, "false"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java index 469617c..2d5978b 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java @@ -177,19 +177,19 @@ public class TopologyManagerTest { private HostGroupInfo group1Info = new HostGroupInfo("group1"); private HostGroupInfo group2Info = new HostGroupInfo("group2"); - private Map<String, HostGroupInfo> groupInfoMap = new HashMap<String, HostGroupInfo>(); + private Map<String, HostGroupInfo> groupInfoMap = new HashMap<>(); private Collection<Component> group1Components = Arrays.asList(new Component("component1"), new Component("component2"), new Component("component3")); private Collection<Component> group2Components = Arrays.asList(new Component("component3"), new Component("component4")); - private Map<String, Collection<String>> group1ServiceComponents = new HashMap<String, Collection<String>>(); - private Map<String, Collection<String>> group2ServiceComponents = new HashMap<String, Collection<String>>(); + private Map<String, Collection<String>> group1ServiceComponents = new HashMap<>(); + private Map<String, Collection<String>> group2ServiceComponents = new HashMap<>(); - private Map<String, Collection<String>> serviceComponents = new HashMap<String, Collection<String>>(); + private Map<String, Collection<String>> serviceComponents = new HashMap<>(); private String predicate = "Hosts/host_name=foo"; - private List<TopologyValidator> topologyValidators = new ArrayList<TopologyValidator>(); + private List<TopologyValidator> topologyValidators = new ArrayList<>(); private Capture<ClusterTopology> clusterTopologyCapture; private Capture<Map<String, Object>> configRequestPropertiesCapture; @@ -223,7 +223,7 @@ public class TopologyManagerTest { groupInfoMap.put("group1", group1Info); groupInfoMap.put("group2", group2Info); - Map<String, HostGroup> groupMap = new HashMap<String, HostGroup>(); + Map<String, HostGroup> groupMap = new HashMap<>(); groupMap.put("group1", group1); groupMap.put("group2", group2); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java index a701507..c2fea1d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/ClusterConfigTypeValidatorTest.java @@ -75,7 +75,7 @@ public class ClusterConfigTypeValidatorTest extends EasyMockSupport { @Test public void testShouldValidationPassWhenNoConfigTypesSpecifiedInCCTemplate() throws Exception { // GIVEN - clusterRequestConfigTypes = Collections.<String>emptySet(); + clusterRequestConfigTypes = Collections.emptySet(); EasyMock.expect(clusterConfigurationMock.getAllConfigTypes()).andReturn(clusterRequestConfigTypes).anyTimes(); replayAll(); @@ -91,10 +91,10 @@ public class ClusterConfigTypeValidatorTest extends EasyMockSupport { public void testShouldValidationPassWhenAllConfigTypesAreValid() throws Exception { // GIVEN // all the config types are OK - clusterRequestConfigTypes = new HashSet<String>(Arrays.asList("core-site", "yarn-site")); + clusterRequestConfigTypes = new HashSet<>(Arrays.asList("core-site", "yarn-site")); EasyMock.expect(clusterConfigurationMock.getAllConfigTypes()).andReturn(clusterRequestConfigTypes).anyTimes(); - EasyMock.expect(blueprintMock.getServices()).andReturn(new HashSet<String>(Arrays.asList("YARN", "HDFS"))); + EasyMock.expect(blueprintMock.getServices()).andReturn(new HashSet<>(Arrays.asList("YARN", "HDFS"))); EasyMock.expect(stackMock.getConfigurationTypes("HDFS")).andReturn(Arrays.asList("core-site")); EasyMock.expect(stackMock.getConfigurationTypes("YARN")).andReturn(Arrays.asList("yarn-site")); @@ -114,10 +114,10 @@ public class ClusterConfigTypeValidatorTest extends EasyMockSupport { // GIVEN // the config type that is not present in the stack definition for services - clusterRequestConfigTypes = new HashSet<String>(Arrays.asList("oozie-site")); + clusterRequestConfigTypes = new HashSet<>(Arrays.asList("oozie-site")); EasyMock.expect(clusterConfigurationMock.getAllConfigTypes()).andReturn(clusterRequestConfigTypes).anyTimes(); - EasyMock.expect(blueprintMock.getServices()).andReturn(new HashSet<String>(Arrays.asList("YARN", "HDFS"))); + EasyMock.expect(blueprintMock.getServices()).andReturn(new HashSet<>(Arrays.asList("YARN", "HDFS"))); EasyMock.expect(stackMock.getConfigurationTypes("HDFS")).andReturn(Arrays.asList("core-site")); EasyMock.expect(stackMock.getConfigurationTypes("YARN")).andReturn(Arrays.asList("yarn-site")); @@ -135,10 +135,10 @@ public class ClusterConfigTypeValidatorTest extends EasyMockSupport { public void testShouldValidationFailWhenThereIsAnInvalidConfigGroupProvided() throws Exception { // GIVEN // oozzie-type is wrong! - clusterRequestConfigTypes = new HashSet<String>(Arrays.asList("core-site", "yarn-site", "oozie-site")); + clusterRequestConfigTypes = new HashSet<>(Arrays.asList("core-site", "yarn-site", "oozie-site")); EasyMock.expect(clusterConfigurationMock.getAllConfigTypes()).andReturn(clusterRequestConfigTypes).anyTimes(); - EasyMock.expect(blueprintMock.getServices()).andReturn(new HashSet<String>(Arrays.asList("YARN", "HDFS"))); + EasyMock.expect(blueprintMock.getServices()).andReturn(new HashSet<>(Arrays.asList("YARN", "HDFS"))); EasyMock.expect(stackMock.getConfigurationTypes("HDFS")).andReturn(Arrays.asList("core-site")); EasyMock.expect(stackMock.getConfigurationTypes("YARN")).andReturn(Arrays.asList("yarn-site")); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalogTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalogTest.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalogTest.java index 96ccc57..4dd7fd9 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalogTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/AbstractUpgradeCatalogTest.java @@ -124,7 +124,7 @@ public class AbstractUpgradeCatalogTest { oldProperties.put("prop1", "v1-old"); - Map<String, Map<String, String>> tags = Collections.<String, Map<String, String>>emptyMap(); + Map<String, Map<String, String>> tags = Collections.emptyMap(); Map<String, String> mergedProperties = new HashMap<>(); mergedProperties.put("prop1", "v1-old"); mergedProperties.put("prop4", "v4"); @@ -145,7 +145,7 @@ public class AbstractUpgradeCatalogTest { oldProperties.put("prop2", "v2-old"); oldProperties.put("prop3", "v3-old"); - Map<String, Map<String, String>> tags = Collections.<String, Map<String, String>>emptyMap(); + Map<String, Map<String, String>> tags = Collections.emptyMap(); Map<String, String> mergedProperties = new HashMap<>(); mergedProperties.put("prop1", "v1-old"); mergedProperties.put("prop2", "v2"); @@ -166,7 +166,7 @@ public class AbstractUpgradeCatalogTest { oldProperties.put("prop1", "v1-old"); oldProperties.put("prop3", "v3-old"); - Map<String, Map<String, String>> tags = Collections.<String, Map<String, String>>emptyMap(); + Map<String, Map<String, String>> tags = Collections.emptyMap(); Map<String, String> mergedProperties = new HashMap<>(); mergedProperties.put("prop1", "v1-old"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java index 729340f..c209671 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog200Test.java @@ -460,10 +460,10 @@ public class UpgradeCatalog200Test { final StackInfo mockStackInfo = easyMockSupport.createNiceMock(StackInfo.class); final Clusters mockClusters = easyMockSupport.createStrictMock(Clusters.class); final Cluster mockCluster = easyMockSupport.createStrictMock(Cluster.class); - final Map<String, Cluster> clusterMap = new HashMap<String, Cluster>(); + final Map<String, Cluster> clusterMap = new HashMap<>(); clusterMap.put("c1",mockCluster); OperatingSystemInfo osi = new OperatingSystemInfo("redhat6"); - HashSet<OperatingSystemInfo> osiSet = new HashSet<OperatingSystemInfo>(); + HashSet<OperatingSystemInfo> osiSet = new HashSet<>(); osiSet.add(osi); StackId stackId = new StackId("HDP","2.2"); final RepositoryInfo mockRepositoryInfo = easyMockSupport.createNiceMock(RepositoryInfo.class); @@ -535,7 +535,7 @@ public class UpgradeCatalog200Test { final Config mockClusterEnvExpected = easyMockSupport.createStrictMock(Config.class); final Config mockClusterEnvMissingSmokeUser = easyMockSupport.createStrictMock(Config.class); - final Map<String, String> propertiesExpectedT0 = new HashMap<String, String>(); + final Map<String, String> propertiesExpectedT0 = new HashMap<>(); propertiesExpectedT0.put("kerberos_domain", "EXAMPLE.COM"); propertiesExpectedT0.put("user_group", "hadoop"); propertiesExpectedT0.put("kinit_path_local", "/usr/bin"); @@ -544,13 +544,13 @@ public class UpgradeCatalog200Test { propertiesExpectedT0.put("smokeuser_keytab", "/etc/security/keytabs/smokeuser.headless.keytab"); propertiesExpectedT0.put("ignore_groupsusers_create", "false"); - final Map<String, String> propertiesExpectedT1 = new HashMap<String, String>(propertiesExpectedT0); + final Map<String, String> propertiesExpectedT1 = new HashMap<>(propertiesExpectedT0); propertiesExpectedT1.put("smokeuser_principal_name", "ambari-qa"); - final Map<String, String> propertiesMissingSmokeUserT0 = new HashMap<String, String>(propertiesExpectedT0); + final Map<String, String> propertiesMissingSmokeUserT0 = new HashMap<>(propertiesExpectedT0); propertiesMissingSmokeUserT0.remove("smokeuser"); - final Map<String, String> propertiesMissingSmokeUserT1 = new HashMap<String, String>(propertiesMissingSmokeUserT0); + final Map<String, String> propertiesMissingSmokeUserT1 = new HashMap<>(propertiesMissingSmokeUserT0); propertiesMissingSmokeUserT1.put("smokeuser_principal_name", "ambari-qa"); final PropertyInfo mockSmokeUserPropertyInfo = easyMockSupport.createStrictMock(PropertyInfo.class); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java index 0d4eb43..c40eac6 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog210Test.java @@ -268,10 +268,10 @@ public class UpgradeCatalog210Test { final Config mockHiveEnv = easyMockSupport.createNiceMock(Config.class); final Config mockHiveServer = easyMockSupport.createNiceMock(Config.class); - final Map<String, String> propertiesExpectedRangerPlugin = new HashMap<String, String>(); + final Map<String, String> propertiesExpectedRangerPlugin = new HashMap<>(); propertiesExpectedRangerPlugin.put("ranger-hive-plugin-enabled", "yes"); - final Map<String, String> propertiesExpectedHiveEnv = new HashMap<String, String>(); - final Map<String, String> propertiesExpectedHiveServer2 = new HashMap<String, String>(); + final Map<String, String> propertiesExpectedHiveEnv = new HashMap<>(); + final Map<String, String> propertiesExpectedHiveServer2 = new HashMap<>(); final Injector mockInjector = Guice.createInjector(new AbstractModule() { @Override protected void configure() { @@ -335,7 +335,7 @@ public class UpgradeCatalog210Test { put("hive.security.authorization.manager", ""); put("hive.security.authenticator.manager", ""); }}; - final Map<String, Service> servicesExpected = new HashMap<String, Service>(); + final Map<String, Service> servicesExpected = new HashMap<>(); final Injector mockInjector = Guice.createInjector(new AbstractModule() { @Override @@ -476,7 +476,7 @@ public class UpgradeCatalog210Test { final Config mockHiveSite = easyMockSupport.createNiceMock(Config.class); final Config mockHiveServerSite = easyMockSupport.createNiceMock(Config.class); - final Map<String, String> propertiesExpectedHiveEnv = new HashMap<String, String>(); + final Map<String, String> propertiesExpectedHiveEnv = new HashMap<>(); final Map<String, String> propertiesExpectedHiveSite = new HashMap<String, String>() {{ put("hive.server2.authentication", "kerberos"); }}; @@ -718,9 +718,9 @@ public class UpgradeCatalog210Test { final Config mockClusterEnv = easyMockSupport.createNiceMock(Config.class); final Config mockStormSite = easyMockSupport.createNiceMock(Config.class); - final Map<String, String> propertiesExpectedClusterEnv = new HashMap<String, String>(); + final Map<String, String> propertiesExpectedClusterEnv = new HashMap<>(); propertiesExpectedClusterEnv.put("security_enabled", "true"); - final Map<String, String> propertiesExpectedStormSite = new HashMap<String, String>(); + final Map<String, String> propertiesExpectedStormSite = new HashMap<>(); final Injector mockInjector = Guice.createInjector(new AbstractModule() { @Override protected void configure() { @@ -761,12 +761,12 @@ public class UpgradeCatalog210Test { final Config mockHBaseSite = easyMockSupport.createNiceMock(Config.class); final Config mockHBaseEnv = easyMockSupport.createNiceMock(Config.class); - final Map<String, String> propertiesExpectedHBaseSite = new HashMap<String, String>(); + final Map<String, String> propertiesExpectedHBaseSite = new HashMap<>(); propertiesExpectedHBaseSite.put("hbase.region.server.rpc.scheduler.factory.class", "org.apache.phoenix.hbase.index.ipc.PhoenixIndexRpcSchedulerFactory"); propertiesExpectedHBaseSite.put("hbase.security.authorization", "true"); - final Map<String, String> propertiesExpectedHBaseEnv = new HashMap<String, String>(); + final Map<String, String> propertiesExpectedHBaseEnv = new HashMap<>(); propertiesExpectedHBaseEnv.put("phoenix_sql_enabled", "false"); final Injector mockInjector = Guice.createInjector(new AbstractModule() { @@ -878,8 +878,8 @@ public class UpgradeCatalog210Test { final Config mockHdfsSite = easyMockSupport.createNiceMock(Config.class); final Config mockCoreSite = easyMockSupport.createStrictMock(Config.class); - final Map<String, String> propertiesExpectedHdfs = new HashMap<String, String>(); - final Map<String, String> propertiesExpectedCoreSite = new HashMap<String, String>(); + final Map<String, String> propertiesExpectedHdfs = new HashMap<>(); + final Map<String, String> propertiesExpectedCoreSite = new HashMap<>(); propertiesExpectedHdfs.put("dfs.nameservices", "nncl1,nncl2"); propertiesExpectedHdfs.put("dfs.ha.namenodes.nncl2", "nn1,nn2"); propertiesExpectedCoreSite.put("fs.defaultFS", "hdfs://EXAMPLE.COM:8020"); @@ -1069,7 +1069,7 @@ public class UpgradeCatalog210Test { public HostSectionDDL() { // Capture all tables that will have the host_id column added to it. - captures = new HashMap<String, Capture<DBColumnInfo>>(); + captures = new HashMap<>(); // Column Capture section // Hosts @@ -1153,7 +1153,7 @@ public class UpgradeCatalog210Test { Capture<DBColumnInfo> userActiveLayoutsColumnCapture; public WidgetSectionDDL() { - captures = new HashMap<String, Capture<List<DBColumnInfo>>>(); + captures = new HashMap<>(); Capture<List<DBColumnInfo>> userWidgetColumnsCapture = EasyMock.newCapture(); Capture<List<DBColumnInfo>> widgetLayoutColumnsCapture = EasyMock.newCapture(); @@ -1217,7 +1217,7 @@ public class UpgradeCatalog210Test { HashMap<String, Capture<DBColumnInfo>> captures; public ViewSectionDDL() { - captures = new HashMap<String, Capture<DBColumnInfo>>(); + captures = new HashMap<>(); Capture<DBAccessor.DBColumnInfo> viewInstanceColumnCapture = EasyMock.newCapture(); Capture<DBAccessor.DBColumnInfo> viewInstanceAlterNamesColumnCapture = EasyMock.newCapture(); @@ -1291,8 +1291,8 @@ public class UpgradeCatalog210Test { public AlertSectionDDL() { - stringCaptures = new HashMap<String, Capture<String>>(); - classCaptures = new HashMap<String, Capture<Class>>(); + stringCaptures = new HashMap<>(); + classCaptures = new HashMap<>(); Capture<String> textCaptureC = EasyMock.newCapture(); Capture<String> textCaptureH = EasyMock.newCapture(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog212Test.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog212Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog212Test.java index a60238a..3743b53 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog212Test.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog212Test.java @@ -262,7 +262,7 @@ public class UpgradeCatalog212Test { expect(mockHbaseSite.getProperties()).andReturn(propertiesHbaseSite).once(); final Config mockClusterEnv = easyMockSupport.createNiceMock(Config.class); - final Map<String, String> propertiesExpectedHbaseEnv = new HashMap<String, String>(); + final Map<String, String> propertiesExpectedHbaseEnv = new HashMap<>(); final Map<String, String> propertiesExpectedClusterEnv = new HashMap<String, String>() {{ put("override_uid", "false"); }}; @@ -320,7 +320,7 @@ public class UpgradeCatalog212Test { expect(mockHbaseEnv.getProperties()).andReturn(propertiesHbaseEnv).once(); final Config mockClusterEnv = easyMockSupport.createNiceMock(Config.class); - final Map<String, String> propertiesExpectedHbaseEnv = new HashMap<String, String>(); + final Map<String, String> propertiesExpectedHbaseEnv = new HashMap<>(); final Map<String, String> propertiesExpectedClusterEnv = new HashMap<String, String>() {{ put("override_uid", "true"); }}; @@ -461,7 +461,7 @@ public class UpgradeCatalog212Test { final Config mockHiveEnv = easyMockSupport.createNiceMock(Config.class); final Config mockHiveSite = easyMockSupport.createNiceMock(Config.class); - final Map<String, String> propertiesExpectedHiveEnv = new HashMap<String, String>(); + final Map<String, String> propertiesExpectedHiveEnv = new HashMap<>(); final Map<String, String> propertiesExpectedHiveSite = new HashMap<String, String>() {{ put("hive.heapsize", "512"); put("hive.server2.custom.authentication.class", ""); @@ -614,7 +614,7 @@ public class UpgradeCatalog212Test { HashMap<String, Capture<DBColumnInfo>> captures; public HostRoleCommandDDL() { - captures = new HashMap<String, Capture<DBColumnInfo>>(); + captures = new HashMap<>(); Capture<DBAccessor.DBColumnInfo> hostRoleCommandAutoSkipColumnCapture = EasyMock.newCapture(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java index 0160d86..4413ca8 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog220Test.java @@ -330,7 +330,7 @@ public class UpgradeCatalog220Test { Clusters clusters = createNiceMock(Clusters.class); expect(amc.getClusters()).andReturn(clusters); - Map<String, Cluster> clusterHashMap = new HashMap<String, Cluster>(); + Map<String, Cluster> clusterHashMap = new HashMap<>(); Cluster cluster = createNiceMock(Cluster.class); clusterHashMap.put(clusterName, cluster); expect(clusters.getClusters()).andReturn(clusterHashMap); @@ -378,7 +378,7 @@ public class UpgradeCatalog220Test { expect(clusterEntity.getClusterName()).andReturn(clusterName).anyTimes(); expect(clusterDAO.findByName(anyObject(String.class))).andReturn(clusterEntity); - Collection<HostEntity> hostEntities = new ArrayList<HostEntity>(); + Collection<HostEntity> hostEntities = new ArrayList<>(); HostEntity hostEntity1 = createNiceMock(HostEntity.class); HostEntity hostEntity2 = createNiceMock(HostEntity.class); expect(hostEntity1.getHostName()).andReturn("host1"); @@ -594,7 +594,7 @@ public class UpgradeCatalog220Test { final Config mockHdfsSite = easyMockSupport.createNiceMock(Config.class); - final Map<String, String> propertiesExpectedHdfs = new HashMap<String, String>(); + final Map<String, String> propertiesExpectedHdfs = new HashMap<>(); propertiesExpectedHdfs.put("dfs.namenode.rpc-address", "nn.rpc.address"); propertiesExpectedHdfs.put("dfs.nameservices", "nn1"); propertiesExpectedHdfs.put("dfs.ha.namenodes.nn1", "value"); @@ -1580,7 +1580,7 @@ public class UpgradeCatalog220Test { final Cluster mockClusterExpected = easyMockSupport.createNiceMock(Cluster.class); // We start with no client properties (< 2.2.0). - final Map<String, String> originalClientProperties = new HashMap<String, String>(); + final Map<String, String> originalClientProperties = new HashMap<>(); // And should get the following property on upgrade. final Map<String, String> updatedClientProperties = new HashMap<String, String>() { { http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java index 55ae3ff..f4b3897 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog221Test.java @@ -313,7 +313,7 @@ public class UpgradeCatalog221Test { .addMockedMethod("updateConfigurationPropertiesForCluster", Cluster.class, String.class, Map.class, boolean.class, boolean.class) .createMock(); - Map<String, String> updates = new HashMap<String, String>(); + Map<String, String> updates = new HashMap<>(); updates.put("tez.counters.max", "10000"); updates.put("tez.counters.max.groups", "3000"); upgradeCatalog221.updateConfigurationPropertiesForCluster(mockClusterExpected, "tez-site", @@ -329,7 +329,7 @@ public class UpgradeCatalog221Test { final Clusters mockClusters = easyMockSupport.createStrictMock(Clusters.class); final Cluster mockClusterExpected = easyMockSupport.createNiceMock(Cluster.class); - final Map<String, String> propertiesRangerKmsDbConfigs = new HashMap<String, String>(); + final Map<String, String> propertiesRangerKmsDbConfigs = new HashMap<>(); propertiesRangerKmsDbConfigs.put("DB_FLAVOR", "MYSQL"); propertiesRangerKmsDbConfigs.put("db_host", "localhost"); propertiesRangerKmsDbConfigs.put("db_name", "testdb"); @@ -365,9 +365,9 @@ public class UpgradeCatalog221Test { @Test public void testUpdateAmsHbaseSiteConfigs() throws Exception { - Map<String, String> clusterEnvProperties = new HashMap<String, String>(); - Map<String, String> amsHbaseSecuritySite = new HashMap<String, String>(); - Map<String, String> newPropertiesAmsHbaseSite = new HashMap<String, String>(); + Map<String, String> clusterEnvProperties = new HashMap<>(); + Map<String, String> amsHbaseSecuritySite = new HashMap<>(); + Map<String, String> newPropertiesAmsHbaseSite = new HashMap<>(); //Unsecure amsHbaseSecuritySite.put("zookeeper.znode.parent", "/ams-hbase-unsecure"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog230Test.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog230Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog230Test.java index f4f95f6..66eb0ed 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog230Test.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog230Test.java @@ -279,7 +279,7 @@ public class UpgradeCatalog230Test extends EasyMockSupport { RoleAuthorizationDAO roleAuthorizationDAO = injector.getInstance(RoleAuthorizationDAO.class); expect(roleAuthorizationDAO.findById(anyString())).andReturn(roleAuthorization).anyTimes(); - Collection<RoleAuthorizationEntity> authorizations = new ArrayList<RoleAuthorizationEntity>(); + Collection<RoleAuthorizationEntity> authorizations = new ArrayList<>(); expect(ambariAdministratorPermissionEntity.getAuthorizations()).andReturn(authorizations).atLeastOnce(); expect(clusterAdministratorPermissionEntity.getAuthorizations()).andReturn(authorizations).atLeastOnce(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java index d1b2eb8..e31a428 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog240Test.java @@ -728,12 +728,12 @@ public class UpgradeCatalog240Test { final Config mockOozieEnv = easyMockSupport.createNiceMock(Config.class); final Config mockHiveEnv = easyMockSupport.createNiceMock(Config.class); - final Map<String, String> propertiesExpectedOozieEnv = new HashMap<String, String>(); + final Map<String, String> propertiesExpectedOozieEnv = new HashMap<>(); propertiesExpectedOozieEnv.put("oozie_derby_database", "Derby"); propertiesExpectedOozieEnv.put("property", "value"); // Imitate missing property // propertiesExpectedOozieEnv.put("oozie_hostname", "hostname"); - final Map<String, String> propertiesExpectedHiveEnv = new HashMap<String, String>(); + final Map<String, String> propertiesExpectedHiveEnv = new HashMap<>(); propertiesExpectedHiveEnv.put("hive_hostname", "hostname"); final Injector mockInjector = Guice.createInjector(new Module() { @@ -790,7 +790,7 @@ public class UpgradeCatalog240Test { final Config mockFalconEnv = easyMockSupport.createNiceMock(Config.class); - final Map<String, String> propertiesExpectedFalconEnv = new HashMap<String, String>(); + final Map<String, String> propertiesExpectedFalconEnv = new HashMap<>(); propertiesExpectedFalconEnv.put("falcon_store_uri", "file:///hadoop/falcon/store"); propertiesExpectedFalconEnv.put("content", "# content"); propertiesExpectedFalconEnv.put("property", "value"); @@ -817,7 +817,7 @@ public class UpgradeCatalog240Test { final Config falconStartupConfig = easyMockSupport.createNiceMock(Config.class); - final Map<String, String> falconStartupConfigProperties= new HashMap<String, String>(); + final Map<String, String> falconStartupConfigProperties= new HashMap<>(); falconStartupConfigProperties.put("*.application.services", applicationServicesOldPropertyValue); falconStartupConfigProperties.put("property", "value"); final Injector mockInjector = Guice.createInjector(new Module() { @@ -1941,39 +1941,39 @@ public class UpgradeCatalog240Test { PrincipalEntity principalAdministratorOnly = ems.createStrictMock(PrincipalEntity.class); expect(principalAdministratorOnly.getPrivileges()) - .andReturn(new HashSet<PrivilegeEntity>(Arrays.asList(privilegeAdmin))) + .andReturn(new HashSet<>(Arrays.asList(privilegeAdmin))) .once(); PrincipalEntity principalNonAdminSingleRoleSingleCluster = ems.createStrictMock(PrincipalEntity.class); expect(principalNonAdminSingleRoleSingleCluster.getPrivileges()) - .andReturn(new HashSet<PrivilegeEntity>(Arrays.asList(privilegeClusterUserC1))) + .andReturn(new HashSet<>(Arrays.asList(privilegeClusterUserC1))) .once(); PrincipalEntity principalNonAdminMultipleRolesSingleCluster = ems.createStrictMock(PrincipalEntity.class); expect(principalNonAdminMultipleRolesSingleCluster.getPrivileges()) - .andReturn(new HashSet<PrivilegeEntity>(Arrays.asList(privilegeClusterUserC1, privilegeClusterOperatorC1))) + .andReturn(new HashSet<>(Arrays.asList(privilegeClusterUserC1, privilegeClusterOperatorC1))) .once(); PrincipalEntity principalNonAdminMultipleRolesMultipleClusters = ems.createStrictMock(PrincipalEntity.class); expect(principalNonAdminMultipleRolesMultipleClusters.getPrivileges()) - .andReturn(new HashSet<PrivilegeEntity>(Arrays.asList(privilegeClusterUserC1, privilegeClusterOperatorC1, - privilegeClusterUserC2, privilegeClusterOperatorC2))) + .andReturn(new HashSet<>(Arrays.asList(privilegeClusterUserC1, privilegeClusterOperatorC1, + privilegeClusterUserC2, privilegeClusterOperatorC2))) .once(); PrincipalEntity principalAdminSingleRoleSingleCluster = ems.createStrictMock(PrincipalEntity.class); expect(principalAdminSingleRoleSingleCluster.getPrivileges()) - .andReturn(new HashSet<PrivilegeEntity>(Arrays.asList(privilegeAdmin, privilegeClusterOperatorC1))) + .andReturn(new HashSet<>(Arrays.asList(privilegeAdmin, privilegeClusterOperatorC1))) .once(); PrincipalEntity principalAdminMultipleRolesSingleCluster = ems.createStrictMock(PrincipalEntity.class); expect(principalAdminMultipleRolesSingleCluster.getPrivileges()) - .andReturn(new HashSet<PrivilegeEntity>(Arrays.asList(privilegeAdmin, privilegeClusterUserC1, privilegeClusterOperatorC1))) + .andReturn(new HashSet<>(Arrays.asList(privilegeAdmin, privilegeClusterUserC1, privilegeClusterOperatorC1))) .once(); PrincipalEntity principalAdminMultipleRolesMultipleClusters = ems.createStrictMock(PrincipalEntity.class); expect(principalAdminMultipleRolesMultipleClusters.getPrivileges()) - .andReturn(new HashSet<PrivilegeEntity>(Arrays.asList(privilegeAdmin, privilegeClusterUserC1, - privilegeClusterOperatorC1, privilegeClusterUserC2, privilegeClusterOperatorC2))) + .andReturn(new HashSet<>(Arrays.asList(privilegeAdmin, privilegeClusterUserC1, + privilegeClusterOperatorC1, privilegeClusterUserC2, privilegeClusterOperatorC2))) .once(); UserEntity userAdministratorOnly = ems.createStrictMock(UserEntity.class); @@ -2193,14 +2193,14 @@ public class UpgradeCatalog240Test { } }); - List<ViewInstanceEntity> instances = new ArrayList<ViewInstanceEntity>(); + List<ViewInstanceEntity> instances = new ArrayList<>(); ViewInstanceEntity instance1 = createNiceMock(ViewInstanceEntity.class); expect(instance1.getViewName()).andReturn("CAPACITY-SCHEDULER{1.0.0}"); expect(instance1.getClusterHandle()).andReturn(null); instances.add(instance1); - Map<String,String> propertyMap = new HashMap<String,String>(); + Map<String,String> propertyMap = new HashMap<>(); String url = "url"; String username = "user"; String password = "password"; @@ -2239,7 +2239,7 @@ public class UpgradeCatalog240Test { final Map<String, String> oldPqsProperties = new HashMap<>(); oldPqsProperties.put("phoenix.queryserver.kerberos.principal", "hbase/_h...@example.com"); oldPqsProperties.put("phoenix.queryserver.keytab.file", "/etc/security/keytabs/hbase.service.keytab"); - final Map<String, String> newPqsProperties = new HashMap<String, String>(); + final Map<String, String> newPqsProperties = new HashMap<>(); newPqsProperties.put("phoenix.queryserver.kerberos.principal", spnegoPrincipal); newPqsProperties.put("phoenix.queryserver.keytab.file", spnegoKeytab); @@ -2389,7 +2389,7 @@ public class UpgradeCatalog240Test { final String spnegoPrincipal = "HTTP/_h...@example.com"; final String spnegoKeytab = "/etc/security/keytabs/spnego.service.keytab"; final Map<String, String> oldProperties = new HashMap<>(); - final Map<String, String> newProperties = new HashMap<String, String>(); + final Map<String, String> newProperties = new HashMap<>(); newProperties.put(UpgradeCatalog240.HBASE_SPNEGO_PRINCIPAL_KEY, spnegoPrincipal); newProperties.put(UpgradeCatalog240.HBASE_SPNEGO_KEYTAB_KEY, spnegoKeytab); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog242Test.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog242Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog242Test.java index 2d0064f..af3ba73 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog242Test.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog242Test.java @@ -337,7 +337,7 @@ public class UpgradeCatalog242Test { allClusterAdministratorPrivilege2.setPrincipal(clusterAdministratorPrincipalEntity); expectLastCall().once(); - Set<PrivilegeEntity> allClusterAdministratorPrivileges = new HashSet<PrivilegeEntity>(); + Set<PrivilegeEntity> allClusterAdministratorPrivileges = new HashSet<>(); allClusterAdministratorPrivileges.add(allClusterAdministratorPrivilege1); allClusterAdministratorPrivileges.add(allClusterAdministratorPrivilege2); @@ -346,7 +346,7 @@ public class UpgradeCatalog242Test { .andReturn(allClusterAdministratorPrivileges) .once(); - List<PrincipalEntity> allClusterAdministratorPrincipals = new ArrayList<PrincipalEntity>(); + List<PrincipalEntity> allClusterAdministratorPrincipals = new ArrayList<>(); allClusterAdministratorPrincipals.add(allClusterAdministratorPrincipalEntity); PrincipalDAO principalDAO = easyMockSupport.createMock(PrincipalDAO.class); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java index 2bb75da..5251c56 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog250Test.java @@ -1184,7 +1184,7 @@ public class UpgradeCatalog250Test { "# log4j.logger.org.apache.hadoop.hbase.client.HConnectionManager$HConnectionImplementation=INFO\n" + "# log4j.logger.org.apache.hadoop.hbase.client.MetaScanner=INFO\n"); - Map<String, String> expectedAmsHbaseLog4j = new HashMap<String, String>(); + Map<String, String> expectedAmsHbaseLog4j = new HashMap<>(); expectedAmsHbaseLog4j.put("content", "# Licensed to the Apache Software Foundation (ASF) under one\n" + "# or more contributor license agreements. See the NOTICE file\n" + "# distributed with this work for additional information\n" + @@ -1745,27 +1745,27 @@ public class UpgradeCatalog250Test { @Test public void testUpdateAtlasConfigs() throws Exception { - Map<String, String> oldHiveProperties = new HashMap<String, String>(); - Map<String, String> newHiveProperties = new HashMap<String, String>(); + Map<String, String> oldHiveProperties = new HashMap<>(); + Map<String, String> newHiveProperties = new HashMap<>(); 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>(); + Map<String, String> oldStormProperties = new HashMap<>(); + Map<String, String> newStormProperties = new HashMap<>(); 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>(); + Map<String, String> oldFalconProperties = new HashMap<>(); + Map<String, String> newFalconProperties = new HashMap<>(); 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>(); + Map<String, String> oldSqoopProperties = new HashMap<>(); + Map<String, String> newSqoopProperties = new HashMap<>(); oldSqoopProperties.put("sqoop.atlas.hook", "false"); newSqoopProperties.put("sqoop.atlas.hook", "true"); testUpdateAtlasHookConfig(oldSqoopProperties, newSqoopProperties, "sqoop-env"); @@ -2004,56 +2004,56 @@ public class UpgradeCatalog250Test { @Test public void testUpdateRangerUrlConfigs() throws Exception { - Map<String, String> oldHdfsProperties = new HashMap<String, String>(); - Map<String, String> newHdfsProperties = new HashMap<String, String>(); + Map<String, String> oldHdfsProperties = new HashMap<>(); + Map<String, String> newHdfsProperties = new HashMap<>(); oldHdfsProperties.put("ranger.plugin.hdfs.policy.rest.url", "{{policymgr_mgr_url}}"); newHdfsProperties.put("ranger.plugin.hdfs.policy.rest.url", "http://localhost:6080"); testUpdateRangerUrl(oldHdfsProperties, newHdfsProperties, "ranger-hdfs-security"); - Map<String, String> oldHiveProperties = new HashMap<String, String>(); - Map<String, String> newHiveProperties = new HashMap<String, String>(); + Map<String, String> oldHiveProperties = new HashMap<>(); + Map<String, String> newHiveProperties = new HashMap<>(); oldHiveProperties.put("ranger.plugin.hive.policy.rest.url", "{{policymgr_mgr_url}}"); newHiveProperties.put("ranger.plugin.hive.policy.rest.url", "http://localhost:6080"); testUpdateRangerUrl(oldHiveProperties, newHiveProperties, "ranger-hive-security"); - Map<String, String> oldHbaseProperties = new HashMap<String, String>(); - Map<String, String> newHbaseProperties = new HashMap<String, String>(); + Map<String, String> oldHbaseProperties = new HashMap<>(); + Map<String, String> newHbaseProperties = new HashMap<>(); oldHbaseProperties.put("ranger.plugin.hbase.policy.rest.url", "{{policymgr_mgr_url}}"); newHbaseProperties.put("ranger.plugin.hbase.policy.rest.url", "http://localhost:6080"); testUpdateRangerUrl(oldHbaseProperties, newHbaseProperties, "ranger-hbase-security"); - Map<String, String> oldKnoxProperties = new HashMap<String, String>(); - Map<String, String> newKnoxProperties = new HashMap<String, String>(); + Map<String, String> oldKnoxProperties = new HashMap<>(); + Map<String, String> newKnoxProperties = new HashMap<>(); oldKnoxProperties.put("ranger.plugin.knox.policy.rest.url", "{{policymgr_mgr_url}}"); newKnoxProperties.put("ranger.plugin.knox.policy.rest.url", "http://localhost:6080"); testUpdateRangerUrl(oldKnoxProperties, newKnoxProperties, "ranger-knox-security"); - Map<String, String> oldStormProperties = new HashMap<String, String>(); - Map<String, String> newStormProperties = new HashMap<String, String>(); + Map<String, String> oldStormProperties = new HashMap<>(); + Map<String, String> newStormProperties = new HashMap<>(); oldStormProperties.put("ranger.plugin.storm.policy.rest.url", "{{policymgr_mgr_url}}"); newStormProperties.put("ranger.plugin.storm.policy.rest.url", "http://localhost:6080"); testUpdateRangerUrl(oldStormProperties, newStormProperties, "ranger-storm-security"); - Map<String, String> oldYarnProperties = new HashMap<String, String>(); - Map<String, String> newYarnProperties = new HashMap<String, String>(); + Map<String, String> oldYarnProperties = new HashMap<>(); + Map<String, String> newYarnProperties = new HashMap<>(); oldYarnProperties.put("ranger.plugin.yarn.policy.rest.url", "{{policymgr_mgr_url}}"); newYarnProperties.put("ranger.plugin.yarn.policy.rest.url", "http://localhost:6080"); testUpdateRangerUrl(oldYarnProperties, newYarnProperties, "ranger-yarn-security"); - Map<String, String> oldKafkaProperties = new HashMap<String, String>(); - Map<String, String> newKafkaProperties = new HashMap<String, String>(); + Map<String, String> oldKafkaProperties = new HashMap<>(); + Map<String, String> newKafkaProperties = new HashMap<>(); oldKafkaProperties.put("ranger.plugin.kafka.policy.rest.url", "{{policymgr_mgr_url}}"); newKafkaProperties.put("ranger.plugin.kafka.policy.rest.url", "http://localhost:6080"); testUpdateRangerUrl(oldKafkaProperties, newKafkaProperties, "ranger-kafka-security"); - Map<String, String> oldAtlasProperties = new HashMap<String, String>(); - Map<String, String> newAtlasProperties = new HashMap<String, String>(); + Map<String, String> oldAtlasProperties = new HashMap<>(); + Map<String, String> newAtlasProperties = new HashMap<>(); oldAtlasProperties.put("ranger.plugin.atlas.policy.rest.url", "{{policymgr_mgr_url}}"); newAtlasProperties.put("ranger.plugin.atlas.policy.rest.url", "http://localhost:6080"); testUpdateRangerUrl(oldAtlasProperties, newAtlasProperties, "ranger-atlas-security"); - Map<String, String> oldKmsProperties = new HashMap<String, String>(); - Map<String, String> newKmsProperties = new HashMap<String, String>(); + Map<String, String> oldKmsProperties = new HashMap<>(); + Map<String, String> newKmsProperties = new HashMap<>(); oldKmsProperties.put("ranger.plugin.kms.policy.rest.url", "{{policymgr_mgr_url}}"); newKmsProperties.put("ranger.plugin.kms.policy.rest.url", "http://localhost:6080"); testUpdateRangerUrl(oldKmsProperties, newKmsProperties, "ranger-kms-security"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeTest.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeTest.java index dd146fa..e311fea 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeTest.java @@ -255,7 +255,7 @@ public class UpgradeTest { @Parameterized.Parameters public static Collection<Object[]> data() { - Collection<Object[]> data = new ArrayList<Object[]>(); + Collection<Object[]> data = new ArrayList<>(); for (String s : VERSIONS) { data.add(new Object[]{s}); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/utils/SetUtilsTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/utils/SetUtilsTest.java b/ambari-server/src/test/java/org/apache/ambari/server/utils/SetUtilsTest.java index 67bcf4b..e600bec 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/utils/SetUtilsTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/utils/SetUtilsTest.java @@ -52,7 +52,7 @@ public class SetUtilsTest { Assert.assertEquals(1, subsets.size()); Assert.assertEquals(1, subsets.get(0).size()); - Set<Integer> set = new LinkedHashSet<Integer>(5); + Set<Integer> set = new LinkedHashSet<>(5); for(int i = 0; i < 5; i++) { set.add(i); } @@ -61,7 +61,7 @@ public class SetUtilsTest { Assert.assertEquals(5, subsets.get(0).size()); - set = new LinkedHashSet<Integer>(10); + set = new LinkedHashSet<>(10); for(int i = 0; i < 10; i++) { set.add(i); } @@ -69,7 +69,7 @@ public class SetUtilsTest { Assert.assertEquals(1, subsets.size()); Assert.assertEquals(10, subsets.get(0).size()); - set = new LinkedHashSet<Integer>(11); + set = new LinkedHashSet<>(11); for(int i = 0; i < 11; i++) { set.add(i); } @@ -78,7 +78,7 @@ public class SetUtilsTest { Assert.assertEquals(10, subsets.get(0).size()); Assert.assertEquals(1, subsets.get(1).size()); - set = new LinkedHashSet<Integer>(20); + set = new LinkedHashSet<>(20); for(int i = 0; i < 20; i++) { set.add(i); } @@ -87,7 +87,7 @@ public class SetUtilsTest { Assert.assertEquals(10, subsets.get(0).size()); Assert.assertEquals(10, subsets.get(1).size()); - set = new LinkedHashSet<Integer>(27); + set = new LinkedHashSet<>(27); for(int i = 0; i < 27; i++) { set.add(i); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java b/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java index cf7ff7f..e9bd27c 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/utils/StageUtilsTest.java @@ -195,8 +195,8 @@ public class StageUtilsTest extends EasyMockSupport { StageUtils stageUtils = new StageUtils(injector.getInstance(StageFactory.class)); Stage s = StageUtils.getATestStage(1, 2, "host1", "clusterHostInfo", "hostParamsStage"); ExecutionCommand cmd = s.getExecutionCommands(getHostName()).get(0).getExecutionCommand(); - HashMap<String, Map<String, String>> configTags = new HashMap<String, Map<String, String>>(); - Map<String, String> globalTag = new HashMap<String, String>(); + HashMap<String, Map<String, String>> configTags = new HashMap<>(); + Map<String, String> globalTag = new HashMap<>(); globalTag.put("tag", "version1"); configTags.put("global", globalTag); cmd.setConfigurationTags(configTags); @@ -221,8 +221,8 @@ public class StageUtilsTest extends EasyMockSupport { final Clusters clusters = createNiceMock(Clusters.class); - List<Host> hosts = new ArrayList<Host>(); - List<String> hostNames = new ArrayList<String>(); + List<Host> hosts = new ArrayList<>(); + List<String> hostNames = new ArrayList<>(); List<Integer> pingPorts = Arrays.asList(StageUtils.DEFAULT_PING_PORT, StageUtils.DEFAULT_PING_PORT, @@ -324,7 +324,7 @@ public class StageUtilsTest extends EasyMockSupport { final ServiceComponentHost nns7ServiceComponentHost = createMock(ServiceComponentHost.class); expect(nns7ServiceComponentHost.getComponentAdminState()).andReturn(HostComponentAdminState.INSERVICE).anyTimes(); - Map<String, Collection<String>> projectedTopology = new HashMap<String, Collection<String>>(); + Map<String, Collection<String>> projectedTopology = new HashMap<>(); final HashMap<String, ServiceComponentHost> nnServiceComponentHosts = new HashMap<String, ServiceComponentHost>() { @@ -582,16 +582,16 @@ public class StageUtilsTest extends EasyMockSupport { Set<String> actualPingPorts = info.get(StageUtils.PORTS); if (pingPorts.contains(null)) { - assertEquals(new HashSet<Integer>(pingPorts).size(), actualPingPorts.size() + 1); + assertEquals(new HashSet<>(pingPorts).size(), actualPingPorts.size() + 1); } else { - assertEquals(new HashSet<Integer>(pingPorts).size(), actualPingPorts.size()); + assertEquals(new HashSet<>(pingPorts).size(), actualPingPorts.size()); } List<Integer> pingPortsActual = getRangeMappedDecompressedSet(actualPingPorts); - List<Integer> reindexedPorts = getReindexedList(pingPortsActual, new ArrayList<String>(allHosts), hostNames); + List<Integer> reindexedPorts = getReindexedList(pingPortsActual, new ArrayList<>(allHosts), hostNames); //Treat null values - List<Integer> expectedPingPorts = new ArrayList<Integer>(pingPorts); + List<Integer> expectedPingPorts = new ArrayList<>(pingPorts); for (int i = 0; i < expectedPingPorts.size(); i++) { if (expectedPingPorts.get(i) == null) { expectedPingPorts.set(i, StageUtils.DEFAULT_PING_PORT); @@ -631,7 +631,7 @@ public class StageUtilsTest extends EasyMockSupport { Collection<String> components = projectedTopology.get(hostname); if (components == null) { - components = new HashSet<String>(); + components = new HashSet<>(); projectedTopology.put(hostname, components); } @@ -642,8 +642,8 @@ public class StageUtilsTest extends EasyMockSupport { private void checkServiceHostIndexes(Map<String, Set<String>> info, String componentName, String mappedComponentName, Map<String, Collection<String>> serviceTopology, List<String> hostList) { - Set<Integer> expectedHostsList = new HashSet<Integer>(); - Set<Integer> actualHostsList = new HashSet<Integer>(); + Set<Integer> expectedHostsList = new HashSet<>(); + Set<Integer> actualHostsList = new HashSet<>(); // Determine the expected hosts for a given component... for (Entry<String, Collection<String>> entry : serviceTopology.entrySet()) { @@ -663,8 +663,8 @@ public class StageUtilsTest extends EasyMockSupport { private void checkServiceHostNames(Map<String, Set<String>> info, String componentName, String mappedComponentName, Map<String, Collection<String>> serviceTopology) { - Set<String> expectedHostsList = new HashSet<String>(); - Set<String> actualHostsList = new HashSet<String>(); + Set<String> expectedHostsList = new HashSet<>(); + Set<String> actualHostsList = new HashSet<>(); // Determine the expected hosts for a given component... for (Entry<String, Collection<String>> entry : serviceTopology.entrySet()) { @@ -684,7 +684,7 @@ public class StageUtilsTest extends EasyMockSupport { private Set<Integer> getDecompressedSet(Set<String> set) { - Set<Integer> resultSet = new HashSet<Integer>(); + Set<Integer> resultSet = new HashSet<>(); for (String index : set) { String[] ranges = index.split(","); @@ -712,7 +712,7 @@ public class StageUtilsTest extends EasyMockSupport { private List<Integer> getRangeMappedDecompressedSet(Set<String> compressedSet) { - SortedMap<Integer, Integer> resultMap = new TreeMap<Integer, Integer>(); + SortedMap<Integer, Integer> resultMap = new TreeMap<>(); for (String token : compressedSet) { @@ -728,7 +728,7 @@ public class StageUtilsTest extends EasyMockSupport { String rangeTokens = split[1]; Set<String> rangeTokensSet = - new HashSet<String>(Arrays.asList(rangeTokens.split(","))); + new HashSet<>(Arrays.asList(rangeTokens.split(","))); Set<Integer> decompressedSet = getDecompressedSet(rangeTokensSet); @@ -738,7 +738,7 @@ public class StageUtilsTest extends EasyMockSupport { } - List<Integer> resultList = new ArrayList<Integer>(resultMap.values()); + List<Integer> resultList = new ArrayList<>(resultMap.values()); return resultList; @@ -747,7 +747,7 @@ public class StageUtilsTest extends EasyMockSupport { private List<Integer> getReindexedList(List<Integer> list, List<String> currentIndexes, List<String> desiredIndexes) { - SortedMap<Integer, Integer> sortedMap = new TreeMap<Integer, Integer>(); + SortedMap<Integer, Integer> sortedMap = new TreeMap<>(); int index = 0; @@ -758,7 +758,7 @@ public class StageUtilsTest extends EasyMockSupport { index++; } - return new ArrayList<Integer>(sortedMap.values()); + return new ArrayList<>(sortedMap.values()); } private String getHostName() { http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/utils/TestParallel.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/utils/TestParallel.java b/ambari-server/src/test/java/org/apache/ambari/server/utils/TestParallel.java index 0740190..558a956 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/utils/TestParallel.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/utils/TestParallel.java @@ -83,7 +83,7 @@ public class TestParallel { */ @Test public void testParallelForLoop() throws Exception { - final List<Integer> input = new LinkedList<Integer>(); + final List<Integer> input = new LinkedList<>(); for(int i = 0; i < 10; i++) { input.add(i); } @@ -110,7 +110,7 @@ public class TestParallel { */ @Test public void testNestedParallelForLoop() throws Exception { - final List<Integer> input = new LinkedList<Integer>(); + final List<Integer> input = new LinkedList<>(); for(int i = 0; i < 10; i++) { input.add(i); } @@ -156,7 +156,7 @@ public class TestParallel { */ @Test public void testParallelForLoopIterationFailures() throws Exception { - final List<Integer> input = new LinkedList<Integer>(); + final List<Integer> input = new LinkedList<>(); for(int i = 0; i < 10; i++) { input.add(i); } @@ -192,7 +192,7 @@ public class TestParallel { */ @Test public void testParallelForLoopIterationExceptions() throws Exception { - final List<Integer> input = new LinkedList<Integer>(); + final List<Integer> input = new LinkedList<>(); for(int i = 0; i < 10; i++) { input.add(i); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/view/ClusterImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/ClusterImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/view/ClusterImplTest.java index 3ee2b21..e240917 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/view/ClusterImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/view/ClusterImplTest.java @@ -59,7 +59,7 @@ public class ClusterImplTest { Cluster cluster = createNiceMock(Cluster.class); Config config = createNiceMock(Config.class); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put("foo", "bar"); @@ -82,7 +82,7 @@ public class ClusterImplTest { String service = "SERVICE"; String component = "COMPONENT"; - List<ServiceComponentHost> components = new ArrayList<ServiceComponentHost>(); + List<ServiceComponentHost> components = new ArrayList<>(); ServiceComponentHost component1 = createNiceMock(ServiceComponentHost.class); expect(component1.getHostName()).andReturn("host1"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/view/ViewAmbariStreamProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewAmbariStreamProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewAmbariStreamProviderTest.java index 57768f2..2632d05 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewAmbariStreamProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewAmbariStreamProviderTest.java @@ -50,11 +50,11 @@ public class ViewAmbariStreamProviderTest { HttpURLConnection urlConnection = createNiceMock(HttpURLConnection.class); InputStream inputStream = createNiceMock(InputStream.class); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put("header", "headerValue"); headers.put("Cookie", "FOO=bar"); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("header", Collections.singletonList("headerValue")); headerMap.put("Cookie", Collections.singletonList("FOO=bar; AMBARISESSIONID=abcdefg")); @@ -85,11 +85,11 @@ public class ViewAmbariStreamProviderTest { InputStream body = new ByteArrayInputStream("params".getBytes()); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put("header", "headerValue"); headers.put("Cookie", "FOO=bar"); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("header", Collections.singletonList("headerValue")); headerMap.put("Cookie", Collections.singletonList("FOO=bar; AMBARISESSIONID=abcdefg")); @@ -120,11 +120,11 @@ public class ViewAmbariStreamProviderTest { String body = null; - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put("header", "headerValue"); headers.put("Cookie", "FOO=bar"); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("header", Collections.singletonList("headerValue")); headerMap.put("Cookie", Collections.singletonList("FOO=bar; AMBARISESSIONID=abcdefg")); @@ -155,11 +155,11 @@ public class ViewAmbariStreamProviderTest { InputStream body = null; - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put("header", "headerValue"); headers.put("Cookie", "FOO=bar"); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("header", Collections.singletonList("headerValue")); headerMap.put("Cookie", Collections.singletonList("FOO=bar; AMBARISESSIONID=abcdefg")); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/view/ViewExtractorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewExtractorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewExtractorTest.java index 3761a97..91244cb 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewExtractorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewExtractorTest.java @@ -210,7 +210,7 @@ public class ViewExtractorTest { Map<File, ViewConfig> viewConfigs = Collections.singletonMap(viewArchive, viewDefinition.getConfiguration()); - Map<String, File> files = new HashMap<String, File>(); + Map<String, File> files = new HashMap<>(); if (System.getProperty("os.name").contains("Windows")) { files.put("\\var\\lib\\ambari-server\\resources\\views\\work", extractedArchiveDir); @@ -229,10 +229,10 @@ public class ViewExtractorTest { files.put("/var/lib/ambari-server/resources/views/work/MY_VIEW{1.0.0}/META-INF", metaInfDir); } - Map<File, FileOutputStream> outputStreams = new HashMap<File, FileOutputStream>(); + Map<File, FileOutputStream> outputStreams = new HashMap<>(); outputStreams.put(entryFile, fos); - Map<File, JarInputStream> jarFiles = new HashMap<File, JarInputStream>(); + Map<File, JarInputStream> jarFiles = new HashMap<>(); jarFiles.put(viewArchive, viewJarFile); TestViewArchiveUtility archiveUtility = new TestViewArchiveUtility(viewConfigs, files, outputStreams, jarFiles);