http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandlerTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandlerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandlerTest.java index 14e06aa..04d03be 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandlerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/MITKerberosOperationHandlerTest.java @@ -135,7 +135,7 @@ public class MITKerberosOperationHandlerTest extends KerberosOperationHandlerTes .addMockedMethod(methodExecuteCommand) .createNiceMock(); injector.injectMembers(handler); - expect(handler.executeCommand(anyObject(String[].class), EasyMock.<Map<String, String>>anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) + expect(handler.executeCommand(anyObject(String[].class), EasyMock.anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) .andAnswer(new IAnswer<ShellCommandUtil.Result>() { @Override public ShellCommandUtil.Result answer() throws Throwable { @@ -198,7 +198,7 @@ public class MITKerberosOperationHandlerTest extends KerberosOperationHandlerTes public void testCreatePrincipalPrincipalAlreadyNotExists() throws Exception { MITKerberosOperationHandler handler = createMock(); - expect(handler.executeCommand(anyObject(String[].class), EasyMock.<Map<String, String>>anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) + expect(handler.executeCommand(anyObject(String[].class), EasyMock.anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) .andAnswer(new IAnswer<ShellCommandUtil.Result>() { @Override public ShellCommandUtil.Result answer() throws Throwable { @@ -263,7 +263,7 @@ public class MITKerberosOperationHandlerTest extends KerberosOperationHandlerTes public void testTestAdministratorCredentialsIncorrectAdminPassword() throws Exception { MITKerberosOperationHandler handler = createMock(); - expect(handler.executeCommand(anyObject(String[].class), EasyMock.<Map<String, String>>anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) + expect(handler.executeCommand(anyObject(String[].class), EasyMock.anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) .andAnswer(new IAnswer<ShellCommandUtil.Result>() { @Override public ShellCommandUtil.Result answer() throws Throwable { @@ -294,7 +294,7 @@ public class MITKerberosOperationHandlerTest extends KerberosOperationHandlerTes public void testTestAdministratorCredentialsIncorrectAdminPrincipal() throws Exception { MITKerberosOperationHandler handler = createMock(); - expect(handler.executeCommand(anyObject(String[].class), EasyMock.<Map<String, String>>anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) + expect(handler.executeCommand(anyObject(String[].class), EasyMock.anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) .andAnswer(new IAnswer<ShellCommandUtil.Result>() { @Override public ShellCommandUtil.Result answer() throws Throwable { @@ -325,7 +325,7 @@ public class MITKerberosOperationHandlerTest extends KerberosOperationHandlerTes public void testTestAdministratorCredentialsInvalidRealm() throws Exception { MITKerberosOperationHandler handler = createMock(); - expect(handler.executeCommand(anyObject(String[].class), EasyMock.<Map<String, String>>anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) + expect(handler.executeCommand(anyObject(String[].class), EasyMock.anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) .andAnswer(new IAnswer<ShellCommandUtil.Result>() { @Override public ShellCommandUtil.Result answer() throws Throwable { @@ -356,7 +356,7 @@ public class MITKerberosOperationHandlerTest extends KerberosOperationHandlerTes public void testTestAdministratorCredentialsInvalidRealm2() throws Exception { MITKerberosOperationHandler handler = createMock(); - expect(handler.executeCommand(anyObject(String[].class), EasyMock.<Map<String, String>>anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) + expect(handler.executeCommand(anyObject(String[].class), EasyMock.anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) .andAnswer(new IAnswer<ShellCommandUtil.Result>() { @Override public ShellCommandUtil.Result answer() throws Throwable { @@ -387,7 +387,7 @@ public class MITKerberosOperationHandlerTest extends KerberosOperationHandlerTes public void testTestAdministratorCredentialsKDCConnectionException() throws Exception { MITKerberosOperationHandler handler = createMock(); - expect(handler.executeCommand(anyObject(String[].class), EasyMock.<Map<String, String>>anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) + expect(handler.executeCommand(anyObject(String[].class), EasyMock.anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) .andAnswer(new IAnswer<ShellCommandUtil.Result>() { @Override public ShellCommandUtil.Result answer() throws Throwable { @@ -418,7 +418,7 @@ public class MITKerberosOperationHandlerTest extends KerberosOperationHandlerTes public void testTestAdministratorCredentialsKDCConnectionException2() throws Exception { MITKerberosOperationHandler handler = createMock(); - expect(handler.executeCommand(anyObject(String[].class), EasyMock.<Map<String, String>>anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) + expect(handler.executeCommand(anyObject(String[].class), EasyMock.anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) .andAnswer(new IAnswer<ShellCommandUtil.Result>() { @Override public ShellCommandUtil.Result answer() throws Throwable { @@ -449,7 +449,7 @@ public class MITKerberosOperationHandlerTest extends KerberosOperationHandlerTes public void testTestAdministratorCredentialsNotFound() throws Exception { MITKerberosOperationHandler handler = createMock(); - expect(handler.executeCommand(anyObject(String[].class), EasyMock.<Map<String, String>>anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) + expect(handler.executeCommand(anyObject(String[].class), EasyMock.anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) .andAnswer(new IAnswer<ShellCommandUtil.Result>() { @Override public ShellCommandUtil.Result answer() throws Throwable { @@ -480,7 +480,7 @@ public class MITKerberosOperationHandlerTest extends KerberosOperationHandlerTes public void testTestAdministratorCredentialsSuccess() throws Exception { MITKerberosOperationHandler handler = createMock(); - expect(handler.executeCommand(anyObject(String[].class), EasyMock.<Map<String, String>>anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) + expect(handler.executeCommand(anyObject(String[].class), EasyMock.anyObject(), anyObject(MITKerberosOperationHandler.InteractivePasswordHandler.class))) .andAnswer(new IAnswer<ShellCommandUtil.Result>() { @Override public ShellCommandUtil.Result answer() throws Throwable {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/UpdateKerberosConfigsServerActionTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/UpdateKerberosConfigsServerActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/UpdateKerberosConfigsServerActionTest.java index 07391b7..59646ce 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/UpdateKerberosConfigsServerActionTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/UpdateKerberosConfigsServerActionTest.java @@ -106,7 +106,7 @@ public class UpdateKerberosConfigsServerActionTest extends EasyMockSupport{ ConfigHelper configHelper = injector.getInstance(ConfigHelper.class); configHelper.updateConfigType(anyObject(Cluster.class), anyObject(StackId.class), anyObject(AmbariManagementController.class), - anyObject(String.class), EasyMock.<Map<String, String>>anyObject(), EasyMock.<Collection<String>>anyObject(), anyObject(String.class), anyObject(String.class)); + anyObject(String.class), EasyMock.anyObject(), EasyMock.anyObject(), anyObject(String.class), anyObject(String.class)); expectLastCall().atLeastOnce(); replayAll(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ConfigureActionTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ConfigureActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ConfigureActionTest.java index 8ebff2c..0bb72af 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ConfigureActionTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ConfigureActionTest.java @@ -615,7 +615,7 @@ public class ConfigureActionTest { ExecutionCommand executionCommand = new ExecutionCommand(); executionCommand.setCommandParams(commandParams); executionCommand.setClusterName("c1"); - executionCommand.setRoleParams(new HashMap<String, String>()); + executionCommand.setRoleParams(new HashMap<>()); executionCommand.getRoleParams().put(ServerAction.ACTION_USER_NAME, "username"); HostRoleCommand hostRoleCommand = hostRoleCommandFactory.create(null, null, null, null); @@ -1202,7 +1202,7 @@ public class ConfigureActionTest { ExecutionCommand executionCommand = new ExecutionCommand(); executionCommand.setCommandParams(commandParams); executionCommand.setClusterName("c1"); - executionCommand.setRoleParams(new HashMap<String, String>()); + executionCommand.setRoleParams(new HashMap<>()); executionCommand.getRoleParams().put(ServerAction.ACTION_USER_NAME, "username"); HostRoleCommand hostRoleCommand = hostRoleCommandFactory.create(null, null, @@ -1838,7 +1838,7 @@ public class ConfigureActionTest { ExecutionCommand executionCommand = new ExecutionCommand(); executionCommand.setClusterName("c1"); executionCommand.setCommandParams(commandParams); - executionCommand.setRoleParams(new HashMap<String, String>()); + executionCommand.setRoleParams(new HashMap<>()); executionCommand.getRoleParams().put(ServerAction.ACTION_USER_NAME, "username"); return executionCommand; http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveZKQuorumConfigActionTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveZKQuorumConfigActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveZKQuorumConfigActionTest.java index 1450961..2f047fa 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveZKQuorumConfigActionTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveZKQuorumConfigActionTest.java @@ -88,7 +88,7 @@ public class HiveZKQuorumConfigActionTest { EasyMock.expect(m_hiveSiteConfig.getProperties()).andReturn(hiveSiteProperties).atLeastOnce(); - m_hiveSiteConfig.setProperties(EasyMock.<Map<String, String>>anyObject()); + m_hiveSiteConfig.setProperties(EasyMock.anyObject()); EasyMock.expectLastCall().once(); m_hiveSiteConfig.save(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKerberosConfigCalculationTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKerberosConfigCalculationTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKerberosConfigCalculationTest.java index dd5d7a3..d6a47f5 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKerberosConfigCalculationTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKerberosConfigCalculationTest.java @@ -102,7 +102,7 @@ public class RangerKerberosConfigCalculationTest { Config adminSiteConfig = EasyMock.createNiceMock(Config.class); expect(adminSiteConfig.getType()).andReturn("ranger-admin-site").anyTimes(); - expect(adminSiteConfig.getProperties()).andReturn(new HashMap<String,String>()).anyTimes(); + expect(adminSiteConfig.getProperties()).andReturn(new HashMap<>()).anyTimes(); expect(cluster.getDesiredConfigByType("hadoop-env")).andReturn(hadoopConfig).atLeastOnce(); expect(cluster.getDesiredConfigByType("hive-env")).andReturn(hiveConfig).atLeastOnce(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/serveraction/users/PostUserCreationHookServerActionTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/users/PostUserCreationHookServerActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/users/PostUserCreationHookServerActionTest.java index 0fe35e2..760ba5a 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/users/PostUserCreationHookServerActionTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/users/PostUserCreationHookServerActionTest.java @@ -129,7 +129,7 @@ public class PostUserCreationHookServerActionTest extends EasyMockSupport { customScriptServerAction.setExecutionCommand(executionCommand); EasyMock.expect(collectionPersisterServiceFactoryMock.createCsvFilePersisterService(EasyMock.anyString())).andReturn(collectionPersisterService); - EasyMock.expect(collectionPersisterService.persistMap(EasyMock.<Map<String, List<String>>>anyObject())).andReturn(Boolean.TRUE); + EasyMock.expect(collectionPersisterService.persistMap(EasyMock.anyObject())).andReturn(Boolean.TRUE); replayAll(); @@ -165,7 +165,7 @@ public class PostUserCreationHookServerActionTest extends EasyMockSupport { private void mockExecutionCommand(int callCnt) { EasyMock.expect(executionCommand.getRoleCommand()).andReturn(RoleCommand.EXECUTE).times(callCnt); EasyMock.expect(executionCommand.getClusterName()).andReturn("unit-test-cluster").times(callCnt); - EasyMock.expect(executionCommand.getConfigurationTags()).andReturn(Collections.<String, Map<String, String>>emptyMap()).times(callCnt); + EasyMock.expect(executionCommand.getConfigurationTags()).andReturn(Collections.emptyMap()).times(callCnt); EasyMock.expect(executionCommand.getRole()).andReturn(Role.AMBARI_SERVER_ACTION.toString()).times(callCnt); EasyMock.expect(executionCommand.getServiceName()).andReturn("custom-hook-script").times(callCnt); EasyMock.expect(executionCommand.getTaskId()).andReturn(-1l).times(callCnt); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/stack/ComponentModuleTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/ComponentModuleTest.java b/ambari-server/src/test/java/org/apache/ambari/server/stack/ComponentModuleTest.java index 990561a..060916a 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/stack/ComponentModuleTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/ComponentModuleTest.java @@ -622,7 +622,7 @@ public class ComponentModuleTest { parentComponent = new ComponentModule(parentInfo); } - component.resolve(parentComponent, Collections.<String, StackModule>emptyMap(), Collections.<String, ServiceModule>emptyMap(), Collections.<String, ExtensionModule>emptyMap()); + component.resolve(parentComponent, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap()); return component; } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/stack/ServiceModuleTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/ServiceModuleTest.java b/ambari-server/src/test/java/org/apache/ambari/server/stack/ServiceModuleTest.java index 784d884..311d400 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/stack/ServiceModuleTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/ServiceModuleTest.java @@ -752,14 +752,14 @@ public class ServiceModuleTest { Map<String, Map<String, Map<String, String>>> parentAttributes = parent.getModuleInfo().getConfigTypeAttributes(); assertEquals(3, childAttributes.size()); - assertAttributes(childAttributes.get("FOO"), Collections.<String, String>emptyMap()); + assertAttributes(childAttributes.get("FOO"), Collections.emptyMap()); assertAttributes(childAttributes.get("BAR"), attributes); - assertAttributes(childAttributes.get("OTHER"), Collections.<String, String>emptyMap()); + assertAttributes(childAttributes.get("OTHER"), Collections.emptyMap()); assertEquals(3, parentAttributes.size()); - assertAttributes(parentAttributes.get("FOO"), Collections.<String, String>emptyMap()); - assertAttributes(parentAttributes.get("BAR"), Collections.<String, String>emptyMap()); - assertAttributes(parentAttributes.get("OTHER"), Collections.<String, String>emptyMap()); + assertAttributes(parentAttributes.get("FOO"), Collections.emptyMap()); + assertAttributes(parentAttributes.get("BAR"), Collections.emptyMap()); + assertAttributes(parentAttributes.get("OTHER"), Collections.emptyMap()); } @Test @@ -858,7 +858,7 @@ public class ServiceModuleTest { assertEquals(2, parentTypeAttributes.size()); assertAttributes(parentTypeAttributes.get("FOO"), parentFooAttributes); - assertAttributes(parentTypeAttributes.get("BAR"), Collections.<String, String>emptyMap()); + assertAttributes(parentTypeAttributes.get("BAR"), Collections.emptyMap()); } @Test @@ -1048,7 +1048,7 @@ public class ServiceModuleTest { info.setCommandScript(createNiceMock(CommandScriptDefinition.class)); StackContext context = createStackContext(info.getName(), true); - ServiceModule service = createServiceModule(info, Collections.<ConfigurationModule>emptySet(), context); + ServiceModule service = createServiceModule(info, Collections.emptySet(), context); service.finalizeModule(); verify(context); @@ -1062,7 +1062,7 @@ public class ServiceModuleTest { info.setDeleted(true); StackContext context = createStackContext(info.getName(), false); - ServiceModule service = createServiceModule(info, Collections.<ConfigurationModule>emptySet(), context); + ServiceModule service = createServiceModule(info, Collections.emptySet(), context); service.finalizeModule(); verify(context); @@ -1224,8 +1224,8 @@ public class ServiceModuleTest { StackContext context = createStackContext(serviceInfo.getName(), true); // no config props - ConfigurationInfo configInfo = createConfigurationInfo(Collections.<PropertyInfo>emptyList(), - Collections.<String, String>emptyMap()); + ConfigurationInfo configInfo = createConfigurationInfo(Collections.emptyList(), + Collections.emptyMap()); ConfigurationModule module = createConfigurationModule(configType, configInfo); ConfigurationDirectory configDirectory = createConfigurationDirectory(Collections.singletonList(module)); @@ -1293,7 +1293,7 @@ public class ServiceModuleTest { } private ConfigurationModule createConfigurationModule(String configType, Collection<PropertyInfo> properties) { - ConfigurationInfo info = new ConfigurationInfo(properties, Collections.<String, String>emptyMap()); + ConfigurationInfo info = new ConfigurationInfo(properties, Collections.emptyMap()); return new ConfigurationModule(configType, info); } @@ -1331,7 +1331,7 @@ public class ServiceModuleTest { } private void resolveService(ServiceModule service, ServiceModule parent) throws AmbariException { - service.resolve(parent, Collections.<String, StackModule>emptyMap(), Collections.<String, ServiceModule>emptyMap(), Collections.<String, ExtensionModule>emptyMap()); + service.resolve(parent, Collections.emptyMap(), Collections.emptyMap(), Collections.emptyMap()); // during runtime this would be called by the Stack module when it's resolve completed service.finalizeModule(); parent.finalizeModule(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/stack/StackModuleTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackModuleTest.java b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackModuleTest.java index 1fb8dfb..ef2918c 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackModuleTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackModuleTest.java @@ -97,7 +97,7 @@ public class StackModuleTest { public void serviceReposAreProcessedEvenIfNoStackRepo() throws Exception { StackModule sm = createStackModule("FooBar", "2.4", - Optional.<List<RepositoryInfo>>absent(), + Optional.absent(), Lists.newArrayList(repoInfo("bar", "2.0.1", "http://bar.org"))); Set<String> repoIds = getIds(sm.getModuleInfo().getRepositories()); assertEquals(ImmutableSet.of("bar:2.0.1"), repoIds); @@ -112,7 +112,7 @@ public class StackModuleTest { public void duplicateStackServiceReposAreCheckedPerOs() throws Exception { StackModule sm = createStackModule("FooBar", "2.4", - Optional.<List<RepositoryInfo>>absent(), + Optional.absent(), Lists.newArrayList(repoInfo("bar", "2.0.1", "http://bar.org", "centos6")), Lists.newArrayList(repoInfo("bar", "2.0.1", "http://bar.org", "centos7"))); Multiset<String> repoIds = getIdsMultiple(sm.getModuleInfo().getRepositories()); @@ -124,7 +124,7 @@ public class StackModuleTest { public void removedServicesInitialValue () throws Exception { StackModule sm = createStackModule("FooBar", "2.4", - Optional.<List<RepositoryInfo>>absent(), + Optional.absent(), Lists.newArrayList(repoInfo("bar", "2.0.1", "http://bar.org", "centos6")), Lists.newArrayList(repoInfo("bar", "2.0.1", "http://bar.org", "centos7"))); List<String> removedServices = sm.getModuleInfo().getRemovedServices(); @@ -135,7 +135,7 @@ public class StackModuleTest { public void servicesWithNoConfigsInitialValue() throws Exception { StackModule sm = createStackModule("FooBar", "2.4", - Optional.<List<RepositoryInfo>>absent(), + Optional.absent(), Lists.newArrayList(repoInfo("bar", "2.0.1", "http://bar.org", "centos6")), Lists.newArrayList(repoInfo("bar", "2.0.1", "http://bar.org", "centos7"))); List<String> servicesWithNoConfigs = sm.getModuleInfo().getServicesWithNoConfigs(); @@ -173,7 +173,7 @@ public class StackModuleTest { StackModule sm = new StackModule(sd, ctx); sm.resolve(null, ImmutableMap.of(String.format("%s:%s", stackName, stackVersion), sm), - ImmutableMap.<String, ServiceModule>of(), ImmutableMap.<String, ExtensionModule>of()); + ImmutableMap.of(), ImmutableMap.of()); return sm; } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java index fc3a133..0301431 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/CheckHelperTest.java @@ -115,7 +115,7 @@ public class CheckHelperTest { m_services.put("KAFKA", service); - Mockito.when(cluster.getServices()).thenReturn(new HashMap<String, Service>()); + Mockito.when(cluster.getServices()).thenReturn(new HashMap<>()); Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster); @@ -185,7 +185,7 @@ public class CheckHelperTest { m_services.put("KAFKA", service); - Mockito.when(cluster.getServices()).thenReturn(new HashMap<String, Service>()); + Mockito.when(cluster.getServices()).thenReturn(new HashMap<>()); Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(clusters.getCluster(Mockito.anyString())).thenReturn(cluster); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java index 6e84b33..38a38cc 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigHelperTest.java @@ -520,7 +520,7 @@ public class ConfigHelperTest { config1Attributes.put("attribute1", attributes); final Config config1 = configFactory.createNew(cluster, "core-site3", "version122", - new HashMap<String, String>(), config1Attributes); + new HashMap<>(), config1Attributes); attributes = new HashMap<>(); attributes.put("namenode_heapsize", "z"); @@ -529,7 +529,7 @@ public class ConfigHelperTest { config2Attributes.put("attribute2", attributes); final Config config2 = configFactory.createNew(cluster, "global3", "version122", - new HashMap<String, String>(), config2Attributes); + new HashMap<>(), config2Attributes); Long groupId = addConfigGroup("g3", "t1", new ArrayList<String>() {{ add("h3"); @@ -799,7 +799,7 @@ public class ConfigHelperTest { confGroupAttributes.put("final", confGroupFinalAttrs); Config overrideConfig = configFactory.createNew(cluster, "type", "version122", - new HashMap<String,String>(), confGroupAttributes); + new HashMap<>(), confGroupAttributes); Map<String, Map<String, String>> result = configHelper.overrideAttributes(overrideConfig, persistedAttributes); @@ -958,7 +958,7 @@ public class ConfigHelperTest { List<Config> configs = new ArrayList<>(); Config configImpl = configFactory.createNew(cluster, "flume-conf", "FLUME1", - new HashMap<String,String>(), null); + new HashMap<>(), null); configs.add(configImpl); addConfigGroup("configGroup1", "FLUME", hosts, configs); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java index 5dfbc53..677b607 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/UpgradeHelperTest.java @@ -141,7 +141,7 @@ public class UpgradeHelperTest extends EasyMockSupport { expect(m_configHelper.getPlaceholderValueFromDesiredConfigurations( EasyMock.anyObject(Cluster.class), EasyMock.eq("{{foo/bar}}"))).andReturn("placeholder-rendered-properly").anyTimes(); expect(m_configHelper.getEffectiveDesiredTags( - EasyMock.anyObject(Cluster.class), EasyMock.anyObject(String.class))).andReturn(new HashMap<String, Map<String, String>>()).anyTimes(); + EasyMock.anyObject(Cluster.class), EasyMock.anyObject(String.class))).andReturn(new HashMap<>()).anyTimes(); } @Before @@ -1216,7 +1216,7 @@ public class UpgradeHelperTest extends EasyMockSupport { * @throws AmbariException */ private Cluster makeCluster(boolean clean) throws AmbariException, AuthorizationException { - return makeCluster(clean, new HashSet<String>()); + return makeCluster(clean, new HashSet<>()); } /** @@ -1836,7 +1836,7 @@ public class UpgradeHelperTest extends EasyMockSupport { ProcessingComponent pc = new ProcessingComponent(); pc.name = "NIMBUS_MESSAGE"; - pc.preTasks = Lists.<Task>newArrayList(mt); + pc.preTasks = Lists.newArrayList(mt); return Collections.singletonMap("STORM", Collections.singletonMap("NIMBUS", pc)); } @@ -2329,7 +2329,7 @@ public class UpgradeHelperTest extends EasyMockSupport { Service zookeeper = createNiceMock(Service.class); expect(zookeeper.getName()).andReturn("ZOOKEEPER").atLeastOnce(); expect(zookeeper.getServiceComponents()).andReturn( - new HashMap<String, ServiceComponent>()).once(); + new HashMap<>()).once(); zookeeper.setDesiredRepositoryVersion(repoVersion220); expectLastCall().once(); @@ -2436,17 +2436,17 @@ public class UpgradeHelperTest extends EasyMockSupport { Config clusterEnv = cf.createNew(cluster, "cluster-env", "version1", ImmutableMap.<String, String>builder().put("a", "b").build(), - Collections.<String, Map<String, String>>emptyMap()); + Collections.emptyMap()); Config zooCfg = cf.createNew(cluster, "zoo.cfg", "version1", ImmutableMap.<String, String>builder().put("c", "d").build(), - Collections.<String, Map<String, String>>emptyMap()); + Collections.emptyMap()); cluster.addDesiredConfig("admin", Sets.newHashSet(clusterEnv, zooCfg)); Map<String, Map<String, String>> stackMap = new HashMap<>(); - stackMap.put("cluster-env", new HashMap<String, String>()); - stackMap.put("hive-site", new HashMap<String, String>()); + stackMap.put("cluster-env", new HashMap<>()); + stackMap.put("hive-site", new HashMap<>()); final Map<String, String> clusterEnvMap = new HashMap<>(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertDefinitionHashTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertDefinitionHashTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertDefinitionHashTest.java index 4895d82..53b0a10 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertDefinitionHashTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertDefinitionHashTest.java @@ -39,7 +39,6 @@ import org.apache.ambari.server.orm.dao.AlertDefinitionDAO; import org.apache.ambari.server.orm.entities.AlertDefinitionEntity; import org.apache.ambari.server.state.Cluster; import org.apache.ambari.server.state.Clusters; -import org.apache.ambari.server.state.Config; import org.apache.ambari.server.state.ConfigHelper; import org.apache.ambari.server.state.Host; import org.apache.ambari.server.state.Service; @@ -207,8 +206,8 @@ public class AlertDefinitionHashTest extends TestCase { // configHelper mock m_configHelper = m_injector.getInstance(ConfigHelper.class); - EasyMock.expect(m_configHelper.getEffectiveDesiredTags((Cluster) anyObject(), EasyMock.anyString())).andReturn(new HashMap<String, Map<String, String>>()).anyTimes(); - EasyMock.expect(m_configHelper.getEffectiveConfigProperties((Cluster) anyObject(), (Map<String, Map<String, String>>) anyObject())).andReturn(new HashMap<String, Map<String, String>>()).anyTimes(); + EasyMock.expect(m_configHelper.getEffectiveDesiredTags((Cluster) anyObject(), EasyMock.anyString())).andReturn(new HashMap<>()).anyTimes(); + EasyMock.expect(m_configHelper.getEffectiveConfigProperties((Cluster) anyObject(), (Map<String, Map<String, String>>) anyObject())).andReturn(new HashMap<>()).anyTimes(); EasyMock.replay(m_configHelper); } @@ -414,7 +413,7 @@ public class AlertDefinitionHashTest extends TestCase { public void configure(Binder binder) { Cluster cluster = EasyMock.createNiceMock(Cluster.class); EasyMock.expect(cluster.getAllConfigs()).andReturn( - new ArrayList<Config>()).anyTimes(); + new ArrayList<>()).anyTimes(); binder.bind(Clusters.class).toInstance( EasyMock.createNiceMock(Clusters.class)); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertReceivedListenerTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertReceivedListenerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertReceivedListenerTest.java index b015866..3ec6943 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertReceivedListenerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertReceivedListenerTest.java @@ -24,7 +24,6 @@ import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; -import java.util.Map; import java.util.UUID; import javax.persistence.EntityManager; @@ -844,7 +843,7 @@ public class AlertReceivedListenerTest { { put(ConfigHelper.CLUSTER_ENV_ALERT_REPEAT_TOLERANCE, "3"); } - }, new HashMap<String, Map<String, String>>()); + }, new HashMap<>()); m_cluster.addDesiredConfig("user", Collections.singleton(config)); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java index 8740a7d..bc8222c 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/alerts/AlertStateChangedEventTest.java @@ -136,7 +136,7 @@ public class AlertStateChangedEventTest extends EasyMockSupport { EasyMock.expect( dispatchDao.createNotices((List<AlertNoticeEntity>) EasyMock.anyObject())).andReturn( - new ArrayList<AlertNoticeEntity>()).once(); + new ArrayList<>()).once(); AlertDefinitionEntity definition = getMockAlertDefinition(); @@ -507,7 +507,7 @@ public class AlertStateChangedEventTest extends EasyMockSupport { EasyMock.expect( dispatchDao.createNotices((List<AlertNoticeEntity>) EasyMock.anyObject())).andReturn( - new ArrayList<AlertNoticeEntity>()).once(); + new ArrayList<>()).once(); AlertCurrentEntity current = getMockedAlertCurrentEntity(); AlertHistoryEntity history = createNiceMock(AlertHistoryEntity.class); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/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 d255b74..0f70980 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 @@ -127,10 +127,8 @@ public class ClusterDeadlockTest { cluster = clusters.getCluster("c1"); helper.getOrCreateRepositoryVersion(stackId, stackId.getStackVersion()); - Config config1 = configFactory.createNew(cluster, "test-type1", "version1", new HashMap<String, String>(), new HashMap<String, - Map<String, String>>()); - Config config2 = configFactory.createNew(cluster, "test-type2", "version1", new HashMap<String, String>(), new HashMap<String, - Map<String, String>>()); + Config config1 = configFactory.createNew(cluster, "test-type1", "version1", new HashMap<>(), new HashMap<>()); + Config config2 = configFactory.createNew(cluster, "test-type2", "version1", new HashMap<>(), new HashMap<>()); cluster.addDesiredConfig("test user", new HashSet<>(Arrays.asList(config1, config2))); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java index 6423164..4b09c6d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClusterTest.java @@ -74,7 +74,6 @@ import org.apache.ambari.server.orm.entities.HostEntity; import org.apache.ambari.server.orm.entities.HostStateEntity; import org.apache.ambari.server.orm.entities.HostVersionEntity; import org.apache.ambari.server.orm.entities.RepositoryVersionEntity; -import org.apache.ambari.server.orm.entities.ServiceComponentDesiredStateEntity; import org.apache.ambari.server.orm.entities.ServiceDesiredStateEntity; import org.apache.ambari.server.orm.entities.StackEntity; import org.apache.ambari.server.state.AgentVersion; @@ -259,7 +258,7 @@ public class ClusterTest { hostEntities.add(host2); clusterEntity.setHostEntities(hostEntities); - clusterEntity.setClusterConfigEntities(Collections.<ClusterConfigEntity>emptyList()); + clusterEntity.setClusterConfigEntities(Collections.emptyList()); //both sides of relation should be set when modifying in runtime host1.setClusterEntities(Arrays.asList(clusterEntity)); host2.setClusterEntities(Arrays.asList(clusterEntity)); @@ -277,7 +276,7 @@ public class ClusterTest { clusterServiceEntity.setServiceName("HDFS"); clusterServiceEntity.setClusterEntity(clusterEntity); clusterServiceEntity.setServiceComponentDesiredStateEntities( - Collections.<ServiceComponentDesiredStateEntity>emptyList()); + Collections.emptyList()); ServiceDesiredStateEntity stateEntity = mock(ServiceDesiredStateEntity.class); @@ -936,10 +935,10 @@ public class ClusterTest { createDefaultCluster(); Map<String, Map<String, String>> c1PropAttributes = new HashMap<>(); - c1PropAttributes.put("final", new HashMap<String, String>()); + c1PropAttributes.put("final", new HashMap<>()); c1PropAttributes.get("final").put("a", "true"); Map<String, Map<String, String>> c2PropAttributes = new HashMap<>(); - c2PropAttributes.put("final", new HashMap<String, String>()); + c2PropAttributes.put("final", new HashMap<>()); c2PropAttributes.get("final").put("x", "true"); Config config1 = configFactory.createNew(c1, "global", "version1", new HashMap<String, String>() {{ put("a", "b"); }}, c1PropAttributes); @@ -948,7 +947,7 @@ public class ClusterTest { new HashMap<String, String>() {{ put("x", "y"); }}, c2PropAttributes); Config config3 = configFactory.createNew(c1, "core-site", "version2", - new HashMap<String, String>() {{ put("x", "y"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String, String>() {{ put("x", "y"); }}, new HashMap<>()); c1.addDesiredConfig("_test", Collections.singleton(config1)); Config res = c1.getDesiredConfigByType("global"); @@ -970,13 +969,13 @@ public class ClusterTest { createDefaultCluster(); Config config1 = configFactory.createNew(c1, "global", "version1", - new HashMap<String, String>() {{ put("a", "b"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String, String>() {{ put("a", "b"); }}, new HashMap<>()); Config config2 = configFactory.createNew(c1, "global", "version2", - new HashMap<String, String>() {{ put("x", "y"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String, String>() {{ put("x", "y"); }}, new HashMap<>()); Config config3 = configFactory.createNew(c1, "core-site", "version2", - new HashMap<String, String>() {{ put("x", "y"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String, String>() {{ put("x", "y"); }}, new HashMap<>()); try { c1.addDesiredConfig(null, Collections.singleton(config1)); @@ -1101,10 +1100,10 @@ public class ClusterTest { c1.addService("HDFS", repositoryVersion); Config config1 = configFactory.createNew(c1, "hdfs-site", "version1", - new HashMap<String, String>() {{ put("a", "b"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String, String>() {{ put("a", "b"); }}, new HashMap<>()); Config config2 = configFactory.createNew(c1, "core-site", "version2", - new HashMap<String, String>() {{ put("x", "y"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String, String>() {{ put("x", "y"); }}, new HashMap<>()); Set<Config> configs = new HashSet<>(); configs.add(config1); @@ -1166,7 +1165,7 @@ public class ClusterTest { HostEntity hostEntity1 = hostDAO.findByName("h1"); Map<String, Map<String, String>> propAttributes = new HashMap<>(); - propAttributes.put("final", new HashMap<String, String>()); + propAttributes.put("final", new HashMap<>()); propAttributes.get("final").put("test", "true"); Config config = configFactory.createNew(c1, "hdfs-site", "1", new HashMap<String, String>(){{ put("test", "test"); @@ -1206,10 +1205,10 @@ public class ClusterTest { createDefaultCluster(); Config config1 = configFactory.createNew(c1, "hdfs-site", "version1", - new HashMap<String, String>() {{ put("a", "b"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String, String>() {{ put("a", "b"); }}, new HashMap<>()); Config config2 = configFactory.createNew(c1, "hdfs-site", "version2", - new HashMap<String, String>() {{ put("x", "y"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String, String>() {{ put("x", "y"); }}, new HashMap<>()); c1.addDesiredConfig("admin", Collections.singleton(config1)); List<ServiceConfigVersionResponse> serviceConfigVersions = @@ -1264,10 +1263,10 @@ public class ClusterTest { createDefaultCluster(); Config config1 = configFactory.createNew(c1, "hdfs-site", "version1", - new HashMap<String, String>() {{ put("a", "b"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String, String>() {{ put("a", "b"); }}, new HashMap<>()); Config config2 = configFactory.createNew(c1, "core-site", "version2", - new HashMap<String, String>() {{ put("x", "y"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String, String>() {{ put("x", "y"); }}, new HashMap<>()); Set<Config> configs = new HashSet<>(); configs.add(config1); @@ -1297,7 +1296,7 @@ public class ClusterTest { c1.addService("HDFS", repositoryVersion); Config config1 = configFactory.createNew(c1, "hdfs-site", "version1", - new HashMap<String, String>() {{ put("a", "b"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String, String>() {{ put("a", "b"); }}, new HashMap<>()); ServiceConfigVersionResponse scvResponse = c1.addDesiredConfig("admin", Collections.singleton(config1)); @@ -1310,11 +1309,11 @@ public class ClusterTest { //create config group Config config2 = configFactory.createNew(c1, "hdfs-site", "version2", - new HashMap<String, String>() {{ put("a", "c"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String, String>() {{ put("a", "c"); }}, new HashMap<>()); ConfigGroup configGroup = configGroupFactory.createNew(c1, "HDFS", "test group", "HDFS", "descr", Collections.singletonMap("hdfs-site", config2), - Collections.<Long, Host>emptyMap()); + Collections.emptyMap()); c1.addConfigGroup(configGroup); @@ -1327,7 +1326,7 @@ public class ClusterTest { 2, activeServiceConfigVersions.get("HDFS").size()); Config config3 = configFactory.createNew(c1, "hdfs-site", "version3", - new HashMap<String, String>() {{ put("a", "d"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String, String>() {{ put("a", "d"); }}, new HashMap<>()); configGroup.setConfigurations(Collections.singletonMap("hdfs-site", config3)); @@ -1367,7 +1366,7 @@ public class ClusterTest { ConfigGroup configGroup2 = configGroupFactory.createNew(c1, "HDFS", "test group 2", "HDFS", "descr", new HashMap<>(Collections.singletonMap("hdfs-site", config4)), - Collections.<Long, Host>emptyMap()); + Collections.emptyMap()); c1.addConfigGroup(configGroup2); @@ -1386,7 +1385,7 @@ public class ClusterTest { createDefaultCluster(); Config hdfsSiteConfigV1 = configFactory.createNew(c1, "hdfs-site", "version1", - ImmutableMap.of("p1", "v1"), ImmutableMap.<String, Map<String,String>>of()); + ImmutableMap.of("p1", "v1"), ImmutableMap.of()); ServiceConfigVersionResponse hdfsSiteConfigResponseV1 = c1.addDesiredConfig("admin", Collections.singleton(hdfsSiteConfigV1)); List<ConfigurationResponse> configResponsesDefaultGroup = Collections.singletonList( @@ -1398,9 +1397,9 @@ public class ClusterTest { hdfsSiteConfigResponseV1.setConfigurations(configResponsesDefaultGroup); Config hdfsSiteConfigV2 = configFactory.createNew(c1, "hdfs-site", "version2", - ImmutableMap.of("p1", "v2"), ImmutableMap.<String, Map<String,String>>of()); + ImmutableMap.of("p1", "v2"), ImmutableMap.of()); - ConfigGroup configGroup = configGroupFactory.createNew(c1, "HDFS", "configGroup1", "version1", "test description", ImmutableMap.of(hdfsSiteConfigV2.getType(), hdfsSiteConfigV2), ImmutableMap.<Long, Host>of()); + ConfigGroup configGroup = configGroupFactory.createNew(c1, "HDFS", "configGroup1", "version1", "test description", ImmutableMap.of(hdfsSiteConfigV2.getType(), hdfsSiteConfigV2), ImmutableMap.of()); c1.addConfigGroup(configGroup); ServiceConfigVersionResponse hdfsSiteConfigResponseV2 = c1.createServiceConfigVersion("HDFS", "admin", "test note", configGroup); @@ -1445,7 +1444,7 @@ public class ClusterTest { createDefaultCluster(); Config hdfsSiteConfigV1 = configFactory.createNew(c1, "hdfs-site", "version1", - ImmutableMap.of("p1", "v1"), ImmutableMap.<String, Map<String,String>>of()); + ImmutableMap.of("p1", "v1"), ImmutableMap.of()); ServiceConfigVersionResponse hdfsSiteConfigResponseV1 = c1.addDesiredConfig("admin", Collections.singleton(hdfsSiteConfigV1)); List<ConfigurationResponse> configResponsesDefaultGroup = Collections.singletonList( @@ -1457,9 +1456,9 @@ public class ClusterTest { hdfsSiteConfigResponseV1.setConfigurations(configResponsesDefaultGroup); Config hdfsSiteConfigV2 = configFactory.createNew(c1, "hdfs-site", "version2", - ImmutableMap.of("p1", "v2"), ImmutableMap.<String, Map<String,String>>of()); + ImmutableMap.of("p1", "v2"), ImmutableMap.of()); - ConfigGroup configGroup = configGroupFactory.createNew(c1, "HDFS", "configGroup1", "version1", "test description", ImmutableMap.of(hdfsSiteConfigV2.getType(), hdfsSiteConfigV2), ImmutableMap.<Long, Host>of()); + ConfigGroup configGroup = configGroupFactory.createNew(c1, "HDFS", "configGroup1", "version1", "test description", ImmutableMap.of(hdfsSiteConfigV2.getType(), hdfsSiteConfigV2), ImmutableMap.of()); c1.addConfigGroup(configGroup); ServiceConfigVersionResponse hdfsSiteConfigResponseV2 = c1.createServiceConfigVersion("HDFS", "admin", "test note", configGroup); @@ -1940,14 +1939,14 @@ public class ClusterTest { { put("one", "two"); } - }, new HashMap<String, Map<String, String>>()); + }, new HashMap<>()); ConfigGroup configGroup = configGroupFactory.createNew(cluster, "HDFS", "g1", "t1", "", new HashMap<String, Config>() { { put("foo-site", originalConfig); } - }, Collections.<Long, Host> emptyMap()); + }, Collections.emptyMap()); cluster.addConfigGroup(configGroup); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java index 39f674c..c204268 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/cluster/ClustersTest.java @@ -77,7 +77,6 @@ import org.apache.ambari.server.topology.LogicalRequest; import org.apache.ambari.server.topology.PersistedState; import org.apache.ambari.server.topology.TopologyManager; import org.apache.ambari.server.topology.TopologyRequest; -import org.apache.ambari.server.topology.tasks.TopologyTask; import org.apache.ambari.server.utils.EventBusSynchronizer; import org.junit.After; import org.junit.Before; @@ -401,12 +400,12 @@ public class ClustersTest { final Config config1 = injector.getInstance(ConfigFactory.class).createNew(cluster, "t1", "1", new HashMap<String, String>() {{ put("prop1", "val1"); - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); Config config2 = injector.getInstance(ConfigFactory.class).createNew(cluster, "t1", "2", new HashMap<String, String>() {{ put("prop2", "val2"); - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); // cluster desired config cluster.addDesiredConfig("_test", Collections.singleton(config1)); @@ -465,8 +464,8 @@ public class ClustersTest { expect(bp.getName()).andReturn("TestBluePrint").anyTimes(); Configuration clusterConfig = new Configuration( - Maps.<String, Map<String, String>>newHashMap(), - Maps.<String, Map<String, Map<String, String>>>newHashMap() + Maps.newHashMap(), + Maps.newHashMap() ); Map<String, HostGroupInfo> hostGroups = Maps.newHashMap(); @@ -563,8 +562,8 @@ public class ClustersTest { expect(bp.getName()).andReturn("TestBluePrint").anyTimes(); Configuration clusterConfig = new Configuration( - Maps.<String, Map<String, String>>newHashMap(), - Maps.<String, Map<String, Map<String, String>>>newHashMap() + Maps.newHashMap(), + Maps.newHashMap() ); Map<String, HostGroupInfo> hostGroups = new HashMap<>(); @@ -596,7 +595,7 @@ public class ClustersTest { expect(hr.getHostgroupName()).andReturn("MyHostGroup").anyTimes(); expect(hr.getHostName()).andReturn(hostName).anyTimes(); expect(hr.getStageId()).andReturn(1L); - expect(hr.getTopologyTasks()).andReturn(Collections.<TopologyTask>emptyList()); + expect(hr.getTopologyTasks()).andReturn(Collections.emptyList()); replay(hr); return hr; http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/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 7672edb..4303bf5 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 @@ -119,11 +119,9 @@ public class ServiceComponentHostConcurrentWriteDeadlockTest { cluster = clusters.getCluster("c1"); m_repositoryVersion = helper.getOrCreateRepositoryVersion(stackId, REPO_VERSION); - Config config1 = configFactory.createNew(cluster, "test-type1", null, new HashMap<String, String>(), new HashMap<String, - Map<String, String>>()); + Config config1 = configFactory.createNew(cluster, "test-type1", null, new HashMap<>(), new HashMap<>()); - Config config2 = configFactory.createNew(cluster, "test-type2", null, new HashMap<String, String>(), new HashMap<String, - Map<String, String>>()); + Config config2 = configFactory.createNew(cluster, "test-type2", null, new HashMap<>(), new HashMap<>()); cluster.addDesiredConfig("test user", new HashSet<>(Arrays.asList(config1, config2))); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java index 3d8b87d..b9195a3 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/host/HostTest.java @@ -383,7 +383,7 @@ public class HostTest { ConfigFactory configFactory = injector.getInstance(ConfigFactory.class); Config config = configFactory.createNew(c1, "global", "v1", - new HashMap<String,String>() {{ put("a", "b"); put("x", "y"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String,String>() {{ put("a", "b"); put("x", "y"); }}, new HashMap<>()); try { host.addDesiredConfig(c1.getClusterId(), true, null, config); @@ -400,7 +400,7 @@ public class HostTest { Assert.assertTrue("Expect desired config to contain global", map.containsKey("global")); config = configFactory.createNew(c1, "global", "v2", - new HashMap<String,String>() {{ put("c", "d"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String,String>() {{ put("c", "d"); }}, new HashMap<>()); host.addDesiredConfig(c1.getClusterId(), true, "_test1", config); map = host.getDesiredConfigs(c1.getClusterId()); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosDescriptorUpdateHelperTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosDescriptorUpdateHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosDescriptorUpdateHelperTest.java index e717190..37cfad9 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosDescriptorUpdateHelperTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/kerberos/KerberosDescriptorUpdateHelperTest.java @@ -32,7 +32,6 @@ import org.apache.ambari.server.api.services.AmbariMetaInfo; import org.apache.ambari.server.configuration.Configuration; import org.apache.ambari.server.orm.DBAccessor; import org.apache.ambari.server.orm.dao.ExtensionLinkDAO; -import org.apache.ambari.server.orm.entities.ExtensionLinkEntity; import org.apache.ambari.server.orm.entities.MetainfoEntity; import org.apache.ambari.server.orm.entities.StackEntity; import org.apache.ambari.server.stack.StackManagerFactory; @@ -84,7 +83,7 @@ public class KerberosDescriptorUpdateHelperTest extends EasyMockSupport { expect(osFamily.os_list()).andReturn(Collections.singleton("centos6")).anyTimes(); ExtensionLinkDAO linkDao = injector.getInstance(ExtensionLinkDAO.class); - expect(linkDao.findByStack(anyString(), anyString())).andReturn(Collections.<ExtensionLinkEntity>emptyList()).anyTimes(); + expect(linkDao.findByStack(anyString(), anyString())).andReturn(Collections.emptyList()).anyTimes(); TypedQuery<StackEntity> query = createNiceMock(TypedQuery.class); expect(query.setMaxResults(1)).andReturn(query).anyTimes(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/FilterEvaluatorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/FilterEvaluatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/FilterEvaluatorTest.java index 8646413..5821006 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/FilterEvaluatorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/FilterEvaluatorTest.java @@ -61,7 +61,7 @@ public class FilterEvaluatorTest { */ @Test public void testWithEmptyFilters() throws Exception { - FilterEvaluator evaluator = new FilterEvaluator(new ArrayList<Filter>()); + FilterEvaluator evaluator = new FilterEvaluator(new ArrayList<>()); assertEquals(Optional.absent(), evaluator.isVisible(namenodeUi)); FilterEvaluator evaluator2 = new FilterEvaluator(null); @@ -129,7 +129,7 @@ public class FilterEvaluatorTest { */ @Test public void testHideFilterTakesPrecedence() throws Exception { - List<Filter> filters = Lists.<Filter>newArrayList( + List<Filter> filters = Lists.newArrayList( linkAttributeFilter(AUTHENTICATED, false), linkAttributeFilter(SSO, true)); FilterEvaluator evaluator = new FilterEvaluator(filters); @@ -168,7 +168,7 @@ public class FilterEvaluatorTest { */ @Test(expected = QuickLinksProfileEvaluationException.class) public void contradictingPropertyFiltersRejected() throws Exception { - List<Filter> filters = Lists.<Filter>newArrayList( + List<Filter> filters = Lists.newArrayList( linkAttributeFilter(SSO, true), linkAttributeFilter(SSO, false)); new FilterEvaluator(filters); @@ -180,7 +180,7 @@ public class FilterEvaluatorTest { */ @Test(expected = QuickLinksProfileEvaluationException.class) public void contradictingLinkAttributeFiltersRejected() throws Exception { - List<Filter> filters = Lists.<Filter>newArrayList( + List<Filter> filters = Lists.newArrayList( linkAttributeFilter(SSO, true), linkAttributeFilter(SSO, false)); new FilterEvaluator(filters); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinkVisibilityControllerTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinkVisibilityControllerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinkVisibilityControllerTest.java index 9e44e45..1a36b9d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinkVisibilityControllerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/quicklinksprofile/QuickLinkVisibilityControllerTest.java @@ -49,11 +49,11 @@ public class QuickLinkVisibilityControllerTest { */ @Test public void testNullsAreAccepted() throws Exception { - QuickLinksProfile profile = QuickLinksProfile.create(ImmutableList.<Filter>of(Filter.acceptAllFilter(true)), null); + QuickLinksProfile profile = QuickLinksProfile.create(ImmutableList.of(Filter.acceptAllFilter(true)), null); DefaultQuickLinkVisibilityController evaluator = new DefaultQuickLinkVisibilityController(profile); evaluator.isVisible(HDFS, namenodeUi); //should not throw NPE - Service service = Service.create(HDFS, ImmutableList.<Filter>of(Filter.acceptAllFilter(true)), null); + Service service = Service.create(HDFS, ImmutableList.of(Filter.acceptAllFilter(true)), null); profile = QuickLinksProfile.create(null, ImmutableList.of(service)); evaluator = new DefaultQuickLinkVisibilityController(profile); evaluator.isVisible(HDFS, namenodeUi); //should not throw NPE @@ -78,11 +78,11 @@ public class QuickLinkVisibilityControllerTest { @Test public void testLinkWithNoComponentField() throws Exception { Component component = Component.create(NAMENODE, - ImmutableList.<Filter>of(Filter.linkNameFilter(NAMENODE_UI, true))); + ImmutableList.of(Filter.linkNameFilter(NAMENODE_UI, true))); - Service service = Service.create(HDFS, ImmutableList.<Filter>of(), ImmutableList.of(component)); + Service service = Service.create(HDFS, ImmutableList.of(), ImmutableList.of(component)); - QuickLinksProfile profile = QuickLinksProfile.create(ImmutableList.<Filter>of(), ImmutableList.of(service)); + QuickLinksProfile profile = QuickLinksProfile.create(ImmutableList.of(), ImmutableList.of(service)); DefaultQuickLinkVisibilityController evaluator = new DefaultQuickLinkVisibilityController(profile); namenodeUi.setComponentName(null); assertFalse("Link should be hidden as there are no applicable filters", evaluator.isVisible(HDFS, namenodeUi)); @@ -95,15 +95,15 @@ public class QuickLinkVisibilityControllerTest { public void testComponentLevelFiltersEvaluatedFirst() throws Exception { Component component = Component.create( NAMENODE, - ImmutableList.<Filter>of(Filter.linkAttributeFilter(AUTHENTICATED, true))); + ImmutableList.of(Filter.linkAttributeFilter(AUTHENTICATED, true))); Service service = Service.create( HDFS, - ImmutableList.<Filter>of(Filter.linkAttributeFilter(AUTHENTICATED, false)), + ImmutableList.of(Filter.linkAttributeFilter(AUTHENTICATED, false)), ImmutableList.of(component)); QuickLinksProfile profile = QuickLinksProfile.create( - ImmutableList.<Filter>of(Filter.acceptAllFilter(false)), + ImmutableList.of(Filter.acceptAllFilter(false)), ImmutableList.of(service)); DefaultQuickLinkVisibilityController evaluator = new DefaultQuickLinkVisibilityController(profile); @@ -116,14 +116,14 @@ public class QuickLinkVisibilityControllerTest { @Test public void testServiceLevelFiltersEvaluatedSecondly() throws Exception { Component component = Component.create(NAMENODE, - ImmutableList.<Filter>of(Filter.linkAttributeFilter(SSO, false))); + ImmutableList.of(Filter.linkAttributeFilter(SSO, false))); Service service = Service.create(HDFS, - ImmutableList.<Filter>of(Filter.linkAttributeFilter(AUTHENTICATED, true)), + ImmutableList.of(Filter.linkAttributeFilter(AUTHENTICATED, true)), ImmutableList.of(component)); QuickLinksProfile profile = QuickLinksProfile.create( - ImmutableList.<Filter>of(Filter.acceptAllFilter(false)), + ImmutableList.of(Filter.acceptAllFilter(false)), ImmutableList.of(service)); DefaultQuickLinkVisibilityController evaluator = new DefaultQuickLinkVisibilityController(profile); @@ -136,14 +136,14 @@ public class QuickLinkVisibilityControllerTest { @Test public void testGlobalFiltersEvaluatedLast() throws Exception { Component component = Component.create(NAMENODE, - ImmutableList.<Filter>of(Filter.linkAttributeFilter(SSO, false))); + ImmutableList.of(Filter.linkAttributeFilter(SSO, false))); Service service = Service.create(HDFS, - ImmutableList.<Filter>of(Filter.linkAttributeFilter(SSO, false)), + ImmutableList.of(Filter.linkAttributeFilter(SSO, false)), ImmutableList.of(component)); QuickLinksProfile profile = QuickLinksProfile.create( - ImmutableList.<Filter>of(Filter.acceptAllFilter(true)), + ImmutableList.of(Filter.acceptAllFilter(true)), ImmutableList.of(service)); DefaultQuickLinkVisibilityController evaluator = new DefaultQuickLinkVisibilityController(profile); @@ -156,21 +156,21 @@ public class QuickLinkVisibilityControllerTest { @Test public void testNoMatchingRule() throws Exception { Component component1 = Component.create(NAMENODE, - ImmutableList.<Filter>of(Filter.linkAttributeFilter(SSO, true))); + ImmutableList.of(Filter.linkAttributeFilter(SSO, true))); Component component2 = Component.create("DATANODE", - ImmutableList.<Filter>of(Filter.acceptAllFilter(true))); + ImmutableList.of(Filter.acceptAllFilter(true))); Service service1 = Service.create(HDFS, - ImmutableList.<Filter>of(Filter.linkAttributeFilter(SSO, true)), + ImmutableList.of(Filter.linkAttributeFilter(SSO, true)), ImmutableList.of(component1, component2)); Service service2 = Service.create("YARN", - ImmutableList.<Filter>of(Filter.acceptAllFilter(true)), - ImmutableList.<Component>of()); + ImmutableList.of(Filter.acceptAllFilter(true)), + ImmutableList.of()); QuickLinksProfile profile = QuickLinksProfile.create( - ImmutableList.<Filter>of(Filter.linkAttributeFilter(SSO, true)), + ImmutableList.of(Filter.linkAttributeFilter(SSO, true)), ImmutableList.of(service1, service2)); DefaultQuickLinkVisibilityController evaluator = new DefaultQuickLinkVisibilityController(profile); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/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 61b0c31..0bb118a 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 @@ -202,7 +202,7 @@ public class AlertNoticeDispatchServiceTest extends AlertNoticeDispatchService { @Test public void testNoDispatch() throws Exception { EasyMock.expect(m_dao.findPendingNotices()).andReturn( - new ArrayList<AlertNoticeEntity>()).once(); + new ArrayList<>()).once(); // m_dispatchFactory should not be called at all EasyMock.replay(m_dao, m_dispatchFactory); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/state/services/RetryUpgradeActionServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/services/RetryUpgradeActionServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/services/RetryUpgradeActionServiceTest.java index e80a43e..f996a6b 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/state/services/RetryUpgradeActionServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/state/services/RetryUpgradeActionServiceTest.java @@ -295,7 +295,7 @@ public class RetryUpgradeActionServiceTest { hrc1.setRole(Role.ZOOKEEPER_SERVER); hrc1.setRoleCommand(RoleCommand.RESTART); - stageEntity.setHostRoleCommands(new ArrayList<HostRoleCommandEntity>()); + stageEntity.setHostRoleCommands(new ArrayList<>()); stageEntity.getHostRoleCommands().add(hrc1); hostRoleCommandDAO.create(hrc1); stageDAO.merge(stageEntity); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/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 54fd733..a989738 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 @@ -214,7 +214,7 @@ public class ServiceComponentHostTest { Cluster c = clusters.getCluster(clusterName); if (c.getConfig("time", String.valueOf(timestamp)) == null) { Config config = configFactory.createNew (c, "time", String.valueOf(timestamp), - new HashMap<String, String>(), new HashMap<String, Map<String,String>>()); + new HashMap<>(), new HashMap<>()); } switch (eventType) { @@ -541,7 +541,7 @@ public class ServiceComponentHostTest { Cluster cluster = clusters.getCluster(clusterName); final ConfigGroup configGroup = configGroupFactory.createNew(cluster, "HDFS", - "cg1", "t1", "", new HashMap<String, Config>(), new HashMap<Long, Host>()); + "cg1", "t1", "", new HashMap<>(), new HashMap<>()); cluster.addConfigGroup(configGroup); @@ -730,7 +730,7 @@ public class ServiceComponentHostTest { makeConfig(cluster, "hdfs-site", "version0", new HashMap<String,String>() {{ put("a", "b"); - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); Map<String, Map<String, String>> actual = new HashMap<String, Map<String, String>>() {{ put("hdfs-site", new HashMap<String,String>() {{ put("tag", "version0"); }}); @@ -741,14 +741,14 @@ public class ServiceComponentHostTest { sch3.updateActualConfigs(actual); makeConfig(cluster, "foo", "version1", - new HashMap<String,String>() {{ put("a", "c"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String,String>() {{ put("a", "c"); }}, new HashMap<>()); // HDP-x/HDFS does not define type 'foo', so changes do not count to stale Assert.assertFalse(sch1.convertToResponse(null).isStaleConfig()); Assert.assertFalse(sch2.convertToResponse(null).isStaleConfig()); makeConfig(cluster, "hdfs-site", "version1", - new HashMap<String,String>() {{ put("a1", "b1"); }}, new HashMap<String, Map<String,String>>()); + new HashMap<String,String>() {{ put("a1", "b1"); }}, new HashMap<>()); // HDP-x/HDFS/hdfs-site is not on the actual, but it is defined, so it is stale Assert.assertTrue(sch1.convertToResponse(null).isStaleConfig()); @@ -768,7 +768,7 @@ public class ServiceComponentHostTest { makeConfig(cluster, "hdfs-site", "version2", new HashMap<String, String>() {{ put("dfs.journalnode.http-address", "http://foo"); }}, - new HashMap<String, Map<String,String>>()); + new HashMap<>()); // HDP-x/HDFS/hdfs-site updated to changed property Assert.assertTrue(sch1.convertToResponse(null).isStaleConfig()); @@ -791,7 +791,7 @@ public class ServiceComponentHostTest { final Config c = configFactory.createNew(cluster, "hdfs-site", "version3", new HashMap<String, String>() {{ put("dfs.journalnode.http-address", "http://goo"); }}, - new HashMap<String, Map<String,String>>()); + new HashMap<>()); host.addDesiredConfig(cluster.getClusterId(), true, "user", c); ConfigGroup configGroup = configGroupFactory.createNew(cluster, "HDFS", "g1", @@ -816,7 +816,7 @@ public class ServiceComponentHostTest { makeConfig(cluster, "mapred-site", "version1", new HashMap<String, String>() {{ put("a", "b"); }}, - new HashMap<String, Map<String,String>>()); + new HashMap<>()); actual.put("mapred-site", new HashMap<String, String>() {{ put ("tag", "version1"); }}); @@ -835,7 +835,7 @@ public class ServiceComponentHostTest { new HashMap<String,String>() {{ put("a", "b"); put("fs.trash.interval", "360"); // HDFS only - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); Assert.assertTrue(sch1.convertToResponse(null).isStaleConfig()); Assert.assertTrue(sch2.convertToResponse(null).isStaleConfig()); @@ -849,7 +849,7 @@ public class ServiceComponentHostTest { final Config c1 = configFactory.createNew(cluster, "core-site", "version2", new HashMap<String, String>() {{ put("fs.trash.interval", "400"); }}, - new HashMap<String, Map<String,String>>()); + new HashMap<>()); configGroup = configGroupFactory.createNew(cluster, "HDFS", "g2", "t2", "", new HashMap<String, Config>() {{ put("core-site", c1); }}, new HashMap<Long, Host>() {{ put(hostEntity.getHostId(), host); }}); @@ -919,11 +919,11 @@ public class ServiceComponentHostTest { put("a", "b"); put("dfs_namenode_name_dir", "/foo1"); // HDFS only put("mapred_log_dir_prefix", "/foo2"); // MR2 only - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); makeConfig(cluster, "hdfs-site", "version1", new HashMap<String,String>() {{ put("hdfs1", "hdfs1value1"); - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); Map<String, Map<String, String>> actual = new HashMap<String, Map<String, String>>() {{ put("global", new HashMap<String,String>() {{ put("tag", "version1"); }}); put("hdfs-site", new HashMap<String,String>() {{ put("tag", "version1"); }}); @@ -953,7 +953,7 @@ public class ServiceComponentHostTest { // Now add config-attributes Map<String, Map<String, String>> c1PropAttributes = new HashMap<>(); - c1PropAttributes.put("final", new HashMap<String, String>()); + c1PropAttributes.put("final", new HashMap<>()); c1PropAttributes.get("final").put("hdfs1", "true"); makeConfig(cluster, "hdfs-site", "version2", new HashMap<String,String>() {{ @@ -968,7 +968,7 @@ public class ServiceComponentHostTest { // Now change config-attributes Map<String, Map<String, String>> c2PropAttributes = new HashMap<>(); - c2PropAttributes.put("final", new HashMap<String, String>()); + c2PropAttributes.put("final", new HashMap<>()); c2PropAttributes.get("final").put("hdfs1", "false"); makeConfig(cluster, "hdfs-site", "version3", new HashMap<String,String>() {{ @@ -985,7 +985,7 @@ public class ServiceComponentHostTest { makeConfig(cluster, "hdfs-site", "version4", new HashMap<String,String>() {{ put("hdfs1", "hdfs1value1"); - }}, new HashMap<String, Map<String,String>>()); + }}, new HashMap<>()); sch1.setRestartRequired(false); sch2.setRestartRequired(false); sch3.setRestartRequired(false); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/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 01af9fa..efafbea 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 @@ -191,8 +191,8 @@ public class AmbariContextTest { expect(type1Group1.getTag()).andReturn("group1").anyTimes(); expect(type1Group1.getProperties()).andReturn(group1ResolvedProperties).anyTimes(); expect(configFactory.createReadOnly(EasyMock.eq("type1"), EasyMock.eq("group1"), - EasyMock.<Map<String, String>> anyObject(), - EasyMock.<Map<String, Map<String, String>>> anyObject())).andReturn(type1Group1).anyTimes(); + EasyMock.anyObject(), + EasyMock.anyObject())).andReturn(type1Group1).anyTimes(); replay(type1Group1); Config type1Service1 = createNiceMock(Config.class); @@ -200,8 +200,8 @@ public class AmbariContextTest { expect(type1Service1.getTag()).andReturn("service1").anyTimes(); expect(type1Service1.getProperties()).andReturn(type1Props).anyTimes(); expect(configFactory.createReadOnly(EasyMock.eq("type1"), EasyMock.eq("service1"), - EasyMock.<Map<String, String>> anyObject(), - EasyMock.<Map<String, Map<String, String>>> anyObject())).andReturn( + EasyMock.anyObject(), + EasyMock.anyObject())).andReturn( type1Service1).anyTimes(); replay(type1Service1); @@ -434,7 +434,7 @@ public class AmbariContextTest { @Test public void testRegisterHostWithConfigGroup_createNewConfigGroup() throws Exception { // test specific expectations - expect(cluster.getConfigGroups()).andReturn(Collections.<Long, ConfigGroup>emptyMap()).once(); + expect(cluster.getConfigGroups()).andReturn(Collections.emptyMap()).once(); expect(clusterController.ensureResourceProvider(Resource.Type.ConfigGroup)).andReturn(configGroupResourceProvider).once(); //todo: for now not using return value so just returning null expect(configGroupResourceProvider.createResources(capture(configGroupRequestCapture))).andReturn(null).once(); @@ -474,7 +474,7 @@ public class AmbariContextTest { @Test public void testRegisterHostWithConfigGroup_createNewConfigGroupWithPendingHosts() throws Exception { // test specific expectations - expect(cluster.getConfigGroups()).andReturn(Collections.<Long, ConfigGroup>emptyMap()).once(); + expect(cluster.getConfigGroups()).andReturn(Collections.emptyMap()).once(); expect(clusterController.ensureResourceProvider(Resource.Type.ConfigGroup)).andReturn(configGroupResourceProvider).once(); //todo: for now not using return value so just returning null expect(configGroupResourceProvider.createResources(capture(configGroupRequestCapture))).andReturn(null).once(); @@ -553,7 +553,7 @@ public class AmbariContextTest { replayAll(); // verify that wait returns successfully with empty updated list passed in - context.waitForConfigurationResolution(CLUSTER_NAME, Collections.<String>emptySet()); + context.waitForConfigurationResolution(CLUSTER_NAME, Collections.emptySet()); } @Test http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/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 2650f3f..e7c0fe9 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 @@ -176,7 +176,7 @@ public class BlueprintFactoryTest { BlueprintFactory factoryUnderTest = new BlueprintFactory(mockStackFactory); - factoryUnderTest.createStack(new HashMap<String, Object>()); + factoryUnderTest.createStack(new HashMap<>()); mockSupport.verifyAll(); } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/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 c61a41c..a706428 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 @@ -87,7 +87,7 @@ public class BlueprintValidatorImplTest { private List<DependencyConditionInfo> dependenciesConditionInfos1 = new ArrayList<>(); private AutoDeployInfo autoDeploy = new AutoDeployInfo(); private Map<String, Map<String, String>> configProperties = new HashMap<>(); - private Configuration configuration = new Configuration(configProperties, Collections.<String, Map<String, Map<String, String>>>emptyMap()); + private Configuration configuration = new Configuration(configProperties, Collections.emptyMap()); @Before @@ -152,7 +152,7 @@ public class BlueprintValidatorImplTest { expect(stack.getComponents("service1")).andReturn(Arrays.asList("component1", "component2")).anyTimes(); - expect(blueprint.getHostGroupsForComponent("component1")).andReturn(Collections.<HostGroup>emptyList()).anyTimes(); + expect(blueprint.getHostGroupsForComponent("component1")).andReturn(Collections.emptyList()).anyTimes(); expect(blueprint.getHostGroupsForComponent("component2")).andReturn(Arrays.asList(group1, group2)).anyTimes(); replay(blueprint, stack, group1, group2, dependency1); @@ -165,7 +165,7 @@ public class BlueprintValidatorImplTest { group1Components.add("component2"); services.addAll(Collections.singleton("service1")); - expect(blueprint.getHostGroupsForComponent("component1")).andReturn(Collections.<HostGroup>emptyList()).anyTimes(); + expect(blueprint.getHostGroupsForComponent("component1")).andReturn(Collections.emptyList()).anyTimes(); expect(blueprint.getHostGroupsForComponent("component2")).andReturn(Arrays.asList(group1, group2)).anyTimes(); expect(stack.getComponents("service1")).andReturn(Arrays.asList("component1", "component2")).anyTimes(); @@ -186,9 +186,9 @@ public class BlueprintValidatorImplTest { dependencies1.add(dependency1); services.addAll(Collections.singleton("service1")); - expect(blueprint.getHostGroupsForComponent("component1")).andReturn(Collections.<HostGroup>emptyList()).anyTimes(); + expect(blueprint.getHostGroupsForComponent("component1")).andReturn(Collections.emptyList()).anyTimes(); expect(blueprint.getHostGroupsForComponent("component2")).andReturn(Arrays.asList(group1, group2)).anyTimes(); - expect(blueprint.getHostGroupsForComponent("component3")).andReturn(Collections.<HostGroup>emptyList()).anyTimes(); + expect(blueprint.getHostGroupsForComponent("component3")).andReturn(Collections.emptyList()).anyTimes(); expect(stack.getComponents("service1")).andReturn(Arrays.asList("component1", "component2")).anyTimes(); expect(stack.getComponents("service2")).andReturn(Collections.singleton("component3")).anyTimes(); @@ -228,7 +228,7 @@ public class BlueprintValidatorImplTest { services.addAll(Arrays.asList("HIVE")); - Configuration config = new Configuration(new HashMap<String, Map<String, String>>(), new HashMap<String, Map<String, Map<String, String>>>()); + Configuration config = new Configuration(new HashMap<>(), new HashMap<>()); expect(group1.getConfiguration()).andReturn(config).anyTimes(); expect(stack.getComponents("HIVE")).andReturn(Collections.singleton("HIVE_METASTORE")).anyTimes(); @@ -252,7 +252,7 @@ public class BlueprintValidatorImplTest { services.addAll(Arrays.asList("OOZIE")); - Configuration config = new Configuration(new HashMap<String, Map<String, String>>(), new HashMap<String, Map<String, Map<String, String>>>()); + Configuration config = new Configuration(new HashMap<>(), new HashMap<>()); expect(group1.getConfiguration()).andReturn(config).anyTimes(); expect(stack.getComponents("OOZIE")).andReturn(Collections.singleton("OOZIE_SERVER")).anyTimes(); @@ -375,7 +375,7 @@ public class BlueprintValidatorImplTest { properties.put("yarn-site", typeProps); Configuration clusterConfig = new Configuration(properties, - Collections.<String, Map<String, Map<String, String>>>emptyMap()); + Collections.emptyMap()); Cardinality cardinality = new Cardinality("1"); @@ -400,8 +400,8 @@ public class BlueprintValidatorImplTest { expect(dependency2.getName()).andReturn("dependency-2").anyTimes(); expect(dependency2.hasDependencyConditions()).andReturn(false).anyTimes(); - expect(dependencyConditionInfo1.isResolved(EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(true).anyTimes(); - expect(dependencyConditionInfo2.isResolved(EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(false).anyTimes(); + expect(dependencyConditionInfo1.isResolved(EasyMock.anyObject())).andReturn(true).anyTimes(); + expect(dependencyConditionInfo2.isResolved(EasyMock.anyObject())).andReturn(false).anyTimes(); expect(dependencyComponentInfo.isClient()).andReturn(false).anyTimes();