http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java index 334b3b3..3eaf890 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesTezDistributedCacheCheckTest.java @@ -95,13 +95,13 @@ public class ServicesTezDistributedCacheCheckTest { final DesiredConfig desiredConfig = Mockito.mock(DesiredConfig.class); Mockito.when(desiredConfig.getTag()).thenReturn("tag"); - Map<String, DesiredConfig> configMap = new HashMap<String, DesiredConfig>(); + Map<String, DesiredConfig> configMap = new HashMap<>(); configMap.put("tez-site", desiredConfig); configMap.put("core-site", desiredConfig); Mockito.when(cluster.getDesiredConfigs()).thenReturn(configMap); final Config config = Mockito.mock(Config.class); Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config); - final Map<String, String> properties = new HashMap<String, String>(); + final Map<String, String> properties = new HashMap<>(); Mockito.when(config.getProperties()).thenReturn(properties); PrerequisiteCheck check = new PrerequisiteCheck(null, null); @@ -169,16 +169,16 @@ public class ServicesTezDistributedCacheCheckTest { final DesiredConfig desiredConfig = Mockito.mock(DesiredConfig.class); Mockito.when(desiredConfig.getTag()).thenReturn("tag"); - Map<String, DesiredConfig> configMap = new HashMap<String, DesiredConfig>(); + Map<String, DesiredConfig> configMap = new HashMap<>(); configMap.put("tez-site", desiredConfig); configMap.put("core-site", desiredConfig); Mockito.when(cluster.getDesiredConfigs()).thenReturn(configMap); final Config config = Mockito.mock(Config.class); Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config); - final Map<String, String> properties = new HashMap<String, String>(); + final Map<String, String> properties = new HashMap<>(); Mockito.when(config.getProperties()).thenReturn(properties); - Map<String, String> checkProperties = new HashMap<String, String>(); + Map<String, String> checkProperties = new HashMap<>(); checkProperties.put("dfs-protocols-regex","^([^:]*dfs|wasb|ecs):.*"); PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class); Mockito.when(prerequisiteCheckConfig.getCheckProperties(
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java index 65505fa..1368b8d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesUpCheckTest.java @@ -116,7 +116,7 @@ public class ServicesUpCheckTest { final Service tezService = Mockito.mock(Service.class); final Service amsService = Mockito.mock(Service.class); - HashMap<String, Service> clusterServices = new HashMap<String, Service>(); + HashMap<String, Service> clusterServices = new HashMap<>(); clusterServices.put("HDFS", hdfsService); clusterServices.put("TEZ", tezService); clusterServices.put("AMBARI_METRICS", amsService); @@ -148,7 +148,7 @@ public class ServicesUpCheckTest { // Put Components inside Services // HDFS - Map<String, ServiceComponent> hdfsComponents = new HashMap<String, ServiceComponent>(); + Map<String, ServiceComponent> hdfsComponents = new HashMap<>(); ServiceComponent nameNode = Mockito.mock(ServiceComponent.class); Mockito.when(nameNode.getName()).thenReturn("NAMENODE"); @@ -175,7 +175,7 @@ public class ServicesUpCheckTest { Mockito.when(hdfsService.getServiceComponents()).thenReturn(hdfsComponents); // TEZ - Map<String, ServiceComponent> tezComponents = new HashMap<String, ServiceComponent>(); + Map<String, ServiceComponent> tezComponents = new HashMap<>(); ServiceComponent tezClient = Mockito.mock(ServiceComponent.class); Mockito.when(tezClient.getName()).thenReturn("TEZ_CLIENT"); @@ -187,7 +187,7 @@ public class ServicesUpCheckTest { Mockito.when(tezService.getServiceComponents()).thenReturn(tezComponents); // AMS - Map<String, ServiceComponent> amsComponents = new HashMap<String, ServiceComponent>(); + Map<String, ServiceComponent> amsComponents = new HashMap<>(); ServiceComponent metricsCollector = Mockito.mock(ServiceComponent.class); Mockito.when(metricsCollector.getName()).thenReturn("METRICS_COLLECTOR"); @@ -223,7 +223,7 @@ public class ServicesUpCheckTest { Mockito.when(hcsMetricsCollector.getHostId()).thenReturn(Long.valueOf(1)); Mockito.when(hcsMetricsMonitor.getHostId()).thenReturn(Long.valueOf(1)); - List<HostComponentSummary> allHostComponentSummaries = new ArrayList<HostComponentSummary>(); + List<HostComponentSummary> allHostComponentSummaries = new ArrayList<>(); allHostComponentSummaries.add(hcsNameNode); allHostComponentSummaries.add(hcsDataNode1); allHostComponentSummaries.add(hcsDataNode2); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java index 4dd3ffb..439710f 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesYarnWorkPreservingCheckTest.java @@ -88,7 +88,7 @@ public class ServicesYarnWorkPreservingCheckTest { Mockito.when(cluster.getDesiredConfigs()).thenReturn(Collections.singletonMap("yarn-site", desiredConfig)); final Config config = Mockito.mock(Config.class); Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config); - final Map<String, String> properties = new HashMap<String, String>(); + final Map<String, String> properties = new HashMap<>(); Mockito.when(config.getProperties()).thenReturn(properties); PrerequisiteCheck check = new PrerequisiteCheck(null, null); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java index 613e47f..7486c71 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/YarnTimelineServerStatePreservingCheckTest.java @@ -77,7 +77,7 @@ public class YarnTimelineServerStatePreservingCheckTest { Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster); Mockito.when(cluster.getCurrentStackVersion()).thenReturn(new StackId("HDP-2.2")); - Map<String, Service> services = new HashMap<String, Service>(); + Map<String, Service> services = new HashMap<>(); Mockito.when(cluster.getServices()).thenReturn(services); ClusterVersionEntity clusterVersionEntity = Mockito.mock(ClusterVersionEntity.class); @@ -87,7 +87,7 @@ public class YarnTimelineServerStatePreservingCheckTest { Mockito.when(clusterVersionEntity.getRepositoryVersion()).thenReturn(repositoryVersionEntity); Mockito.when(repositoryVersionEntity.getVersion()).thenReturn("2.2.4.2"); - Map<String, String> checkProperties = new HashMap<String, String>(); + Map<String, String> checkProperties = new HashMap<>(); checkProperties.put("min-applicable-stack-version","HDP-2.2.4.2"); PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class); Mockito.when(prerequisiteCheckConfig.getCheckProperties( @@ -119,14 +119,14 @@ public class YarnTimelineServerStatePreservingCheckTest { final DesiredConfig desiredConfig = Mockito.mock(DesiredConfig.class); Mockito.when(desiredConfig.getTag()).thenReturn("tag"); - Map<String, DesiredConfig> configMap = new HashMap<String, DesiredConfig>(); + Map<String, DesiredConfig> configMap = new HashMap<>(); configMap.put("yarn-site", desiredConfig); configMap.put("core-site", desiredConfig); Mockito.when(cluster.getDesiredConfigs()).thenReturn(configMap); final Config config = Mockito.mock(Config.class); Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config); - final Map<String, String> properties = new HashMap<String, String>(); + final Map<String, String> properties = new HashMap<>(); Mockito.when(config.getProperties()).thenReturn(properties); PrerequisiteCheck check = new PrerequisiteCheck(null, null); @@ -156,7 +156,7 @@ public class YarnTimelineServerStatePreservingCheckTest { Mockito.when(clusterVersionEntity.getRepositoryVersion()).thenReturn(repositoryVersionEntity); Mockito.when(m_clusters.getCluster("c1")).thenReturn(cluster); - Map<String, String> checkProperties = new HashMap<String, String>(); + Map<String, String> checkProperties = new HashMap<>(); checkProperties.put("min-applicable-stack-version","HDP-2.2.4.2"); PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class); Mockito.when(prerequisiteCheckConfig.getCheckProperties( @@ -204,7 +204,7 @@ public class YarnTimelineServerStatePreservingCheckTest { Mockito.when(clusterVersionEntity.getRepositoryVersion()).thenReturn(repositoryVersionEntity); Mockito.when(m_clusters.getCluster("c1")).thenReturn(cluster); - Map<String, String> checkProperties = new HashMap<String, String>(); + Map<String, String> checkProperties = new HashMap<>(); checkProperties.put("min-applicable-stack-version", "HDP-2.2.4.2"); PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class); Mockito.when(prerequisiteCheckConfig.getCheckProperties( http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/AndPredicateTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/AndPredicateTest.java b/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/AndPredicateTest.java index 278d85f..1611ef5 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/AndPredicateTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/AndPredicateTest.java @@ -77,10 +77,10 @@ public class AndPredicateTest extends EasyMockSupport { verifyAll(); - Map<String, Object> expectedMap = new HashMap<String, Object>(); - expectedMap.put("and", new ArrayList<Map<String, Object>>( - Arrays.asList(Collections.<String, Object>singletonMap("nop", "foo"), - Collections.<String, Object>singletonMap("nop", "baz")) + Map<String, Object> expectedMap = new HashMap<>(); + expectedMap.put("and", new ArrayList<>( + Arrays.asList(Collections.<String, Object>singletonMap("nop", "foo"), + Collections.<String, Object>singletonMap("nop", "baz")) )); Assert.assertEquals(expectedMap, actualMap); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/ContainsPredicateTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/ContainsPredicateTest.java b/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/ContainsPredicateTest.java index 4d32af1..2190c18 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/ContainsPredicateTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/ContainsPredicateTest.java @@ -37,8 +37,8 @@ public class ContainsPredicateTest extends EasyMockSupport { @Test public void testEvaluate() { - Set<String> data1 = new HashSet<String>(Arrays.asList("ONE", "TWO", "THREE")); - Set<String> data2 = new HashSet<String>(Arrays.asList("TWO", "THREE")); + Set<String> data1 = new HashSet<>(Arrays.asList("ONE", "TWO", "THREE")); + Set<String> data2 = new HashSet<>(Arrays.asList("TWO", "THREE")); ContextTransformer transformer = createStrictMock(ContextTransformer.class); expect(transformer.transform(EasyMock.<Map<?, ?>>anyObject())).andReturn(data1).times(1); @@ -66,8 +66,8 @@ public class ContainsPredicateTest extends EasyMockSupport { verifyAll(); - Map<String, Object> expectedMap = new HashMap<String, Object>(); - expectedMap.put("contains", new ArrayList<String>(Arrays.asList("data", "ONE"))); + Map<String, Object> expectedMap = new HashMap<>(); + expectedMap.put("contains", new ArrayList<>(Arrays.asList("data", "ONE"))); Assert.assertEquals(expectedMap, actualMap); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/ContextTransformerTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/ContextTransformerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/ContextTransformerTest.java index 810234c..c6d962d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/ContextTransformerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/ContextTransformerTest.java @@ -37,7 +37,7 @@ public class ContextTransformerTest extends EasyMockSupport { @Test public void testTransformSimple() { - Map<String, Object> context = new HashMap<String, Object>(); + Map<String, Object> context = new HashMap<>(); context.put("key", "value"); context.put("key1", "value1"); context.put("key2", "value2"); @@ -48,14 +48,14 @@ public class ContextTransformerTest extends EasyMockSupport { @Test public void testTransformTree() { - Map<String, Object> serviceSite = new HashMap<String, Object>(); + Map<String, Object> serviceSite = new HashMap<>(); serviceSite.put("property", "service-site-property"); - Map<String, Object> configurations = new HashMap<String, Object>(); + Map<String, Object> configurations = new HashMap<>(); configurations.put("service-site", serviceSite); configurations.put("property", "configuration-property"); - Map<String, Object> context = new HashMap<String, Object>(); + Map<String, Object> context = new HashMap<>(); context.put("configurations", configurations); context.put("property", "context-property"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/EqualsPredicateTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/EqualsPredicateTest.java b/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/EqualsPredicateTest.java index 83c17b3..c463b43 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/EqualsPredicateTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/EqualsPredicateTest.java @@ -64,8 +64,8 @@ public class EqualsPredicateTest extends EasyMockSupport { verifyAll(); - Map<String, Object> expectedMap = new HashMap<String, Object>(); - expectedMap.put("equals", new ArrayList<String>(Arrays.asList("data", "value"))); + Map<String, Object> expectedMap = new HashMap<>(); + expectedMap.put("equals", new ArrayList<>(Arrays.asList("data", "value"))); Assert.assertEquals(expectedMap, actualMap); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/NotPredicateTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/NotPredicateTest.java b/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/NotPredicateTest.java index 7405ef4..5c30f31 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/NotPredicateTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/NotPredicateTest.java @@ -64,7 +64,7 @@ public class NotPredicateTest extends EasyMockSupport { verifyAll(); - Map<String, Object> expectedMap = new HashMap<String, Object>(); + Map<String, Object> expectedMap = new HashMap<>(); expectedMap.put("not", Collections.<String, Object>singletonMap("nop", "foo")); Assert.assertEquals(expectedMap, actualMap); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/OrPredicateTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/OrPredicateTest.java b/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/OrPredicateTest.java index 0d5ef77..c094d44 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/OrPredicateTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/collections/functors/OrPredicateTest.java @@ -76,10 +76,10 @@ public class OrPredicateTest extends EasyMockSupport { verifyAll(); - Map<String, Object> expectedMap = new HashMap<String, Object>(); - expectedMap.put("or", new ArrayList<Map<String, Object>>( - Arrays.asList(Collections.<String, Object>singletonMap("nop", "foo"), - Collections.<String, Object>singletonMap("nop", "baz")) + Map<String, Object> expectedMap = new HashMap<>(); + expectedMap.put("or", new ArrayList<>( + Arrays.asList(Collections.<String, Object>singletonMap("nop", "foo"), + Collections.<String, Object>singletonMap("nop", "baz")) )); Assert.assertEquals(expectedMap, actualMap); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java index 9a0300f..71a02f5 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelperTest.java @@ -146,7 +146,7 @@ public class AmbariCustomCommandExecutionHelperTest { stackInfo.setName("HDP"); stackInfo.setVersion("2.0.6"); StackId stackId = new StackId(stackInfo); - Map<String, DesiredConfig> desiredConfigMap = new HashMap<String, DesiredConfig>(); + Map<String, DesiredConfig> desiredConfigMap = new HashMap<>(); Map<PropertyInfo, String> userProperties = new HashMap<>(); Map<PropertyInfo, String> groupProperties = new HashMap<>(); PropertyInfo userProperty = new PropertyInfo(); @@ -169,7 +169,7 @@ public class AmbariCustomCommandExecutionHelperTest { userProperties.put(userProperty, "zookeeperUser"); groupProperties.put(groupProperty, "zookeeperGroup"); Map<String, Set<String>> userGroupsMap = new HashMap<>(); - userGroupsMap.put("zookeeperUser", new HashSet<String>(Arrays.asList("zookeeperGroup"))); + userGroupsMap.put("zookeeperUser", new HashSet<>(Arrays.asList("zookeeperGroup"))); Cluster cluster = clusters.getCluster("c1"); EasyMock.expect(configHelper.getPropertiesWithPropertyType( stackId, PropertyInfo.PropertyType.USER, cluster, desiredConfigMap)).andReturn(userProperties).anyTimes(); @@ -596,7 +596,7 @@ public class AmbariCustomCommandExecutionHelperTest { } } private void setOsFamily(Host host, String osFamily, String osVersion) { - Map<String, String> hostAttributes = new HashMap<String, String>(); + Map<String, String> hostAttributes = new HashMap<>(); hostAttributes.put("os_family", osFamily); hostAttributes.put("os_release_version", osVersion); @@ -616,7 +616,7 @@ public class AmbariCustomCommandExecutionHelperTest { dStateStr = desiredState.toString(); } ServiceRequest r1 = new ServiceRequest(clusterName, serviceName, dStateStr); - Set<ServiceRequest> requests = new HashSet<ServiceRequest>(); + Set<ServiceRequest> requests = new HashSet<>(); requests.add(r1); ServiceResourceProviderTest.createServices(ambariManagementController, requests); @@ -632,7 +632,7 @@ public class AmbariCustomCommandExecutionHelperTest { ServiceComponentRequest r = new ServiceComponentRequest(clusterName, serviceName, componentName, dStateStr); Set<ServiceComponentRequest> requests = - new HashSet<ServiceComponentRequest>(); + new HashSet<>(); requests.add(r); ComponentResourceProviderTest.createComponents(ambariManagementController, requests); } @@ -646,7 +646,7 @@ public class AmbariCustomCommandExecutionHelperTest { ServiceComponentHostRequest r = new ServiceComponentHostRequest(clusterName, serviceName, componentName, hostname, dStateStr); Set<ServiceComponentHostRequest> requests = - new HashSet<ServiceComponentHostRequest>(); + new HashSet<>(); requests.add(r); ambariManagementController.createHostComponents(requests); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariHandlerListTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariHandlerListTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariHandlerListTest.java index 9fe240e..191deca 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariHandlerListTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariHandlerListTest.java @@ -85,7 +85,7 @@ public class AmbariHandlerListTest { handlerList.addViewInstance(viewInstanceEntity); - ArrayList<Handler> handlers = new ArrayList<Handler>(Arrays.asList(handlerList.getHandlers())); + ArrayList<Handler> handlers = new ArrayList<>(Arrays.asList(handlerList.getHandlers())); Assert.assertTrue(handlers.contains(handler)); @@ -112,13 +112,13 @@ public class AmbariHandlerListTest { handlerList.addViewInstance(viewInstanceEntity); - ArrayList<Handler> handlers = new ArrayList<Handler>(Arrays.asList(handlerList.getHandlers())); + ArrayList<Handler> handlers = new ArrayList<>(Arrays.asList(handlerList.getHandlers())); Assert.assertTrue(handlers.contains(handler)); handlerList.removeViewInstance(viewInstanceEntity); - handlers = new ArrayList<Handler>(Arrays.asList(handlerList.getHandlers())); + handlers = new ArrayList<>(Arrays.asList(handlerList.getHandlers())); Assert.assertFalse(handlers.contains(handler)); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java index abae5a1..625ac8a 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerImplTest.java @@ -229,7 +229,7 @@ public class AmbariManagementControllerImplTest { Cluster cluster = createNiceMock(Cluster.class); ClusterResponse response = createNiceMock(ClusterResponse.class); - Set<ClusterRequest> setRequests = new HashSet<ClusterRequest>(); + Set<ClusterRequest> setRequests = new HashSet<>(); setRequests.add(request1); // expectations @@ -289,7 +289,7 @@ public class AmbariManagementControllerImplTest { Cluster cluster = createNiceMock(Cluster.class); Service service = createNiceMock(Service.class); ServiceComponent component = createNiceMock(ServiceComponent.class); - Map<String, ServiceComponentHost> hostMap = new HashMap<String, ServiceComponentHost>(); + Map<String, ServiceComponentHost> hostMap = new HashMap<>(); expect(component.getServiceComponentHosts()).andReturn(hostMap); replay(cluster, service, component, injector); @@ -380,7 +380,7 @@ public class AmbariManagementControllerImplTest { expect(service.getDesiredStackVersion()).andReturn(stackId); expect(stackId.getStackName()).andReturn("stack"); expect(stackId.getStackVersion()).andReturn("1.0"); - Map<String, ServiceComponent> componentsMap = new HashMap<String, ServiceComponent>(); + Map<String, ServiceComponent> componentsMap = new HashMap<>(); componentsMap.put("component1", component1); componentsMap.put("component2", component2); expect(service.getServiceComponents()).andReturn(componentsMap); @@ -418,7 +418,7 @@ public class AmbariManagementControllerImplTest { expect(service.getDesiredStackVersion()).andReturn(stackId); expect(stackId.getStackName()).andReturn("stack"); expect(stackId.getStackVersion()).andReturn("1.0"); - Map<String, ServiceComponent> componentsMap = new HashMap<String, ServiceComponent>(); + Map<String, ServiceComponent> componentsMap = new HashMap<>(); componentsMap.put("component1", component1); componentsMap.put("component2", component2); expect(service.getServiceComponents()).andReturn(componentsMap); @@ -453,7 +453,7 @@ public class AmbariManagementControllerImplTest { // requests ClusterRequest request1 = new ClusterRequest(null, "cluster1", "1", Collections.<String>emptySet()); - Set<ClusterRequest> setRequests = new HashSet<ClusterRequest>(); + Set<ClusterRequest> setRequests = new HashSet<>(); setRequests.add(request1); // expectations @@ -504,7 +504,7 @@ public class AmbariManagementControllerImplTest { ClusterRequest request3 = new ClusterRequest(null, "cluster3", "1", Collections.<String>emptySet()); ClusterRequest request4 = new ClusterRequest(null, "cluster4", "1", Collections.<String>emptySet()); - Set<ClusterRequest> setRequests = new HashSet<ClusterRequest>(); + Set<ClusterRequest> setRequests = new HashSet<>(); setRequests.add(request1); setRequests.add(request2); setRequests.add(request3); @@ -1028,7 +1028,7 @@ public class AmbariManagementControllerImplTest { ServiceComponentHostRequest request1 = new ServiceComponentHostRequest( "cluster1", null, "component1", "host1", null); - Set<ServiceComponentHostRequest> setRequests = new HashSet<ServiceComponentHostRequest>(); + Set<ServiceComponentHostRequest> setRequests = new HashSet<>(); setRequests.add(request1); // expectations @@ -1099,7 +1099,7 @@ public class AmbariManagementControllerImplTest { "cluster1", null, "component1", "host1", null); - Set<ServiceComponentHostRequest> setRequests = new HashSet<ServiceComponentHostRequest>(); + Set<ServiceComponentHostRequest> setRequests = new HashSet<>(); setRequests.add(request1); // expectations @@ -1164,7 +1164,7 @@ public class AmbariManagementControllerImplTest { request1.setState("INSTALLED"); - Set<ServiceComponentHostRequest> setRequests = new HashSet<ServiceComponentHostRequest>(); + Set<ServiceComponentHostRequest> setRequests = new HashSet<>(); setRequests.add(request1); // expectations @@ -1239,7 +1239,7 @@ public class AmbariManagementControllerImplTest { request1.setMaintenanceState("ON"); - Set<ServiceComponentHostRequest> setRequests = new HashSet<ServiceComponentHostRequest>(); + Set<ServiceComponentHostRequest> setRequests = new HashSet<>(); setRequests.add(request1); // expectations @@ -1331,7 +1331,7 @@ public class AmbariManagementControllerImplTest { "cluster1", null, "component3", "host1", null); - Set<ServiceComponentHostRequest> setRequests = new HashSet<ServiceComponentHostRequest>(); + Set<ServiceComponentHostRequest> setRequests = new HashSet<>(); setRequests.add(request1); setRequests.add(request2); setRequests.add(request3); @@ -1433,7 +1433,7 @@ public class AmbariManagementControllerImplTest { "cluster1", null, "component3", "host1", null); - Set<ServiceComponentHostRequest> setRequests = new HashSet<ServiceComponentHostRequest>(); + Set<ServiceComponentHostRequest> setRequests = new HashSet<>(); setRequests.add(request1); setRequests.add(request2); setRequests.add(request3); @@ -1538,7 +1538,7 @@ public class AmbariManagementControllerImplTest { "cluster1", null, "component3", "host1", null); - Set<ServiceComponentHostRequest> setRequests = new HashSet<ServiceComponentHostRequest>(); + Set<ServiceComponentHostRequest> setRequests = new HashSet<>(); setRequests.add(request1); setRequests.add(request2); setRequests.add(request3); @@ -1645,7 +1645,7 @@ public class AmbariManagementControllerImplTest { "cluster1", null, "component3", null, null); - Set<ServiceComponentHostRequest> setRequests = new HashSet<ServiceComponentHostRequest>(); + Set<ServiceComponentHostRequest> setRequests = new HashSet<>(); setRequests.add(request1); setRequests.add(request2); setRequests.add(request3); @@ -1729,7 +1729,7 @@ public class AmbariManagementControllerImplTest { "cluster1", null, "component3", "host1", null); - Set<ServiceComponentHostRequest> setRequests = new HashSet<ServiceComponentHostRequest>(); + Set<ServiceComponentHostRequest> setRequests = new HashSet<>(); setRequests.add(request1); setRequests.add(request2); setRequests.add(request3); @@ -1784,7 +1784,7 @@ public class AmbariManagementControllerImplTest { "cluster1", null, "component3", "host1", null); - Set<ServiceComponentHostRequest> setRequests = new HashSet<ServiceComponentHostRequest>(); + Set<ServiceComponentHostRequest> setRequests = new HashSet<>(); setRequests.add(request1); setRequests.add(request2); setRequests.add(request3); @@ -1843,10 +1843,10 @@ public class AmbariManagementControllerImplTest { "cluster1", null, "component1", null, null); - Set<ServiceComponentHostRequest> setRequests = new HashSet<ServiceComponentHostRequest>(); + Set<ServiceComponentHostRequest> setRequests = new HashSet<>(); setRequests.add(request1); - Map<String, ServiceComponentHost> mapHostComponents = new HashMap<String, ServiceComponentHost>(); + Map<String, ServiceComponentHost> mapHostComponents = new HashMap<>(); mapHostComponents.put("foo", componentHost1); mapHostComponents.put("bar", componentHost2); @@ -1926,14 +1926,14 @@ public class AmbariManagementControllerImplTest { "cluster1", null, null, null, null); - Set<ServiceComponentHostRequest> setRequests = new HashSet<ServiceComponentHostRequest>(); + Set<ServiceComponentHostRequest> setRequests = new HashSet<>(); setRequests.add(request1); - Map<String, Service> mapServices = new HashMap<String, Service>(); + Map<String, Service> mapServices = new HashMap<>(); mapServices.put("foo", service1); mapServices.put("bar", service2); - Map<String, ServiceComponentHost> mapHostComponents = new HashMap<String, ServiceComponentHost>(); + Map<String, ServiceComponentHost> mapHostComponents = new HashMap<>(); mapHostComponents.put("foo", componentHost1); mapHostComponents.put("bar", componentHost2); @@ -1998,10 +1998,10 @@ public class AmbariManagementControllerImplTest { MaintenanceStateHelper maintHelper = createNiceMock(MaintenanceStateHelper.class); ServiceInfo serviceInfo = createNiceMock(ServiceInfo.class); - Map<String, String> hostParams = new HashMap<String, String>(); + Map<String, String> hostParams = new HashMap<>(); String osFamily = "testOSFamily"; - Map<String, ServiceOsSpecific> osSpecifics = new HashMap<String, ServiceOsSpecific>(); + Map<String, ServiceOsSpecific> osSpecifics = new HashMap<>(); ServiceOsSpecific.Package package1 = new ServiceOsSpecific.Package(); package1.setName("testrpm1"); @@ -2010,9 +2010,9 @@ public class AmbariManagementControllerImplTest { ServiceOsSpecific.Package package3 = new ServiceOsSpecific.Package(); package3.setName("testrpm3"); - List<ServiceOsSpecific.Package> packageList1 = new ArrayList<ServiceOsSpecific.Package>(); + List<ServiceOsSpecific.Package> packageList1 = new ArrayList<>(); packageList1.add(package1); - List<ServiceOsSpecific.Package> packageList2 = new ArrayList<ServiceOsSpecific.Package>(); + List<ServiceOsSpecific.Package> packageList2 = new ArrayList<>(); packageList2.add(package2); packageList2.add(package3); @@ -2143,10 +2143,10 @@ public class AmbariManagementControllerImplTest { @Test public void testSynchronizeLdapUsersAndGroups() throws Exception { - Set<String> userSet = new HashSet<String>(); + Set<String> userSet = new HashSet<>(); userSet.add("user1"); - Set<String> groupSet = new HashSet<String>(); + Set<String> groupSet = new HashSet<>(); groupSet.add("group1"); Injector injector = Guice.createInjector(Modules.override(new InMemoryDefaultTestModule()).with(new MockModule())); @@ -2263,7 +2263,7 @@ public class AmbariManagementControllerImplTest { f.setAccessible(true); f.set(controller, configuration); - Set<RepositoryRequest> requests = new HashSet<RepositoryRequest>(); + Set<RepositoryRequest> requests = new HashSet<>(); RepositoryRequest request = new RepositoryRequest("stackName", "stackVersion", "redhat6", "repoId"); request.setBaseUrl("file:///some/repo"); requests.add(request); @@ -2304,23 +2304,23 @@ public class AmbariManagementControllerImplTest { expect(cluster.getCurrentStackVersion()).andReturn(stackId); expect(service.getName()).andReturn("HDFS").anyTimes(); - Map<String, ServiceComponent> serviceComponents = new HashMap<String, ServiceComponent>(); + Map<String, ServiceComponent> serviceComponents = new HashMap<>(); serviceComponents.put("NAMENODE", serviceComponent); expect(service.getServiceComponents()).andReturn(serviceComponents).anyTimes(); - Map<String, ServiceComponentHost> schMap = new HashMap<String, ServiceComponentHost>(); + Map<String, ServiceComponentHost> schMap = new HashMap<>(); schMap.put("host1", serviceComponentHost); expect(serviceComponent.getServiceComponentHosts()).andReturn(schMap).anyTimes(); serviceComponentHost.setRestartRequired(true); - Set<String> services = new HashSet<String>(); + Set<String> services = new HashSet<>(); services.add("HDFS"); expect(ambariMetaInfo.getRackSensitiveServicesNames(null, null)).andReturn(services); - Map<String, Service> serviceMap = new HashMap<String, Service>(); + Map<String, Service> serviceMap = new HashMap<>(); serviceMap.put("HDFS", service); expect(cluster.getServices()).andReturn(serviceMap).anyTimes();