http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterDeadlockTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterDeadlockTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterDeadlockTest.java index 76146b5..d479ca2 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterDeadlockTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterDeadlockTest.java @@ -105,7 +105,7 @@ public class ClusterDeadlockTest { /** * */ - private List<String> hostNames = new ArrayList<String>(NUMBER_OF_HOSTS); + private List<String> hostNames = new ArrayList<>(NUMBER_OF_HOSTS); /** * Creates 100 hosts and adds them to the cluster. @@ -130,7 +130,7 @@ public class ClusterDeadlockTest { Config config2 = configFactory.createNew(cluster, "test-type2", "version1", new HashMap<String, String>(), new HashMap<String, Map<String, String>>()); - cluster.addDesiredConfig("test user", new HashSet<Config>(Arrays.asList(config1, config2))); + cluster.addDesiredConfig("test user", new HashSet<>(Arrays.asList(config1, config2))); // 100 hosts for (int i = 0; i < NUMBER_OF_HOSTS; i++) { @@ -170,7 +170,7 @@ public class ClusterDeadlockTest { ServiceComponentHost dataNodeSCH = createNewServiceComponentHost("HDFS", "DATANODE", "c64-0"); - List<Thread> threads = new ArrayList<Thread>(); + List<Thread> threads = new ArrayList<>(); for (int i = 0; i < NUMBER_OF_THREADS; i++) { DeadlockExerciserThread thread = new DeadlockExerciserThread(); thread.setCluster(cluster); @@ -209,7 +209,7 @@ public class ClusterDeadlockTest { ServiceComponent nameNodeComponent = service.getServiceComponent("NAMENODE"); ServiceComponent dataNodeComponent = service.getServiceComponent("DATANODE"); - List<Thread> threads = new ArrayList<Thread>(); + List<Thread> threads = new ArrayList<>(); for (int i = 0; i < 5; i++) { ServiceComponentReaderWriterThread thread = new ServiceComponentReaderWriterThread(); thread.setDataNodeComponent(dataNodeComponent); @@ -241,7 +241,7 @@ public class ClusterDeadlockTest { @Test() public void testDeadlockWhileRestartingComponents() throws Exception { // for each host, install both components - List<ServiceComponentHost> serviceComponentHosts = new ArrayList<ServiceComponentHost>(); + List<ServiceComponentHost> serviceComponentHosts = new ArrayList<>(); for (String hostName : hostNames) { serviceComponentHosts.add(createNewServiceComponentHost("HDFS", "NAMENODE", hostName)); @@ -250,7 +250,7 @@ public class ClusterDeadlockTest { "DATANODE", hostName)); } - List<Thread> threads = new ArrayList<Thread>(); + List<Thread> threads = new ArrayList<>(); for (int i = 0; i < NUMBER_OF_THREADS; i++) { ClusterReaderThread clusterReaderThread = new ClusterReaderThread(); ClusterWriterThread clusterWriterThread = new ClusterWriterThread(); @@ -281,7 +281,7 @@ public class ClusterDeadlockTest { @Test public void testDeadlockWithConfigsUpdate() throws Exception { - List<Thread> threads = new ArrayList<Thread>(); + List<Thread> threads = new ArrayList<>(); for (int i = 0; i < NUMBER_OF_THREADS; i++) { ClusterDesiredConfigsReaderThread readerThread = null; for (int j = 0; j < NUMBER_OF_THREADS; j++) { @@ -559,7 +559,7 @@ public class ClusterDeadlockTest { } private void setOsFamily(Host host, String osFamily, String osVersion) { - Map<String, String> hostAttributes = new HashMap<String, String>(2); + Map<String, String> hostAttributes = new HashMap<>(2); hostAttributes.put("os_family", osFamily); hostAttributes.put("os_release_version", osVersion); host.setHostAttributes(hostAttributes);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java index 3172571..76f9130 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterImplTest.java @@ -75,7 +75,7 @@ public class ClusterImplTest { @Test public void testAddSessionAttributes() throws Exception { - Map<String, Object> attributes = new HashMap<String, Object>(); + Map<String, Object> attributes = new HashMap<>(); attributes.put("foo", "bar"); AmbariSessionManager sessionManager = createMock(AmbariSessionManager.class); @@ -101,14 +101,14 @@ public class ClusterImplTest { @Test public void testSetSessionAttribute() throws Exception { - Map<String, Object> attributes = new HashMap<String, Object>(); + Map<String, Object> attributes = new HashMap<>(); attributes.put("foo", "bar"); attributes.put("foo2", "bar2"); - Map<String, Object> updatedAttributes = new HashMap<String, Object>(attributes); + Map<String, Object> updatedAttributes = new HashMap<>(attributes); updatedAttributes.put("foo2", "updated value"); - Map<String, Object> addedAttributes = new HashMap<String, Object>(updatedAttributes); + Map<String, Object> addedAttributes = new HashMap<>(updatedAttributes); updatedAttributes.put("foo3", "added value"); AmbariSessionManager sessionManager = createMock(AmbariSessionManager.class); @@ -144,11 +144,11 @@ public class ClusterImplTest { @Test public void testRemoveSessionAttribute() throws Exception { - Map<String, Object> attributes = new HashMap<String, Object>(); + Map<String, Object> attributes = new HashMap<>(); attributes.put("foo", "bar"); attributes.put("foo2", "bar2"); - Map<String, Object> trimmedAttributes = new HashMap<String, Object>(attributes); + Map<String, Object> trimmedAttributes = new HashMap<>(attributes); trimmedAttributes.remove("foo2"); AmbariSessionManager sessionManager = createMock(AmbariSessionManager.class); @@ -175,7 +175,7 @@ public class ClusterImplTest { @Test public void testGetSessionAttributes() throws Exception { - Map<String, Object> attributes = new HashMap<String, Object>(); + Map<String, Object> attributes = new HashMap<>(); attributes.put("foo", "bar"); AmbariSessionManager sessionManager = createMock(AmbariSessionManager.class); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersDeadlockTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersDeadlockTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersDeadlockTest.java index 2f289bb..1a112d6 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersDeadlockTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersDeadlockTest.java @@ -139,7 +139,7 @@ public class ClustersDeadlockTest { final int numberOfThreads, CountDownLatch writerStoppedSignal, CountDownLatch readerStoppedSignal) throws Exception { - List<Thread> writerThreads = new ArrayList<Thread>(); + List<Thread> writerThreads = new ArrayList<>(); for (int i = 0; i < numberOfThreads; i++) { Thread readerThread = readerProvider.get(); Thread writerThread = writerProvider.get(); @@ -347,7 +347,7 @@ public class ClustersDeadlockTest { */ @Override public void run() { - List<String> hostNames = new ArrayList<String>(100); + List<String> hostNames = new ArrayList<>(100); try { // pre-map the hosts for (int i = 0; i < NUMBER_OF_HOSTS; i++) { @@ -372,7 +372,7 @@ public class ClustersDeadlockTest { private void setOsFamily(Host host, String osFamily, String osVersion) { - Map<String, String> hostAttributes = new HashMap<String, String>(2); + Map<String, String> hostAttributes = new HashMap<>(2); hostAttributes.put("os_family", osFamily); hostAttributes.put("os_release_version", osVersion); host.setHostAttributes(hostAttributes); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersImplTest.java index ce95b49..3450bac 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersImplTest.java @@ -36,7 +36,7 @@ public class ClustersImplTest { @Test public void testAddSessionAttributes() throws Exception { - Map<String, Object> attributes = new HashMap<String, Object>(); + Map<String, Object> attributes = new HashMap<>(); attributes.put("foo", "bar"); Cluster cluster = createMock(Cluster.class); @@ -54,7 +54,7 @@ public class ClustersImplTest { @Test public void testGetSessionAttributes() throws Exception { - Map<String, Object> attributes = new HashMap<String, Object>(); + Map<String, Object> attributes = new HashMap<>(); attributes.put("foo", "bar"); Cluster cluster = createMock(Cluster.class); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ConcurrentServiceConfigVersionTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ConcurrentServiceConfigVersionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ConcurrentServiceConfigVersionTest.java index 8b56004..46a039d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ConcurrentServiceConfigVersionTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ConcurrentServiceConfigVersionTest.java @@ -144,7 +144,7 @@ public class ConcurrentServiceConfigVersionTest { Assert.assertEquals(nextVersion, 1); - List<Thread> threads = new ArrayList<Thread>(); + List<Thread> threads = new ArrayList<>(); for (int i = 0; i < NUMBER_OF_THREADS; i++) { Thread thread = new ConcurrentServiceConfigThread(cluster); threads.add(thread); @@ -192,7 +192,7 @@ public class ConcurrentServiceConfigVersionTest { } private void setOsFamily(Host host, String osFamily, String osVersion) { - Map<String, String> hostAttributes = new HashMap<String, String>(2); + Map<String, String> hostAttributes = new HashMap<>(2); hostAttributes.put("os_family", osFamily); hostAttributes.put("os_release_version", osVersion); host.setHostAttributes(hostAttributes); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ServiceComponentHostConcurrentWriteDeadlockTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ServiceComponentHostConcurrentWriteDeadlockTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ServiceComponentHostConcurrentWriteDeadlockTest.java index eecf347..e13dd70 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ServiceComponentHostConcurrentWriteDeadlockTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ServiceComponentHostConcurrentWriteDeadlockTest.java @@ -121,7 +121,7 @@ public class ServiceComponentHostConcurrentWriteDeadlockTest { Config config2 = configFactory.createNew(cluster, "test-type2", null, new HashMap<String, String>(), new HashMap<String, Map<String, String>>()); - cluster.addDesiredConfig("test user", new HashSet<Config>(Arrays.asList(config1, config2))); + cluster.addDesiredConfig("test user", new HashSet<>(Arrays.asList(config1, config2))); String hostName = "c6401"; clusters.addHost(hostName); @@ -144,11 +144,11 @@ public class ServiceComponentHostConcurrentWriteDeadlockTest { ServiceComponentHost nameNodeSCH = createNewServiceComponentHost("HDFS", "NAMENODE", "c6401"); ServiceComponentHost dataNodeSCH = createNewServiceComponentHost("HDFS", "DATANODE", "c6401"); - List<ServiceComponentHost> serviceComponentHosts = new ArrayList<ServiceComponentHost>(); + List<ServiceComponentHost> serviceComponentHosts = new ArrayList<>(); serviceComponentHosts.add(nameNodeSCH); serviceComponentHosts.add(dataNodeSCH); - List<Thread> threads = new ArrayList<Thread>(); + List<Thread> threads = new ArrayList<>(); for (int i = 0; i < NUMBER_OF_THREADS; i++) { ServiceComponentHostDeadlockWriter thread = new ServiceComponentHostDeadlockWriter(); thread.setServiceComponentHosts(serviceComponentHosts); @@ -216,7 +216,7 @@ public class ServiceComponentHostConcurrentWriteDeadlockTest { } private void setOsFamily(Host host, String osFamily, String osVersion) { - Map<String, String> hostAttributes = new HashMap<String, String>(2); + Map<String, String> hostAttributes = new HashMap<>(2); hostAttributes.put("os_family", osFamily); hostAttributes.put("os_release_version", osVersion); host.setHostAttributes(hostAttributes); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosComponentDescriptorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosComponentDescriptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosComponentDescriptorTest.java index f1d2a59..09699c6 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosComponentDescriptorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosComponentDescriptorTest.java @@ -59,25 +59,25 @@ public class KerberosComponentDescriptorTest { static final Map<String, Object> MAP_VALUE; static { - Map<String, Object> identitiesMap = new TreeMap<String, Object>(); + Map<String, Object> identitiesMap = new TreeMap<>(); identitiesMap.put((String) KerberosIdentityDescriptorTest.MAP_VALUE.get("name"), KerberosIdentityDescriptorTest.MAP_VALUE); identitiesMap.put((String) KerberosIdentityDescriptorTest.MAP_VALUE_ALT.get("name"), KerberosIdentityDescriptorTest.MAP_VALUE_ALT); identitiesMap.put((String) KerberosIdentityDescriptorTest.MAP_VALUE_REFERENCE.get("name"), KerberosIdentityDescriptorTest.MAP_VALUE_REFERENCE); - Map<String, Object> serviceSiteProperties = new TreeMap<String, Object>(); + Map<String, Object> serviceSiteProperties = new TreeMap<>(); serviceSiteProperties.put("service.component.property1", "red"); serviceSiteProperties.put("service.component.property", "green"); - Map<String, Map<String, Object>> serviceSiteMap = new TreeMap<String, Map<String, Object>>(); + Map<String, Map<String, Object>> serviceSiteMap = new TreeMap<>(); serviceSiteMap.put("service-site", serviceSiteProperties); - TreeMap<String, Map<String, Map<String, Object>>> configurationsMap = new TreeMap<String, Map<String, Map<String, Object>>>(); + TreeMap<String, Map<String, Map<String, Object>>> configurationsMap = new TreeMap<>(); configurationsMap.put("service-site", serviceSiteMap); - Collection<String> authToLocalRules = new ArrayList<String>(); + Collection<String> authToLocalRules = new ArrayList<>(); authToLocalRules.add("component.name.rules2"); - MAP_VALUE = new TreeMap<String, Object>(); + MAP_VALUE = new TreeMap<>(); MAP_VALUE.put("name", "A_DIFFERENT_COMPONENT_NAME"); MAP_VALUE.put(AbstractKerberosDescriptor.Type.IDENTITY.getDescriptorPluralName(), new ArrayList<>(identitiesMap.values())); MAP_VALUE.put(AbstractKerberosDescriptor.Type.CONFIGURATION.getDescriptorPluralName(), configurationsMap.values()); @@ -184,7 +184,7 @@ public class KerberosComponentDescriptorTest { Assert.assertNotNull(authToLocalProperties); Assert.assertEquals(2, authToLocalProperties.size()); // guarantee ordering... - Iterator<String> iterator = new TreeSet<String>(authToLocalProperties).iterator(); + Iterator<String> iterator = new TreeSet<>(authToLocalProperties).iterator(); Assert.assertEquals("component.name.rules1", iterator.next()); Assert.assertEquals("component.name.rules2", iterator.next()); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosConfigurationDescriptorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosConfigurationDescriptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosConfigurationDescriptorTest.java index c35222c..e891fde 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosConfigurationDescriptorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosConfigurationDescriptorTest.java @@ -58,22 +58,22 @@ public class KerberosConfigurationDescriptorTest { static { - TreeMap<String, Object> configuration_data = new TreeMap<String, Object>(); + TreeMap<String, Object> configuration_data = new TreeMap<>(); configuration_data.put("property1", "black"); configuration_data.put("property2", "white"); - MAP_SINGLE_VALUE = new TreeMap<String, Map<String, Object>>(); + MAP_SINGLE_VALUE = new TreeMap<>(); MAP_SINGLE_VALUE.put("configuration-type", configuration_data); - TreeMap<String, Object> configurationType2Properties = new TreeMap<String, Object>(); + TreeMap<String, Object> configurationType2Properties = new TreeMap<>(); configurationType2Properties.put("property1", "red"); configurationType2Properties.put("property2", "yellow"); configurationType2Properties.put("property3", "green"); - Map<String, Map<String, Object>> configurationType2 = new TreeMap<String, Map<String, Object>>(); + Map<String, Map<String, Object>> configurationType2 = new TreeMap<>(); configurationType2.put("configuration-type2", configurationType2Properties); - TreeMap<String, Map<String, Map<String, Object>>> multipleValuesMap = new TreeMap<String, Map<String, Map<String, Object>>>(); + TreeMap<String, Map<String, Map<String, Object>>> multipleValuesMap = new TreeMap<>(); multipleValuesMap.put("configuration-type", MAP_SINGLE_VALUE); multipleValuesMap.put("configuration-type2", configurationType2); @@ -107,7 +107,7 @@ public class KerberosConfigurationDescriptorTest { }.getType()); - List<KerberosConfigurationDescriptor> configurations = new ArrayList<KerberosConfigurationDescriptor>(); + List<KerberosConfigurationDescriptor> configurations = new ArrayList<>(); for (Map<String, Object> item : jsonData) { configurations.add(new KerberosConfigurationDescriptor(item)); @@ -161,7 +161,7 @@ public class KerberosConfigurationDescriptorTest { @Test public void testMapDeserializeMultiple() { - List<KerberosConfigurationDescriptor> configurations = new ArrayList<KerberosConfigurationDescriptor>(); + List<KerberosConfigurationDescriptor> configurations = new ArrayList<>(); for (Map<String, Map<String, Object>> item : MAP_MULTIPLE_VALUES) { configurations.add(new KerberosConfigurationDescriptor(item)); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosDescriptorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosDescriptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosDescriptorTest.java index 0031be7..f574d99 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosDescriptorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosDescriptorTest.java @@ -59,48 +59,48 @@ public class KerberosDescriptorTest { public static final Map<String, Object> MAP_VALUE; static { - Map<String, Object> keytabOwnerMap = new TreeMap<String, Object>(); + Map<String, Object> keytabOwnerMap = new TreeMap<>(); keytabOwnerMap.put("name", "root"); keytabOwnerMap.put("access", "rw"); - Map<String, Object> keytabGroupMap = new TreeMap<String, Object>(); + Map<String, Object> keytabGroupMap = new TreeMap<>(); keytabGroupMap.put("name", "hadoop"); keytabGroupMap.put("access", "r"); - Map<String, Object> keytabMap = new TreeMap<String, Object>(); + Map<String, Object> keytabMap = new TreeMap<>(); keytabMap.put("file", "/etc/security/keytabs/subject.service.keytab"); keytabMap.put("owner", keytabOwnerMap); keytabMap.put("group", keytabGroupMap); keytabMap.put("configuration", "service-site/service2.component.keytab.file"); - Map<String, Object> sharedIdentityMap = new TreeMap<String, Object>(); + Map<String, Object> sharedIdentityMap = new TreeMap<>(); sharedIdentityMap.put("name", "shared"); sharedIdentityMap.put("principal", KerberosPrincipalDescriptorTest.MAP_VALUE); sharedIdentityMap.put("keytab", keytabMap); - Map<String, Object> servicesMap = new TreeMap<String, Object>(); + Map<String, Object> servicesMap = new TreeMap<>(); servicesMap.put((String) KerberosServiceDescriptorTest.MAP_VALUE.get("name"), KerberosServiceDescriptorTest.MAP_VALUE); - Map<String, Object> identitiesMap = new TreeMap<String, Object>(); + Map<String, Object> identitiesMap = new TreeMap<>(); identitiesMap.put("shared", sharedIdentityMap); - Map<String, Object> clusterConfigProperties = new TreeMap<String, Object>(); + Map<String, Object> clusterConfigProperties = new TreeMap<>(); clusterConfigProperties.put("property1", "red"); - Map<String, Map<String, Object>> clusterConfigMap = new TreeMap<String, Map<String, Object>>(); + Map<String, Map<String, Object>> clusterConfigMap = new TreeMap<>(); clusterConfigMap.put("cluster-conf", clusterConfigProperties); - TreeMap<String, Map<String, Map<String, Object>>> configurationsMap = new TreeMap<String, Map<String, Map<String, Object>>>(); + TreeMap<String, Map<String, Map<String, Object>>> configurationsMap = new TreeMap<>(); configurationsMap.put("cluster-conf", clusterConfigMap); - Collection<String> authToLocalRules = new ArrayList<String>(); + Collection<String> authToLocalRules = new ArrayList<>(); authToLocalRules.add("global.name.rules"); - TreeMap<String, Object> properties = new TreeMap<String, Object>(); + TreeMap<String, Object> properties = new TreeMap<>(); properties.put("realm", "EXAMPLE.COM"); properties.put("some.property", "Hello World"); - MAP_VALUE = new TreeMap<String, Object>(); + MAP_VALUE = new TreeMap<>(); MAP_VALUE.put("properties", properties); MAP_VALUE.put(AbstractKerberosDescriptor.Type.AUTH_TO_LOCAL_PROPERTY.getDescriptorPluralName(), authToLocalRules); MAP_VALUE.put(AbstractKerberosDescriptor.Type.SERVICE.getDescriptorPluralName(), servicesMap.values()); @@ -230,7 +230,7 @@ public class KerberosDescriptorTest { Assert.assertNotNull(authToLocalProperties); Assert.assertEquals(2, authToLocalProperties.size()); // guarantee ordering... - Iterator<String> iterator = new TreeSet<String>(authToLocalProperties).iterator(); + Iterator<String> iterator = new TreeSet<>(authToLocalProperties).iterator(); Assert.assertEquals("generic.name.rules", iterator.next()); Assert.assertEquals("global.name.rules", iterator.next()); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosIdentityDescriptorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosIdentityDescriptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosIdentityDescriptorTest.java index bc7aec0..d11962b 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosIdentityDescriptorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosIdentityDescriptorTest.java @@ -49,34 +49,34 @@ public class KerberosIdentityDescriptorTest { static final Map<String, Object> MAP_VALUE_REFERENCE; static { - MAP_VALUE = new TreeMap<String, Object>(); + MAP_VALUE = new TreeMap<>(); MAP_VALUE.put("name", "identity_1"); MAP_VALUE.put("principal", KerberosPrincipalDescriptorTest.MAP_VALUE); MAP_VALUE.put("keytab", KerberosKeytabDescriptorTest.MAP_VALUE); MAP_VALUE.put("password", "secret"); - MAP_VALUE_ALT = new TreeMap<String, Object>(); + MAP_VALUE_ALT = new TreeMap<>(); MAP_VALUE_ALT.put("name", "identity_2"); MAP_VALUE_ALT.put("principal", KerberosPrincipalDescriptorTest.MAP_VALUE); MAP_VALUE_ALT.put("keytab", KerberosKeytabDescriptorTest.MAP_VALUE); MAP_VALUE_ALT.put("password", "secret2"); - TreeMap<String, Object> ownerMap = new TreeMap<String, Object>(); + TreeMap<String, Object> ownerMap = new TreeMap<>(); ownerMap.put("name", "me"); ownerMap.put("access", "rw"); - TreeMap<String, Object> groupMap = new TreeMap<String, Object>(); + TreeMap<String, Object> groupMap = new TreeMap<>(); groupMap.put("name", "nobody"); groupMap.put("access", ""); - TreeMap<String, Object> keytabMap = new TreeMap<String, Object>(); + TreeMap<String, Object> keytabMap = new TreeMap<>(); keytabMap.put("file", "/home/user/me/subject.service.keytab"); keytabMap.put("owner", ownerMap); keytabMap.put("group", groupMap); keytabMap.put("configuration", "service-site/me.component.keytab.file"); - MAP_VALUE_REFERENCE = new TreeMap<String, Object>(); + MAP_VALUE_REFERENCE = new TreeMap<>(); MAP_VALUE_REFERENCE.put("name", "shared_identity"); MAP_VALUE_REFERENCE.put("reference", "/shared"); MAP_VALUE_REFERENCE.put("keytab", keytabMap); @@ -159,12 +159,12 @@ public class KerberosIdentityDescriptorTest { public void testShouldInclude() { KerberosIdentityDescriptor identityDescriptor = createFromJSON(); - Map<String, Object> context = new TreeMap<String, Object>(); + Map<String, Object> context = new TreeMap<>(); - context.put("services", new HashSet<String>(Arrays.asList("HIVE", "HDFS", "ZOOKEEPER"))); + context.put("services", new HashSet<>(Arrays.asList("HIVE", "HDFS", "ZOOKEEPER"))); Assert.assertTrue(identityDescriptor.shouldInclude(context)); - context.put("services", new HashSet<String>(Arrays.asList("NOT_HIVE", "HDFS", "ZOOKEEPER"))); + context.put("services", new HashSet<>(Arrays.asList("NOT_HIVE", "HDFS", "ZOOKEEPER"))); Assert.assertFalse(identityDescriptor.shouldInclude(context)); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosKeytabDescriptorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosKeytabDescriptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosKeytabDescriptorTest.java index 5bdf5ed..8cdb39e 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosKeytabDescriptorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosKeytabDescriptorTest.java @@ -48,15 +48,15 @@ public class KerberosKeytabDescriptorTest { public static final Map<String, Object> MAP_VALUE; static { - TreeMap<String, Object> ownerMap = new TreeMap<String, Object>(); + TreeMap<String, Object> ownerMap = new TreeMap<>(); ownerMap.put("name", "root"); ownerMap.put("access", "rw"); - TreeMap<String, Object> groupMap = new TreeMap<String, Object>(); + TreeMap<String, Object> groupMap = new TreeMap<>(); groupMap.put("name", "hadoop"); groupMap.put("access", "r"); - MAP_VALUE = new TreeMap<String, Object>(); + MAP_VALUE = new TreeMap<>(); MAP_VALUE.put("file", "/etc/security/keytabs/subject.service.keytab"); MAP_VALUE.put("owner", ownerMap); MAP_VALUE.put("group", groupMap); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptorTest.java index ffef001..b84223f 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosPrincipalDescriptorTest.java @@ -48,13 +48,13 @@ public class KerberosPrincipalDescriptorTest { public static final Map<String, Object> MAP_VALUE_SPARSE; static { - MAP_VALUE = new TreeMap<String, Object>(); + MAP_VALUE = new TreeMap<>(); MAP_VALUE.put("value", "user@_REALM"); MAP_VALUE.put("configuration", "service-site/service.component.kerberos.https.principal"); MAP_VALUE.put("type", "user"); MAP_VALUE.put("local_username", null); - MAP_VALUE_SPARSE = new TreeMap<String, Object>(); + MAP_VALUE_SPARSE = new TreeMap<>(); MAP_VALUE_SPARSE.put("value", "userOther@_REALM"); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosServiceDescriptorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosServiceDescriptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosServiceDescriptorTest.java index 3bc5dcd..064e1cc 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosServiceDescriptorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosServiceDescriptorTest.java @@ -107,26 +107,26 @@ public class KerberosServiceDescriptorTest { public static final Map<String, Object> MAP_VALUE; static { - Map<String, Object> identitiesMap = new TreeMap<String, Object>(); + Map<String, Object> identitiesMap = new TreeMap<>(); identitiesMap.put((String) KerberosIdentityDescriptorTest.MAP_VALUE.get("name"), KerberosIdentityDescriptorTest.MAP_VALUE); - Map<String, Object> componentsMap = new TreeMap<String, Object>(); + Map<String, Object> componentsMap = new TreeMap<>(); componentsMap.put((String) KerberosComponentDescriptorTest.MAP_VALUE.get("name"), KerberosComponentDescriptorTest.MAP_VALUE); - Map<String, Object> serviceSiteProperties = new TreeMap<String, Object>(); + Map<String, Object> serviceSiteProperties = new TreeMap<>(); serviceSiteProperties.put("service.property1", "red"); serviceSiteProperties.put("service.property", "green"); - Map<String, Map<String, Object>> serviceSiteMap = new TreeMap<String, Map<String, Object>>(); + Map<String, Map<String, Object>> serviceSiteMap = new TreeMap<>(); serviceSiteMap.put("service-site", serviceSiteProperties); - TreeMap<String, Map<String, Map<String, Object>>> configurationsMap = new TreeMap<String, Map<String, Map<String, Object>>>(); + TreeMap<String, Map<String, Map<String, Object>>> configurationsMap = new TreeMap<>(); configurationsMap.put("service-site", serviceSiteMap); - Collection<String> authToLocalRules = new ArrayList<String>(); + Collection<String> authToLocalRules = new ArrayList<>(); authToLocalRules.add("service.name.rules2"); - MAP_VALUE = new TreeMap<String, Object>(); + MAP_VALUE = new TreeMap<>(); MAP_VALUE.put("name", "A_DIFFERENT_SERVICE_NAME"); MAP_VALUE.put(AbstractKerberosDescriptor.Type.IDENTITY.getDescriptorPluralName(), identitiesMap.values()); MAP_VALUE.put(AbstractKerberosDescriptor.Type.COMPONENT.getDescriptorPluralName(), componentsMap.values()); @@ -275,7 +275,7 @@ public class KerberosServiceDescriptorTest { Assert.assertNotNull(authToLocalProperties); Assert.assertEquals(2, authToLocalProperties.size()); // guarantee ordering... - Iterator<String> iterator = new TreeSet<String>(authToLocalProperties).iterator(); + Iterator<String> iterator = new TreeSet<>(authToLocalProperties).iterator(); Assert.assertEquals("service.name.rules1", iterator.next()); Assert.assertEquals("service.name.rules2", iterator.next()); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/VariableReplacementHelperTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/VariableReplacementHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/VariableReplacementHelperTest.java index 3ad42a7..f00f694 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/VariableReplacementHelperTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/VariableReplacementHelperTest.java @@ -191,26 +191,26 @@ public class VariableReplacementHelperTest { List<String> expected; List<String> actual; - expected = new LinkedList<String>(Arrays.asList("four", "hello", "one", "three", "two")); - actual = new LinkedList<String>(Arrays.asList(helper.replaceVariables("${foobar-site/hello | append(foobar-site/data, \\,, true)}", configurations).split(","))); + expected = new LinkedList<>(Arrays.asList("four", "hello", "one", "three", "two")); + actual = new LinkedList<>(Arrays.asList(helper.replaceVariables("${foobar-site/hello | append(foobar-site/data, \\,, true)}", configurations).split(","))); Collections.sort(expected); Collections.sort(actual); Assert.assertEquals(expected, actual); - expected = new LinkedList<String>(Arrays.asList("four", "hello", "one", "there", "three", "two")); - actual = new LinkedList<String>(Arrays.asList(helper.replaceVariables("${foobar-site/hello_there | append(foobar-site/data, \\,, true)}", configurations).split(","))); + expected = new LinkedList<>(Arrays.asList("four", "hello", "one", "there", "three", "two")); + actual = new LinkedList<>(Arrays.asList(helper.replaceVariables("${foobar-site/hello_there | append(foobar-site/data, \\,, true)}", configurations).split(","))); Collections.sort(expected); Collections.sort(actual); Assert.assertEquals(expected, actual); - expected = new LinkedList<String>(Arrays.asList("four", "hello", "one", "there", "three", "two")); - actual = new LinkedList<String>(Arrays.asList(helper.replaceVariables("${foobar-site/hello_there_one | append(foobar-site/data, \\,, true)}", configurations).split(","))); + expected = new LinkedList<>(Arrays.asList("four", "hello", "one", "there", "three", "two")); + actual = new LinkedList<>(Arrays.asList(helper.replaceVariables("${foobar-site/hello_there_one | append(foobar-site/data, \\,, true)}", configurations).split(","))); Collections.sort(expected); Collections.sort(actual); Assert.assertEquals(expected, actual); - expected = new LinkedList<String>(Arrays.asList("four", "hello", "one", "one", "there", "three", "two")); - actual = new LinkedList<String>(Arrays.asList(helper.replaceVariables("${foobar-site/hello_there_one | append(foobar-site/data, \\,, false)}", configurations).split(","))); + expected = new LinkedList<>(Arrays.asList("four", "hello", "one", "one", "there", "three", "two")); + actual = new LinkedList<>(Arrays.asList(helper.replaceVariables("${foobar-site/hello_there_one | append(foobar-site/data, \\,, false)}", configurations).split(","))); Collections.sort(expected); Collections.sort(actual); Assert.assertEquals(expected, actual); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/scheduler/BatchRequestJobTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/scheduler/BatchRequestJobTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/scheduler/BatchRequestJobTest.java index 2281785..9c01e96 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/scheduler/BatchRequestJobTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/scheduler/BatchRequestJobTest.java @@ -56,7 +56,7 @@ public class BatchRequestJobTest { long executionId = 31L; long batchId = 1L; - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(BatchRequestJob.BATCH_REQUEST_EXECUTION_ID_KEY, executionId); properties.put(BatchRequestJob.BATCH_REQUEST_BATCH_ID_KEY, batchId); properties.put(BatchRequestJob.BATCH_REQUEST_CLUSTER_NAME_KEY, clusterName); @@ -117,7 +117,7 @@ public class BatchRequestJobTest { JobExecutionContext executionContext = createNiceMock(JobExecutionContext.class); JobDataMap jobDataMap = createNiceMock(JobDataMap.class); JobDetail jobDetail = createNiceMock(JobDetail.class); - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(BatchRequestJob.BATCH_REQUEST_FAILED_TASKS_KEY, 10); properties.put(BatchRequestJob.BATCH_REQUEST_TOTAL_TASKS_KEY, 20); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/services/AlertNoticeDispatchServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/services/AlertNoticeDispatchServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/services/AlertNoticeDispatchServiceTest.java index 8423eaf..cd33e53 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/services/AlertNoticeDispatchServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/services/AlertNoticeDispatchServiceTest.java @@ -93,8 +93,8 @@ public class AlertNoticeDispatchServiceTest extends AlertNoticeDispatchService { private AlertDispatchDAO m_dao = null; private Injector m_injector; - List<AlertDefinitionEntity> m_definitions = new ArrayList<AlertDefinitionEntity>(); - List<AlertHistoryEntity> m_histories = new ArrayList<AlertHistoryEntity>(); + List<AlertDefinitionEntity> m_definitions = new ArrayList<>(); + List<AlertHistoryEntity> m_histories = new ArrayList<>(); @Before public void before() { @@ -494,7 +494,7 @@ public class AlertNoticeDispatchServiceTest extends AlertNoticeDispatchService { notice.setAlertHistory(history); notice.setNotifyState(NotificationState.PENDING); - ArrayList<AlertNoticeEntity> notices = new ArrayList<AlertNoticeEntity>(); + ArrayList<AlertNoticeEntity> notices = new ArrayList<>(); notices.add(notice); return notices; @@ -552,7 +552,7 @@ public class AlertNoticeDispatchServiceTest extends AlertNoticeDispatchService { notice2.setAlertHistory(history2); notice2.setNotifyState(NotificationState.PENDING); - ArrayList<AlertNoticeEntity> notices = new ArrayList<AlertNoticeEntity>(); + ArrayList<AlertNoticeEntity> notices = new ArrayList<>(); notices.add(notice1); notices.add(notice2); @@ -614,7 +614,7 @@ public class AlertNoticeDispatchServiceTest extends AlertNoticeDispatchService { private static class MockSnmpDispatcher implements NotificationDispatcher { - private List<Notification> m_notifications = new ArrayList<Notification>(); + private List<Notification> m_notifications = new ArrayList<>(); /** * {@inheritDoc} http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/stack/OSFamilyTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/stack/OSFamilyTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/stack/OSFamilyTest.java index 8ffc594..ccbc611 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/stack/OSFamilyTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/stack/OSFamilyTest.java @@ -61,10 +61,10 @@ public class OSFamilyTest { @Test public void testOSListing() throws Exception{ Set<String> actual_oslist = os_family.os_list(); - Set<String> expected_oslist = new HashSet<String>(Arrays.asList( - "redhat6", "oraclelinux5", "suse11", "fedora6", "opensuse11", - "centos6", "fedora5","centos5", "ubuntu12", "redhat5", "sles11", - "oraclelinux6", "debian12", "sled11", "win2012server6", "win2012serverr26", "win2008serverr26", "win2008server6" + Set<String> expected_oslist = new HashSet<>(Arrays.asList( + "redhat6", "oraclelinux5", "suse11", "fedora6", "opensuse11", + "centos6", "fedora5", "centos5", "ubuntu12", "redhat5", "sles11", + "oraclelinux6", "debian12", "sled11", "win2012server6", "win2012serverr26", "win2008serverr26", "win2008server6" )); Assert.assertNotNull(actual_oslist); @@ -74,7 +74,7 @@ public class OSFamilyTest { @Test public void testParsingOS() throws Exception{ // test data - Map<String,String> expected_map = new HashMap<String,String>(); + Map<String,String> expected_map = new HashMap<>(); expected_map.put("distro", "ubuntu"); expected_map.put("versions", "12"); @@ -102,9 +102,9 @@ public class OSFamilyTest { @Test public void testFindTypes() throws Exception{ - Set<String> expected_set = new HashSet<String>(Arrays.asList( - "ubuntu12", - "debian12" + Set<String> expected_set = new HashSet<>(Arrays.asList( + "ubuntu12", + "debian12" )); Set<String> actual_set = os_family.findTypes("ubuntu12"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelperTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelperTest.java index a852743..3a5532b 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelperTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/stack/upgrade/RepositoryVersionHelperTest.java @@ -52,7 +52,7 @@ public class RepositoryVersionHelperTest { @Test public void testSerializeOperatingSystems() throws Exception { - final List<RepositoryInfo> repositories = new ArrayList<RepositoryInfo>(); + final List<RepositoryInfo> repositories = new ArrayList<>(); final RepositoryInfo repository = new RepositoryInfo(); repository.setBaseUrl("baseurl"); repository.setOsType("os"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java index 854a163..6db820b 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostTest.java @@ -106,7 +106,7 @@ public class ServiceComponentHostTest { private String clusterName = "c1"; private String hostName1 = "h1"; - private Map<String, String> hostAttributes = new HashMap<String, String>(); + private Map<String, String> hostAttributes = new HashMap<>(); @Before @@ -120,7 +120,7 @@ public class ServiceComponentHostTest { hostAttributes.put("os_family", "redhat"); hostAttributes.put("os_release_version", "5.9"); - Set<String> hostNames = new HashSet<String>(); + Set<String> hostNames = new HashSet<>(); hostNames.add(hostName1); addHostsToCluster(clusterName, hostAttributes, hostNames); @@ -145,7 +145,7 @@ public class ServiceComponentHostTest { private void addHostsToCluster(String clusterName, Map<String, String> hostAttributes, Set<String> hostNames) throws AmbariException { ClusterEntity clusterEntity = clusterDAO.findByName(clusterName); - List<HostEntity> hostEntities = new ArrayList<HostEntity>(); + List<HostEntity> hostEntities = new ArrayList<>(); for (String hostName : hostNames) { clusters.addHost(hostName); Host host = clusters.getHost(hostName); @@ -660,7 +660,7 @@ public class ServiceComponentHostTest { // Test valid states in which host component can be disabled long timestamp = 0; - HashSet<State> validStates = new HashSet<State>(); + HashSet<State> validStates = new HashSet<>(); validStates.add(State.INSTALLED); validStates.add(State.INSTALL_FAILED); validStates.add(State.UNKNOWN); @@ -678,7 +678,7 @@ public class ServiceComponentHostTest { } // Test invalid states in which host component cannot be disabled - HashSet<State> invalidStates = new HashSet<State>(); + HashSet<State> invalidStates = new HashSet<>(); invalidStates.add(State.INIT); invalidStates.add(State.INSTALLING); invalidStates.add(State.STARTING); @@ -716,7 +716,7 @@ public class ServiceComponentHostTest { createCluster(stackId, clusterName); final String hostName = "h3"; - Set<String> hostNames = new HashSet<String>(); + Set<String> hostNames = new HashSet<>(); hostNames.add(hostName); addHostsToCluster(clusterName, hostAttributes, hostNames); @@ -883,7 +883,7 @@ public class ServiceComponentHostTest { // Test actual configs are updated for deleted config group Long id = configGroup.getId(); - HashMap<String, String> tags = new HashMap<String, String>(2); + HashMap<String, String> tags = new HashMap<>(2); tags.put("tag", "version1"); tags.put(id.toString(), "version2"); actual.put("core-site", tags); @@ -910,7 +910,7 @@ public class ServiceComponentHostTest { createCluster(stackId, clusterName); final String hostName = "h3"; - Set<String> hostNames = new HashSet<String>(); + Set<String> hostNames = new HashSet<>(); hostNames.add(hostName); addHostsToCluster(clusterName, hostAttributes, hostNames); @@ -977,7 +977,7 @@ public class ServiceComponentHostTest { Assert.assertFalse(sch3.convertToResponse(null).isStaleConfig()); // Now add config-attributes - Map<String, Map<String, String>> c1PropAttributes = new HashMap<String, Map<String,String>>(); + Map<String, Map<String, String>> c1PropAttributes = new HashMap<>(); c1PropAttributes.put("final", new HashMap<String, String>()); c1PropAttributes.get("final").put("hdfs1", "true"); makeConfig(cluster, "hdfs-site", "version2", @@ -992,7 +992,7 @@ public class ServiceComponentHostTest { Assert.assertFalse(sch3.convertToResponse(null).isStaleConfig()); // Now change config-attributes - Map<String, Map<String, String>> c2PropAttributes = new HashMap<String, Map<String,String>>(); + Map<String, Map<String, String>> c2PropAttributes = new HashMap<>(); c2PropAttributes.put("final", new HashMap<String, String>()); c2PropAttributes.get("final").put("hdfs1", "false"); makeConfig(cluster, "hdfs-site", "version3", @@ -1040,7 +1040,7 @@ public class ServiceComponentHostTest { createCluster(stackId, clusterName); final String hostName = "h3"; - Set<String> hostNames = new HashSet<String>(); + Set<String> hostNames = new HashSet<>(); hostNames.add(hostName); addHostsToCluster(clusterName, hostAttributes, hostNames); @@ -1087,7 +1087,7 @@ public class ServiceComponentHostTest { createCluster(stackId, clusterName); final String hostName = "h3"; - Set<String> hostNames = new HashSet<String>(); + Set<String> hostNames = new HashSet<>(); hostNames.add(hostName); addHostsToCluster(clusterName, hostAttributes, hostNames); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockWarningThread.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockWarningThread.java b/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockWarningThread.java index e24dacb..6d00a23 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockWarningThread.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockWarningThread.java @@ -49,7 +49,7 @@ public class DeadlockWarningThread extends Thread { } public DeadlockWarningThread(Collection<Thread> monitoredThreads, int maxStackDepth, int sleepTimeMS) { - this.errorMessages = new ArrayList<String>(); + this.errorMessages = new ArrayList<>(); this.monitoredThreads = monitoredThreads; this.MAX_STACK_DEPTH = maxStackDepth; this.SLEEP_TIME_MS = sleepTimeMS; @@ -111,7 +111,7 @@ public class DeadlockWarningThread extends Thread { deadlocked = false; break; } else if (!hasRunning) { - List<Long> tIds = new ArrayList<Long>(); + List<Long> tIds = new ArrayList<>(); for (Thread monitoredThread : monitoredThreads) { State state = monitoredThread.getState(); if (state == State.WAITING || state == State.BLOCKED) { http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockedThreadsTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockedThreadsTest.java b/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockedThreadsTest.java index 922b334..ee911a5 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockedThreadsTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/testing/DeadlockedThreadsTest.java @@ -29,7 +29,7 @@ import org.junit.Assert; * Test if DeadlockWarningThread can detect deadlocks properly */ public class DeadlockedThreadsTest { - static Set<Thread> threads = new HashSet<Thread>(); + static Set<Thread> threads = new HashSet<>(); /** * http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/topology/AmbariContextTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/AmbariContextTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/AmbariContextTest.java index 80003e5..33d85af 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/AmbariContextTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/AmbariContextTest.java @@ -118,9 +118,9 @@ public class AmbariContextTest { private static final ConfigFactory configFactory = createNiceMock(ConfigFactory.class); private static final Service mockService1 = createStrictMock(Service.class); - private static final Collection<String> blueprintServices = new HashSet<String>(); - private static final Map<String, Service> clusterServices = new HashMap<String, Service>(); - private static final Map<Long, ConfigGroup> configGroups = new HashMap<Long, ConfigGroup>(); + private static final Collection<String> blueprintServices = new HashSet<>(); + private static final Map<String, Service> clusterServices = new HashMap<>(); + private static final Map<Long, ConfigGroup> configGroups = new HashMap<>(); private Configuration bpConfiguration = null; private Configuration group1Configuration = null; private static final Collection<String> group1Hosts = Arrays.asList(HOST1, HOST2); @@ -156,26 +156,26 @@ public class AmbariContextTest { f.set(null, hostComponentResourceProvider); // bp configuration - Map<String, Map<String, String>> bpProperties = new HashMap<String, Map<String, String>>(); - Map<String, String> bpType1Props = new HashMap<String, String>(); + Map<String, Map<String, String>> bpProperties = new HashMap<>(); + Map<String, String> bpType1Props = new HashMap<>(); bpProperties.put("type1", bpType1Props); bpType1Props.put("prop1", "val1"); bpType1Props.put("prop2", "val2"); bpConfiguration = new Configuration(bpProperties, null); // host group 1 configuration - Map<String, Map<String, String>> group1Properties = new HashMap<String, Map<String, String>>(); - Map<String, String> type1Props = new HashMap<String, String>(); + Map<String, Map<String, String>> group1Properties = new HashMap<>(); + Map<String, String> type1Props = new HashMap<>(); group1Properties.put("type1", type1Props); type1Props.put("prop1", "val1.2"); type1Props.put("prop3", "val3"); group1Configuration = new Configuration(group1Properties, null, bpConfiguration); - Map<String, String> group1ResolvedProperties = new HashMap<String, String>(bpType1Props); + Map<String, String> group1ResolvedProperties = new HashMap<>(bpType1Props); group1ResolvedProperties.putAll(type1Props); // config type -> service mapping - Map<String, String> configTypeServiceMapping = new HashMap<String, String>(); + Map<String, String> configTypeServiceMapping = new HashMap<>(); configTypeServiceMapping.put("type1", "service1"); // config groups @@ -305,7 +305,7 @@ public class AmbariContextTest { Collection<ServiceRequest> serviceRequests = serviceRequestCapture.getValue(); assertEquals(2, serviceRequests.size()); - Collection<String> servicesFound = new HashSet<String>(); + Collection<String> servicesFound = new HashSet<>(); for (ServiceRequest serviceRequest : serviceRequests) { servicesFound.add(serviceRequest.getServiceName()); assertEquals(CLUSTER_NAME, serviceRequest.getClusterName()); @@ -315,13 +315,13 @@ public class AmbariContextTest { Collection<ServiceComponentRequest> serviceComponentRequests = serviceComponentRequestCapture.getValue(); assertEquals(3, serviceComponentRequests.size()); - Map<String, Collection<String>> foundServiceComponents = new HashMap<String, Collection<String>>(); + Map<String, Collection<String>> foundServiceComponents = new HashMap<>(); for (ServiceComponentRequest componentRequest : serviceComponentRequests) { assertEquals(CLUSTER_NAME, componentRequest.getClusterName()); String serviceName = componentRequest.getServiceName(); Collection<String> serviceComponents = foundServiceComponents.get(serviceName); if (serviceComponents == null) { - serviceComponents = new HashSet<String>(); + serviceComponents = new HashSet<>(); foundServiceComponents.put(serviceName, serviceComponents); } serviceComponents.add(componentRequest.getComponentName()); @@ -342,7 +342,7 @@ public class AmbariContextTest { Map<String, Object> installProperties = installPropertiesSet.iterator().next(); assertEquals(CLUSTER_NAME, installProperties.get(ServiceResourceProvider.SERVICE_CLUSTER_NAME_PROPERTY_ID)); assertEquals("INSTALLED", installProperties.get(ServiceResourceProvider.SERVICE_SERVICE_STATE_PROPERTY_ID)); - assertEquals(new EqualsPredicate<String>(ServiceResourceProvider.SERVICE_CLUSTER_NAME_PROPERTY_ID, CLUSTER_NAME), + assertEquals(new EqualsPredicate<>(ServiceResourceProvider.SERVICE_CLUSTER_NAME_PROPERTY_ID, CLUSTER_NAME), installPredicateCapture.getValue()); Request startRequest = serviceStartRequestCapture.getValue(); @@ -351,7 +351,7 @@ public class AmbariContextTest { Map<String, Object> startProperties = startPropertiesSet.iterator().next(); assertEquals(CLUSTER_NAME, startProperties.get(ServiceResourceProvider.SERVICE_CLUSTER_NAME_PROPERTY_ID)); assertEquals("STARTED", startProperties.get(ServiceResourceProvider.SERVICE_SERVICE_STATE_PROPERTY_ID)); - assertEquals(new EqualsPredicate<String>(ServiceResourceProvider.SERVICE_CLUSTER_NAME_PROPERTY_ID, CLUSTER_NAME), + assertEquals(new EqualsPredicate<>(ServiceResourceProvider.SERVICE_CLUSTER_NAME_PROPERTY_ID, CLUSTER_NAME), installPredicateCapture.getValue()); } @@ -555,7 +555,7 @@ public class AmbariContextTest { testClusterEnvDesiredConfig.setTag(topologyResolvedState); Map<String, DesiredConfig> testDesiredConfigs = - new HashMap<String, DesiredConfig>(); + new HashMap<>(); testDesiredConfigs.put("hdfs-site", testHdfsDesiredConfig); testDesiredConfigs.put("core-site", testCoreSiteDesiredConfig); testDesiredConfigs.put("cluster-env", testClusterEnvDesiredConfig); @@ -565,7 +565,7 @@ public class AmbariContextTest { replayAll(); Set<String> testUpdatedConfigTypes = - new HashSet<String>(); + new HashSet<>(); testUpdatedConfigTypes.add("hdfs-site"); testUpdatedConfigTypes.add("core-site"); testUpdatedConfigTypes.add("cluster-env"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintFactoryTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintFactoryTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintFactoryTest.java index 53a9d93..c21b602 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintFactoryTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintFactoryTest.java @@ -69,11 +69,11 @@ public class BlueprintFactoryTest { public void init() throws Exception { setPrivateField(factory, "blueprintDAO", dao); - Map<String, Collection<String>> componentMap = new HashMap<String, Collection<String>>(); - Collection<String> components1 = new HashSet<String>(); + Map<String, Collection<String>> componentMap = new HashMap<>(); + Collection<String> components1 = new HashSet<>(); componentMap.put("test-service1", components1); components1.add("component1"); - Collection<String> components2 = new HashSet<String>(); + Collection<String> components2 = new HashSet<>(); componentMap.put("test-service2", components2); components2.add("component2"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java index 8107d09..255145c 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintImplTest.java @@ -98,7 +98,7 @@ public class BlueprintImplTest { requiredHDFSProperties.add(new Stack.ConfigProperty("hdfs-site", "some_password", null)); requiredHDFSProperties.add(new Stack.ConfigProperty("category1", "prop1", null)); - Collection<Stack.ConfigProperty> requiredService2Properties = new HashSet<Stack.ConfigProperty>(); + Collection<Stack.ConfigProperty> requiredService2Properties = new HashSet<>(); requiredService2Properties.add(new Stack.ConfigProperty("category2", "prop2", null)); expect(stack.getRequiredConfigurationProperties("HDFS")).andReturn(requiredHDFSProperties).anyTimes(); expect(stack.getRequiredConfigurationProperties("SERVICE2")).andReturn(requiredService2Properties).anyTimes(); @@ -158,11 +158,11 @@ public class BlueprintImplTest { group1Components.add("NAMENODE"); group2Components.add("NAMENODE"); expect(stack.getServiceForComponent("NAMENODE")).andReturn("SERVICE2").atLeastOnce(); - Map<String, String> hdfsProps = new HashMap<String, String>(); + Map<String, String> hdfsProps = new HashMap<>(); properties.put("hdfs-site", hdfsProps); hdfsProps.put("foo", "val"); hdfsProps.put("bar", "val"); - Map<String, String> hadoopProps = new HashMap<String, String>(); + Map<String, String> hadoopProps = new HashMap<>(); properties.put("hadoop-env", hadoopProps); hadoopProps.put("dfs_ha_initial_namenode_active", "%HOSTGROUP:group1%"); hadoopProps.put("dfs_ha_initial_namenode_standby", "%HOSTGROUP:group2%"); @@ -197,12 +197,12 @@ public class BlueprintImplTest { group2Components.add("ZKFC"); expect(stack.getServiceForComponent("NAMENODE")).andReturn("SERVICE2").atLeastOnce(); expect(stack.getServiceForComponent("ZKFC")).andReturn("SERVICE2").atLeastOnce(); - Map<String, String> hdfsProps = new HashMap<String, String>(); + Map<String, String> hdfsProps = new HashMap<>(); properties.put("hdfs-site", hdfsProps); hdfsProps.put("foo", "val"); hdfsProps.put("bar", "val"); hdfsProps.put("dfs.nameservices", "val"); - Map<String, String> hadoopProps = new HashMap<String, String>(); + Map<String, String> hadoopProps = new HashMap<>(); properties.put("hadoop-env", hadoopProps); hadoopProps.put("dfs_ha_initial_namenode_active", "%HOSTGROUP::group1%"); hadoopProps.put("dfs_ha_initial_namenode_standby", "%HOSTGROUP::group2%"); @@ -239,12 +239,12 @@ public class BlueprintImplTest { group2Components.add("ZKFC"); expect(stack.getServiceForComponent("NAMENODE")).andReturn("SERVICE2").atLeastOnce(); expect(stack.getServiceForComponent("ZKFC")).andReturn("SERVICE2").atLeastOnce(); - Map<String, String> hdfsProps = new HashMap<String, String>(); + Map<String, String> hdfsProps = new HashMap<>(); properties.put("hdfs-site", hdfsProps); hdfsProps.put("foo", "val"); hdfsProps.put("bar", "val"); hdfsProps.put("dfs.nameservices", "val"); - Map<String, String> hadoopProps = new HashMap<String, String>(); + Map<String, String> hadoopProps = new HashMap<>(); properties.put("hadoop-env", hadoopProps); hadoopProps.put("dfs_ha_initial_namenode_active", "%HOSTGROUP::group2%"); hadoopProps.put("dfs_ha_initial_namenode_standby", "%HOSTGROUP::group3%"); @@ -275,12 +275,12 @@ public class BlueprintImplTest { group2Components.add("ZKFC"); expect(stack.getServiceForComponent("NAMENODE")).andReturn("SERVICE2").atLeastOnce(); expect(stack.getServiceForComponent("ZKFC")).andReturn("SERVICE2").atLeastOnce(); - Map<String, String> hdfsProps = new HashMap<String, String>(); + Map<String, String> hdfsProps = new HashMap<>(); properties.put("hdfs-site", hdfsProps); hdfsProps.put("foo", "val"); hdfsProps.put("bar", "val"); hdfsProps.put("dfs.nameservices", "val"); - Map<String, String> hadoopProps = new HashMap<String, String>(); + Map<String, String> hadoopProps = new HashMap<>(); properties.put("hadoop-env", hadoopProps); hadoopProps.put("dfs_ha_initial_namenode_active", "%HOSTGROUP::group2%"); hadoopProps.put("dfs_ha_initial_namenode_standby", "%HOSTGROUP::group2%"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintValidatorImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintValidatorImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintValidatorImplTest.java index 08b9889..97c8636 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintValidatorImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/BlueprintValidatorImplTest.java @@ -79,14 +79,14 @@ public class BlueprintValidatorImplTest { @Mock(type = MockType.NICE) private DependencyConditionInfo dependencyConditionInfo2; - private final Collection<String> group1Components = new ArrayList<String>(); - private final Collection<String> group2Components = new ArrayList<String>(); - private final Collection<String> services = new ArrayList<String>(); + private final Collection<String> group1Components = new ArrayList<>(); + private final Collection<String> group2Components = new ArrayList<>(); + private final Collection<String> services = new ArrayList<>(); - private Collection<DependencyInfo> dependencies1 = new ArrayList<DependencyInfo>(); - private List<DependencyConditionInfo> dependenciesConditionInfos1 = new ArrayList<DependencyConditionInfo>(); + private Collection<DependencyInfo> dependencies1 = new ArrayList<>(); + private List<DependencyConditionInfo> dependenciesConditionInfos1 = new ArrayList<>(); private AutoDeployInfo autoDeploy = new AutoDeployInfo(); - private Map<String, Map<String, String>> configProperties = new HashMap<String, Map<String, String>>(); + private Map<String, Map<String, String>> configProperties = new HashMap<>(); private Configuration configuration = new Configuration(configProperties, Collections.<String, Map<String, Map<String, String>>>emptyMap()); @@ -220,7 +220,7 @@ public class BlueprintValidatorImplTest { @Test(expected=InvalidTopologyException.class) public void testValidateRequiredProperties_SqlaInHiveStackHdp22() throws Exception { - Map<String, String> hiveEnvConfig = new HashMap<String, String>(); + Map<String, String> hiveEnvConfig = new HashMap<>(); hiveEnvConfig.put("hive_database","Existing SQL Anywhere Database"); configProperties.put("hive-env", hiveEnvConfig); @@ -244,7 +244,7 @@ public class BlueprintValidatorImplTest { @Test(expected=InvalidTopologyException.class) public void testValidateRequiredProperties_SqlaInOozieStackHdp22() throws Exception { - Map<String, String> hiveEnvConfig = new HashMap<String, String>(); + Map<String, String> hiveEnvConfig = new HashMap<>(); hiveEnvConfig.put("oozie_database","Existing SQL Anywhere Database"); configProperties.put("oozie-env", hiveEnvConfig); @@ -369,8 +369,8 @@ public class BlueprintValidatorImplTest { expect(blueprint.getHostGroupsForComponent("component-1")).andReturn(Arrays.asList(group1)).anyTimes(); expect(blueprint.getName()).andReturn("blueprint-1").anyTimes(); - 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); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java index c97c568..1440c4d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java @@ -198,7 +198,7 @@ public class ClusterConfigurationRequestTest { ConfigurationTopologyException { - Map<String, Map<String, String>> existingConfig = new HashMap<String, Map<String, String>>(); + Map<String, Map<String, String>> existingConfig = new HashMap<>(); Configuration stackDefaultConfig = new Configuration(existingConfig, new HashMap<String, Map<String, Map<String, String>>>()); if (stackPropertyValue != null) { @@ -222,7 +222,7 @@ public class ClusterConfigurationRequestTest { expect(blueprint.getStack()).andReturn(stack).anyTimes(); expect(stack.getServiceForConfigType("testConfigType")).andReturn("KERBEROS").anyTimes(); - expect(stack.getAllConfigurationTypes(anyString())).andReturn(Collections.<String>singletonList("testConfigType") + expect(stack.getAllConfigurationTypes(anyString())).andReturn(Collections.singletonList("testConfigType") ).anyTimes(); expect(stack.getExcludedConfigurationTypes(anyString())).andReturn(Collections.<String>emptySet()).anyTimes(); expect(stack.getConfigurationPropertiesWithMetadata(anyString(), anyString())).andReturn(Collections.<String, @@ -294,7 +294,7 @@ public class ClusterConfigurationRequestTest { @Test public void testProcessClusterConfigRequestDontIncludeKererosConfigs() throws Exception { - Map<String, Map<String, String>> existingConfig = new HashMap<String, Map<String, String>>(); + Map<String, Map<String, String>> existingConfig = new HashMap<>(); Configuration stackConfig = new Configuration(existingConfig, new HashMap<String, Map<String, Map<String, String>>>()); @@ -306,7 +306,7 @@ public class ClusterConfigurationRequestTest { expect(clusters.getCluster("testCluster")).andReturn(cluster).anyTimes(); expect(blueprint.getStack()).andReturn(stack).anyTimes(); - expect(stack.getAllConfigurationTypes(anyString())).andReturn(Collections.<String>singletonList("testConfigType") + expect(stack.getAllConfigurationTypes(anyString())).andReturn(Collections.singletonList("testConfigType") ).anyTimes(); expect(stack.getExcludedConfigurationTypes(anyString())).andReturn(Collections.<String>emptySet()).anyTimes(); expect(stack.getConfigurationPropertiesWithMetadata(anyString(), anyString())).andReturn(Collections.<String, @@ -355,7 +355,7 @@ public class ClusterConfigurationRequestTest { public void testProcessClusterConfigRequestRemoveUnusedConfigTypes() throws Exception { // GIVEN Configuration configuration = createConfigurations(); - Set<String> services = new HashSet<String>(); + Set<String> services = new HashSet<>(); services.add("HDFS"); services.add("RANGER"); Map<String, HostGroupInfo> hostGroupInfoMap = Maps.newHashMap(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java index af3fc08..a691cbc 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java @@ -179,19 +179,19 @@ public class ClusterDeployWithStartOnlyTest { 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<String> group1Components = Arrays.asList("component1", "component2", "component3"); private Collection<String> group2Components = Arrays.asList("component3", "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; @@ -225,7 +225,7 @@ public class ClusterDeployWithStartOnlyTest { 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/ClusterInstallWithoutStartOnComponentLevelTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java index 09a6aa2..98ba592 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java @@ -175,19 +175,19 @@ public class ClusterInstallWithoutStartOnComponentLevelTest { 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<String> group1Components = Arrays.asList("component1", "component2", "component3"); private Collection<String> group2Components = Arrays.asList("component3", "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; @@ -221,7 +221,7 @@ public class ClusterInstallWithoutStartOnComponentLevelTest { 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/ClusterInstallWithoutStartTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java index 44cc9f7..fc7ac27 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java @@ -175,19 +175,19 @@ public class ClusterInstallWithoutStartTest { 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<String> group1Components = Arrays.asList("component1", "component2", "component3"); private Collection<String> group2Components = Arrays.asList("component3", "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; @@ -221,7 +221,7 @@ public class ClusterInstallWithoutStartTest { 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/ClusterTopologyImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java index 1f31d05..3ea17b4 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java @@ -54,9 +54,9 @@ public class ClusterTopologyImplTest { private static final HostGroup group2 = createNiceMock(HostGroup.class); private static final HostGroup group3 = createNiceMock(HostGroup.class); private static final HostGroup group4 = createNiceMock(HostGroup.class); - private final Map<String, HostGroupInfo> hostGroupInfoMap = new HashMap<String, HostGroupInfo>(); - private final Map<String, HostGroup> hostGroupMap = new HashMap<String, HostGroup>(); - private final List<TopologyValidator> topologyValidators = new ArrayList<TopologyValidator>(); + private final Map<String, HostGroupInfo> hostGroupInfoMap = new HashMap<>(); + private final Map<String, HostGroup> hostGroupMap = new HashMap<>(); + private final List<TopologyValidator> topologyValidators = new ArrayList<>(); private Configuration configuration; private Configuration bpconfiguration; @@ -78,16 +78,16 @@ public class ClusterTopologyImplTest { hostGroupInfoMap.put("group4", group4Info); group1Info.setConfiguration(configuration); - Collection<String> group1Hosts = new HashSet<String>(); + Collection<String> group1Hosts = new HashSet<>(); group1Hosts.add("host1"); group1Hosts.add("host2"); group1Info.addHosts(group1Hosts); group2Info.setConfiguration(configuration); - Collection<String> group2Hosts = new HashSet<String>(); + Collection<String> group2Hosts = new HashSet<>(); group2Hosts.add("host3"); group2Info.addHosts(group2Hosts); - Collection<String> group4Hosts = new HashSet<String>(); + Collection<String> group4Hosts = new HashSet<>(); group4Hosts.add("host4"); group4Hosts.add("host5"); group4Info.addHosts(group4Hosts); @@ -106,19 +106,19 @@ public class ClusterTopologyImplTest { hostGroupMap.put("group3", group3); hostGroupMap.put("group4", group4); - Set<Component> group1Components = new HashSet<Component>(); + Set<Component> group1Components = new HashSet<>(); group1Components.add(new Component("component1")); group1Components.add(new Component("component2")); - Set<String> group1ComponentNames = new HashSet<String>(); + Set<String> group1ComponentNames = new HashSet<>(); group1ComponentNames.add("component1"); group1ComponentNames.add("component2"); - Set<Component> group2Components = new HashSet<Component>(); + Set<Component> group2Components = new HashSet<>(); group2Components.add(new Component("component3")); - Set<Component> group3Components = new HashSet<Component>(); + Set<Component> group3Components = new HashSet<>(); group3Components.add(new Component("component4")); - Set<Component> group4Components = new HashSet<Component>(); + Set<Component> group4Components = new HashSet<>(); group4Components.add(new Component("component5")); expect(blueprint.getHostGroups()).andReturn(hostGroupMap).anyTimes(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationFactoryTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationFactoryTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationFactoryTest.java index 9bb9523..12112b3 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationFactoryTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigurationFactoryTest.java @@ -103,10 +103,10 @@ public class ConfigurationFactoryTest { } private Collection<Map<String, String>> getNewSyntaxConfigProps() { - Collection<Map<String, String>> configurations = new ArrayList<Map<String, String>>(); + Collection<Map<String, String>> configurations = new ArrayList<>(); // type foo has both properties and attributes - Map<String, String> configProperties1 = new HashMap<String, String>(); + Map<String, String> configProperties1 = new HashMap<>(); configProperties1.put("foo-type/properties/prop1", "prop1Value"); configProperties1.put("foo-type/properties/prop2", "prop2Value"); // foo type attributes @@ -117,12 +117,12 @@ public class ConfigurationFactoryTest { configurations.add(configProperties1); // type bar has only properties - Map<String, String> configProperties2 = new HashMap<String, String>(); + Map<String, String> configProperties2 = new HashMap<>(); configProperties2.put("bar-type/properties/prop3", "prop3Value"); configurations.add(configProperties2); // type foobar has only attributes - Map<String, String> configProperties3 = new HashMap<String, String>(); + Map<String, String> configProperties3 = new HashMap<>(); configProperties3.put("foobar-type/properties_attributes/attribute1/prop10", "attribute1-prop10-value"); configProperties3.put("foobar-type/properties_attributes/attribute10/prop11", "attribute10-prop11-value"); configurations.add(configProperties3); @@ -131,14 +131,14 @@ public class ConfigurationFactoryTest { } private Collection<Map<String, String>> getOldSyntaxConfigProps() { - Collection<Map<String, String>> configurations = new ArrayList<Map<String, String>>(); + Collection<Map<String, String>> configurations = new ArrayList<>(); - Map<String, String> configProperties1 = new HashMap<String, String>(); + Map<String, String> configProperties1 = new HashMap<>(); configProperties1.put("foo-type/prop1", "prop1Value"); configProperties1.put("foo-type/prop2", "prop2Value"); configurations.add(configProperties1); - Map<String, String> configProperties2 = new HashMap<String, String>(); + Map<String, String> configProperties2 = new HashMap<>(); configProperties2.put("bar-type/prop3", "prop3Value"); configurations.add(configProperties2);