http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/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 66a6e98..7384464 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 @@ -258,7 +258,7 @@ public class AmbariCustomCommandExecutionHelperTest { new RequestResourceFilter("GANGLIA", "GANGLIA_MONITOR", Collections.singletonList("c1-c6402")) ), new RequestOperationLevel(Resource.Type.Service, "c1", "GANGLIA", null, null), - new HashMap<String, String>(), false); + new HashMap<>(), false); EasyMock.replay(hostRoleCommand, actionManager, configHelper); @@ -293,7 +293,7 @@ public class AmbariCustomCommandExecutionHelperTest { new RequestResourceFilter("GANGLIA", "GANGLIA_MONITOR", Collections.singletonList("c1-c6401")), new RequestResourceFilter("GANGLIA", "GANGLIA_MONITOR", Collections.singletonList("c1-c6402"))), new RequestOperationLevel(Resource.Type.Service, "c1", "GANGLIA", null, null), - new HashMap<String, String>(), false); + new HashMap<>(), false); EasyMock.replay(hostRoleCommand, actionManager, configHelper); @@ -330,7 +330,7 @@ public class AmbariCustomCommandExecutionHelperTest { new RequestResourceFilter("GANGLIA", "GANGLIA_MONITOR", Collections.singletonList("c1-c6401")), new RequestResourceFilter("GANGLIA", "GANGLIA_MONITOR", Collections.singletonList("c1-c6402"))), new RequestOperationLevel(Resource.Type.Host, "c1", "GANGLIA", null, null), - new HashMap<String, String>(), false); + new HashMap<>(), false); EasyMock.replay(hostRoleCommand, actionManager, configHelper); @@ -376,7 +376,7 @@ public class AmbariCustomCommandExecutionHelperTest { Collections.singletonList("c6402"))), new RequestOperationLevel(Resource.Type.Service, "c1", "ZOOKEEPER", null, null), - new HashMap<String, String>(), false); + new HashMap<>(), false); EasyMock.replay(hostRoleCommand, actionManager, configHelper); ambariManagementController.createAction(actionRequest, requestProperties); @@ -416,7 +416,7 @@ public class AmbariCustomCommandExecutionHelperTest { Collections.singletonList("c6402"))), new RequestOperationLevel(Resource.Type.Service, "c1", "ZOOKEEPER", null, null), - new HashMap<String, String>(), false); + new HashMap<>(), false); EasyMock.replay(hostRoleCommand, actionManager, configHelper); ambariManagementController.createAction(actionRequest, requestProperties); @@ -434,7 +434,7 @@ public class AmbariCustomCommandExecutionHelperTest { ActionExecutionContext actionExecutionContext = new ActionExecutionContext("c1", "SERVICE_CHECK", requestResourceFilter); Stage stage = EasyMock.niceMock(Stage.class); - ambariCustomCommandExecutionHelper.addExecutionCommandsToStage(actionExecutionContext, stage, new HashMap<String, String>(), null); + ambariCustomCommandExecutionHelper.addExecutionCommandsToStage(actionExecutionContext, stage, new HashMap<>(), null); Assert.fail("Expected an exception since there are no hosts which can run the Flume service check"); } @@ -469,7 +469,7 @@ public class AmbariCustomCommandExecutionHelperTest { EasyMock.expect(execCmd.getLocalComponents()).andReturn(localComponents).anyTimes(); EasyMock.replay(configHelper, stage, execCmdWrapper, execCmd); - ambariCustomCommandExecutionHelper.addExecutionCommandsToStage(actionExecutionContext, stage, new HashMap<String, String>(), null); + ambariCustomCommandExecutionHelper.addExecutionCommandsToStage(actionExecutionContext, stage, new HashMap<>(), null); Map<String, String> configMap = timeOutCapture.getValues().get(0); for (Map.Entry<String, String> config : configMap.entrySet()) { if (config.getKey().equals(ExecutionCommand.KeyNames.COMMAND_TIMEOUT)) { @@ -519,7 +519,7 @@ public class AmbariCustomCommandExecutionHelperTest { EasyMock.expect(execCmd.getLocalComponents()).andReturn(localComponents).anyTimes(); EasyMock.replay(configHelper, stage, execCmdWrapper, execCmd); - ambariCustomCommandExecutionHelper.addExecutionCommandsToStage(actionExecutionContext, stage, new HashMap<String, String>(), null); + ambariCustomCommandExecutionHelper.addExecutionCommandsToStage(actionExecutionContext, stage, new HashMap<>(), null); } @Test
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/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 9509608..a02690f 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 @@ -224,7 +224,7 @@ public class AmbariManagementControllerImplTest { Injector injector = createStrictMock(Injector.class); Capture<AmbariManagementController> controllerCapture = EasyMock.newCapture(); - ClusterRequest request1 = new ClusterRequest(null, "cluster1", "1", Collections.<String>emptySet()); + ClusterRequest request1 = new ClusterRequest(null, "cluster1", "1", Collections.emptySet()); Cluster cluster = createNiceMock(Cluster.class); ClusterResponse response = createNiceMock(ClusterResponse.class); @@ -350,7 +350,7 @@ public class AmbariManagementControllerImplTest { ComponentInfo compInfo = createNiceMock(ComponentInfo.class); expect(serviceInfo.getClientComponent()).andReturn(compInfo); expect(compInfo.getName()).andReturn("component"); - expect(component.getServiceComponentHosts()).andReturn(Collections.<String, ServiceComponentHost>singletonMap("host", null)); + expect(component.getServiceComponentHosts()).andReturn(Collections.singletonMap("host", null)); expect(ambariMetaInfo.getService("stack", "1.0", "service")).andReturn(serviceInfo); replay(injector, cluster, service, component, serviceInfo, compInfo, ambariMetaInfo, stackId); @@ -383,9 +383,9 @@ public class AmbariManagementControllerImplTest { componentsMap.put("component1", component1); componentsMap.put("component2", component2); expect(service.getServiceComponents()).andReturn(componentsMap); - expect(component1.getServiceComponentHosts()).andReturn(Collections.<String, ServiceComponentHost>emptyMap()); + expect(component1.getServiceComponentHosts()).andReturn(Collections.emptyMap()); expect(component2.getServiceComponentHosts()).andReturn( - Collections.<String, ServiceComponentHost>singletonMap("anyHost", null)); + Collections.singletonMap("anyHost", null)); ServiceInfo serviceInfo = createNiceMock(ServiceInfo.class); ComponentInfo compInfo = createNiceMock(ComponentInfo.class); @@ -421,9 +421,9 @@ public class AmbariManagementControllerImplTest { componentsMap.put("component1", component1); componentsMap.put("component2", component2); expect(service.getServiceComponents()).andReturn(componentsMap); - expect(component1.getServiceComponentHosts()).andReturn(Collections.<String, ServiceComponentHost>emptyMap()); + expect(component1.getServiceComponentHosts()).andReturn(Collections.emptyMap()); expect(component2.getServiceComponentHosts()).andReturn( - Collections.<String, ServiceComponentHost>singletonMap("anyHost", null)); + Collections.singletonMap("anyHost", null)); ServiceInfo serviceInfo = createNiceMock(ServiceInfo.class); expect(serviceInfo.getClientComponent()).andReturn(null); @@ -450,7 +450,7 @@ public class AmbariManagementControllerImplTest { Capture<AmbariManagementController> controllerCapture = EasyMock.newCapture(); // requests - ClusterRequest request1 = new ClusterRequest(null, "cluster1", "1", Collections.<String>emptySet()); + ClusterRequest request1 = new ClusterRequest(null, "cluster1", "1", Collections.emptySet()); Set<ClusterRequest> setRequests = new HashSet<>(); setRequests.add(request1); @@ -498,10 +498,10 @@ public class AmbariManagementControllerImplTest { ClusterResponse response2 = createNiceMock(ClusterResponse.class); // requests - ClusterRequest request1 = new ClusterRequest(null, "cluster1", "1", Collections.<String>emptySet()); - ClusterRequest request2 = new ClusterRequest(null, "cluster2", "1", Collections.<String>emptySet()); - ClusterRequest request3 = new ClusterRequest(null, "cluster3", "1", Collections.<String>emptySet()); - ClusterRequest request4 = new ClusterRequest(null, "cluster4", "1", Collections.<String>emptySet()); + ClusterRequest request1 = new ClusterRequest(null, "cluster1", "1", Collections.emptySet()); + ClusterRequest request2 = new ClusterRequest(null, "cluster2", "1", Collections.emptySet()); + ClusterRequest request3 = new ClusterRequest(null, "cluster3", "1", Collections.emptySet()); + ClusterRequest request4 = new ClusterRequest(null, "cluster4", "1", Collections.emptySet()); Set<ClusterRequest> setRequests = new HashSet<>(); setRequests.add(request1); @@ -583,7 +583,7 @@ public class AmbariManagementControllerImplTest { expect(clusters.getClusterById(1L)).andReturn(cluster).times(2); expect(cluster.getClusterName()).andReturn("clusterOld").times(1); - cluster.addSessionAttributes(EasyMock.<Map<String, Object>>anyObject()); + cluster.addSessionAttributes(EasyMock.anyObject()); expectLastCall().once(); cluster.setClusterName("clusterNew"); @@ -642,14 +642,14 @@ public class AmbariManagementControllerImplTest { expect(clusterRequest.getDesiredConfig()).andReturn(ImmutableList.of(configReq)).anyTimes(); expect(clusters.getClusterById(1L)).andReturn(cluster).anyTimes(); expect(cluster.getClusterName()).andReturn("clusterOld").anyTimes(); - expect(cluster.getConfigPropertiesTypes(anyObject(String.class))).andReturn(Maps.<PropertyInfo.PropertyType, Set<String>>newHashMap()).anyTimes(); + expect(cluster.getConfigPropertiesTypes(anyObject(String.class))).andReturn(Maps.newHashMap()).anyTimes(); expect(config.getType()).andReturn("config-type").anyTimes(); expect(config.getProperties()).andReturn(configReqProps).anyTimes(); - expect(config.getPropertiesAttributes()).andReturn(new HashMap<String,Map<String,String>>()).anyTimes(); + expect(config.getPropertiesAttributes()).andReturn(new HashMap<>()).anyTimes(); expect(cluster.getDesiredConfigByType(anyObject(String.class))).andReturn(config).anyTimes(); - cluster.addSessionAttributes(EasyMock.<Map<String, Object>>anyObject()); + cluster.addSessionAttributes(EasyMock.anyObject()); expectLastCall().once(); cluster.setClusterName("clusterNew"); @@ -693,7 +693,7 @@ public class AmbariManagementControllerImplTest { expect(clusters.getClusterById(1L)).andReturn(cluster).times(2); expect(cluster.getClusterName()).andReturn("cluster").times(1); - cluster.addSessionAttributes(EasyMock.<Map<String, Object>>anyObject()); + cluster.addSessionAttributes(EasyMock.anyObject()); expectLastCall().once(); // replay mocks @@ -737,13 +737,13 @@ public class AmbariManagementControllerImplTest { expect(cluster.getClusterName()).andReturn("cluster").times(1); expect(cluster.getSecurityType()).andReturn(SecurityType.KERBEROS).anyTimes(); - cluster.addSessionAttributes(EasyMock.<Map<String, Object>>anyObject()); + cluster.addSessionAttributes(EasyMock.anyObject()); expectLastCall().once(); expect(kerberosHelper.shouldExecuteCustomOperations(SecurityType.KERBEROS, null)) .andReturn(false) .once(); - expect(kerberosHelper.getForceToggleKerberosDirective(EasyMock.<Map<String, String>>anyObject())) + expect(kerberosHelper.getForceToggleKerberosDirective(EasyMock.anyObject())) .andReturn(false) .once(); // Note: kerberosHelper.toggleKerberos is not called @@ -787,7 +787,7 @@ public class AmbariManagementControllerImplTest { expect(cluster.getClusterName()).andReturn("cluster").times(1); expect(cluster.getSecurityType()).andReturn(SecurityType.NONE).anyTimes(); - cluster.addSessionAttributes(EasyMock.<Map<String, Object>>anyObject()); + cluster.addSessionAttributes(EasyMock.anyObject()); expectLastCall().once(); expect(kerberosHelper.shouldExecuteCustomOperations(SecurityType.KERBEROS, null)) @@ -871,16 +871,16 @@ public class AmbariManagementControllerImplTest { expect(cluster.getClusterName()).andReturn("cluster").times(1); expect(cluster.getSecurityType()).andReturn(SecurityType.KERBEROS).anyTimes(); - cluster.addSessionAttributes(EasyMock.<Map<String, Object>>anyObject()); + cluster.addSessionAttributes(EasyMock.anyObject()); expectLastCall().once(); expect(kerberosHelper.shouldExecuteCustomOperations(SecurityType.NONE, null)) .andReturn(false) .once(); - expect(kerberosHelper.getForceToggleKerberosDirective(EasyMock.<Map<String, String>>anyObject())) + expect(kerberosHelper.getForceToggleKerberosDirective(EasyMock.anyObject())) .andReturn(false) .once(); - expect(kerberosHelper.getManageIdentitiesDirective(EasyMock.<Map<String, String>>anyObject())) + expect(kerberosHelper.getManageIdentitiesDirective(EasyMock.anyObject())) .andReturn(manageIdentities) .once(); expect(kerberosHelper.toggleKerberos(anyObject(Cluster.class), anyObject(SecurityType.class), anyObject(RequestStageContainer.class), captureBoolean(manageIdentitiesCapture))) @@ -937,16 +937,16 @@ public class AmbariManagementControllerImplTest { cluster.setClusterName(anyObject(String.class)); expectLastCall().once(); - cluster.addSessionAttributes(EasyMock.<Map<String, Object>>anyObject()); + cluster.addSessionAttributes(EasyMock.anyObject()); expectLastCall().once(); expect(kerberosHelper.shouldExecuteCustomOperations(SecurityType.NONE, null)) .andReturn(false) .once(); - expect(kerberosHelper.getForceToggleKerberosDirective(EasyMock.<Map<String, String>>anyObject())) + expect(kerberosHelper.getForceToggleKerberosDirective(EasyMock.anyObject())) .andReturn(false) .once(); - expect(kerberosHelper.getManageIdentitiesDirective(EasyMock.<Map<String, String>>anyObject())) + expect(kerberosHelper.getManageIdentitiesDirective(EasyMock.anyObject())) .andReturn(null) .once(); expect(kerberosHelper.toggleKerberos(anyObject(Cluster.class), anyObject(SecurityType.class), anyObject(RequestStageContainer.class), anyBoolean())) @@ -2093,8 +2093,8 @@ public class AmbariManagementControllerImplTest { expect(configuration.getServerDBName()).andReturn(SERVER_DB_NAME); expect(configuration.getJavaVersion()).andReturn(8); expect(configuration.areHostsSysPrepped()).andReturn("true"); - expect(configuration.getDatabaseConnectorNames()).andReturn(new HashMap<String, String>()).anyTimes(); - expect(configuration.getPreviousDatabaseConnectorNames()).andReturn(new HashMap<String, String>()).anyTimes(); + expect(configuration.getDatabaseConnectorNames()).andReturn(new HashMap<>()).anyTimes(); + expect(configuration.getPreviousDatabaseConnectorNames()).andReturn(new HashMap<>()).anyTimes(); expect(repositoryVersionEntity.getVersion()).andReturn("1234").anyTimes(); expect(repositoryVersionEntity.getStackId()).andReturn(stackId).anyTimes(); expect(configHelper.getPropertiesWithPropertyType(stackId, @@ -2111,7 +2111,7 @@ public class AmbariManagementControllerImplTest { .withConstructor(manager, clusters, injector).createNiceMock(); expect(ambariManagementControllerImpl. - getRcaParameters()).andReturn(new HashMap<String, String>()); + getRcaParameters()).andReturn(new HashMap<>()); replay(ambariManagementControllerImpl); // Inject configuration manually http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java index a3bbe68..85ad36d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AmbariManagementControllerTest.java @@ -2752,7 +2752,7 @@ public class AmbariManagementControllerTest { r = new ServiceComponentHostRequest(cluster1, "HDFS", "DATANODE", host2, null); r.setAdminState("DECOMMISSIONED"); try { - updateHostComponents(Collections.singleton(r), new HashMap<String, String>(), false); + updateHostComponents(Collections.singleton(r), new HashMap<>(), false); Assert.fail("Must throw exception when decommission attribute is updated."); } catch (IllegalArgumentException ex) { Assert.assertTrue(ex.getMessage().contains("Property adminState cannot be modified through update")); @@ -3597,13 +3597,13 @@ public class AmbariManagementControllerTest { req1 = new ServiceComponentRequest(cluster1, serviceName1, sc3.getName(), State.INSTALLED.toString()); reqs.add(req1); - ComponentResourceProviderTest.updateComponents(controller, reqs, Collections.<String, String>emptyMap(), true); + ComponentResourceProviderTest.updateComponents(controller, reqs, Collections.emptyMap(), true); try { reqs.clear(); req1 = new ServiceComponentRequest(cluster1, serviceName1, sc1.getName(), State.INIT.toString()); reqs.add(req1); - ComponentResourceProviderTest.updateComponents(controller, reqs, Collections.<String, String>emptyMap(), true); + ComponentResourceProviderTest.updateComponents(controller, reqs, Collections.emptyMap(), true); fail("Expected failure for invalid state update"); } catch (Exception e) { // Expected @@ -3629,7 +3629,7 @@ public class AmbariManagementControllerTest { req1 = new ServiceComponentRequest(cluster1, serviceName1, sc1.getName(), State.STARTED.toString()); reqs.add(req1); - ComponentResourceProviderTest.updateComponents(controller, reqs, Collections.<String, String>emptyMap(), true); + ComponentResourceProviderTest.updateComponents(controller, reqs, Collections.emptyMap(), true); fail("Expected failure for invalid state update"); } catch (Exception e) { // Expected @@ -3660,7 +3660,7 @@ public class AmbariManagementControllerTest { reqs.add(req1); reqs.add(req2); reqs.add(req3); - RequestStatusResponse trackAction = ComponentResourceProviderTest.updateComponents(controller, reqs, Collections.<String, String>emptyMap(), true); + RequestStatusResponse trackAction = ComponentResourceProviderTest.updateComponents(controller, reqs, Collections.emptyMap(), true); Assert.assertEquals(State.INSTALLED, s1.getDesiredState()); Assert.assertEquals(State.INSTALLED, sc1.getDesiredState()); @@ -3704,7 +3704,7 @@ public class AmbariManagementControllerTest { sc2.getName(), State.INSTALLED.toString()); reqs.add(req1); reqs.add(req2); - trackAction = ComponentResourceProviderTest.updateComponents(controller, reqs, Collections.<String, String>emptyMap(), true); + trackAction = ComponentResourceProviderTest.updateComponents(controller, reqs, Collections.emptyMap(), true); Assert.assertNull(trackAction); } @@ -3821,7 +3821,7 @@ public class AmbariManagementControllerTest { reqs.add(req3); reqs.add(req4); reqs.add(req5); - updateHostComponents(reqs, Collections.<String, String>emptyMap(), true); + updateHostComponents(reqs, Collections.emptyMap(), true); // Expected, now client components with STARTED status will be ignored } catch (Exception e) { fail("Failure for invalid states"); @@ -3844,7 +3844,7 @@ public class AmbariManagementControllerTest { reqs.add(req4); reqs.add(req5); RequestStatusResponse trackAction = updateHostComponents(reqs, - Collections.<String, String>emptyMap(), true); + Collections.emptyMap(), true); Assert.assertNotNull(trackAction); long requestId = trackAction.getRequestId(); @@ -3876,8 +3876,7 @@ public class AmbariManagementControllerTest { State.INSTALLED.toString()); reqs.add(req1); reqs.add(req2); - trackAction = updateHostComponents(reqs, Collections.<String, - String>emptyMap(), true); + trackAction = updateHostComponents(reqs, Collections.emptyMap(), true); Assert.assertNull(trackAction); } @@ -3905,17 +3904,17 @@ public class AmbariManagementControllerTest { Config config1 = cf.createNew(cluster, "global", "version1", new HashMap<String, String>() {{ put("key1", "value1"); - }}, new HashMap<String, Map<String, String>>()); + }}, new HashMap<>()); Config config2 = cf.createNew(cluster, "core-site", "version1", new HashMap<String, String>() {{ put("key1", "value1"); - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); Config config3 = cf.createNew(cluster, "yarn-site", "version1", new HashMap<String, String>() {{ put("test.password", "supersecret"); - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); RepositoryVersionEntity repositoryVersion = repositoryVersion206; @@ -4073,12 +4072,12 @@ public class AmbariManagementControllerTest { Config config1 = cf.createNew(cluster, "global", "version1", new HashMap<String, String>() {{ put("key1", "value1"); - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); Config config2 = cf.createNew(cluster, "core-site", "version1", new HashMap<String, String>() {{ put("key1", "value1"); - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); RepositoryVersionEntity repositoryVersion = repositoryVersion207; @@ -4177,12 +4176,12 @@ public class AmbariManagementControllerTest { Config config1 = cf.createNew(cluster, "global", "version1", new HashMap<String, String>() {{ put("key1", "value1"); - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); Config config2 = cf.createNew(cluster, "core-site", "version1", new HashMap<String, String>() {{ put("key1", "value1"); - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); cluster.addConfig(config1); cluster.addConfig(config2); @@ -4451,12 +4450,12 @@ public class AmbariManagementControllerTest { ConfigFactory cf = injector.getInstance(ConfigFactory.class); Config config1 = cf.createNew(cluster, "global", "version1", - new HashMap<String, String>(){{ put("key1", "value1"); }}, new HashMap<String, Map<String,String>>()); - config1.setPropertiesAttributes(new HashMap<String, Map<String, String>>(){{ put("attr1", new HashMap<String, String>()); }}); + new HashMap<String, String>(){{ put("key1", "value1"); }}, new HashMap<>()); + config1.setPropertiesAttributes(new HashMap<String, Map<String, String>>(){{ put("attr1", new HashMap<>()); }}); Config config2 = cf.createNew(cluster, "core-site", "version1", - new HashMap<String, String>(){{ put("key1", "value1"); }}, new HashMap<String, Map<String,String>>()); - config2.setPropertiesAttributes(new HashMap<String, Map<String, String>>(){{ put("attr2", new HashMap<String, String>()); }}); + new HashMap<String, String>(){{ put("key1", "value1"); }}, new HashMap<>()); + config2.setPropertiesAttributes(new HashMap<String, Map<String, String>>(){{ put("attr2", new HashMap<>()); }}); cluster.addDesiredConfig("_test", Collections.singleton(config1)); cluster.addDesiredConfig("_test", Collections.singleton(config2)); @@ -4773,14 +4772,14 @@ public class AmbariManagementControllerTest { schReqs.clear(); schReqs.add(new ServiceComponentHostRequest(cluster1, serviceName, componentName1, host1, null)); - Assert.assertNull(updateHostComponents(schReqs, Collections.<String, String>emptyMap(), true)); + Assert.assertNull(updateHostComponents(schReqs, Collections.emptyMap(), true)); configVersions.clear(); configVersions.put("typeC", "v1"); configVersions.put("typeD", "v1"); scReqs.clear(); scReqs.add(new ServiceComponentRequest(cluster1, serviceName, componentName2, null)); - Assert.assertNull(ComponentResourceProviderTest.updateComponents(controller, scReqs, Collections.<String, String>emptyMap(), true)); + Assert.assertNull(ComponentResourceProviderTest.updateComponents(controller, scReqs, Collections.emptyMap(), true)); // update configs at service level configVersions.clear(); @@ -4800,7 +4799,7 @@ public class AmbariManagementControllerTest { schReqs.clear(); schReqs.add(new ServiceComponentHostRequest(cluster1, serviceName, componentName1, host1, null)); - Assert.assertNull(updateHostComponents(schReqs, Collections.<String, String>emptyMap(), true)); + Assert.assertNull(updateHostComponents(schReqs, Collections.emptyMap(), true)); // update configs at SC level configVersions.clear(); @@ -4809,7 +4808,7 @@ public class AmbariManagementControllerTest { scReqs.clear(); scReqs.add(new ServiceComponentRequest(cluster1, serviceName, componentName1, null)); - Assert.assertNull(ComponentResourceProviderTest.updateComponents(controller, scReqs, Collections.<String, String>emptyMap(), true)); + Assert.assertNull(ComponentResourceProviderTest.updateComponents(controller, scReqs, Collections.emptyMap(), true)); } @@ -4879,7 +4878,7 @@ public class AmbariManagementControllerTest { configs.put("a", "b"); Map<String, Map<String, String>> configAttributes = new HashMap<>(); - configAttributes.put("final", new HashMap<String, String>()); + configAttributes.put("final", new HashMap<>()); configAttributes.get("final").put("a", "true"); ConfigurationRequest cr1, cr2, cr3, cr4, cr5, cr6, cr7, cr8; @@ -4921,7 +4920,7 @@ public class AmbariManagementControllerTest { schReqs.clear(); schReqs.add(new ServiceComponentHostRequest(cluster1, serviceName, componentName1, host1, null)); - Assert.assertNull(updateHostComponents(schReqs, Collections.<String, String>emptyMap(), true)); + Assert.assertNull(updateHostComponents(schReqs, Collections.emptyMap(), true)); configVersions.clear(); configVersions.put("typeC", "v1"); @@ -4929,7 +4928,7 @@ public class AmbariManagementControllerTest { scReqs.clear(); scReqs.add(new ServiceComponentRequest(cluster1, serviceName, componentName2, null)); - Assert.assertNull(ComponentResourceProviderTest.updateComponents(controller, scReqs, Collections.<String, String>emptyMap(), true)); + Assert.assertNull(ComponentResourceProviderTest.updateComponents(controller, scReqs, Collections.emptyMap(), true)); // update configs at service level configVersions.clear(); @@ -4948,7 +4947,7 @@ public class AmbariManagementControllerTest { schReqs.clear(); schReqs.add(new ServiceComponentHostRequest(cluster1, serviceName, componentName1, host1, null)); - Assert.assertNull(updateHostComponents(schReqs, Collections.<String, String>emptyMap(), true)); + Assert.assertNull(updateHostComponents(schReqs, Collections.emptyMap(), true)); // update configs at SC level configVersions.clear(); @@ -4957,7 +4956,7 @@ public class AmbariManagementControllerTest { scReqs.clear(); scReqs.add(new ServiceComponentRequest(cluster1, serviceName, componentName1, null)); - Assert.assertNull(ComponentResourceProviderTest.updateComponents(controller, scReqs, Collections.<String, String>emptyMap(), true)); + Assert.assertNull(ComponentResourceProviderTest.updateComponents(controller, scReqs, Collections.emptyMap(), true)); } @@ -5057,7 +5056,7 @@ public class AmbariManagementControllerTest { schReqs.clear(); schReqs.add(new ServiceComponentHostRequest(cluster1, serviceName, componentName1, host1, null)); - Assert.assertNull(updateHostComponents(schReqs, Collections.<String, String>emptyMap(), true)); + Assert.assertNull(updateHostComponents(schReqs, Collections.emptyMap(), true)); // Reconfigure SCH level configVersions.clear(); @@ -5065,7 +5064,7 @@ public class AmbariManagementControllerTest { schReqs.clear(); schReqs.add(new ServiceComponentHostRequest(cluster1, serviceName, componentName1, host1, null)); - Assert.assertNull(updateHostComponents(schReqs, Collections.<String, String>emptyMap(), true)); + Assert.assertNull(updateHostComponents(schReqs, Collections.emptyMap(), true)); // Clear Entity Manager entityManager.clear(); @@ -5076,11 +5075,11 @@ public class AmbariManagementControllerTest { configVersions.put("hdfs-site", "version1"); scReqs.add(new ServiceComponentRequest(cluster1, serviceName, componentName2, null)); - Assert.assertNull(ComponentResourceProviderTest.updateComponents(controller, scReqs, Collections.<String, String>emptyMap(), true)); + Assert.assertNull(ComponentResourceProviderTest.updateComponents(controller, scReqs, Collections.emptyMap(), true)); scReqs.add(new ServiceComponentRequest(cluster1, serviceName, componentName1, null)); - Assert.assertNull(ComponentResourceProviderTest.updateComponents(controller, scReqs, Collections.<String, String>emptyMap(), true)); + Assert.assertNull(ComponentResourceProviderTest.updateComponents(controller, scReqs, Collections.emptyMap(), true)); // Reconfigure SC level configVersions.clear(); @@ -5089,12 +5088,12 @@ public class AmbariManagementControllerTest { scReqs.clear(); scReqs.add(new ServiceComponentRequest(cluster1, serviceName, componentName2, null)); - Assert.assertNull(ComponentResourceProviderTest.updateComponents(controller, scReqs, Collections.<String, String>emptyMap(), true)); + Assert.assertNull(ComponentResourceProviderTest.updateComponents(controller, scReqs, Collections.emptyMap(), true)); scReqs.clear(); scReqs.add(new ServiceComponentRequest(cluster1, serviceName, componentName1, null)); - Assert.assertNull(ComponentResourceProviderTest.updateComponents(controller, scReqs, Collections.<String, String>emptyMap(), true)); + Assert.assertNull(ComponentResourceProviderTest.updateComponents(controller, scReqs, Collections.emptyMap(), true)); entityManager.clear(); @@ -5193,7 +5192,7 @@ public class AmbariManagementControllerTest { ConfigFactory cf = injector.getInstance(ConfigFactory.class); Config config1 = cf.createNew(cluster, "kerberos-env", "version1", - new HashMap<String, String>(), new HashMap<String, Map<String,String>>()); + new HashMap<>(), new HashMap<>()); ClusterRequest crReq = new ClusterRequest(cluster.getClusterId(), cluster1, null, null); crReq.setDesiredConfig(Collections.singletonList(cr1)); @@ -5838,7 +5837,7 @@ public class AmbariManagementControllerTest { HashSet<>(); setReqs.add(schr); RequestStatusResponse resp = updateHostComponents(setReqs, - Collections.<String, String>emptyMap(), false); + Collections.emptyMap(), false); Assert.assertNotNull(resp); Assert.assertTrue(resp.getRequestId() > 0); @@ -5889,7 +5888,7 @@ public class AmbariManagementControllerTest { Set<ServiceRequest> setReqs = new HashSet<>(); setReqs.add(sr); RequestStatusResponse resp = ServiceResourceProviderTest.updateServices(controller, - setReqs, Collections.<String, String>emptyMap(), false, true); + setReqs, Collections.emptyMap(), false, true); Assert.assertNotNull(resp); Assert.assertTrue(resp.getRequestId() > 0); @@ -6039,13 +6038,13 @@ public class AmbariManagementControllerTest { componentName1, host2, State.INSTALLED.toString()); Set<ServiceComponentHostRequest> requests = new HashSet<>(); requests.add(r); - updateHostComponents(requests, Collections.<String, String>emptyMap(), true); + updateHostComponents(requests, Collections.emptyMap(), true); s.getServiceComponent(componentName1).getServiceComponentHost(host2).setState(State.INSTALLED); r = new ServiceComponentHostRequest(cluster1, serviceName, componentName1, host2, State.STARTED.toString()); requests.clear(); requests.add(r); - updateHostComponents(requests, Collections.<String, String>emptyMap(), true); + updateHostComponents(requests, Collections.emptyMap(), true); s.getServiceComponent(componentName1).getServiceComponentHost(host2).setState(State.STARTED); params = new HashMap<String, String>(){{ @@ -6118,12 +6117,12 @@ public class AmbariManagementControllerTest { cf.createNew(cluster, "global", "version1", new HashMap<String, String>() {{ put("key1", "value1"); - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); cf.createNew(cluster, "core-site", "version1", new HashMap<String, String>() {{ put("key1", "value1"); - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); Service hdfs = cluster.addService("HDFS", repositoryVersion); Service mapred = cluster.addService("YARN", repositoryVersion); @@ -6221,12 +6220,12 @@ public class AmbariManagementControllerTest { Config config1 = cf.createNew(cluster, "global", "version1", new HashMap<String, String>() {{ put("key1", "value1"); - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); Config config2 = cf.createNew(cluster, "core-site", "version1", new HashMap<String, String>() {{ put("key1", "value1"); - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); Service hdfs = cluster.addService("HDFS", repositoryVersion); Service mapred = cluster.addService("YARN", repositoryVersion); @@ -6489,7 +6488,7 @@ public class AmbariManagementControllerTest { put("hdfs-site", "version1"); }}; ServiceRequest sr = new ServiceRequest(cluster1, serviceName, repositoryVersion01.getId(), null); - ServiceResourceProviderTest.updateServices(controller, Collections.singleton(sr), new HashMap<String,String>(), false, false); + ServiceResourceProviderTest.updateServices(controller, Collections.singleton(sr), new HashMap<>(), false, false); // Install installService(cluster1, serviceName, false, false); @@ -7588,7 +7587,7 @@ public class AmbariManagementControllerTest { Set<ServiceComponentHostRequest> reqs1 = new HashSet<>(); reqs1.add(r1); - updateHostComponents(reqs1, Collections.<String, String>emptyMap(), true); + updateHostComponents(reqs1, Collections.emptyMap(), true); Assert.assertEquals(State.INSTALLED, sch.getDesiredState()); } } @@ -7895,7 +7894,7 @@ public class AmbariManagementControllerTest { // an UNKOWN failure will throw an exception ServiceRequest req = new ServiceRequest(cluster1, serviceName1, repositoryVersion02.getId(), State.INSTALLED.toString()); - ServiceResourceProviderTest.updateServices(controller, Collections.singleton(req), Collections.<String, String>emptyMap(), true, false); + ServiceResourceProviderTest.updateServices(controller, Collections.singleton(req), Collections.emptyMap(), true, false); } @Test @@ -8169,7 +8168,7 @@ public class AmbariManagementControllerTest { // Disable HC for non-clients schRequests.add(new ServiceComponentHostRequest(cluster1, serviceName, componentName1, host1, "DISABLED")); schRequests.add(new ServiceComponentHostRequest(cluster1, serviceName, componentName2, host1, "DISABLED")); - updateHostComponents(schRequests, new HashMap<String,String>(), false); + updateHostComponents(schRequests, new HashMap<>(), false); // Delete HC schRequests.clear(); @@ -8359,13 +8358,13 @@ public class AmbariManagementControllerTest { @Test public void testExecutionCommandConfiguration() throws AmbariException { Map<String, Map<String, String>> config = new HashMap<>(); - config.put("type1", new HashMap<String, String>()); - config.put("type3", new HashMap<String, String>()); + config.put("type1", new HashMap<>()); + config.put("type3", new HashMap<>()); config.get("type3").put("name1", "neverchange"); configHelper.applyCustomConfig(config, "type1", "name1", "value11", false); Assert.assertEquals("value11", config.get("type1").get("name1")); - config.put("type1", new HashMap<String, String>()); + config.put("type1", new HashMap<>()); configHelper.applyCustomConfig(config, "type1", "name1", "value12", false); Assert.assertEquals("value12", config.get("type1").get("name1")); @@ -8428,7 +8427,7 @@ public class AmbariManagementControllerTest { }.getType(); ConfigurationRequest configurationRequest = new ConfigurationRequest(cluster1, type, tag, - gson.<Map<String, String>>fromJson("{ \"fs.default.name\" : \"localhost:8020\"}", confType), null); + gson.fromJson("{ \"fs.default.name\" : \"localhost:8020\"}", confType), null); amc.createConfiguration(configurationRequest); amc.createConfiguration(configurationRequest); @@ -8473,7 +8472,7 @@ public class AmbariManagementControllerTest { new HashMap<String, String>() {{ put("a", "b"); }}, null); ClusterRequest ur = new ClusterRequest(clusterId, CLUSTER_NAME, STACK_ID, null); ur.setDesiredConfig(Collections.singletonList(configRequest)); - amc.updateClusters(Collections.singleton(ur), new HashMap<String, String>()); + amc.updateClusters(Collections.singleton(ur), new HashMap<>()); // add some hosts Set<HostRequest> hrs = new HashSet<>(); @@ -8565,15 +8564,15 @@ public class AmbariManagementControllerTest { Type confType = new TypeToken<Map<String, String>>() {}.getType(); ConfigurationRequest configurationRequest = new ConfigurationRequest(cluster1, "core-site", "version1", - gson.<Map<String, String>>fromJson("{ \"fs.default.name\" : \"localhost:8020\"}", confType), null); + gson.fromJson("{ \"fs.default.name\" : \"localhost:8020\"}", confType), null); amc.createConfiguration(configurationRequest); configurationRequest = new ConfigurationRequest(cluster1, "hdfs-site", "version1", - gson.<Map<String, String>>fromJson("{ \"dfs.datanode.data.dir.perm\" : \"750\"}", confType), null); + gson.fromJson("{ \"dfs.datanode.data.dir.perm\" : \"750\"}", confType), null); amc.createConfiguration(configurationRequest); configurationRequest = new ConfigurationRequest(cluster1, "global", "version1", - gson.<Map<String, String>>fromJson("{ \"hive.server2.enable.doAs\" : \"true\"}", confType), null); + gson.fromJson("{ \"hive.server2.enable.doAs\" : \"true\"}", confType), null); amc.createConfiguration(configurationRequest); Assert.assertTrue(clusters.getCluster(cluster1).getDesiredConfigs().containsKey("hive-site")); @@ -8791,13 +8790,13 @@ public class AmbariManagementControllerTest { org.junit.Assert.assertEquals(1, ServiceResourceProviderTest.getServices(amc, serviceRequests).size()); //Create new configs configurationRequest = new ConfigurationRequest(cluster1, "core-site", "version2", - gson.<Map<String, String>>fromJson("{ \"fs.default.name\" : \"localhost:8020\"}", confType), null); + gson.fromJson("{ \"fs.default.name\" : \"localhost:8020\"}", confType), null); amc.createConfiguration(configurationRequest); configurationRequest = new ConfigurationRequest(cluster1, "hdfs-site", "version2", - gson.<Map<String, String>>fromJson("{ \"dfs.datanode.data.dir.perm\" : \"750\"}", confType), null); + gson.fromJson("{ \"dfs.datanode.data.dir.perm\" : \"750\"}", confType), null); amc.createConfiguration(configurationRequest); configurationRequest = new ConfigurationRequest(cluster1, "global", "version2", - gson.<Map<String, String>>fromJson("{ \"hbase_hdfs_root_dir\" : \"/apps/hbase/\"}", confType), null); + gson.fromJson("{ \"hbase_hdfs_root_dir\" : \"/apps/hbase/\"}", confType), null); amc.createConfiguration(configurationRequest); //Add configs to service serviceRequests.clear(); @@ -9837,15 +9836,15 @@ public class AmbariManagementControllerTest { Map<String, Map<String, String>> requestConfigAttributes = new HashMap<>(); Map<String, Map<String, String>> clusterConfigAttributes = new HashMap<>(); Assert.assertTrue(controllerImpl.isAttributeMapsEqual(requestConfigAttributes, clusterConfigAttributes)); - requestConfigAttributes.put("final", new HashMap<String, String>()); + requestConfigAttributes.put("final", new HashMap<>()); requestConfigAttributes.get("final").put("c", "true"); - clusterConfigAttributes.put("final", new HashMap<String, String>()); + clusterConfigAttributes.put("final", new HashMap<>()); clusterConfigAttributes.get("final").put("c", "true"); Assert.assertTrue(controllerImpl.isAttributeMapsEqual(requestConfigAttributes, clusterConfigAttributes)); - clusterConfigAttributes.put("final2", new HashMap<String, String>()); + clusterConfigAttributes.put("final2", new HashMap<>()); clusterConfigAttributes.get("final2").put("a", "true"); Assert.assertFalse(controllerImpl.isAttributeMapsEqual(requestConfigAttributes, clusterConfigAttributes)); - requestConfigAttributes.put("final2", new HashMap<String, String>()); + requestConfigAttributes.put("final2", new HashMap<>()); requestConfigAttributes.get("final2").put("a", "false"); Assert.assertFalse(controllerImpl.isAttributeMapsEqual(requestConfigAttributes, clusterConfigAttributes)); } @@ -9862,21 +9861,21 @@ public class AmbariManagementControllerTest { // test null map with no prior cr.setDesiredConfig(Collections.singletonList( new ConfigurationRequest(cluster1, "typeA", "v1", null, null))); - controller.updateClusters(Collections.singleton(cr), new HashMap<String, String>()); + controller.updateClusters(Collections.singleton(cr), new HashMap<>()); Config config = cluster.getDesiredConfigByType("typeA"); Assert.assertNull(config); // test empty map with no prior cr.setDesiredConfig(Collections.singletonList( - new ConfigurationRequest(cluster1, "typeA", "v1", new HashMap<String, String>(), new HashMap<String, Map<String,String>>()))); - controller.updateClusters(Collections.singleton(cr), new HashMap<String, String>()); + new ConfigurationRequest(cluster1, "typeA", "v1", new HashMap<>(), new HashMap<>()))); + controller.updateClusters(Collections.singleton(cr), new HashMap<>()); config = cluster.getDesiredConfigByType("typeA"); Assert.assertNotNull(config); // test empty properties on a new version cr.setDesiredConfig(Collections.singletonList( - new ConfigurationRequest(cluster1, "typeA", "v2", new HashMap<String, String>(), new HashMap<String, Map<String,String>>()))); - controller.updateClusters(Collections.singleton(cr), new HashMap<String, String>()); + new ConfigurationRequest(cluster1, "typeA", "v2", new HashMap<>(), new HashMap<>()))); + controller.updateClusters(Collections.singleton(cr), new HashMap<>()); config = cluster.getDesiredConfigByType("typeA"); Assert.assertNotNull(config); Assert.assertEquals(Integer.valueOf(0), Integer.valueOf(config.getProperties().size())); @@ -9886,19 +9885,19 @@ public class AmbariManagementControllerTest { map.clear(); map.put("c", "d"); Map<String, Map<String, String>> attributesMap = new HashMap<>(); - attributesMap.put("final", new HashMap<String, String>()); + attributesMap.put("final", new HashMap<>()); attributesMap.get("final").put("c", "true"); cr.setDesiredConfig(Collections.singletonList( new ConfigurationRequest(cluster1, "typeA", "v3", map, attributesMap))); - controller.updateClusters(Collections.singleton(cr), new HashMap<String, String>()); + controller.updateClusters(Collections.singleton(cr), new HashMap<>()); config = cluster.getDesiredConfigByType("typeA"); Assert.assertNotNull(config); Assert.assertTrue(config.getProperties().containsKey("c")); // test reset to v2 cr.setDesiredConfig(Collections.singletonList( - new ConfigurationRequest(cluster1, "typeA", "v2", new HashMap<String, String>(), new HashMap<String, Map<String,String>>()))); - controller.updateClusters(Collections.singleton(cr), new HashMap<String, String>()); + new ConfigurationRequest(cluster1, "typeA", "v2", new HashMap<>(), new HashMap<>()))); + controller.updateClusters(Collections.singleton(cr), new HashMap<>()); config = cluster.getDesiredConfigByType("typeA"); Assert.assertEquals("v2", config.getTag()); Assert.assertNotNull(config); @@ -9911,7 +9910,7 @@ public class AmbariManagementControllerTest { } }))); try { - controller.updateClusters(Collections.singleton(cr), new HashMap<String, String>()); + controller.updateClusters(Collections.singleton(cr), new HashMap<>()); Assert.fail("Expect failure when creating a config that exists"); } catch (AmbariException e) { // expected @@ -10162,7 +10161,7 @@ public class AmbariManagementControllerTest { put("test.password", "first"); put("test.password.empty", ""); }}, - new HashMap<String, Map<String, String>>() + new HashMap<>() ); crReq = new ClusterRequest(clusterId, cluster1, null, null); crReq.setDesiredConfig(Collections.singletonList(cr)); @@ -10176,7 +10175,7 @@ public class AmbariManagementControllerTest { put("test.password", "SECRET:hdfs-site:1:test.password"); put("new", "new");//need this to mark config as "changed" }}, - new HashMap<String, Map<String, String>>() + new HashMap<>() ); crReq = new ClusterRequest(clusterId, cluster1, null, null); crReq.setDesiredConfig(Collections.singletonList(cr)); @@ -10188,7 +10187,7 @@ public class AmbariManagementControllerTest { new HashMap<String, String>(){{ put("test.password", "brandNewPassword"); }}, - new HashMap<String, Map<String, String>>() + new HashMap<>() ); crReq = new ClusterRequest(clusterId, cluster1, null, null); crReq.setDesiredConfig(Collections.singletonList(cr)); @@ -10200,7 +10199,7 @@ public class AmbariManagementControllerTest { new HashMap<String, String>(){{ put("test.password", "SECRET:hdfs-site:666:test.password"); }}, - new HashMap<String, Map<String, String>>() + new HashMap<>() ); crReq = new ClusterRequest(clusterId, cluster1, null, null); crReq.setDesiredConfig(Collections.singletonList(cr)); @@ -10217,7 +10216,7 @@ public class AmbariManagementControllerTest { new HashMap<String, String>(){{ put("foo", "bar"); }}, - new HashMap<String, Map<String, String>>() + new HashMap<>() ); crReq = new ClusterRequest(clusterId, cluster1, null, null); crReq.setDesiredConfig(Collections.singletonList(cr)); @@ -10229,7 +10228,7 @@ public class AmbariManagementControllerTest { put("test.password", "SECRET:hdfs-site:4:test.password"); put("new", "new"); }}, - new HashMap<String, Map<String, String>>() + new HashMap<>() ); crReq = new ClusterRequest(clusterId, cluster1, null, null); crReq.setDesiredConfig(Collections.singletonList(cr)); @@ -10323,7 +10322,7 @@ public class AmbariManagementControllerTest { } // no new commands since no targeted info - resp = updateHostComponents(Collections.singleton(req), new HashMap<String, String>(), false); + resp = updateHostComponents(Collections.singleton(req), new HashMap<>(), false); assertNull(resp); // role commands added for targeted command http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/controller/AuthToLocalBuilderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/AuthToLocalBuilderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/AuthToLocalBuilderTest.java index 5953231..c193f62 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/AuthToLocalBuilderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/AuthToLocalBuilderTest.java @@ -33,7 +33,7 @@ public class AuthToLocalBuilderTest { @Test public void testRuleGeneration() { - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); builder.addRule("nn/_h...@example.com", "hdfs"); // Duplicate principal for secondary namenode, should be filtered out... @@ -64,7 +64,7 @@ public class AuthToLocalBuilderTest { @Test public void testRuleGeneration_caseInsensitiveSupport() { - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), true); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), true); builder.addRule("nn/_h...@example.com", "hdfs"); // Duplicate principal for secondary namenode, should be filtered out... @@ -94,7 +94,7 @@ public class AuthToLocalBuilderTest { @Test public void testRuleGeneration_changeToCaseInsensitiveSupport() { - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); builder.addRule("nn/_h...@example.com", "hdfs"); // Duplicate principal for secondary namenode, should be filtered out... @@ -108,7 +108,7 @@ public class AuthToLocalBuilderTest { String existingRules = builder.generate(); - builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), true); + builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), true); builder.addRules(existingRules); builder.addRule("nn/_h...@example.com", "hdfs"); @@ -134,7 +134,7 @@ public class AuthToLocalBuilderTest { @Test public void testRuleGeneration_changeToCaseSensitiveSupport() { - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), true); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), true); builder.addRule("nn/_h...@example.com", "hdfs"); // Duplicate principal for secondary namenode, should be filtered out... @@ -148,7 +148,7 @@ public class AuthToLocalBuilderTest { String existingRules = builder.generate(); - builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); builder.addRules(existingRules); builder.addRule("nn/_h...@example.com", "hdfs"); @@ -174,7 +174,7 @@ public class AuthToLocalBuilderTest { @Test public void testRuleGeneration_ExistingRules() { - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); // previously generated non-host specific rules builder.addRule("foo...@example.com", "hdfs"); // doesn't exist in latter generation @@ -182,7 +182,7 @@ public class AuthToLocalBuilderTest { builder.addRule("nn/_h...@example.com", "hdfs"); String existingRules = builder.generate(); - builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); // set previously existing rules builder.addRules(existingRules); @@ -212,7 +212,7 @@ public class AuthToLocalBuilderTest { @Test public void testRuleGeneration_ExistingRules_existingMoreSpecificRule() { - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); // previously generated non-host specific rules builder.addRule("foo...@example.com", "hdfs"); builder.addRule("hm/_h...@example.com", "hbase"); @@ -223,7 +223,7 @@ public class AuthToLocalBuilderTest { // append default realm rule for additional realm existingRules += "\nRULE:[1:$1@$0](.*@OTHER_REALM.COM)s/@.*//"; - builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); // set previously existing rules builder.addRules(existingRules); // more specific host qualifed rule exists for dn @@ -257,7 +257,7 @@ public class AuthToLocalBuilderTest { @Test public void testAddNullExistingRule() { - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); builder.addRules(null); assertEquals( @@ -277,7 +277,7 @@ public class AuthToLocalBuilderTest { "RULE:[2:$1@$0](j...@example.com)s/.*/mapred/\\\\\\" + "RULE:[2:$1@$0](j...@example.com)s/.*/hdfs/\\/\\"; - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); builder.addRules(rules); assertEquals( @@ -299,7 +299,7 @@ public class AuthToLocalBuilderTest { "RULE:[1:$1@$0](.*@\\QEXAMPLE1.COM\\E)s/@\\QEXAMPLE1.COM\\E//\n" + "RULE:[2:$1@$0](.*@\\QEXAMPLE1.COM\\E)s/@\\QEXAMPLE1.COM\\E//"; - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); builder.addRules(rules); builder.addRule("nn/_h...@example.com", "hdfs"); @@ -338,7 +338,7 @@ public class AuthToLocalBuilderTest { "RULE:[2:$1@$0] (j...@example.com)s/.*/mapred/\n" + "RULE:[2:$1@$0](j...@example.com) s/.*/hdfs/\n"; - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); builder.addRules(rulesWithWhitespace); assertEquals( @@ -355,7 +355,7 @@ public class AuthToLocalBuilderTest { @Test public void testExistingRuleWithNoRealm() { - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); builder.addRules("RULE:[1:$1](foobar)s/.*/hdfs/"); assertEquals( @@ -367,7 +367,7 @@ public class AuthToLocalBuilderTest { @Test public void testExistingRuleWithNoRealm2() { - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); builder.addRules("RULE:[1:$1/$2](foobar/someHost)s/.*/hdfs/"); assertEquals( @@ -379,21 +379,21 @@ public class AuthToLocalBuilderTest { @Test(expected = IllegalArgumentException.class) public void testAddNewRuleWithNoRealm() { - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); builder.addRule("someUser", "hdfs"); } @Test(expected = IllegalArgumentException.class) public void testAddNewRuleWithNoRealm2() { - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); builder.addRule("someUser/someHost", "hdfs"); } @Test public void testExistingWildcardRealm() { - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); builder.addRules("RULE:[2:$1@$0]([rn]m@.*)s/.*/yarn/\n" + "RULE:[2:$1@$0]([nd]n@.*)s/.*/hdfs/\n" + "RULE:[2:$1@$0](.*@EXAMPLE.COM)s/.*/yarn/\n" + @@ -417,7 +417,7 @@ public class AuthToLocalBuilderTest { @Test public void testClone() throws CloneNotSupportedException { - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); builder.addRule("nn/_h...@example.com", "hdfs"); builder.addRule("dn/_h...@example.com", "hdfs"); @@ -474,7 +474,7 @@ public class AuthToLocalBuilderTest { @Test public void testAdditionalRealms_Null() { - AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.<String>emptyList(), false); + AuthToLocalBuilder builder = new AuthToLocalBuilder("EXAMPLE.COM", Collections.emptyList(), false); builder.addRule("nn/_h...@example.com", "hdfs"); builder.addRule("dn/_h...@example.com", "hdfs"); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/controller/BackgroundCustomCommandExecutionTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/BackgroundCustomCommandExecutionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/BackgroundCustomCommandExecutionTest.java index 8223acb..3d8d161 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/BackgroundCustomCommandExecutionTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/BackgroundCustomCommandExecutionTest.java @@ -146,7 +146,7 @@ public class BackgroundCustomCommandExecutionTest { }; ExecuteActionRequest actionRequest = new ExecuteActionRequest("c1", - "REBALANCEHDFS", new HashMap<String, String>(), false); + "REBALANCEHDFS", new HashMap<>(), false); actionRequest.getResourceFilters().add(new RequestResourceFilter("HDFS", "NAMENODE",Collections.singletonList("c6401"))); controller.createAction(actionRequest, requestProperties);