You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2017/03/29 22:40:33 UTC
[15/50] [abbrv] ambari git commit: AMBARI-19149. Code cleanup:
redundant type arguments
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandlerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandlerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandlerTest.java
index ea8b1b0..603f744 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandlerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/ADKerberosOperationHandlerTest.java
@@ -465,7 +465,7 @@ public class ADKerberosOperationHandlerTest extends KerberosOperationHandlerTest
@Test
public void testDigests() throws Exception {
PrincipalKeyCredential kc = new PrincipalKeyCredential(DEFAULT_ADMIN_PRINCIPAL, DEFAULT_ADMIN_PASSWORD);
- Map<String, String> kerberosEnvMap = new HashMap<String, String>();
+ Map<String, String> kerberosEnvMap = new HashMap<>();
kerberosEnvMap.put(ADKerberosOperationHandler.KERBEROS_ENV_LDAP_URL, DEFAULT_LDAP_URL);
kerberosEnvMap.put(ADKerberosOperationHandler.KERBEROS_ENV_PRINCIPAL_CONTAINER_DN, DEFAULT_PRINCIPAL_CONTAINER_DN);
kerberosEnvMap.put(ADKerberosOperationHandler.KERBEROS_ENV_AD_CREATE_ATTRIBUTES_TEMPLATE, "" +
@@ -560,7 +560,7 @@ public class ADKerberosOperationHandlerTest extends KerberosOperationHandlerTest
}
PrincipalKeyCredential credentials = new PrincipalKeyCredential(principal, password);
- Map<String, String> kerberosEnvMap = new HashMap<String, String>();
+ Map<String, String> kerberosEnvMap = new HashMap<>();
kerberosEnvMap.put(ADKerberosOperationHandler.KERBEROS_ENV_LDAP_URL, ldapUrl);
kerberosEnvMap.put(ADKerberosOperationHandler.KERBEROS_ENV_PRINCIPAL_CONTAINER_DN, containerDN);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/FinalizeKerberosServerActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/FinalizeKerberosServerActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/FinalizeKerberosServerActionTest.java
index 9404480..8d6ecc3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/FinalizeKerberosServerActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/FinalizeKerberosServerActionTest.java
@@ -82,7 +82,7 @@ public class FinalizeKerberosServerActionTest extends EasyMockSupport {
replayAll();
- ConcurrentMap<String, Object> requestSharedDataContext = new ConcurrentHashMap<String, Object>();
+ ConcurrentMap<String, Object> requestSharedDataContext = new ConcurrentHashMap<>();
FinalizeKerberosServerAction action = injector.getInstance(FinalizeKerberosServerAction.class);
action.setExecutionCommand(executionCommand);
@@ -113,7 +113,7 @@ public class FinalizeKerberosServerActionTest extends EasyMockSupport {
replayAll();
- ConcurrentMap<String, Object> requestSharedDataContext = new ConcurrentHashMap<String, Object>();
+ ConcurrentMap<String, Object> requestSharedDataContext = new ConcurrentHashMap<>();
FinalizeKerberosServerAction action = injector.getInstance(FinalizeKerberosServerAction.class);
action.setExecutionCommand(executionCommand);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandlerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandlerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandlerTest.java
index 3f9ee42..68f6f6d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandlerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/KerberosOperationHandlerTest.java
@@ -84,7 +84,7 @@ public abstract class KerberosOperationHandlerTest extends EasyMockSupport {
File file = folder.newFile();
final String principal1 = "principal1@REALM.COM";
final String principal2 = "principal2@REALM.COM";
- Set<String> seenEntries = new HashSet<String>();
+ Set<String> seenEntries = new HashSet<>();
Assert.assertTrue(handler.createKeytabFile(principal1, "some password", 0, file));
Assert.assertTrue(handler.createKeytabFile(principal2, "some password", 0, file));
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/KerberosServerActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/KerberosServerActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/KerberosServerActionTest.java
index 863e4f5..f63e6b8 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/KerberosServerActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/kerberos/KerberosServerActionTest.java
@@ -56,7 +56,7 @@ import junit.framework.Assert;
public class KerberosServerActionTest {
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
File temporaryDirectory;
private Injector injector;
private KerberosServerAction action;
@@ -169,8 +169,8 @@ public class KerberosServerActionTest {
@Test
public void testSetPrincipalPasswordMapStatic() throws Exception {
- ConcurrentMap<String, Object> sharedMap = new ConcurrentHashMap<String, Object>();
- Map<String, String> dataMap = new HashMap<String, String>();
+ ConcurrentMap<String, Object> sharedMap = new ConcurrentHashMap<>();
+ Map<String, String> dataMap = new HashMap<>();
KerberosServerAction.setPrincipalPasswordMap(sharedMap, dataMap);
Assert.assertSame(dataMap, KerberosServerAction.getPrincipalPasswordMap(sharedMap));
@@ -178,7 +178,7 @@ public class KerberosServerActionTest {
@Test
public void testGetPrincipalPasswordMapStatic() throws Exception {
- ConcurrentMap<String, Object> sharedMap = new ConcurrentHashMap<String, Object>();
+ ConcurrentMap<String, Object> sharedMap = new ConcurrentHashMap<>();
Assert.assertNotNull(KerberosServerAction.getPrincipalPasswordMap(sharedMap));
}
@@ -196,7 +196,7 @@ public class KerberosServerActionTest {
replay(kerberosHelper);
- ConcurrentMap<String, Object> sharedMap = new ConcurrentHashMap<String, Object>();
+ ConcurrentMap<String, Object> sharedMap = new ConcurrentHashMap<>();
CommandReport report = action.processIdentities(sharedMap);
Assert.assertNotNull(report);
Assert.assertEquals(HostRoleStatus.COMPLETED.toString(), report.getStatus());
@@ -218,7 +218,7 @@ public class KerberosServerActionTest {
replay(kerberosHelper);
- ConcurrentMap<String, Object> sharedMap = new ConcurrentHashMap<String, Object>();
+ ConcurrentMap<String, Object> sharedMap = new ConcurrentHashMap<>();
sharedMap.put("FAIL", "true");
CommandReport report = action.processIdentities(sharedMap);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/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 0442add..722ab0c 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
@@ -97,7 +97,7 @@ public class UpdateKerberosConfigsServerActionTest extends EasyMockSupport{
@Test
public void testUpdateConfig() throws Exception {
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put(KerberosServerAction.DATA_DIRECTORY, dataDir);
ExecutionCommand executionCommand = new ExecutionCommand();
@@ -119,7 +119,7 @@ public class UpdateKerberosConfigsServerActionTest extends EasyMockSupport{
@Test
public void testUpdateConfigMissingDataDirectory() throws Exception {
ExecutionCommand executionCommand = new ExecutionCommand();
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
executionCommand.setCommandParams(commandParams);
replayAll();
@@ -133,7 +133,7 @@ public class UpdateKerberosConfigsServerActionTest extends EasyMockSupport{
@Test
public void testUpdateConfigEmptyDataDirectory() throws Exception {
ExecutionCommand executionCommand = new ExecutionCommand();
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put(KerberosServerAction.DATA_DIRECTORY, testFolder.newFolder().getAbsolutePath());
executionCommand.setCommandParams(commandParams);
@@ -147,7 +147,7 @@ public class UpdateKerberosConfigsServerActionTest extends EasyMockSupport{
@Test
public void testUpdateConfigForceSecurityEnabled() throws Exception {
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put(KerberosServerAction.DATA_DIRECTORY, dataDir);
ExecutionCommand executionCommand = new ExecutionCommand();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AutoSkipFailedSummaryActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AutoSkipFailedSummaryActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AutoSkipFailedSummaryActionTest.java
index 9f27257..fbad1b1 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AutoSkipFailedSummaryActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/AutoSkipFailedSummaryActionTest.java
@@ -183,7 +183,7 @@ public class AutoSkipFailedSummaryActionTest {
anyObject(HostRoleStatus.class), anyLong(), anyLong())).andReturn(skippedTasks).anyTimes();
replay(hostRoleCommandDAOMock);
- ConcurrentMap<String, Object> requestSharedDataContext = new ConcurrentHashMap<String, Object>();
+ ConcurrentMap<String, Object> requestSharedDataContext = new ConcurrentHashMap<>();
CommandReport result = action.execute(requestSharedDataContext);
assertNotNull(result.getStructuredOut());
@@ -260,7 +260,7 @@ public class AutoSkipFailedSummaryActionTest {
anyObject(HostRoleStatus.class), anyLong(), anyLong())).andReturn(skippedTasks).anyTimes();
replay(hostRoleCommandDAOMock);
- ConcurrentMap<String, Object> requestSharedDataContext = new ConcurrentHashMap<String, Object>();
+ ConcurrentMap<String, Object> requestSharedDataContext = new ConcurrentHashMap<>();
CommandReport result = action.execute(requestSharedDataContext);
assertNotNull(result.getStructuredOut());
@@ -340,7 +340,7 @@ public class AutoSkipFailedSummaryActionTest {
anyObject(HostRoleStatus.class), anyLong(), anyLong())).andReturn(skippedTasks).anyTimes();
replay(hostRoleCommandDAOMock);
- ConcurrentMap<String, Object> requestSharedDataContext = new ConcurrentHashMap<String, Object>();
+ ConcurrentMap<String, Object> requestSharedDataContext = new ConcurrentHashMap<>();
CommandReport result = action.execute(requestSharedDataContext);
assertNotNull(result.getStructuredOut());
@@ -418,7 +418,7 @@ public class AutoSkipFailedSummaryActionTest {
anyObject(HostRoleStatus.class), anyLong(), anyLong())).andReturn(skippedTasks).anyTimes();
replay(hostRoleCommandDAOMock);
- ConcurrentMap<String, Object> requestSharedDataContext = new ConcurrentHashMap<String, Object>();
+ ConcurrentMap<String, Object> requestSharedDataContext = new ConcurrentHashMap<>();
CommandReport result = action.execute(requestSharedDataContext);
assertNotNull(result.getStructuredOut());
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckActionTest.java
index ceaa83a..e02a1be 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/ComponentVersionCheckActionTest.java
@@ -159,7 +159,7 @@ public class ComponentVersionCheckActionTest {
Host host = clusters.getHost(hostName);
- Map<String, String> hostAttributes = new HashMap<String, String>();
+ Map<String, String> hostAttributes = new HashMap<>();
hostAttributes.put("os_family", "redhat");
hostAttributes.put("os_release_version", "6");
host.setHostAttributes(hostAttributes);
@@ -213,7 +213,7 @@ public class ComponentVersionCheckActionTest {
clusters.addHost(hostName);
Host host = clusters.getHost(hostName);
- Map<String, String> hostAttributes = new HashMap<String, String>();
+ Map<String, String> hostAttributes = new HashMap<>();
hostAttributes.put("os_family", "redhat");
hostAttributes.put("os_release_version", "6");
host.setHostAttributes(hostAttributes);
@@ -273,7 +273,7 @@ public class ComponentVersionCheckActionTest {
assertEquals(HDP_211_CENTOS6_REPO_URL, repo.getBaseUrl());
// Finalize the upgrade
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put(FinalizeUpgradeAction.UPGRADE_DIRECTION_KEY, "upgrade");
commandParams.put(FinalizeUpgradeAction.VERSION_KEY, targetRepo);
@@ -348,7 +348,7 @@ public class ComponentVersionCheckActionTest {
// now finalize and ensure we can transition from UPGRADING to UPGRADED
// automatically before CURRENT
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put(FinalizeUpgradeAction.UPGRADE_DIRECTION_KEY, "upgrade");
commandParams.put(FinalizeUpgradeAction.VERSION_KEY, targetRepo);
commandParams.put(FinalizeUpgradeAction.ORIGINAL_STACK_KEY, sourceStack.getStackId());
@@ -417,8 +417,8 @@ public class ComponentVersionCheckActionTest {
}
private void createConfigs(Cluster cluster) {
- Map<String, String> properties = new HashMap<String, String>();
- Map<String, Map<String, String>> propertiesAttributes = new HashMap<String, Map<String, String>>();
+ Map<String, String> properties = new HashMap<>();
+ Map<String, Map<String, String>> propertiesAttributes = new HashMap<>();
properties.put("a", "a1");
properties.put("b", "b1");
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixOozieAdminUsersTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixOozieAdminUsersTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixOozieAdminUsersTest.java
index d4c90b8..29cfd84 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixOozieAdminUsersTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixOozieAdminUsersTest.java
@@ -90,7 +90,7 @@ public class FixOozieAdminUsersTest {
@Test
public void testOozieAdminUserUpdated() throws Exception {
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put("clusterName", "c1");
ExecutionCommand executionCommand = new ExecutionCommand();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixYarnWebServiceUrlTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixYarnWebServiceUrlTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixYarnWebServiceUrlTest.java
index 737ece8..9106c1d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixYarnWebServiceUrlTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/FixYarnWebServiceUrlTest.java
@@ -88,7 +88,7 @@ public class FixYarnWebServiceUrlTest {
expect(cluster.getDesiredConfigByType(SOURCE_CONFIG_TYPE)).andReturn(yarnSiteConfig).atLeastOnce();
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put("clusterName", "c1");
ExecutionCommand executionCommand = new ExecutionCommand();
@@ -145,7 +145,7 @@ public class FixYarnWebServiceUrlTest {
expect(cluster.getDesiredConfigByType(SOURCE_CONFIG_TYPE)).andReturn(yarnSiteConfig).atLeastOnce();
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put("clusterName", "c1");
ExecutionCommand executionCommand = new ExecutionCommand();
@@ -202,7 +202,7 @@ public class FixYarnWebServiceUrlTest {
expect(cluster.getDesiredConfigByType(SOURCE_CONFIG_TYPE)).andReturn(yarnSiteConfig).atLeastOnce();
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put("clusterName", "c1");
ExecutionCommand executionCommand = new ExecutionCommand();
@@ -261,7 +261,7 @@ public class FixYarnWebServiceUrlTest {
expect(cluster.getDesiredConfigByType(SOURCE_CONFIG_TYPE)).andReturn(yarnSiteConfig).atLeastOnce();
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put("clusterName", "c1");
ExecutionCommand executionCommand = new ExecutionCommand();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HBaseEnvMaxDirectMemorySizeActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HBaseEnvMaxDirectMemorySizeActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HBaseEnvMaxDirectMemorySizeActionTest.java
index f8a5373..6ab6f3d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HBaseEnvMaxDirectMemorySizeActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HBaseEnvMaxDirectMemorySizeActionTest.java
@@ -146,7 +146,7 @@ public class HBaseEnvMaxDirectMemorySizeActionTest {
@Test
public void testAction() throws Exception {
Pattern regex = Pattern.compile("^.*\\s*(HBASE_MASTER_OPTS)\\s*=.*(XX:MaxDirectMemorySize).*$", Pattern.MULTILINE);
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put("clusterName", "c1");
ExecutionCommand executionCommand = new ExecutionCommand();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveEnvClasspathActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveEnvClasspathActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveEnvClasspathActionTest.java
index 8926203..939e2fb 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveEnvClasspathActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/HiveEnvClasspathActionTest.java
@@ -127,7 +127,7 @@ public class HiveEnvClasspathActionTest {
@Test
public void testAction() throws Exception {
Pattern regex = Pattern.compile("^\\s*export\\s(?<property>HIVE_HOME|HIVE_CONF_DIR)\\s*=\\s*(?<value>.*)$", Pattern.MULTILINE);
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put("clusterName", "c1");
ExecutionCommand executionCommand = new ExecutionCommand();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/KerberosKeytabsActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/KerberosKeytabsActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/KerberosKeytabsActionTest.java
index d18f727..c0c5e78 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/KerberosKeytabsActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/KerberosKeytabsActionTest.java
@@ -97,7 +97,7 @@ public class KerberosKeytabsActionTest {
expect(m_kerberosHelper.isClusterKerberosEnabled(EasyMock.anyObject(Cluster.class))).andReturn(Boolean.FALSE).atLeastOnce();
replay(m_kerberosHelper);
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put("clusterName", "c1");
ExecutionCommand executionCommand = new ExecutionCommand();
@@ -129,7 +129,7 @@ public class KerberosKeytabsActionTest {
expect(m_kerberosHelper.isClusterKerberosEnabled(EasyMock.anyObject(Cluster.class))).andReturn(Boolean.TRUE).atLeastOnce();
replay(m_kerberosHelper);
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put("clusterName", "c1");
ExecutionCommand executionCommand = new ExecutionCommand();
@@ -162,7 +162,7 @@ public class KerberosKeytabsActionTest {
replay(m_kerberosHelper);
m_kerberosConfig.getProperties().put("kdc_type", "mit-kdc");
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put("clusterName", "c1");
ExecutionCommand executionCommand = new ExecutionCommand();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerConfigCalculationTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerConfigCalculationTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerConfigCalculationTest.java
index 7a6a6c3..94e12f5 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerConfigCalculationTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerConfigCalculationTest.java
@@ -67,7 +67,7 @@ public class RangerConfigCalculationTest {
expect(adminConfig.getType()).andReturn("admin-properties").anyTimes();
expect(adminConfig.getProperties()).andReturn(mockProperties).anyTimes();
- mockProperties = new HashMap<String, String>();
+ mockProperties = new HashMap<>();
Config adminSiteConfig = EasyMock.createNiceMock(Config.class);
expect(adminSiteConfig.getType()).andReturn("admin-properties").anyTimes();
@@ -94,7 +94,7 @@ public class RangerConfigCalculationTest {
@Test
public void testAction() throws Exception {
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put("clusterName", "c1");
ExecutionCommand executionCommand = new ExecutionCommand();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/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 06092c3..3627151 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
@@ -129,7 +129,7 @@ public class RangerKerberosConfigCalculationTest {
@Test
public void testAction() throws Exception {
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put("clusterName", "c1");
ExecutionCommand executionCommand = new ExecutionCommand();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKmsProxyConfigTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKmsProxyConfigTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKmsProxyConfigTest.java
index 7a0d66f..214ef17 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKmsProxyConfigTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerKmsProxyConfigTest.java
@@ -83,7 +83,7 @@ public class RangerKmsProxyConfigTest {
@Test
public void testAction() throws Exception {
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put("clusterName", "c1");
ExecutionCommand executionCommand = new ExecutionCommand();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
index 273abcd..5d2e605 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/RangerWebAlertConfigActionTest.java
@@ -89,7 +89,7 @@ public class RangerWebAlertConfigActionTest {
Mockito.when(m_clusters.getCluster(Mockito.anyString())).thenReturn(cluster);
Mockito.when(cluster.getClusterId()).thenReturn(1L);
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put("clusterName", CLUSTER_NAME);
@@ -136,7 +136,7 @@ public class RangerWebAlertConfigActionTest {
rangerWebAlertConfigAction.setExecutionCommand(m_executionCommand);
rangerWebAlertConfigAction.setHostRoleCommand(hrc);
- ConcurrentMap<String, Object> requestSharedDataContext = new ConcurrentHashMap<String, Object>();
+ ConcurrentMap<String, Object> requestSharedDataContext = new ConcurrentHashMap<>();
CommandReport commandReport = null;
try {
commandReport = rangerWebAlertConfigAction.execute(requestSharedDataContext);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
index bb76a71..a17c40d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeActionTest.java
@@ -193,7 +193,7 @@ public class UpgradeActionTest {
Host host = clusters.getHost(hostName);
- Map<String, String> hostAttributes = new HashMap<String, String>();
+ Map<String, String> hostAttributes = new HashMap<>();
hostAttributes.put("os_family", "redhat");
hostAttributes.put("os_release_version", "6");
host.setHostAttributes(hostAttributes);
@@ -230,7 +230,7 @@ public class UpgradeActionTest {
Host host = clusters.getHost(hostName);
- Map<String, String> hostAttributes = new HashMap<String, String>();
+ Map<String, String> hostAttributes = new HashMap<>();
hostAttributes.put("os_family", "redhat");
hostAttributes.put("os_release_version", "6");
host.setHostAttributes(hostAttributes);
@@ -293,7 +293,7 @@ public class UpgradeActionTest {
Host host = clusters.getHost(hostName);
- Map<String, String> hostAttributes = new HashMap<String, String>();
+ Map<String, String> hostAttributes = new HashMap<>();
hostAttributes.put("os_family", "redhat");
hostAttributes.put("os_release_version", "6");
host.setHostAttributes(hostAttributes);
@@ -379,7 +379,7 @@ public class UpgradeActionTest {
clusters.addHost(hostName);
Host host = clusters.getHost(hostName);
- Map<String, String> hostAttributes = new HashMap<String, String>();
+ Map<String, String> hostAttributes = new HashMap<>();
hostAttributes.put("os_family", "redhat");
hostAttributes.put("os_release_version", "6");
host.setHostAttributes(hostAttributes);
@@ -468,7 +468,7 @@ public class UpgradeActionTest {
Collection<Config> configs = cluster.getAllConfigs();
Assert.assertFalse(configs.isEmpty());
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put(UpdateDesiredStackAction.COMMAND_PARAM_ORIGINAL_STACK, sourceStack.getStackId());
commandParams.put(UpdateDesiredStackAction.COMMAND_PARAM_TARGET_STACK, targetStack.getStackId());
commandParams.put(UpdateDesiredStackAction.COMMAND_PARAM_DIRECTION, Direction.UPGRADE.toString());
@@ -514,7 +514,7 @@ public class UpgradeActionTest {
makeDowngradeCluster(sourceStack, sourceRepo, targetStack, targetRepo);
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put(FinalizeUpgradeAction.UPGRADE_DIRECTION_KEY, "downgrade");
commandParams.put(FinalizeUpgradeAction.VERSION_KEY, sourceRepo);
commandParams.put(FinalizeUpgradeAction.ORIGINAL_STACK_KEY, sourceStack.getStackId());
@@ -572,7 +572,7 @@ public class UpgradeActionTest {
makeTwoUpgradesWhereLastDidNotComplete(sourceStack, sourceRepo, midStack, midRepo, targetStack, targetRepo);
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put(FinalizeUpgradeAction.UPGRADE_DIRECTION_KEY, "downgrade");
commandParams.put(FinalizeUpgradeAction.VERSION_KEY, midRepo);
commandParams.put(FinalizeUpgradeAction.ORIGINAL_STACK_KEY, sourceStack.getStackId());
@@ -615,7 +615,7 @@ public class UpgradeActionTest {
verifyBaseRepoURL(helper, cluster, host, HDP_211_CENTOS6_REPO_URL);
// Finalize the upgrade
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put(FinalizeUpgradeAction.UPGRADE_DIRECTION_KEY, "upgrade");
commandParams.put(FinalizeUpgradeAction.VERSION_KEY, targetRepo);
@@ -679,7 +679,7 @@ public class UpgradeActionTest {
verifyBaseRepoURL(helper, cluster, host, HDP_211_CENTOS6_REPO_URL);
// Finalize the upgrade
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put(FinalizeUpgradeAction.UPGRADE_DIRECTION_KEY, "upgrade");
commandParams.put(FinalizeUpgradeAction.VERSION_KEY, targetRepo);
@@ -728,7 +728,7 @@ public class UpgradeActionTest {
cluster.setCurrentStackVersion(sourceStack);
cluster.setDesiredStackVersion(targetStack);
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put(FinalizeUpgradeAction.UPGRADE_DIRECTION_KEY, "upgrade");
commandParams.put(FinalizeUpgradeAction.VERSION_KEY, targetRepo);
commandParams.put(FinalizeUpgradeAction.ORIGINAL_STACK_KEY, sourceStack.getStackId());
@@ -801,7 +801,7 @@ public class UpgradeActionTest {
Collection<Config> configs = cluster.getAllConfigs();
assertEquals(8, configs.size());
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put(FinalizeUpgradeAction.UPGRADE_DIRECTION_KEY, "downgrade");
commandParams.put(FinalizeUpgradeAction.VERSION_KEY, sourceRepo);
commandParams.put(FinalizeUpgradeAction.ORIGINAL_STACK_KEY, sourceStack.getStackId());
@@ -908,7 +908,7 @@ public class UpgradeActionTest {
// now finalize and ensure we can transition from UPGRADING to UPGRADED
// automatically before CURRENT
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put(FinalizeUpgradeAction.UPGRADE_DIRECTION_KEY, "upgrade");
commandParams.put(FinalizeUpgradeAction.VERSION_KEY, targetRepo);
commandParams.put(FinalizeUpgradeAction.ORIGINAL_STACK_KEY, sourceStack.getStackId());
@@ -1000,7 +1000,7 @@ public class UpgradeActionTest {
// Finalize the upgrade, passing in the request ID so that history is
// created
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put(FinalizeUpgradeAction.REQUEST_ID, String.valueOf(requestEntity.getRequestId()));
commandParams.put(FinalizeUpgradeAction.UPGRADE_DIRECTION_KEY, "upgrade");
commandParams.put(FinalizeUpgradeAction.VERSION_KEY, targetRepo);
@@ -1074,8 +1074,8 @@ public class UpgradeActionTest {
}
private void createConfigs(Cluster cluster) {
- Map<String, String> properties = new HashMap<String, String>();
- Map<String, Map<String, String>> propertiesAttributes = new HashMap<String, Map<String, String>>();
+ Map<String, String> properties = new HashMap<>();
+ Map<String, Map<String, String>> propertiesAttributes = new HashMap<>();
properties.put("a", "a1");
properties.put("b", "b1");
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeUserKerberosDescriptorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeUserKerberosDescriptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeUserKerberosDescriptorTest.java
index 5a78c81..643adc9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeUserKerberosDescriptorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/serveraction/upgrades/UpgradeUserKerberosDescriptorTest.java
@@ -83,7 +83,7 @@ public class UpgradeUserKerberosDescriptorTest {
@Test
public void testUpgrade() throws Exception {
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put("clusterName", "c1");
commandParams.put("upgrade_direction", "UPGRADE");
commandParams.put("original_stack", "HDP-2.4");
@@ -141,7 +141,7 @@ public class UpgradeUserKerberosDescriptorTest {
@Test
public void testDowngrade() throws Exception {
- Map<String, String> commandParams = new HashMap<String, String>();
+ Map<String, String> commandParams = new HashMap<>();
commandParams.put("clusterName", "c1");
commandParams.put("upgrade_direction", "DOWNGRADE");
commandParams.put("original_stack", "HDP-2.4");
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/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 746b974..fc5fa62 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
@@ -91,7 +91,7 @@ public class ComponentModuleTest {
@Test
public void testResolve_ClientConfigFiles() {
- List<ClientConfigFileDefinition> clientConfigs = new ArrayList<ClientConfigFileDefinition>();
+ List<ClientConfigFileDefinition> clientConfigs = new ArrayList<>();
ClientConfigFileDefinition clientConfig1 = new ClientConfigFileDefinition();
clientConfig1.setType("type1");
clientConfig1.setDictionaryName("dictName1");
@@ -116,7 +116,7 @@ public class ComponentModuleTest {
assertEquals(clientConfigs, resolveComponent(info, parentInfo).getModuleInfo().getClientConfigFiles());
// value set in both parent and child; child overwrites with no merge
- List<ClientConfigFileDefinition> clientConfigs2 = new ArrayList<ClientConfigFileDefinition>();
+ List<ClientConfigFileDefinition> clientConfigs2 = new ArrayList<>();
ClientConfigFileDefinition clientConfig3 = new ClientConfigFileDefinition();
clientConfig3.setType("type1");
clientConfig3.setDictionaryName("dictName1");
@@ -204,7 +204,7 @@ public class ComponentModuleTest {
@Test
public void testResolve_Dependencies() {
- List<DependencyInfo> dependencies = new ArrayList<DependencyInfo>();
+ List<DependencyInfo> dependencies = new ArrayList<>();
DependencyInfo dependency1 = new DependencyInfo();
dependency1.setName("service/one");
DependencyInfo dependency2 = new DependencyInfo();
@@ -226,7 +226,7 @@ public class ComponentModuleTest {
// value set in both parent and child; merge parent and child
//todo: currently there is no way to remove an inherited dependency
- List<DependencyInfo> dependencies2 = new ArrayList<DependencyInfo>();
+ List<DependencyInfo> dependencies2 = new ArrayList<>();
DependencyInfo dependency3 = new DependencyInfo();
dependency3.setName("service/two");
DependencyInfo dependency4 = new DependencyInfo();
@@ -246,7 +246,7 @@ public class ComponentModuleTest {
@Test
public void testResolve_CustomCommands() throws Exception {
- List<CustomCommandDefinition> commands = new ArrayList<CustomCommandDefinition>();
+ List<CustomCommandDefinition> commands = new ArrayList<>();
CustomCommandDefinition command1 = new CustomCommandDefinition();
setPrivateField(command1, "name", "one");
CustomCommandDefinition command2 = new CustomCommandDefinition();
@@ -268,7 +268,7 @@ public class ComponentModuleTest {
// value set in both parent and child; merge parent and child
//todo: currently there is no way to remove an inherited command
- List<CustomCommandDefinition> commands2 = new ArrayList<CustomCommandDefinition>();
+ List<CustomCommandDefinition> commands2 = new ArrayList<>();
CustomCommandDefinition command3 = new CustomCommandDefinition();
// override command 2
setPrivateField(command3, "name", "two");
@@ -292,7 +292,7 @@ public class ComponentModuleTest {
// merged if any config dependency is specified in the child. So, the merged result is either the child
// dependencies or if null, the parent dependencies.
public void testResolve_ConfigDependencies() {
- List<String> dependencies = new ArrayList<String>();
+ List<String> dependencies = new ArrayList<>();
String dependency1 = "one";
String dependency2 = "two";
dependencies.add(dependency1);
@@ -311,7 +311,7 @@ public class ComponentModuleTest {
assertEquals(dependencies, resolveComponent(info, parentInfo).getModuleInfo().getConfigDependencies());
// value set in both parent and child; merge parent and child
- List<String> dependencies2 = new ArrayList<String>();
+ List<String> dependencies2 = new ArrayList<>();
String dependency3 = "two";
String dependency4 = "four";
dependencies2.add(dependency3);
@@ -331,7 +331,7 @@ public class ComponentModuleTest {
// in that the collections aren't merged if any "client to update configs" is specified in the child.
// So, the merged result is either the child collection or if null, the parent collection.
public void testResolve_ClientToUpdateConfigs() {
- List<String> clientsToUpdate = new ArrayList<String>();
+ List<String> clientsToUpdate = new ArrayList<>();
String client1 = "one";
String client2 = "two";
clientsToUpdate.add(client1);
@@ -350,7 +350,7 @@ public class ComponentModuleTest {
assertEquals(clientsToUpdate, resolveComponent(info, parentInfo).getModuleInfo().getClientsToUpdateConfigs());
// value set in both parent and child; merge parent and child
- List<String> clientsToUpdate2 = new ArrayList<String>();
+ List<String> clientsToUpdate2 = new ArrayList<>();
String client3 = "two";
String client4 = "four";
clientsToUpdate2.add(client3);
@@ -579,7 +579,7 @@ public class ComponentModuleTest {
}
private List<ComponentInfo> createComponentInfo(int count){
- List<ComponentInfo> result = new ArrayList<ComponentInfo>();
+ List<ComponentInfo> result = new ArrayList<>();
if(count > 0) {
for(int i = 0; i < count; i++){
result.add(new ComponentInfo());
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/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 7c0523f..d7dd513 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
@@ -142,7 +142,7 @@ public class ServiceModuleTest {
@Test
public void testResolve_RequiredServices() throws Exception {
- List<String> requiredServices = new ArrayList<String>();
+ List<String> requiredServices = new ArrayList<>();
requiredServices.add("foo");
requiredServices.add("bar");
@@ -232,7 +232,7 @@ public class ServiceModuleTest {
@Test
public void testResolve_OsSpecifics() throws Exception {
- Map<String, ServiceOsSpecific> osSpecifics = new HashMap<String, ServiceOsSpecific>();
+ Map<String, ServiceOsSpecific> osSpecifics = new HashMap<>();
osSpecifics.put("foo", new ServiceOsSpecific());
// specified in child only
@@ -251,7 +251,7 @@ public class ServiceModuleTest {
assertEquals(osSpecifics, service.getModuleInfo().getOsSpecifics());
// specified in both
- Map<String, ServiceOsSpecific> osSpecifics2 = new HashMap<String, ServiceOsSpecific>();
+ Map<String, ServiceOsSpecific> osSpecifics2 = new HashMap<>();
osSpecifics.put("bar", new ServiceOsSpecific());
info.setOsSpecifics(osSpecifics);
@@ -470,7 +470,7 @@ public class ServiceModuleTest {
@Test
public void testResolve_CustomCommands() throws Exception {
- List<CustomCommandDefinition> customCommands = new ArrayList<CustomCommandDefinition>();
+ List<CustomCommandDefinition> customCommands = new ArrayList<>();
CustomCommandDefinition cmd1 = new CustomCommandDefinition();
setPrivateField(cmd1, "name", "cmd1");
setPrivateField(cmd1, "background", false);
@@ -495,7 +495,7 @@ public class ServiceModuleTest {
assertEquals(customCommands, service.getModuleInfo().getCustomCommands());
// specified in both
- List<CustomCommandDefinition> parentCustomCommands = new ArrayList<CustomCommandDefinition>();
+ List<CustomCommandDefinition> parentCustomCommands = new ArrayList<>();
CustomCommandDefinition cmd3 = new CustomCommandDefinition();
setPrivateField(cmd3, "name", "cmd1");
setPrivateField(cmd3, "background", true);
@@ -524,7 +524,7 @@ public class ServiceModuleTest {
@Test
public void testResolve_ConfigDependencies() throws Exception {
- List<String> configDependencies = new ArrayList<String>();
+ List<String> configDependencies = new ArrayList<>();
configDependencies.add("foo");
configDependencies.add("bar");
@@ -544,7 +544,7 @@ public class ServiceModuleTest {
assertEquals(configDependencies, service.getModuleInfo().getConfigDependencies());
// specified in both
- List<String> parentCustomCommands = new ArrayList<String>();
+ List<String> parentCustomCommands = new ArrayList<>();
parentCustomCommands.add("bar");
parentCustomCommands.add("other");
@@ -614,7 +614,7 @@ public class ServiceModuleTest {
List<ComponentInfo> components = child.getModuleInfo().getComponents();
assertEquals(3, components.size());
- Map<String, ComponentInfo> mergedComponents = new HashMap<String, ComponentInfo>();
+ Map<String, ComponentInfo> mergedComponents = new HashMap<>();
for (ComponentInfo component : components) {
mergedComponents.put(component.getName(), component);
}
@@ -635,33 +635,33 @@ public class ServiceModuleTest {
// child configurations
//FOO
- Collection<PropertyInfo> childFooProperties = new ArrayList<PropertyInfo>();
+ Collection<PropertyInfo> childFooProperties = new ArrayList<>();
PropertyInfo childProp1 = new PropertyInfo();
childProp1.setName("childName1");
childProp1.setValue("childVal1");
childFooProperties.add(childProp1);
//BAR : Doesn't inherit parents BAR due to attribute Supports.DO_NOT_EXTEND
- Collection<PropertyInfo> childBarProperties = new ArrayList<PropertyInfo>();
+ Collection<PropertyInfo> childBarProperties = new ArrayList<>();
PropertyInfo childProp2 = new PropertyInfo();
childProp2.setName("childName2");
childProp2.setValue("childVal2");
childBarProperties.add(childProp2);
// add attributes for BAR
- Map<String, String> attributes = new HashMap<String, String>();
+ Map<String, String> attributes = new HashMap<>();
attributes.put(ConfigurationInfo.Supports.DO_NOT_EXTEND.getXmlAttributeName(), "true");
// create child config modules
ConfigurationModule childConfigModule1 = createConfigurationModule("FOO", childFooProperties);
ConfigurationModule childConfigModule2 = createConfigurationModule("BAR", childBarProperties, attributes);
- Collection<ConfigurationModule> childModules = new ArrayList<ConfigurationModule>();
+ Collection<ConfigurationModule> childModules = new ArrayList<>();
childModules.add(childConfigModule1);
childModules.add(childConfigModule2);
// parent configurations
//FOO
- Collection<PropertyInfo> parentFooProperties = new ArrayList<PropertyInfo>();
+ Collection<PropertyInfo> parentFooProperties = new ArrayList<>();
PropertyInfo parentProp1 = new PropertyInfo();
parentProp1.setName("parentName1");
parentProp1.setValue("parentVal1");
@@ -673,14 +673,14 @@ public class ServiceModuleTest {
parentFooProperties.add(parentProp12);
//BAR
- Collection<PropertyInfo> parentBarProperties = new ArrayList<PropertyInfo>();
+ Collection<PropertyInfo> parentBarProperties = new ArrayList<>();
PropertyInfo parentProp2 = new PropertyInfo();
parentProp2.setName("parentName2");
parentProp2.setValue("parentVal2");
parentBarProperties.add(parentProp2);
//OTHER
- Collection<PropertyInfo> parentOtherProperties = new ArrayList<PropertyInfo>();
+ Collection<PropertyInfo> parentOtherProperties = new ArrayList<>();
PropertyInfo parentProp3 = new PropertyInfo();
parentProp3.setName("parentName3");
parentProp3.setValue("parentVal3");
@@ -690,7 +690,7 @@ public class ServiceModuleTest {
ConfigurationModule parentConfigModule1 = createConfigurationModule("FOO", parentFooProperties);
ConfigurationModule parentConfigModule2 = createConfigurationModule("BAR", parentBarProperties);
ConfigurationModule parentConfigModule3 = createConfigurationModule("OTHER", parentOtherProperties);
- Collection<ConfigurationModule> parentModules = new ArrayList<ConfigurationModule>();
+ Collection<ConfigurationModule> parentModules = new ArrayList<>();
parentModules.add(parentConfigModule1);
parentModules.add(parentConfigModule2);
parentModules.add(parentConfigModule3);
@@ -706,7 +706,7 @@ public class ServiceModuleTest {
List<PropertyInfo> mergedProperties = child.getModuleInfo().getProperties();
assertEquals(4, mergedProperties.size());
- Map<String, PropertyInfo> mergedPropertyMap = new HashMap<String, PropertyInfo>();
+ Map<String, PropertyInfo> mergedPropertyMap = new HashMap<>();
for (PropertyInfo prop : mergedProperties) {
mergedPropertyMap.put(prop.getName(), prop);
}
@@ -757,39 +757,39 @@ public class ServiceModuleTest {
// child configurations
//FOO
- Collection<PropertyInfo> childFooProperties = new ArrayList<PropertyInfo>();
+ Collection<PropertyInfo> childFooProperties = new ArrayList<>();
PropertyInfo childProp1 = new PropertyInfo();
childProp1.setName("childName1");
childProp1.setValue("childVal1");
childFooProperties.add(childProp1);
// add attributes for parent FOO
- Map<String, String> childFooAttributes = new HashMap<String, String>();
+ Map<String, String> childFooAttributes = new HashMap<>();
// override parents value
childFooAttributes.put(ConfigurationInfo.Supports.ADDING_FORBIDDEN.getXmlAttributeName(), "false");
// create child config modules
ConfigurationModule childConfigModule1 = createConfigurationModule("FOO", childFooProperties, childFooAttributes);
- Collection<ConfigurationModule> childModules = new ArrayList<ConfigurationModule>();
+ Collection<ConfigurationModule> childModules = new ArrayList<>();
childModules.add(childConfigModule1);
// parent configurations
//FOO
- Collection<PropertyInfo> parentFooProperties = new ArrayList<PropertyInfo>();
+ Collection<PropertyInfo> parentFooProperties = new ArrayList<>();
PropertyInfo parentProp1 = new PropertyInfo();
parentProp1.setName("parentName1");
parentProp1.setValue("parentVal1");
parentFooProperties.add(parentProp1);
// add attributes for parent FOO
- Map<String, String> parentFooAttributes = new HashMap<String, String>();
+ Map<String, String> parentFooAttributes = new HashMap<>();
// child will inherit
parentFooAttributes.put(ConfigurationInfo.Supports.FINAL.getXmlAttributeName(), "true");
// child will override
parentFooAttributes.put(ConfigurationInfo.Supports.ADDING_FORBIDDEN.getXmlAttributeName(), "true");
//BAR
- Collection<PropertyInfo> parentBarProperties = new ArrayList<PropertyInfo>();
+ Collection<PropertyInfo> parentBarProperties = new ArrayList<>();
PropertyInfo parentProp2 = new PropertyInfo();
parentProp2.setName("parentName2");
parentProp2.setValue("parentVal2");
@@ -799,7 +799,7 @@ public class ServiceModuleTest {
// create parent config modules
ConfigurationModule parentConfigModule1 = createConfigurationModule("FOO", parentFooProperties, parentFooAttributes);
ConfigurationModule parentConfigModule2 = createConfigurationModule("BAR", parentBarProperties);
- Collection<ConfigurationModule> parentModules = new ArrayList<ConfigurationModule>();
+ Collection<ConfigurationModule> parentModules = new ArrayList<>();
parentModules.add(parentConfigModule1);
parentModules.add(parentConfigModule2);
@@ -836,7 +836,7 @@ public class ServiceModuleTest {
info.setExcludedConfigTypes(Collections.singleton("BAR"));
//FOO
- Collection<PropertyInfo> fooProperties = new ArrayList<PropertyInfo>();
+ Collection<PropertyInfo> fooProperties = new ArrayList<>();
PropertyInfo prop1 = new PropertyInfo();
prop1.setName("name1");
prop1.setValue("val1");
@@ -847,14 +847,14 @@ public class ServiceModuleTest {
fooProperties.add(prop2);
//BAR
- Collection<PropertyInfo> barProperties = new ArrayList<PropertyInfo>();
+ Collection<PropertyInfo> barProperties = new ArrayList<>();
PropertyInfo prop3 = new PropertyInfo();
prop3.setName("name1");
prop3.setValue("val3");
barProperties.add(prop3);
//OTHER
- Collection<PropertyInfo> otherProperties = new ArrayList<PropertyInfo>();
+ Collection<PropertyInfo> otherProperties = new ArrayList<>();
PropertyInfo prop4 = new PropertyInfo();
prop4.setName("name1");
prop4.setValue("val4");
@@ -863,7 +863,7 @@ public class ServiceModuleTest {
ConfigurationModule configModule1 = createConfigurationModule("FOO", fooProperties);
ConfigurationModule configModule2 = createConfigurationModule("BAR", barProperties);
ConfigurationModule configModule3 = createConfigurationModule("OTHER", otherProperties);
- Collection<ConfigurationModule> configModules = new ArrayList<ConfigurationModule>();
+ Collection<ConfigurationModule> configModules = new ArrayList<>();
configModules.add(configModule1);
configModules.add(configModule2);
configModules.add(configModule3);
@@ -886,7 +886,7 @@ public class ServiceModuleTest {
info.setExcludedConfigTypes(Collections.singleton("BAR"));
//FOO
- Collection<PropertyInfo> fooProperties = new ArrayList<PropertyInfo>();
+ Collection<PropertyInfo> fooProperties = new ArrayList<>();
PropertyInfo prop1 = new PropertyInfo();
prop1.setName("name1");
prop1.setValue("val1");
@@ -897,21 +897,21 @@ public class ServiceModuleTest {
fooProperties.add(prop2);
ConfigurationModule childConfigModule = createConfigurationModule("FOO", fooProperties);
- Collection<ConfigurationModule> childConfigModules = new ArrayList<ConfigurationModule>();
+ Collection<ConfigurationModule> childConfigModules = new ArrayList<>();
childConfigModules.add(childConfigModule);
// parent
ServiceInfo parentInfo = new ServiceInfo();
//BAR
- Collection<PropertyInfo> barProperties = new ArrayList<PropertyInfo>();
+ Collection<PropertyInfo> barProperties = new ArrayList<>();
PropertyInfo prop3 = new PropertyInfo();
prop3.setName("name1");
prop3.setValue("val3");
barProperties.add(prop3);
ConfigurationModule parentConfigModule = createConfigurationModule("BAR", barProperties);
- Collection<ConfigurationModule> parentConfigModules = new ArrayList<ConfigurationModule>();
+ Collection<ConfigurationModule> parentConfigModules = new ArrayList<>();
parentConfigModules.add(parentConfigModule);
// create service modules
@@ -936,29 +936,29 @@ public class ServiceModuleTest {
public void testMerge_Configuration__ExcludedTypes() throws Exception {
// child
ServiceInfo info = new ServiceInfo();
- Set<String> childExcludedConfigTypes = new HashSet<String>();
+ Set<String> childExcludedConfigTypes = new HashSet<>();
childExcludedConfigTypes.add("FOO");
info.setExcludedConfigTypes(childExcludedConfigTypes);
//FOO
- Collection<PropertyInfo> fooProperties = new ArrayList<PropertyInfo>();
+ Collection<PropertyInfo> fooProperties = new ArrayList<>();
ConfigurationModule childConfigModule = createConfigurationModule("FOO", fooProperties);
- Collection<ConfigurationModule> childConfigModules = new ArrayList<ConfigurationModule>();
+ Collection<ConfigurationModule> childConfigModules = new ArrayList<>();
childConfigModules.add(childConfigModule);
// parent
ServiceInfo parentInfo = new ServiceInfo();
- Set<String> parentExcludedConfigTypes = new HashSet<String>();
+ Set<String> parentExcludedConfigTypes = new HashSet<>();
childExcludedConfigTypes.add("BAR");
info.setExcludedConfigTypes(childExcludedConfigTypes);
parentInfo.setExcludedConfigTypes(parentExcludedConfigTypes);
//BAR
- Collection<PropertyInfo> barProperties = new ArrayList<PropertyInfo>();
+ Collection<PropertyInfo> barProperties = new ArrayList<>();
ConfigurationModule parentConfigModule = createConfigurationModule("BAR", barProperties);
- Collection<ConfigurationModule> parentConfigModules = new ArrayList<ConfigurationModule>();
+ Collection<ConfigurationModule> parentConfigModules = new ArrayList<>();
parentConfigModules.add(parentConfigModule);
// create service modules
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerCommonServicesTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerCommonServicesTest.java b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerCommonServicesTest.java
index 6503e7f..4e20c2b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerCommonServicesTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerCommonServicesTest.java
@@ -170,7 +170,7 @@ public class StackManagerCommonServicesTest {
Collection<ServiceInfo> services = stack.getServices();
assertEquals(3, services.size());
- Map<String, ServiceInfo> serviceMap = new HashMap<String, ServiceInfo>();
+ Map<String, ServiceInfo> serviceMap = new HashMap<>();
for (ServiceInfo service : services) {
serviceMap.put(service.getName(), service);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
index e4fcb77..9900eb5 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerExtensionTest.java
@@ -62,7 +62,7 @@ public class StackManagerExtensionTest {
StackEntity stackEntity = createNiceMock(StackEntity.class);
ExtensionEntity extensionEntity = createNiceMock(ExtensionEntity.class);
ExtensionLinkEntity linkEntity = createNiceMock(ExtensionLinkEntity.class);
- List<ExtensionLinkEntity> list = new ArrayList<ExtensionLinkEntity>();
+ List<ExtensionLinkEntity> list = new ArrayList<>();
list.add(linkEntity);
expect(
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
index 0234d79..ec41040 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/stack/StackManagerTest.java
@@ -163,7 +163,7 @@ public class StackManagerTest {
List<String> removedServices = stack.getRemovedServices();
assertEquals(removedServices.size(), 2);
- HashSet<String> expectedServices = new HashSet<String>();
+ HashSet<String> expectedServices = new HashSet<>();
expectedServices.add("SPARK");
expectedServices.add("SPARK2");
@@ -185,7 +185,7 @@ public class StackManagerTest {
Collection<ServiceInfo> services = stack.getServices();
assertEquals(3, services.size());
- Map<String, ServiceInfo> serviceMap = new HashMap<String, ServiceInfo>();
+ Map<String, ServiceInfo> serviceMap = new HashMap<>();
for (ServiceInfo service : services) {
serviceMap.put(service.getName(), service);
}
@@ -271,7 +271,7 @@ public class StackManagerTest {
//should include all stacks in hierarchy
assertEquals(17, services.size());
- HashSet<String> expectedServices = new HashSet<String>();
+ HashSet<String> expectedServices = new HashSet<>();
expectedServices.add("GANGLIA");
expectedServices.add("HBASE");
expectedServices.add("HCATALOG");
@@ -382,7 +382,7 @@ public class StackManagerTest {
// compare components
List<ComponentInfo> stormServiceComponents = stormService.getComponents();
List<ComponentInfo> baseStormServiceComponents = baseStormService.getComponents();
- assertEquals(new HashSet<ComponentInfo>(stormServiceComponents), new HashSet<ComponentInfo>(baseStormServiceComponents));
+ assertEquals(new HashSet<>(stormServiceComponents), new HashSet<>(baseStormServiceComponents));
// values from base service
assertEquals(baseStormService.isDeleted(), stormService.isDeleted());
//todo: specify alerts file in stack
@@ -515,7 +515,7 @@ public class StackManagerTest {
Collection<ServiceInfo> allServices = stack.getServices();
assertEquals(12, allServices.size());
- HashSet<String> expectedServices = new HashSet<String>();
+ HashSet<String> expectedServices = new HashSet<>();
expectedServices.add("GANGLIA");
expectedServices.add("HBASE");
expectedServices.add("HCATALOG");
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/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 43acb67..c4ae9c7 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
@@ -146,7 +146,7 @@ public class StackModuleTest {
ServiceInfo serviceInfo = mock(ServiceInfo.class);
when(serviceInfo.isValid()).thenReturn(true);
when(serviceInfo.getName()).thenReturn(UUID.randomUUID().toString()); // unique service names
- when(serviceMetainfoXml.getServices()).thenReturn(Lists.<ServiceInfo>newArrayList(serviceInfo));
+ when(serviceMetainfoXml.getServices()).thenReturn(Lists.newArrayList(serviceInfo));
when(svd.getMetaInfoFile()).thenReturn(serviceMetainfoXml);
serviceDirectories.add(svd);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/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 4f6ae13..63eae6a 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
@@ -67,7 +67,7 @@ public class CheckHelperTest {
@Test
public void testPreUpgradeCheck() throws Exception {
final CheckHelper helper = new CheckHelper();
- List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<AbstractCheckDescriptor>();
+ List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<>();
AbstractCheckDescriptor descriptor = EasyMock.createNiceMock(AbstractCheckDescriptor.class);
descriptor.perform(EasyMock.<PrerequisiteCheck> anyObject(), EasyMock.<PrereqCheckRequest> anyObject());
EasyMock.expectLastCall().times(1);
@@ -85,7 +85,7 @@ public class CheckHelperTest {
@Test
public void testPreUpgradeCheckNotApplicable() throws Exception {
final CheckHelper helper = new CheckHelper();
- List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<AbstractCheckDescriptor>();
+ List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<>();
AbstractCheckDescriptor descriptor = EasyMock.createNiceMock(AbstractCheckDescriptor.class);
EasyMock.expect(descriptor.isApplicable(EasyMock.<PrereqCheckRequest> anyObject())).andReturn(false);
EasyMock.replay(descriptor);
@@ -100,7 +100,7 @@ public class CheckHelperTest {
@Test
public void testPreUpgradeCheckThrowsException() throws Exception {
final CheckHelper helper = new CheckHelper();
- List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<AbstractCheckDescriptor>();
+ List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<>();
AbstractCheckDescriptor descriptor = EasyMock.createNiceMock(AbstractCheckDescriptor.class);
descriptor.perform(EasyMock.<PrerequisiteCheck> anyObject(), EasyMock.<PrereqCheckRequest> anyObject());
@@ -122,7 +122,7 @@ public class CheckHelperTest {
// This mock class extends CheckHelper and overrides the getPrerequisiteChecks method in order to return
// a PrerequisiteCheck object whose status is FAIL.
final CheckHelperMock helper = new CheckHelperMock();
- List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<AbstractCheckDescriptor>();
+ List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<>();
PrereqCheckRequest checkRequest = EasyMock.createNiceMock(PrereqCheckRequest.class);
EasyMock.expect(checkRequest.getClusterName()).andReturn("c1").anyTimes();
@@ -167,7 +167,7 @@ public class CheckHelperTest {
});
final CheckHelper helper = injector.getInstance(CheckHelper.class);
- List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<AbstractCheckDescriptor>();
+ List<AbstractCheckDescriptor> updateChecksRegistry = new ArrayList<>();
// mocked Cluster has no services, so the check should always be PASS
updateChecksRegistry.add(injector.getInstance(ServicesUpCheck.class));
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
index c70dcc6..4437e60 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ConfigGroupTest.java
@@ -83,19 +83,19 @@ public class ConfigGroupTest {
@Transactional
ConfigGroup createConfigGroup() throws AmbariException {
// Create config without persisting and save group
- Map<String, String> properties = new HashMap<String, String>();
+ Map<String, String> properties = new HashMap<>();
properties.put("a", "b");
properties.put("c", "d");
- Map<String, Map<String, String>> propertiesAttributes = new HashMap<String, Map<String,String>>();
- Map<String, String> attributes = new HashMap<String, String>();
+ Map<String, Map<String, String>> propertiesAttributes = new HashMap<>();
+ Map<String, String> attributes = new HashMap<>();
attributes.put("a", "true");
propertiesAttributes.put("final", attributes);
Config config = configFactory.createNew(cluster, "hdfs-site", "testversion", properties, propertiesAttributes);
Host host = clusters.getHost("h1");
- Map<String, Config> configs = new HashMap<String, Config>();
- Map<Long, Host> hosts = new HashMap<Long, Host>();
+ Map<String, Config> configs = new HashMap<>();
+ Map<Long, Host> hosts = new HashMap<>();
configs.put(config.getType(), config);
hosts.put(host.getHostId(), host);
@@ -147,10 +147,10 @@ public class ConfigGroupTest {
Assert.assertEquals(2, configGroup.getHosts().values().size());
// Create a new config
- Map<String, String> properties = new HashMap<String, String>();
+ Map<String, String> properties = new HashMap<>();
properties.put("key1", "value1");
- Map<String, Map<String, String>> propertiesAttributes = new HashMap<String, Map<String,String>>();
- Map<String, String> attributes = new HashMap<String, String>();
+ Map<String, Map<String, String>> propertiesAttributes = new HashMap<>();
+ Map<String, String> attributes = new HashMap<>();
attributes.put("key1", "true");
propertiesAttributes.put("final", attributes);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/PropertyInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/PropertyInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/PropertyInfoTest.java
index 6e283ce..5d6cd04 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/PropertyInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/PropertyInfoTest.java
@@ -67,7 +67,7 @@ public class PropertyInfoTest {
public void testAttributes() throws Exception {
PropertyInfo property = new PropertyInfo();
- List<Element> elements = new ArrayList<Element>();
+ List<Element> elements = new ArrayList<>();
Element e1 = createNiceMock(Element.class);
Element e2 = createNiceMock(Element.class);
Node n1 = createNiceMock(Node.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/RequestExecutionTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/RequestExecutionTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/RequestExecutionTest.java
index 55aefb4..59b8874 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/RequestExecutionTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/RequestExecutionTest.java
@@ -90,7 +90,7 @@ public class RequestExecutionTest {
batchSettings.setTaskFailureToleranceLimit(10);
batches.setBatchSettings(batchSettings);
- List<BatchRequest> batchRequests = new ArrayList<BatchRequest>();
+ List<BatchRequest> batchRequests = new ArrayList<>();
BatchRequest batchRequest1 = new BatchRequest();
batchRequest1.setOrderId(10L);
batchRequest1.setType(BatchRequest.Type.DELETE);
@@ -172,7 +172,7 @@ public class RequestExecutionTest {
// Remove host and add host
Batch batches = new Batch();
- List<BatchRequest> batchRequests = new ArrayList<BatchRequest>();
+ List<BatchRequest> batchRequests = new ArrayList<>();
BatchRequest batchRequest1 = new BatchRequest();
batchRequest1.setOrderId(10L);
batchRequest1.setType(BatchRequest.Type.PUT);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java
index e7572f4..5383113 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceComponentTest.java
@@ -182,7 +182,7 @@ public class ServiceComponentTest {
h.setIPv4(hostname + "ipv4");
h.setIPv6(hostname + "ipv6");
- Map<String, String> hostAttributes = new HashMap<String, String>();
+ Map<String, String> hostAttributes = new HashMap<>();
hostAttributes.put("os_family", "redhat");
hostAttributes.put("os_release_version", "6.3");
h.setHostAttributes(hostAttributes);
@@ -281,7 +281,7 @@ public class ServiceComponentTest {
sch.setState(State.INSTALLED);
Map<String, ServiceComponentHost> compHosts =
- new HashMap<String, ServiceComponentHost>();
+ new HashMap<>();
compHosts.put("h1", sch);
component.addServiceComponentHosts(compHosts);
Assert.assertEquals(1, component.getServiceComponentHosts().size());
@@ -425,7 +425,7 @@ public class ServiceComponentTest {
serviceComponentHostFactory.createNew(sc, "h2");
Map<String, ServiceComponentHost> compHosts =
- new HashMap<String, ServiceComponentHost>();
+ new HashMap<>();
compHosts.put("h1", sch1);
compHosts.put("h2", sch2);
sc.addServiceComponentHosts(compHosts);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java
index c88b6ed..1b9296e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java
@@ -657,7 +657,7 @@ public class ServiceInfoTest {
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
ServiceMetainfoXml serviceMetainfoXml = (ServiceMetainfoXml) unmarshaller.unmarshal(configStream);
- Map<String, ServiceInfo> serviceInfoMap = new HashMap<String, ServiceInfo>();
+ Map<String, ServiceInfo> serviceInfoMap = new HashMap<>();
for (ServiceInfo serviceInfo : serviceMetainfoXml.getServices()) {
serviceInfoMap.put(serviceInfo.getName(), serviceInfo);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceTest.java
index 7cb9a74..fc12e44 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceTest.java
@@ -166,7 +166,7 @@ public class ServiceTest {
serviceComponentFactory.createNew(s, "DATANODE2");
Map<String, ServiceComponent> comps = new
- HashMap<String, ServiceComponent>();
+ HashMap<>();
comps.put(sc1.getName(), sc1);
comps.put(sc2.getName(), sc2);
@@ -326,7 +326,7 @@ public class ServiceTest {
h.setIPv4(hostname + "ipv4");
h.setIPv6(hostname + "ipv6");
- Map<String, String> hostAttributes = new HashMap<String, String>();
+ Map<String, String> hostAttributes = new HashMap<>();
hostAttributes.put("os_family", "redhat");
hostAttributes.put("os_release_version", "6.3");
h.setHostAttributes(hostAttributes);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/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 4c20de4..62fc19e 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
@@ -101,7 +101,7 @@ public class AlertDefinitionHashTest extends TestCase {
m_mockDao = m_injector.getInstance(AlertDefinitionDAO.class);
// add HDFS/NN
- List<ServiceComponentHost> serviceComponentHosts = new ArrayList<ServiceComponentHost>();
+ List<ServiceComponentHost> serviceComponentHosts = new ArrayList<>();
ServiceComponentHost sch = EasyMock.createNiceMock(ServiceComponentHost.class);
expect(sch.getServiceName()).andReturn("HDFS").anyTimes();
expect(sch.getServiceComponentName()).andReturn("NAMENODE").anyTimes();
@@ -117,19 +117,19 @@ public class AlertDefinitionHashTest extends TestCase {
EasyMock.replay(sch);
serviceComponentHosts.add(sch);
- Map<String, ServiceComponentHost> mapComponentHosts = new HashMap<String, ServiceComponentHost>();
+ Map<String, ServiceComponentHost> mapComponentHosts = new HashMap<>();
ServiceComponentHost host = EasyMock.createNiceMock(ServiceComponentHost.class);
expect(host.getHostName()).andReturn(HOSTNAME).anyTimes();
mapComponentHosts.put(HOSTNAME, host);
- Map<String, ServiceComponent> serviceComponents = new HashMap<String, ServiceComponent>();
+ Map<String, ServiceComponent> serviceComponents = new HashMap<>();
ServiceComponent namenode = EasyMock.createNiceMock(ServiceComponent.class);
expect(namenode.getServiceComponentHosts()).andReturn(mapComponentHosts).anyTimes();
expect(namenode.isMasterComponent()).andReturn(true).anyTimes();
serviceComponents.put("NAMENODE", namenode);
// create HDFS for the cluster
- Map<String, Service> services = new HashMap<String, Service>();
+ Map<String, Service> services = new HashMap<>();
String hdfsName = "HDFS";
Service hdfs = EasyMock.createNiceMock(Service.class);
expect(hdfs.getName()).andReturn("HDFS").anyTimes();
@@ -146,7 +146,7 @@ public class AlertDefinitionHashTest extends TestCase {
expect(m_mockClusters.getClusterById(EasyMock.anyInt())).andReturn(
m_mockCluster).atLeastOnce();
- Map<String, Host> clusterHosts = new HashMap<String, Host>();
+ Map<String, Host> clusterHosts = new HashMap<>();
clusterHosts.put(HOSTNAME, null);
expect(m_mockClusters.getHostsForCluster(EasyMock.eq(CLUSTERNAME))).andReturn(
@@ -197,7 +197,7 @@ public class AlertDefinitionHashTest extends TestCase {
EasyMock.anyObject(String.class), EasyMock.anyObject(String.class))).andReturn(
Collections.singletonList(m_hdfsHost)).anyTimes();
- m_agentDefinitions = new ArrayList<AlertDefinitionEntity>();
+ m_agentDefinitions = new ArrayList<>();
m_agentDefinitions.add(agentScoped);
EasyMock.expect(m_mockDao.findAgentScoped(EasyMock.anyInt())).andReturn(
m_agentDefinitions).anyTimes();
@@ -353,7 +353,7 @@ public class AlertDefinitionHashTest extends TestCase {
@Test
public void testHashingAlgorithm() throws Exception {
- List<String> uuids = new ArrayList<String>();
+ List<String> uuids = new ArrayList<>();
uuids.add(m_hdfsService.getHash());
uuids.add(m_hdfsHost.getHash());
@@ -394,7 +394,7 @@ public class AlertDefinitionHashTest extends TestCase {
assertEquals(2, actionQueue.size(HOSTNAME));
assertEquals(1, actionQueue.size("anotherHost"));
- Set<String> hosts = new HashSet<String>();
+ Set<String> hosts = new HashSet<>();
hosts.add(HOSTNAME);
// should invalidate both alert commands, and add a new definition command
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/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 c21ed6b..222f2b0 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
@@ -119,8 +119,8 @@ public class AlertStateChangedEventTest extends EasyMockSupport {
AlertTargetEntity alertTarget = createNiceMock(AlertTargetEntity.class);
AlertGroupEntity alertGroup = createMock(AlertGroupEntity.class);
- List<AlertGroupEntity> groups = new ArrayList<AlertGroupEntity>();
- Set<AlertTargetEntity> targets = new HashSet<AlertTargetEntity>();
+ List<AlertGroupEntity> groups = new ArrayList<>();
+ Set<AlertTargetEntity> targets = new HashSet<>();
targets.add(alertTarget);
groups.add(alertGroup);
@@ -171,8 +171,8 @@ public class AlertStateChangedEventTest extends EasyMockSupport {
public void testAlertNoticeSkippedForTarget() throws Exception {
AlertTargetEntity alertTarget = createMock(AlertTargetEntity.class);
AlertGroupEntity alertGroup = createMock(AlertGroupEntity.class);
- List<AlertGroupEntity> groups = new ArrayList<AlertGroupEntity>();
- Set<AlertTargetEntity> targets = new HashSet<AlertTargetEntity>();
+ List<AlertGroupEntity> groups = new ArrayList<>();
+ Set<AlertTargetEntity> targets = new HashSet<>();
targets.add(alertTarget);
groups.add(alertGroup);
@@ -223,8 +223,8 @@ public class AlertStateChangedEventTest extends EasyMockSupport {
public void testAlertNoticeSkippedForDisabledTarget() throws Exception {
AlertTargetEntity alertTarget = createMock(AlertTargetEntity.class);
AlertGroupEntity alertGroup = createMock(AlertGroupEntity.class);
- List<AlertGroupEntity> groups = new ArrayList<AlertGroupEntity>();
- Set<AlertTargetEntity> targets = new HashSet<AlertTargetEntity>();
+ List<AlertGroupEntity> groups = new ArrayList<>();
+ Set<AlertTargetEntity> targets = new HashSet<>();
targets.add(alertTarget);
groups.add(alertGroup);
@@ -384,8 +384,8 @@ public class AlertStateChangedEventTest extends EasyMockSupport {
AlertTargetEntity alertTarget = createNiceMock(AlertTargetEntity.class);
AlertGroupEntity alertGroup = createMock(AlertGroupEntity.class);
- List<AlertGroupEntity> groups = new ArrayList<AlertGroupEntity>();
- Set<AlertTargetEntity> targets = new HashSet<AlertTargetEntity>();
+ List<AlertGroupEntity> groups = new ArrayList<>();
+ Set<AlertTargetEntity> targets = new HashSet<>();
targets.add(alertTarget);
groups.add(alertGroup);
@@ -433,8 +433,8 @@ public class AlertStateChangedEventTest extends EasyMockSupport {
AlertTargetEntity alertTarget = createNiceMock(AlertTargetEntity.class);
AlertGroupEntity alertGroup = createMock(AlertGroupEntity.class);
- List<AlertGroupEntity> groups = new ArrayList<AlertGroupEntity>();
- Set<AlertTargetEntity> targets = new HashSet<AlertTargetEntity>();
+ List<AlertGroupEntity> groups = new ArrayList<>();
+ Set<AlertTargetEntity> targets = new HashSet<>();
targets.add(alertTarget);
groups.add(alertGroup);
@@ -484,8 +484,8 @@ public class AlertStateChangedEventTest extends EasyMockSupport {
AlertTargetEntity alertTarget = createNiceMock(AlertTargetEntity.class);
AlertGroupEntity alertGroup = createMock(AlertGroupEntity.class);
- List<AlertGroupEntity> groups = new ArrayList<AlertGroupEntity>();
- Set<AlertTargetEntity> targets = new HashSet<AlertTargetEntity>();
+ List<AlertGroupEntity> groups = new ArrayList<>();
+ Set<AlertTargetEntity> targets = new HashSet<>();
targets.add(alertTarget);
groups.add(alertGroup);