http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/AlertScriptDispatcherTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/AlertScriptDispatcherTest.java b/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/AlertScriptDispatcherTest.java index 78f8ba0..68e7d02 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/AlertScriptDispatcherTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/AlertScriptDispatcherTest.java @@ -167,7 +167,7 @@ public class AlertScriptDispatcherTest { notification.CallbackIds = Collections.singletonList(UUID.randomUUID().toString()); // put the custom config value - notification.DispatchProperties = new HashMap<String, String>(); + notification.DispatchProperties = new HashMap<>(); notification.DispatchProperties.put(AlertScriptDispatcher.DISPATCH_PROPERTY_SCRIPT_CONFIG_KEY, customScriptKey);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcherTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcherTest.java b/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcherTest.java index 64f1c8f..7b248ff 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcherTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcherTest.java @@ -91,7 +91,7 @@ public class AmbariSNMPDispatcherTest { Notification notification = mock(AlertNotification.class); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "3"); properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "4"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv1"); @@ -110,7 +110,7 @@ public class AmbariSNMPDispatcherTest { Notification notification = mock(AlertNotification.class); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - notification.DispatchProperties = new HashMap<String, String>(); + notification.DispatchProperties = new HashMap<>(); dispatcher.dispatch(notification); verify(notification.Callback).onFailure(notification.CallbackIds); verify(notification.Callback, never()).onSuccess(notification.CallbackIds); @@ -122,7 +122,7 @@ public class AmbariSNMPDispatcherTest { Notification notification = getAlertNotification(true); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "3"); properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "4"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv1"); @@ -138,12 +138,12 @@ public class AmbariSNMPDispatcherTest { Notification notification = getAlertNotification(true); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "3"); properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "4"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv1"); notification.DispatchProperties = properties; - notification.Recipients = new ArrayList<Recipient>(); + notification.Recipients = new ArrayList<>(); dispatcher.dispatch(notification); verify(notification.Callback).onFailure(notification.CallbackIds); verify(notification.Callback, never()).onSuccess(notification.CallbackIds); @@ -155,7 +155,7 @@ public class AmbariSNMPDispatcherTest { Notification notification = mock(AlertNotification.class); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "3"); properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "4"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv1"); @@ -173,7 +173,7 @@ public class AmbariSNMPDispatcherTest { Notification notification = mock(AlertNotification.class); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "3"); properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "4"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv11"); @@ -191,7 +191,7 @@ public class AmbariSNMPDispatcherTest { Notification notification = mock(AlertNotification.class); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "3"); properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "4"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv1"); @@ -210,7 +210,7 @@ public class AmbariSNMPDispatcherTest { Notification notification = mock(AlertNotification.class); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "3"); properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "4"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv2c"); @@ -228,7 +228,7 @@ public class AmbariSNMPDispatcherTest { Notification notification = getAlertNotification(true); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "162"); properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "public"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv3"); @@ -252,7 +252,7 @@ public class AmbariSNMPDispatcherTest { Notification notification = getAlertNotification(true); PDU pdu = dispatcher.prepareTrap(notification, snmpVersion); assertEquals(PDU.V1TRAP, pdu.getType()); - Map<String, VariableBinding> variableBindings = new HashMap<String, VariableBinding>(); + Map<String, VariableBinding> variableBindings = new HashMap<>(); for (VariableBinding variableBinding : pdu.toArray()) { variableBindings.put(variableBinding.getOid().toString(), variableBinding); } @@ -284,7 +284,7 @@ public class AmbariSNMPDispatcherTest { AlertNotification notification = (AlertNotification) getAlertNotification(false); PDU pdu = dispatcher.prepareTrap(notification, snmpVersion); assertEquals(PDU.V1TRAP, pdu.getType()); - Map<String, VariableBinding> variableBindings = new HashMap<String, VariableBinding>(); + Map<String, VariableBinding> variableBindings = new HashMap<>(); for (VariableBinding variableBinding : pdu.toArray()) { variableBindings.put(variableBinding.getOid().toString(), variableBinding); } @@ -300,7 +300,7 @@ public class AmbariSNMPDispatcherTest { Notification notification = getAlertNotification(true); PDU pdu = dispatcher.prepareTrap(notification, snmpVersion); assertEquals(PDU.TRAP, pdu.getType()); - Map<String, VariableBinding> variableBindings = new HashMap<String, VariableBinding>(); + Map<String, VariableBinding> variableBindings = new HashMap<>(); for (VariableBinding variableBinding : pdu.toArray()) { variableBindings.put(variableBinding.getOid().toString(), variableBinding); } @@ -324,7 +324,7 @@ public class AmbariSNMPDispatcherTest { AmbariSNMPDispatcher dispatcher = spy(new AmbariSNMPDispatcher(snmp)); PDU trap = mock(PDU.class); Notification notification = new AlertNotification(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "public"); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "162"); notification.DispatchProperties = properties; @@ -346,7 +346,7 @@ public class AmbariSNMPDispatcherTest { AmbariSNMPDispatcher dispatcher = spy(new AmbariSNMPDispatcher(snmp)); PDU trap = mock(PDU.class); Notification notification = new AlertNotification(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "public"); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "162"); notification.DispatchProperties = properties; @@ -368,7 +368,7 @@ public class AmbariSNMPDispatcherTest { AmbariSNMPDispatcher dispatcher = spy(new AmbariSNMPDispatcher(snmp)); PDU trap = mock(PDU.class); Notification notification = new AlertNotification(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "162"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv3"); properties.put(AmbariSNMPDispatcher.SECURITY_USERNAME_PROPERTY, "USER"); @@ -394,7 +394,7 @@ public class AmbariSNMPDispatcherTest { AmbariSNMPDispatcher dispatcher = spy(new AmbariSNMPDispatcher(snmp)); PDU trap = mock(PDU.class); Notification notification = new AlertNotification(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "162"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv3"); properties.put(AmbariSNMPDispatcher.SECURITY_USERNAME_PROPERTY, "USER"); @@ -411,7 +411,7 @@ public class AmbariSNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv1() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv1"); properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "public"); @@ -422,7 +422,7 @@ public class AmbariSNMPDispatcherTest { @Test public void testValidateAlertValidation_incorrectSNMPversion() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "162"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv4"); properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "public"); @@ -433,7 +433,7 @@ public class AmbariSNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv1_invalid_noPort() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv1"); properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "public"); NotificationDispatcher dispatcher = new AmbariSNMPDispatcher(DEFAULT_SNMP_PORT); @@ -443,7 +443,7 @@ public class AmbariSNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv2c() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "162"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv2c"); properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "public"); @@ -454,7 +454,7 @@ public class AmbariSNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv2c_invalid() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "162"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv2c"); NotificationDispatcher dispatcher = new AmbariSNMPDispatcher(DEFAULT_SNMP_PORT); @@ -464,7 +464,7 @@ public class AmbariSNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv3_incorrectSecurityLevel() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "162"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv3"); properties.put(AmbariSNMPDispatcher.SECURITY_USERNAME_PROPERTY, "USER"); @@ -478,7 +478,7 @@ public class AmbariSNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv3_noAuthNoPriv() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "162"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv3"); properties.put(AmbariSNMPDispatcher.SECURITY_USERNAME_PROPERTY, "USER"); @@ -490,7 +490,7 @@ public class AmbariSNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv3_AuthNoPriv_valid() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "162"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv3"); properties.put(AmbariSNMPDispatcher.SECURITY_USERNAME_PROPERTY, "USER"); @@ -503,7 +503,7 @@ public class AmbariSNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv3_AuthNoPriv_invalid() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "162"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv3"); properties.put(AmbariSNMPDispatcher.SECURITY_USERNAME_PROPERTY, "USER"); @@ -515,7 +515,7 @@ public class AmbariSNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv3_AuthPriv_valid() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "162"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv3"); properties.put(AmbariSNMPDispatcher.SECURITY_USERNAME_PROPERTY, "USER"); @@ -529,7 +529,7 @@ public class AmbariSNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv3_AuthPriv_noPassphrases() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "162"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv3"); properties.put(AmbariSNMPDispatcher.SECURITY_USERNAME_PROPERTY, "USER"); @@ -541,7 +541,7 @@ public class AmbariSNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv3_AuthPriv_onlyAuthPassphrase() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "162"); properties.put(AmbariSNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv3"); properties.put(AmbariSNMPDispatcher.SECURITY_USERNAME_PROPERTY, "USER"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcherTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcherTest.java b/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcherTest.java index a1159e3..3b91f0d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcherTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcherTest.java @@ -71,7 +71,7 @@ public class EmailDispatcherTest { DispatchCallback callback = EasyMock.createMock(DispatchCallback.class); notification.Callback = callback; - List<String> callbackIds = new ArrayList<String>(); + List<String> callbackIds = new ArrayList<>(); callbackIds.add(UUID.randomUUID().toString()); notification.CallbackIds = callbackIds; @@ -94,14 +94,14 @@ public class EmailDispatcherTest { Notification notification = new Notification(); DispatchCallback callback = EasyMock.createMock(DispatchCallback.class); notification.Callback = callback; - notification.Recipients = new ArrayList<Recipient>(); + notification.Recipients = new ArrayList<>(); Recipient recipient = new Recipient(); recipient.Identifier = "foo"; notification.Recipients.add(recipient); - List<String> callbackIds = new ArrayList<String>(); + List<String> callbackIds = new ArrayList<>(); callbackIds.add(UUID.randomUUID().toString()); notification.CallbackIds = callbackIds; @@ -119,7 +119,7 @@ public class EmailDispatcherTest { @Test public void testValidateTargetConfig_invalidOnAuthenticationException() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); Transport mockedTransport = EasyMock.createNiceMock(Transport.class); EmailDispatcher dispatcher = EasyMock.createMockBuilder(EmailDispatcher.class). addMockedMethods("getMailTransport").createNiceMock(); @@ -137,7 +137,7 @@ public class EmailDispatcherTest { @Test public void testValidateTargetConfig_invalidOnMessagingException() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); Transport mockedTransport = EasyMock.createNiceMock(Transport.class); EmailDispatcher dispatcher = EasyMock.createMockBuilder(EmailDispatcher.class). addMockedMethods("getMailTransport").createNiceMock(); @@ -155,7 +155,7 @@ public class EmailDispatcherTest { @Test public void testValidateTargetConfig_validIfNoErrors() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); Transport mockedTransport = EasyMock.createNiceMock(Transport.class); EmailDispatcher dispatcher = EasyMock.createMockBuilder(EmailDispatcher.class). addMockedMethods("getMailTransport").createNiceMock(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/SNMPDispatcherTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/SNMPDispatcherTest.java b/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/SNMPDispatcherTest.java index 22d677c..ebe5c10 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/SNMPDispatcherTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/SNMPDispatcherTest.java @@ -71,7 +71,7 @@ public class SNMPDispatcherTest { Notification notification = mock(Notification.class); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "3"); @@ -95,7 +95,7 @@ public class SNMPDispatcherTest { Notification notification = mock(Notification.class); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - notification.DispatchProperties = new HashMap<String, String>(); + notification.DispatchProperties = new HashMap<>(); dispatcher.dispatch(notification); verify(notification.Callback).onFailure(notification.CallbackIds); verify(notification.Callback, never()).onSuccess(notification.CallbackIds); @@ -107,7 +107,7 @@ public class SNMPDispatcherTest { Notification notification = mock(Notification.class); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "3"); @@ -128,7 +128,7 @@ public class SNMPDispatcherTest { Notification notification = mock(Notification.class); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "3"); @@ -138,7 +138,7 @@ public class SNMPDispatcherTest { notification.DispatchProperties = properties; notification.Body = "body"; notification.Subject = "subject"; - notification.Recipients = new ArrayList<Recipient>(); + notification.Recipients = new ArrayList<>(); dispatcher.dispatch(notification); verify(notification.Callback).onFailure(notification.CallbackIds); verify(notification.Callback, never()).onSuccess(notification.CallbackIds); @@ -150,7 +150,7 @@ public class SNMPDispatcherTest { Notification notification = mock(Notification.class); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "3"); @@ -173,7 +173,7 @@ public class SNMPDispatcherTest { Notification notification = mock(Notification.class); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "3"); @@ -196,7 +196,7 @@ public class SNMPDispatcherTest { Notification notification = mock(Notification.class); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "3"); @@ -220,7 +220,7 @@ public class SNMPDispatcherTest { Notification notification = mock(Notification.class); notification.Callback = mock(DispatchCallback.class); notification.CallbackIds = new ArrayList<>(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "3"); @@ -245,7 +245,7 @@ public class SNMPDispatcherTest { notification.CallbackIds = new ArrayList<>(); notification.Body = "body"; notification.Subject = "subject"; - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); @@ -270,7 +270,7 @@ public class SNMPDispatcherTest { SNMPDispatcher.SnmpVersion snmpVersion = SNMPDispatcher.SnmpVersion.SNMPv1; SNMPDispatcher dispatcher = new SNMPDispatcher(DEFAULT_SNMP_PORT); Notification notification = new Notification(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.TRAP_OID_PROPERTY, "3"); @@ -279,7 +279,7 @@ public class SNMPDispatcherTest { notification.Subject = "subject"; PDU pdu = dispatcher.prepareTrap(notification, snmpVersion); assertEquals(PDU.V1TRAP, pdu.getType()); - Map<String, VariableBinding> variableBindings = new HashMap<String, VariableBinding>(); + Map<String, VariableBinding> variableBindings = new HashMap<>(); for (VariableBinding variableBinding : pdu.toArray()) { variableBindings.put(variableBinding.getOid().toString(), variableBinding); } @@ -294,7 +294,7 @@ public class SNMPDispatcherTest { SNMPDispatcher.SnmpVersion snmpVersion = SNMPDispatcher.SnmpVersion.SNMPv2c; SNMPDispatcher dispatcher = new SNMPDispatcher(DEFAULT_SNMP_PORT); Notification notification = new Notification(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.TRAP_OID_PROPERTY, "4"); @@ -303,7 +303,7 @@ public class SNMPDispatcherTest { notification.Subject = "subject"; PDU pdu = dispatcher.prepareTrap(notification, snmpVersion); assertEquals(PDU.TRAP, pdu.getType()); - Map<String, VariableBinding> variableBindings = new HashMap<String, VariableBinding>(); + Map<String, VariableBinding> variableBindings = new HashMap<>(); for (VariableBinding variableBinding : pdu.toArray()) { variableBindings.put(variableBinding.getOid().toString(), variableBinding); } @@ -320,7 +320,7 @@ public class SNMPDispatcherTest { SNMPDispatcher dispatcher = spy(new SNMPDispatcher(snmp)); PDU trap = mock(PDU.class); Notification notification = new Notification(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(SNMPDispatcher.COMMUNITY_PROPERTY, "public"); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); notification.DispatchProperties = properties; @@ -342,7 +342,7 @@ public class SNMPDispatcherTest { SNMPDispatcher dispatcher = spy(new SNMPDispatcher(snmp)); PDU trap = mock(PDU.class); Notification notification = new Notification(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(SNMPDispatcher.COMMUNITY_PROPERTY, "public"); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); notification.DispatchProperties = properties; @@ -364,7 +364,7 @@ public class SNMPDispatcherTest { SNMPDispatcher dispatcher = spy(new SNMPDispatcher(snmp)); PDU trap = mock(PDU.class); Notification notification = new Notification(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); properties.put(SNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv3"); properties.put(SNMPDispatcher.TRAP_OID_PROPERTY, "1.3.6.1.6.3.1.1.5.4"); @@ -391,7 +391,7 @@ public class SNMPDispatcherTest { SNMPDispatcher dispatcher = spy(new SNMPDispatcher(snmp)); PDU trap = mock(PDU.class); Notification notification = new Notification(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); properties.put(SNMPDispatcher.SNMP_VERSION_PROPERTY, "SNMPv3"); properties.put(SNMPDispatcher.TRAP_OID_PROPERTY, "1.3.6.1.6.3.1.1.5.4"); @@ -409,7 +409,7 @@ public class SNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv1() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); @@ -423,7 +423,7 @@ public class SNMPDispatcherTest { @Test public void testValidateAlertValidation_incorrectSNMPversion() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); @@ -437,7 +437,7 @@ public class SNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv1_invalid() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); @@ -450,7 +450,7 @@ public class SNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv2c() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); @@ -464,7 +464,7 @@ public class SNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv2c_invalid() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); @@ -477,7 +477,7 @@ public class SNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv3_incorrectSecurityLevel() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); @@ -494,7 +494,7 @@ public class SNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv3_noAuthNoPriv() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); @@ -509,7 +509,7 @@ public class SNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv3_AuthNoPriv_valid() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); @@ -525,7 +525,7 @@ public class SNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv3_AuthNoPriv_invalid() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); @@ -540,7 +540,7 @@ public class SNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv3_AuthPriv_valid() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); @@ -557,7 +557,7 @@ public class SNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv3_AuthPriv_noPassphrases() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); @@ -572,7 +572,7 @@ public class SNMPDispatcherTest { @Test public void testValidateAlertValidation_SNMPv3_AuthPriv_onlyAuthPassphrase() throws Exception { - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1"); properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2"); properties.put(SNMPDispatcher.PORT_PROPERTY, "162"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/orm/DBAccessorImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/DBAccessorImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/DBAccessorImplTest.java index 9522259..9aaa80f 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/DBAccessorImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/DBAccessorImplTest.java @@ -82,7 +82,7 @@ public class DBAccessorImplTest { private void createMyTable(String tableName) throws Exception { DBAccessorImpl dbAccessor = injector.getInstance(DBAccessorImpl.class); - List<DBColumnInfo> columns = new ArrayList<DBColumnInfo>(); + List<DBColumnInfo> columns = new ArrayList<>(); columns.add(new DBColumnInfo("id", Long.class, null, null, false)); columns.add(new DBColumnInfo("name", String.class, 20000, null, true)); columns.add(new DBColumnInfo("time", Long.class, null, null, true)); @@ -217,7 +217,7 @@ public class DBAccessorImplTest { createMyTable(tableName); DBAccessorImpl dbAccessor = injector.getInstance(DBAccessorImpl.class); - List<DBColumnInfo> columns = new ArrayList<DBColumnInfo>(); + List<DBColumnInfo> columns = new ArrayList<>(); columns.add(new DBColumnInfo("fid", Long.class, null, null, false)); columns.add(new DBColumnInfo("fname", String.class, null, null, false)); @@ -252,7 +252,7 @@ public class DBAccessorImplTest { DBAccessorImpl dbAccessor = injector.getInstance(DBAccessorImpl.class); - List<DBColumnInfo> columns = new ArrayList<DBColumnInfo>(); + List<DBColumnInfo> columns = new ArrayList<>(); columns.add(new DBColumnInfo("id", Long.class, null, null, false)); columns.add(new DBColumnInfo("sid", Long.class, null, null, false)); columns.add(new DBColumnInfo("data", char[].class, null, null, true)); @@ -314,7 +314,7 @@ public class DBAccessorImplTest { DBAccessorImpl dbAccessor = injector.getInstance(DBAccessorImpl.class); - List<DBColumnInfo> columns = new ArrayList<DBColumnInfo>(); + List<DBColumnInfo> columns = new ArrayList<>(); columns.add(new DBColumnInfo("fid", Long.class, null, null, false)); columns.add(new DBColumnInfo("fname", String.class, null, null, false)); @@ -336,7 +336,7 @@ public class DBAccessorImplTest { DBAccessorImpl dbAccessor = injector.getInstance(DBAccessorImpl.class); - List<DBColumnInfo> columns = new ArrayList<DBColumnInfo>(); + List<DBColumnInfo> columns = new ArrayList<>(); columns.add(new DBColumnInfo("fid", Long.class, null, null, false)); columns.add(new DBColumnInfo("fname", String.class, null, null, false)); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java index ac8c8de..8e50b5f 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/OrmTestHelper.java @@ -177,7 +177,7 @@ public class OrmTestHelper { host2.setIpv4("192.168.0.2"); host3.setIpv4("192.168.0.3"); - List<HostEntity> hostEntities = new ArrayList<HostEntity>(); + List<HostEntity> hostEntities = new ArrayList<>(); hostEntities.add(host1); hostEntities.add(host2); @@ -199,7 +199,7 @@ public class OrmTestHelper { ClusterServiceEntity clusterServiceEntity = new ClusterServiceEntity(); clusterServiceEntity.setServiceName("HDFS"); clusterServiceEntity.setClusterEntity(clusterEntity); - List<ClusterServiceEntity> clusterServiceEntities = new ArrayList<ClusterServiceEntity>(); + List<ClusterServiceEntity> clusterServiceEntities = new ArrayList<>(); clusterServiceEntities.add(clusterServiceEntity); clusterEntity.setClusterServiceEntities(clusterServiceEntities); @@ -231,7 +231,7 @@ public class OrmTestHelper { admin.setUserPassword(encoder.encode("admin")); admin.setPrincipal(principalEntity); - Set<UserEntity> users = new HashSet<UserEntity>(); + Set<UserEntity> users = new HashSet<>(); users.add(admin); @@ -415,7 +415,7 @@ public class OrmTestHelper { 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.4"); host.setHostAttributes(hostAttributes); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/orm/TestOrmImpl.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/TestOrmImpl.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/TestOrmImpl.java index 5334c51..2acf26d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/TestOrmImpl.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/TestOrmImpl.java @@ -273,7 +273,7 @@ public class TestOrmImpl extends Assert { RequestDAO requestDAO = injector.getInstance(RequestDAO.class); RequestEntity requestEntity = requestDAO.findByPK(1L); - List<StageEntity> stageEntities = new ArrayList<StageEntity>(); + List<StageEntity> stageEntities = new ArrayList<>(); StageEntity stageEntity = new StageEntity(); stageEntity.setClusterId(clusterDAO.findByName("test_cluster1").getClusterId()); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAOTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAOTest.java index 5b31c78..e744671 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAOTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertDefinitionDAOTest.java @@ -231,7 +231,7 @@ public class AlertDefinitionDAOTest { @Test public void testFindByIds() { List<AlertDefinitionEntity> definitions = dao.findAll(); - List<Long> ids = new ArrayList<Long>(); + List<Long> ids = new ArrayList<>(); ids.add(definitions.get(0).getDefinitionId()); ids.add(definitions.get(1).getDefinitionId()); ids.add(99999L); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java index 346d0b5..a43817f 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/AlertsDAOTest.java @@ -505,7 +505,7 @@ public class AlertsDAOTest { */ @Test public void testFindByState() { - List<AlertState> allStates = new ArrayList<AlertState>(); + List<AlertState> allStates = new ArrayList<>(); allStates.add(AlertState.OK); allStates.add(AlertState.WARNING); allStates.add(AlertState.CRITICAL); @@ -1355,7 +1355,7 @@ public class AlertsDAOTest { m_componentFactory, m_schFactory, HOSTNAME); m_alertHelper.populateData(m_cluster); - List<SortRequestProperty> sortProperties = new ArrayList<SortRequestProperty>(); + List<SortRequestProperty> sortProperties = new ArrayList<>(); SortRequest sortRequest = new SortRequestImpl(sortProperties); AlertHistoryRequest request = new AlertHistoryRequest(); request.Sort = sortRequest; http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/ConfigGroupDAOTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/ConfigGroupDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/ConfigGroupDAOTest.java index a42aa63..61a8c9c 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/ConfigGroupDAOTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/ConfigGroupDAOTest.java @@ -104,7 +104,7 @@ public class ConfigGroupDAOTest { configGroupDAO.create(configGroupEntity); if (hosts != null && !hosts.isEmpty()) { - List<ConfigGroupHostMappingEntity> hostMappingEntities = new ArrayList<ConfigGroupHostMappingEntity>(); + List<ConfigGroupHostMappingEntity> hostMappingEntities = new ArrayList<>(); for (HostEntity host : hosts) { host.setClusterEntities(Arrays.asList(clusterEntity)); @@ -124,7 +124,7 @@ public class ConfigGroupDAOTest { if (configs != null && !configs.isEmpty()) { List<ConfigGroupConfigMappingEntity> configMappingEntities = new - ArrayList<ConfigGroupConfigMappingEntity>(); + ArrayList<>(); for (ClusterConfigEntity config : configs) { config.setClusterEntity(clusterEntity); @@ -204,7 +204,7 @@ public class ConfigGroupDAOTest { @Test public void testFindByHost() throws Exception { - List<HostEntity> hosts = new ArrayList<HostEntity>(); + List<HostEntity> hosts = new ArrayList<>(); // Partially constructed HostEntity that will persisted in {@link createConfigGroup} HostEntity hostEntity = new HostEntity(); hostEntity.setHostName("h1"); @@ -244,7 +244,7 @@ public class ConfigGroupDAOTest { configEntity.setStack(stackEntity); List<ClusterConfigEntity> configEntities = new - ArrayList<ClusterConfigEntity>(); + ArrayList<>(); configEntities.add(configEntity); ConfigGroupEntity configGroupEntity = http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/HostVersionDAOTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/HostVersionDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/HostVersionDAOTest.java index 6219a69..eb0c49e 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/HostVersionDAOTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/HostVersionDAOTest.java @@ -120,7 +120,7 @@ public class HostVersionDAOTest { ClusterVersionEntity clusterVersionEntity = new ClusterVersionEntity( clusterEntity, repoVersionEntity, RepositoryVersionState.CURRENT, System.currentTimeMillis(), System.currentTimeMillis(), "admin"); - List<ClusterVersionEntity> clusterVersionEntities = new ArrayList<ClusterVersionEntity>(); + List<ClusterVersionEntity> clusterVersionEntities = new ArrayList<>(); clusterVersionEntities.add(clusterVersionEntity); clusterEntity.setClusterVersionEntities(clusterVersionEntities); @@ -139,7 +139,7 @@ public class HostVersionDAOTest { host2.setIpv4("192.168.0.2"); host3.setIpv4("192.168.0.3"); - List<HostEntity> hostEntities = new ArrayList<HostEntity>(); + List<HostEntity> hostEntities = new ArrayList<>(); hostEntities.add(host1); hostEntities.add(host2); hostEntities.add(host3); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RequestDAOTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RequestDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RequestDAOTest.java index 246c056..9b62671 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RequestDAOTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/RequestDAOTest.java @@ -118,7 +118,7 @@ public class RequestDAOTest { Assert.assertEquals(calc1.getPercent(), calc2.getPercent(), 0.01d); // !!! simulate an upgrade group - Set<Long> group = new HashSet<Long>(); + Set<Long> group = new HashSet<>(); group.add(2L); group.add(3L); group.add(4L); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/StageDAOTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/StageDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/StageDAOTest.java index 1f71af2..b62faf5 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/StageDAOTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/StageDAOTest.java @@ -124,7 +124,7 @@ public class StageDAOTest { */ @Test public void testStageSorting() throws Exception { - List<SortRequestProperty> sortProperties = new ArrayList<SortRequestProperty>(); + List<SortRequestProperty> sortProperties = new ArrayList<>(); SortRequest sortRequest = new SortRequestImpl(sortProperties); Predicate predicate = new PredicateBuilder().property( @@ -134,7 +134,7 @@ public class StageDAOTest { sortProperties.add(new SortRequestProperty( StageResourceProvider.STAGE_LOG_INFO, SortRequest.Order.ASC)); - Request request = PropertyHelper.getReadRequest(new HashSet<String>(Arrays.<String>asList()), + Request request = PropertyHelper.getReadRequest(new HashSet<>(Arrays.<String>asList()), null, null, null, sortRequest); // get back all 5 http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/UpgradeDAOTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/UpgradeDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/UpgradeDAOTest.java index dc30c6c..636108e 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/UpgradeDAOTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/UpgradeDAOTest.java @@ -93,7 +93,7 @@ public class UpgradeDAOTest { group.setTitle("group title"); // create 2 items - List<UpgradeItemEntity> items = new ArrayList<UpgradeItemEntity>(); + List<UpgradeItemEntity> items = new ArrayList<>(); UpgradeItemEntity item = new UpgradeItemEntity(); item.setState(UpgradeState.IN_PROGRESS); item.setStageId(Long.valueOf(1L)); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/WidgetDAOTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/WidgetDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/WidgetDAOTest.java index 1f03f8f..0a55ab8 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/WidgetDAOTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/WidgetDAOTest.java @@ -87,7 +87,7 @@ public class WidgetDAOTest { widgetLayoutUserWidget.setWidgetOrder(0); widgetEntity.getListWidgetLayoutUserWidgetEntity().add(widgetLayoutUserWidget); - List<WidgetLayoutUserWidgetEntity> widgetLayoutUserWidgetEntityList = new LinkedList<WidgetLayoutUserWidgetEntity>(); + List<WidgetLayoutUserWidgetEntity> widgetLayoutUserWidgetEntityList = new LinkedList<>(); widgetLayoutUserWidgetEntityList.add(widgetLayoutUserWidget); widgetLayoutEntity.setListWidgetLayoutUserWidgetEntity(widgetLayoutUserWidgetEntityList); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/WidgetLayoutDAOTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/WidgetLayoutDAOTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/WidgetLayoutDAOTest.java index dc79b6f..8e7594e 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/WidgetLayoutDAOTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/dao/WidgetLayoutDAOTest.java @@ -78,7 +78,7 @@ public class WidgetLayoutDAOTest { widgetLayoutEntity2.setScope("CLUSTER"); widgetLayoutEntity2.setDisplayName("displ_name2"); - List<WidgetLayoutUserWidgetEntity> widgetLayoutUserWidgetEntityList = new LinkedList<WidgetLayoutUserWidgetEntity>(); + List<WidgetLayoutUserWidgetEntity> widgetLayoutUserWidgetEntityList = new LinkedList<>(); for (int i=0; i<3; i++) { WidgetEntity widgetEntity = new WidgetEntity(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/orm/db/DDLTests.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/db/DDLTests.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/db/DDLTests.java index 64fc1fd..22fd225 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/db/DDLTests.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/db/DDLTests.java @@ -215,12 +215,12 @@ public class DDLTests { diffs.addAll( compareSets(String.format("Comparing columns of table %s.", tableName), baseTable.columns, otherTable.columns)); diffs.addAll( - DDLTests.<FKConstraintContent>compareConstraints(tableName, "FK", baseTable.foreignKeys, otherTable.foreignKeys, false)); + DDLTests.compareConstraints(tableName, "FK", baseTable.foreignKeys, otherTable.foreignKeys, false)); diffs.addAll( - DDLTests.<Set<String>>compareConstraints(tableName, "UQ", baseTable.uniqueConstraints, otherTable.uniqueConstraints, false)); + DDLTests.compareConstraints(tableName, "UQ", baseTable.uniqueConstraints, otherTable.uniqueConstraints, false)); boolean comparePKName = !tableName.contains("qrtz"); // we are more lenient with quartz tables diffs.addAll( - DDLTests.<Set<String>>compareConstraints(tableName, "PK", toSet(baseTable.primaryKey), toSet(otherTable.primaryKey), comparePKName)); + DDLTests.compareConstraints(tableName, "PK", toSet(baseTable.primaryKey), toSet(otherTable.primaryKey), comparePKName)); } return diffs; http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/LdapSyncSpecEntityTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/LdapSyncSpecEntityTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/LdapSyncSpecEntityTest.java index 3cc97fe..a84c38b 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/LdapSyncSpecEntityTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/LdapSyncSpecEntityTest.java @@ -53,7 +53,7 @@ public class LdapSyncSpecEntityTest { @Test public void testGetPrincipalNames() throws Exception { - List<String> names = new LinkedList<String>(); + List<String> names = new LinkedList<>(); names.add("joe"); names.add("fred"); @@ -72,7 +72,7 @@ public class LdapSyncSpecEntityTest { // expected } - List<String> names = new LinkedList<String>(); + List<String> names = new LinkedList<>(); names.add("joe"); names.add("fred"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/PrincipalEntityTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/PrincipalEntityTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/PrincipalEntityTest.java index ce8601a..ab79075 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/PrincipalEntityTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/PrincipalEntityTest.java @@ -51,7 +51,7 @@ public class PrincipalEntityTest { @Test public void testSetGetPrivileges() throws Exception { - Set<PrivilegeEntity> privileges = new HashSet<PrivilegeEntity>(); + Set<PrivilegeEntity> privileges = new HashSet<>(); PrivilegeEntity privilegeEntity = new PrivilegeEntity(); privilegeEntity.setId(1); privileges.add(privilegeEntity); @@ -68,7 +68,7 @@ public class PrincipalEntityTest { @Test public void testRemovePrivilege() throws Exception { - Set<PrivilegeEntity> privileges = new HashSet<PrivilegeEntity>(); + Set<PrivilegeEntity> privileges = new HashSet<>(); PrivilegeEntity privilegeEntity1 = new PrivilegeEntity(); privilegeEntity1.setId(1); privileges.add(privilegeEntity1); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/ViewInstanceEntityTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/ViewInstanceEntityTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/ViewInstanceEntityTest.java index e8c7ed1..381bb08 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/ViewInstanceEntityTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/entities/ViewInstanceEntityTest.java @@ -443,7 +443,7 @@ public class ViewInstanceEntityTest { } public static Set<ViewInstanceEntity> getViewInstanceEntities(ViewEntity viewDefinition) throws Exception { - Set<ViewInstanceEntity> entities = new HashSet<ViewInstanceEntity>(); + Set<ViewInstanceEntity> entities = new HashSet<>(); InstanceConfig instanceConfig = InstanceConfigTest.getInstanceConfigs().get(0); entities.add(new ViewInstanceEntity(viewDefinition, instanceConfig)); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/proxy/ProxyServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/proxy/ProxyServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/proxy/ProxyServiceTest.java index 8e84bcd..b1c293e 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/proxy/ProxyServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/proxy/ProxyServiceTest.java @@ -65,12 +65,12 @@ public class ProxyServiceTest extends BaseServiceTest { URI uriMock = PowerMock.createMock(URI.class); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> headerParams = new MultivaluedMapImpl(); - Map<String, List<String>> headerParamsToForward = new HashMap<String, List<String>>(); + Map<String, List<String>> headerParamsToForward = new HashMap<>(); Response.ResponseBuilder responseBuilderMock = PowerMock.createMock(ResponseBuilderImpl.class); Response responseMock = createMock(ResponseImpl.class); headerParams.add("AmbariProxy-User-Remote","testuser"); headerParams.add("Content-Type","testtype"); - List<String> userRemoteParams = new LinkedList<String>(); + List<String> userRemoteParams = new LinkedList<>(); userRemoteParams.add("testuser"); headerParamsToForward.put("User-Remote", userRemoteParams); InputStream is = new ByteArrayInputStream("test".getBytes()); @@ -103,12 +103,12 @@ public class ProxyServiceTest extends BaseServiceTest { URI uriMock = PowerMock.createMock(URI.class); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> headerParams = new MultivaluedMapImpl(); - Map<String, List<String>> headerParamsToForward = new HashMap<String, List<String>>(); + Map<String, List<String>> headerParamsToForward = new HashMap<>(); Response.ResponseBuilder responseBuilderMock = PowerMock.createMock(ResponseBuilderImpl.class); Response responseMock = createMock(ResponseImpl.class); headerParams.add("AmbariProxy-User-Remote","testuser"); headerParams.add("Content-Type","testtype"); - List<String> userRemoteParams = new LinkedList<String>(); + List<String> userRemoteParams = new LinkedList<>(); userRemoteParams.add("testuser"); headerParamsToForward.put("User-Remote", userRemoteParams); InputStream is = new ByteArrayInputStream("test".getBytes()); @@ -142,12 +142,12 @@ public class ProxyServiceTest extends BaseServiceTest { URI uriMock = PowerMock.createMock(URI.class); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> headerParams = new MultivaluedMapImpl(); - Map<String, List<String>> headerParamsToForward = new HashMap<String, List<String>>(); + Map<String, List<String>> headerParamsToForward = new HashMap<>(); Response.ResponseBuilder responseBuilderMock = PowerMock.createMock(ResponseBuilderImpl.class); Response responseMock = createMock(ResponseImpl.class); headerParams.add("AmbariProxy-User-Remote","testuser"); headerParams.add("Content-Type","testtype"); - List<String> userRemoteParams = new LinkedList<String>(); + List<String> userRemoteParams = new LinkedList<>(); userRemoteParams.add("testuser"); headerParamsToForward.put("User-Remote", userRemoteParams); InputStream is = new ByteArrayInputStream("test".getBytes()); @@ -181,12 +181,12 @@ public class ProxyServiceTest extends BaseServiceTest { URI uriMock = PowerMock.createMock(URI.class); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> headerParams = new MultivaluedMapImpl(); - Map<String, List<String>> headerParamsToForward = new HashMap<String, List<String>>(); + Map<String, List<String>> headerParamsToForward = new HashMap<>(); Response.ResponseBuilder responseBuilderMock = PowerMock.createMock(ResponseBuilderImpl.class); Response responseMock = createMock(ResponseImpl.class); headerParams.add("AmbariProxy-User-Remote","testuser"); headerParams.add("Content-Type","testtype"); - List<String> userRemoteParams = new LinkedList<String>(); + List<String> userRemoteParams = new LinkedList<>(); userRemoteParams.add("testuser"); headerParamsToForward.put("User-Remote", userRemoteParams); InputStream is = new ByteArrayInputStream("test".getBytes()); @@ -222,10 +222,10 @@ public class ProxyServiceTest extends BaseServiceTest { InputStream es = new ByteArrayInputStream("error".getBytes()); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> headerParams = new MultivaluedMapImpl(); - Map<String, List<String>> headerParamsToForward = new HashMap<String, List<String>>(); + Map<String, List<String>> headerParamsToForward = new HashMap<>(); headerParams.add("AmbariProxy-User-Remote","testuser"); headerParams.add("Content-Type","testtype"); - List<String> userRemoteParams = new LinkedList<String>(); + List<String> userRemoteParams = new LinkedList<>(); userRemoteParams.add("testuser"); headerParamsToForward.put("User-Remote", userRemoteParams); PowerMock.mockStatic(Response.class); @@ -257,12 +257,12 @@ public class ProxyServiceTest extends BaseServiceTest { URI uriMock = PowerMock.createMock(URI.class); MultivaluedMap<String, String> queryParams = new MultivaluedMapImpl(); MultivaluedMap<String, String> headerParams = new MultivaluedMapImpl(); - Map<String, List<String>> headerParamsToForward = new HashMap<String, List<String>>(); + Map<String, List<String>> headerParamsToForward = new HashMap<>(); Response.ResponseBuilder responseBuilderMock = PowerMock.createMock(ResponseBuilderImpl.class); Response responseMock = createMock(ResponseImpl.class); headerParams.add("AmbariProxy-User-Remote","testuser"); headerParams.add("Content-Type","testtype"); - List<String> userRemoteParams = new LinkedList<String>(); + List<String> userRemoteParams = new LinkedList<>(); userRemoteParams.add("testuser"); headerParamsToForward.put("User-Remote", userRemoteParams); Map map = new Gson().fromJson(new InputStreamReader(new ByteArrayInputStream("{ \"test\":\"test\" }".getBytes())), Map.class); @@ -296,9 +296,9 @@ public class ProxyServiceTest extends BaseServiceTest { HttpURLConnection urlConnectionMock = createMock(HttpURLConnection.class); URI uri = UriBuilder.fromUri("http://dev01.hortonworks.com:8080/proxy?url=http%3a%2f%2fserver%3a8188%2fws%2fv1%2f" + "timeline%2fHIVE_QUERY_ID%3ffields=events%2cprimaryfilters%26limit=10%26primaryFilter=user%3ahiveuser1").build(); - Map<String, List<String>> headerParamsToForward = new HashMap<String, List<String>>(); + Map<String, List<String>> headerParamsToForward = new HashMap<>(); InputStream is = new ByteArrayInputStream("test".getBytes()); - List<String> userRemoteParams = new LinkedList<String>(); + List<String> userRemoteParams = new LinkedList<>(); userRemoteParams.add("testuser"); headerParams.add("AmbariProxy-User-Remote","testuser"); headerParams.add("Content-Type","testtype"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java index 726972b..1341e47 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java @@ -171,7 +171,7 @@ public class ExecutionScheduleManagerTest { 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); @@ -356,7 +356,7 @@ public class ExecutionScheduleManagerTest { String type = "post"; String body = "body"; Integer userId = 1; - Map<Long, RequestExecution> executionMap = new HashMap<Long, RequestExecution>(); + Map<Long, RequestExecution> executionMap = new HashMap<>(); executionMap.put(executionId, requestExecutionMock); BatchRequestResponse batchRequestResponse = new BatchRequestResponse(); @@ -418,7 +418,7 @@ public class ExecutionScheduleManagerTest { long requestId = 5L; String clusterName = "mycluster"; - Map<Long, RequestExecution> executionMap = new HashMap<Long, RequestExecution>(); + Map<Long, RequestExecution> executionMap = new HashMap<>(); executionMap.put(executionId, requestExecutionMock); BatchRequestResponse batchRequestResponse = new BatchRequestResponse(); @@ -510,7 +510,7 @@ public class ExecutionScheduleManagerTest { BatchSettings batchSettings = new BatchSettings(); batchSettings.setTaskFailureToleranceLimit(1); - Map<Long, RequestExecution> executionMap = new HashMap<Long, RequestExecution>(); + Map<Long, RequestExecution> executionMap = new HashMap<>(); executionMap.put(executionId, requestExecutionMock); expect(clustersMock.getCluster(clusterName)).andReturn(clusterMock).anyTimes(); @@ -560,7 +560,7 @@ public class ExecutionScheduleManagerTest { String clusterName = "c1"; Date pastDate = new Date(new Date().getTime() - 2); - Map<Long, RequestExecution> executionMap = new HashMap<Long, RequestExecution>(); + Map<Long, RequestExecution> executionMap = new HashMap<>(); executionMap.put(executionId, requestExecutionMock); EasyMock.expect(configurationMock.getApiSSLAuthentication()).andReturn(Boolean.FALSE); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariServerSecurityHeaderFilterTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariServerSecurityHeaderFilterTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariServerSecurityHeaderFilterTest.java index 7fa2386..e8d3bfd 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariServerSecurityHeaderFilterTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariServerSecurityHeaderFilterTest.java @@ -36,7 +36,7 @@ public class AmbariServerSecurityHeaderFilterTest extends AbstractSecurityHeader static { Map<String, String> map; - map = new HashMap<String, String>(); + map = new HashMap<>(); map.put(AbstractSecurityHeaderFilter.STRICT_TRANSPORT_HEADER, Configuration.HTTP_STRICT_TRANSPORT_HEADER_VALUE.getKey()); map.put(AbstractSecurityHeaderFilter.X_FRAME_OPTIONS_HEADER, Configuration.HTTP_X_FRAME_OPTIONS_HEADER_VALUE.getKey()); map.put(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER, Configuration.HTTP_X_XSS_PROTECTION_HEADER_VALUE.getKey()); @@ -46,7 +46,7 @@ public class AmbariServerSecurityHeaderFilterTest extends AbstractSecurityHeader PROPERTY_NAME_MAP = Collections.unmodifiableMap(map); - map = new HashMap<String, String>(); + map = new HashMap<>(); map.put(AbstractSecurityHeaderFilter.STRICT_TRANSPORT_HEADER, Configuration.HTTP_STRICT_TRANSPORT_HEADER_VALUE.getDefaultValue()); map.put(AbstractSecurityHeaderFilter.X_FRAME_OPTIONS_HEADER, Configuration.HTTP_X_FRAME_OPTIONS_HEADER_VALUE.getDefaultValue()); map.put(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER, Configuration.HTTP_X_XSS_PROTECTION_HEADER_VALUE.getDefaultValue()); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariViewsSecurityHeaderFilterTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariViewsSecurityHeaderFilterTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariViewsSecurityHeaderFilterTest.java index d699ae0..d317399 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariViewsSecurityHeaderFilterTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/security/AmbariViewsSecurityHeaderFilterTest.java @@ -37,7 +37,7 @@ public class AmbariViewsSecurityHeaderFilterTest extends AbstractSecurityHeaderF Map<String, String> map; - map = new HashMap<String, String>(); + map = new HashMap<>(); map.put(AbstractSecurityHeaderFilter.STRICT_TRANSPORT_HEADER, Configuration.VIEWS_HTTP_STRICT_TRANSPORT_HEADER_VALUE.getKey()); map.put(AbstractSecurityHeaderFilter.X_FRAME_OPTIONS_HEADER, Configuration.VIEWS_HTTP_X_FRAME_OPTIONS_HEADER_VALUE.getKey()); map.put(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER, Configuration.VIEWS_HTTP_X_XSS_PROTECTION_HEADER_VALUE.getKey()); @@ -46,7 +46,7 @@ public class AmbariViewsSecurityHeaderFilterTest extends AbstractSecurityHeaderF map.put(AbstractSecurityHeaderFilter.PRAGMA_HEADER, Configuration.VIEWS_HTTP_PRAGMA_HEADER_VALUE.getKey()); PROPERTY_NAME_MAP = Collections.unmodifiableMap(map); - map = new HashMap<String, String>(); + map = new HashMap<>(); map.put(AbstractSecurityHeaderFilter.STRICT_TRANSPORT_HEADER, Configuration.VIEWS_HTTP_STRICT_TRANSPORT_HEADER_VALUE.getDefaultValue()); map.put(AbstractSecurityHeaderFilter.X_FRAME_OPTIONS_HEADER, Configuration.VIEWS_HTTP_X_FRAME_OPTIONS_HEADER_VALUE.getDefaultValue()); map.put(AbstractSecurityHeaderFilter.X_XSS_PROTECTION_HEADER, Configuration.VIEWS_HTTP_X_XSS_PROTECTION_HEADER_VALUE.getDefaultValue()); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/security/CertificateManagerTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/CertificateManagerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/CertificateManagerTest.java index ca10c9d..dceeab2 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/security/CertificateManagerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/security/CertificateManagerTest.java @@ -52,7 +52,7 @@ public class CertificateManagerTest extends EasyMockSupport { String hostname = "host1.example.com"; - Map<String, String> configurationMap = new HashMap<String, String>(); + Map<String, String> configurationMap = new HashMap<>(); configurationMap.put(Configuration.SRVR_KSTR_DIR.getKey(), directory.getAbsolutePath()); configurationMap.put(Configuration.SRVR_CRT_PASS.getKey(), "server_cert_pass"); configurationMap.put(Configuration.SRVR_CRT_NAME.getKey(), "server_cert_name"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/security/SecurePasswordHelperTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/SecurePasswordHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/SecurePasswordHelperTest.java index 91d44a6..64d38fc 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/security/SecurePasswordHelperTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/security/SecurePasswordHelperTest.java @@ -134,7 +134,7 @@ public class SecurePasswordHelperTest { private void assertMinCharacterCount(int minCount, String string, char[] characters) { int count = 0; - Set<Character> set = new HashSet<Character>(); + Set<Character> set = new HashSet<>(); for(char c:characters) { set.add(c); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/kerberos/AmbariKerberosAuthenticationPropertiesTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/kerberos/AmbariKerberosAuthenticationPropertiesTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/kerberos/AmbariKerberosAuthenticationPropertiesTest.java index 9096897..eb26cd8 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/kerberos/AmbariKerberosAuthenticationPropertiesTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/security/authentication/kerberos/AmbariKerberosAuthenticationPropertiesTest.java @@ -64,11 +64,11 @@ public class AmbariKerberosAuthenticationPropertiesTest { public void testOrderedUserTypes() throws Exception { AmbariKerberosAuthenticationProperties properties = new AmbariKerberosAuthenticationProperties(); - properties.setOrderedUserTypes(new ArrayList<UserType>(Arrays.asList(UserType.LDAP, UserType.LOCAL))); - Assert.assertEquals(new ArrayList<UserType>(Arrays.asList(UserType.LDAP, UserType.LOCAL)), properties.getOrderedUserTypes()); + properties.setOrderedUserTypes(new ArrayList<>(Arrays.asList(UserType.LDAP, UserType.LOCAL))); + Assert.assertEquals(new ArrayList<>(Arrays.asList(UserType.LDAP, UserType.LOCAL)), properties.getOrderedUserTypes()); properties.setOrderedUserTypes(Collections.singletonList(UserType.JWT)); - Assert.assertEquals(new ArrayList<UserType>(Collections.singletonList(UserType.JWT)), properties.getOrderedUserTypes()); + Assert.assertEquals(new ArrayList<>(Collections.singletonList(UserType.JWT)), properties.getOrderedUserTypes()); } @Test http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProviderTest.java index 99d0055..5b3acd0 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AmbariPamAuthenticationProviderTest.java @@ -79,7 +79,7 @@ public class AmbariPamAuthenticationProviderTest { PAM pam = createNiceMock(PAM.class); UnixUser unixUser = createNiceMock(UnixUser.class); expect(pam.authenticate(EasyMock.anyObject(String.class), EasyMock.anyObject(String.class))).andReturn(unixUser).atLeastOnce(); - expect(unixUser.getGroups()).andReturn(new HashSet<String>(Arrays.asList("group"))).atLeastOnce(); + expect(unixUser.getGroups()).andReturn(new HashSet<>(Arrays.asList("group"))).atLeastOnce(); EasyMock.replay(unixUser); EasyMock.replay(pam); Authentication authentication = new UsernamePasswordAuthenticationToken("allowedUser", "password"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationHelperTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationHelperTest.java index 26eb8fb..ebbc5d6 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationHelperTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/AuthorizationHelperTest.java @@ -87,7 +87,7 @@ public class AuthorizationHelperTest extends EasyMockSupport { @Test public void testConvertPrivilegesToAuthorities() throws Exception { - Collection<PrivilegeEntity> privilegeEntities = new ArrayList<PrivilegeEntity>(); + Collection<PrivilegeEntity> privilegeEntities = new ArrayList<>(); ResourceTypeEntity resourceTypeEntity = new ResourceTypeEntity(); resourceTypeEntity.setId(1); @@ -136,7 +136,7 @@ public class AuthorizationHelperTest extends EasyMockSupport { assertEquals("Wrong number of authorities", 2, authorities.size()); - Set<String> authorityNames = new HashSet<String>(); + Set<String> authorityNames = new HashSet<>(); for (GrantedAuthority authority : authorities) { authorityNames.add(authority.getAuthority()); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/UsersTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/UsersTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/UsersTest.java index dcb3109..f426c85 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/UsersTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/security/authorization/UsersTest.java @@ -105,13 +105,13 @@ public class UsersTest extends EasyMockSupport { PrivilegeEntity clusterOperatorPrivilegeEntity = createMock(PrivilegeEntity.class); expect(clusterOperatorPrivilegeEntity.getPermission()).andReturn(clusterOperatorPrivilegePermissionEntity).times(1); - List<PrivilegeEntity> privilegeEntities = new ArrayList<PrivilegeEntity>(); + List<PrivilegeEntity> privilegeEntities = new ArrayList<>(); privilegeEntities.add(clusterUserPrivilegeEntity); privilegeEntities.add(clusterOperatorPrivilegeEntity); PrivilegeEntity clusterUserViewUserPrivilegeEntity = createMock(PrivilegeEntity.class); - List<PrivilegeEntity> rolePrivilegeEntities = new ArrayList<PrivilegeEntity>(); + List<PrivilegeEntity> rolePrivilegeEntities = new ArrayList<>(); rolePrivilegeEntities.add(clusterUserViewUserPrivilegeEntity); Capture<? extends List<PrincipalEntity>> principalEntitiesCapture = newCapture(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/security/encryption/MasterKeyServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/encryption/MasterKeyServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/encryption/MasterKeyServiceTest.java index e362e03..87f0414 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/security/encryption/MasterKeyServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/security/encryption/MasterKeyServiceTest.java @@ -95,7 +95,7 @@ public class MasterKeyServiceTest extends TestCase { @Test public void testReadFromEnvAsKey() throws Exception { - Map<String, String> mapRet = new HashMap<String, String>(); + Map<String, String> mapRet = new HashMap<>(); mapRet.put("AMBARI_SECURITY_MASTER_KEY", "ThisisSomePassPhrase"); mockStatic(System.class); expect(System.getenv()).andReturn(mapRet); @@ -118,7 +118,7 @@ public class MasterKeyServiceTest extends TestCase { Assert.assertTrue(ms.isMasterKeyInitialized()); Assert.assertTrue(masterKeyFile.exists()); - Map<String, String> mapRet = new HashMap<String, String>(); + Map<String, String> mapRet = new HashMap<>(); mapRet.put(Configuration.MASTER_KEY_LOCATION.getKey(), masterKeyFile.getAbsolutePath()); mockStatic(System.class); expect(System.getenv()).andReturn(mapRet); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/security/ldap/AmbariLdapDataPopulatorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/ldap/AmbariLdapDataPopulatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/ldap/AmbariLdapDataPopulatorTest.java index 46fe33a..e5e36f3 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/security/ldap/AmbariLdapDataPopulatorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/security/ldap/AmbariLdapDataPopulatorTest.java @@ -231,7 +231,7 @@ public class AmbariLdapDataPopulatorTest { } private <T> Set<T> createSet(T...elements) { - return new HashSet<T>(Arrays.asList(elements)); + return new HashSet<>(Arrays.asList(elements)); } @Test @@ -1522,7 +1522,7 @@ public class AmbariLdapDataPopulatorTest { expect(externalGroup.getMemberAttributes()).andReturn(createSet("user1", "user2", "user4", "user6")).anyTimes(); replay(externalGroup); - Map<String, User> internalMembers = new HashMap<String, User>(); + Map<String, User> internalMembers = new HashMap<>(); internalMembers.put("user1", user1); internalMembers.put("user3", user3); internalMembers.put("user4", user4); @@ -1548,22 +1548,22 @@ public class AmbariLdapDataPopulatorTest { populator.setLdapTemplate(ldapTemplate); populator.setLdapServerProperties(ldapServerProperties); - Map<String, User> internalUsers = new HashMap<String, User>(); + Map<String, User> internalUsers = new HashMap<>(); internalUsers.putAll(internalMembers); internalUsers.put("user2", user2); - Map<String, Group> internalGroups = new HashMap<String, Group>(); + Map<String, Group> internalGroups = new HashMap<>(); internalGroups.put("group2", group2); populator.refreshGroupMembers(batchInfo, externalGroup, internalUsers, internalGroups, null, true); - Set<String> groupMembersToAdd = new HashSet<String>(); + Set<String> groupMembersToAdd = new HashSet<>(); for (LdapUserGroupMemberDto ldapUserGroupMemberDto : batchInfo.getMembershipToAdd()) { groupMembersToAdd.add(ldapUserGroupMemberDto.getUserName()); } assertEquals(3, groupMembersToAdd.size()); assertTrue(groupMembersToAdd.contains("user2")); assertTrue(groupMembersToAdd.contains("user6")); - Set<String> groupMembersToRemove = new HashSet<String>(); + Set<String> groupMembersToRemove = new HashSet<>(); for (LdapUserGroupMemberDto ldapUserGroupMemberDto : batchInfo.getMembershipToRemove()) { groupMembersToRemove.add(ldapUserGroupMemberDto.getUserName()); } @@ -1606,9 +1606,9 @@ public class AmbariLdapDataPopulatorTest { add(localUserWithGroup); } }; - expect(users.getAllUsers()).andReturn(new ArrayList<User>(allUsers)); + expect(users.getAllUsers()).andReturn(new ArrayList<>(allUsers)); - final List<User> removedUsers = new ArrayList<User>(); + final List<User> removedUsers = new ArrayList<>(); final Capture<User> userCapture = EasyMock.newCapture(); users.removeUser(capture(userCapture)); expectLastCall().andAnswer(new IAnswer<Void>() { @@ -1650,7 +1650,7 @@ public class AmbariLdapDataPopulatorTest { PagedResultsCookie cookie = createNiceMock(PagedResultsCookie.class); LdapUserDto dto = new LdapUserDto(); - List<LdapUserDto> list = new LinkedList<LdapUserDto>(); + List<LdapUserDto> list = new LinkedList<>(); list.add(dto); expect(configuration.getLdapServerProperties()).andReturn(ldapServerProperties).anyTimes(); @@ -1689,7 +1689,7 @@ public class AmbariLdapDataPopulatorTest { PagedResultsCookie cookie = createNiceMock(PagedResultsCookie.class); LdapUserDto dto = new LdapUserDto(); - List<LdapUserDto> list = new LinkedList<LdapUserDto>(); + List<LdapUserDto> list = new LinkedList<>(); list.add(dto); expect(configuration.getLdapServerProperties()).andReturn(ldapServerProperties).anyTimes(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/security/ldap/LdapPerformanceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/security/ldap/LdapPerformanceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/security/ldap/LdapPerformanceTest.java index 02e67f5..9f280b7 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/security/ldap/LdapPerformanceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/security/ldap/LdapPerformanceTest.java @@ -87,11 +87,11 @@ public class LdapPerformanceTest { long time = System.currentTimeMillis(); Set<LdapGroupDto> groups = populator.getExternalLdapGroupInfo(); Set<LdapUserDto> users = populator.getExternalLdapUserInfo(); - Set<String> userNames = new HashSet<String>(); + Set<String> userNames = new HashSet<>(); for (LdapUserDto user : users) { userNames.add(user.getUserName()); } - Set<String> groupNames = new HashSet<String>(); + Set<String> groupNames = new HashSet<>(); for (LdapGroupDto group : groups) { groupNames.add(group.getGroupName()); }