http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/PersistenceManagerImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/PersistenceManagerImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/PersistenceManagerImplTest.java index d1f9c90..07c3a90 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/PersistenceManagerImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/PersistenceManagerImplTest.java @@ -120,18 +120,18 @@ public class PersistenceManagerImplTest { Request serverRequest = createStrictMock(Request.class); RequestBody body = new RequestBody(); - Map<Resource.Type, String> mapResourceIds = new HashMap<Resource.Type, String>(); + Map<Resource.Type, String> mapResourceIds = new HashMap<>(); mapResourceIds.put(Resource.Type.Cluster, "clusterId"); mapResourceIds.put(Resource.Type.Service, "serviceId"); - Map<String, Object> mapProperties = new HashMap<String, Object>(); + Map<String, Object> mapProperties = new HashMap<>(); mapProperties.put("componentId", "id"); mapProperties.put(PropertyHelper.getPropertyId("foo", "bar"), "value"); NamedPropertySet namedPropSet = new NamedPropertySet("", mapProperties); body.addPropertySet(namedPropSet); - Set<Map<String, Object>> setExpected = new HashSet<Map<String, Object>>(); - Map<String, Object> mapExpected = new HashMap<String, Object>(mapProperties); + Set<Map<String, Object>> setExpected = new HashSet<>(); + Map<String, Object> mapExpected = new HashMap<>(mapProperties); mapExpected.put(clusterId, "clusterId"); mapExpected.put(serviceId, "serviceId"); setExpected.add(mapExpected); @@ -164,13 +164,13 @@ public class PersistenceManagerImplTest { Request serverRequest = createStrictMock(Request.class); RequestBody body = new RequestBody(); - Map<Resource.Type, String> mapResourceIds = new HashMap<Resource.Type, String>(); + Map<Resource.Type, String> mapResourceIds = new HashMap<>(); mapResourceIds.put(Resource.Type.Cluster, "clusterId"); mapResourceIds.put(Resource.Type.Service, "serviceId"); mapResourceIds.put(Resource.Type.Component, "componentId"); - Set<Map<String, Object>> setExpected = new HashSet<Map<String, Object>>(); - Map<String, Object> mapExpected = new HashMap<String, Object>(); + Set<Map<String, Object>> setExpected = new HashSet<>(); + Map<String, Object> mapExpected = new HashMap<>(); mapExpected.put(clusterId, "clusterId"); mapExpected.put(serviceId, "serviceId"); mapExpected.put(componentId, "componentId"); @@ -204,15 +204,15 @@ public class PersistenceManagerImplTest { String clusterId = "clusterId"; String serviceId = "serviceId"; - Map<Resource.Type, String> mapResourceIds = new HashMap<Resource.Type, String>(); + Map<Resource.Type, String> mapResourceIds = new HashMap<>(); mapResourceIds.put(Resource.Type.Cluster, "clusterId"); mapResourceIds.put(Resource.Type.Service, "serviceId"); - Map<String, Object> mapResourceProps1 = new HashMap<String, Object>(); + Map<String, Object> mapResourceProps1 = new HashMap<>(); mapResourceProps1.put("componentId", "id1"); mapResourceProps1.put(PropertyHelper.getPropertyId("foo", "bar"), "value"); - Map<String, Object> mapResourceProps2 = new HashMap<String, Object>(); + Map<String, Object> mapResourceProps2 = new HashMap<>(); mapResourceProps1.put("componentId", "id2"); mapResourceProps2.put(PropertyHelper.getPropertyId("foo", "bar2"), "value2"); @@ -222,12 +222,12 @@ public class PersistenceManagerImplTest { body.addPropertySet(namedPropSet1); body.addPropertySet(namedPropSet2); - Set<Map<String, Object>> setExpected = new HashSet<Map<String, Object>>(); - Map<String, Object> mapExpected1 = new HashMap<String, Object>(mapResourceProps1); + Set<Map<String, Object>> setExpected = new HashSet<>(); + Map<String, Object> mapExpected1 = new HashMap<>(mapResourceProps1); mapExpected1.put(clusterId, "clusterId"); mapExpected1.put(serviceId, "serviceId"); setExpected.add(mapExpected1); - Map<String, Object> mapExpected2 = new HashMap<String, Object>(mapResourceProps2); + Map<String, Object> mapExpected2 = new HashMap<>(mapResourceProps2); mapExpected2.put(clusterId, "clusterId"); mapExpected2.put(serviceId, "serviceId"); setExpected.add(mapExpected2); @@ -264,16 +264,16 @@ public class PersistenceManagerImplTest { // because the value is not set in the request String serviceId = null; - Map<Resource.Type, String> mapResourceIds = new HashMap<Resource.Type, String>(); + Map<Resource.Type, String> mapResourceIds = new HashMap<>(); mapResourceIds.put(Resource.Type.Cluster, clusterId); mapResourceIds.put(Resource.Type.Service, serviceId); - Map<String, Object> mapProperties = new HashMap<String, Object>(); + Map<String, Object> mapProperties = new HashMap<>(); mapProperties.put(PropertyHelper.getPropertyId("foo", "bar"), "value"); NamedPropertySet namedPropSet = new NamedPropertySet("", mapProperties); body.addPropertySet(namedPropSet); - Set<Map<String, Object>> setExpected = new HashSet<Map<String, Object>>(); + Set<Map<String, Object>> setExpected = new HashSet<>(); setExpected.add(mapProperties); //expectations
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/PreUpgradeCheckServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/PreUpgradeCheckServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/PreUpgradeCheckServiceTest.java index 06673ea..23c99d9 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/PreUpgradeCheckServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/PreUpgradeCheckServiceTest.java @@ -38,7 +38,7 @@ public class PreUpgradeCheckServiceTest extends BaseServiceTest { @Override public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); PreUpgradeCheckService service; Method m; http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/PrivilegeServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/PrivilegeServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/PrivilegeServiceTest.java index c93b1ce..134c753 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/PrivilegeServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/PrivilegeServiceTest.java @@ -39,7 +39,7 @@ public class PrivilegeServiceTest extends BaseServiceTest { public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); //getPrivilege PrivilegeService service = new TestPrivilegeService("id"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/RecommendationServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/RecommendationServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/RecommendationServiceTest.java index a1a0908..779a320 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/RecommendationServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/RecommendationServiceTest.java @@ -38,7 +38,7 @@ public class RecommendationServiceTest extends BaseServiceTest { @Override public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); //getRecommendation RecommendationService service = new TestRecommendationService("stackName", "stackVersion"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/RepositoryServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/RepositoryServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/RepositoryServiceTest.java index e47c1aa..6d6ba7b 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/RepositoryServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/RepositoryServiceTest.java @@ -39,7 +39,7 @@ public class RepositoryServiceTest extends BaseServiceTest { @Override public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); RepositoryService service; Method m; http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/RequestFactoryTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/RequestFactoryTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/RequestFactoryTest.java index 5b7d29d..8390202 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/RequestFactoryTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/RequestFactoryTest.java @@ -81,7 +81,7 @@ public class RequestFactoryTest { ResourceDefinition resourceDefinition = createNiceMock(ResourceDefinition.class); @SuppressWarnings("unchecked") MultivaluedMap<String, String> mapQueryParams = createMock(MultivaluedMap.class); - Map<String, List<String>> mapProps = new HashMap<String, List<String>>(); + Map<String, List<String>> mapProps = new HashMap<>(); mapProps.put("foo", Collections.singletonList("bar")); @@ -116,10 +116,10 @@ public class RequestFactoryTest { @SuppressWarnings("unchecked") MultivaluedMap<String, String> mapQueryParams = createMock(MultivaluedMap.class); - Map<String, List<String>> mapProps = new HashMap<String, List<String>>(); + Map<String, List<String>> mapProps = new HashMap<>(); mapProps.put("foo", Collections.singletonList("bar")); - Map<String, String> requestInfoMap = new HashMap<String, String>(); + Map<String, String> requestInfoMap = new HashMap<>(); //expectations expect(uriInfo.getQueryParameters()).andReturn(mapQueryParams).anyTimes(); @@ -154,10 +154,10 @@ public class RequestFactoryTest { @SuppressWarnings("unchecked") MultivaluedMap<String, String> mapQueryParams = createMock(MultivaluedMap.class); - Map<String, List<String>> mapProps = new HashMap<String, List<String>>(); + Map<String, List<String>> mapProps = new HashMap<>(); mapProps.put("foo", Collections.singletonList("bar")); - Map<String, String> requestInfoMap = new HashMap<String, String>(); + Map<String, String> requestInfoMap = new HashMap<>(); //expectations expect(uriInfo.getQueryParameters()).andReturn(mapQueryParams).anyTimes(); @@ -298,10 +298,10 @@ public class RequestFactoryTest { @SuppressWarnings("unchecked") MultivaluedMap<String, String> mapQueryParams = createMock(MultivaluedMap.class); - Map<String, List<String>> mapProps = new HashMap<String, List<String>>(); + Map<String, List<String>> mapProps = new HashMap<>(); mapProps.put("foo", Collections.singletonList("bar")); - Map<String, String> requestInfoMap = new HashMap<String, String>(); + Map<String, String> requestInfoMap = new HashMap<>(); //expectations expect(uriInfo.getQueryParameters()).andReturn(mapQueryParams).anyTimes(); @@ -336,10 +336,10 @@ public class RequestFactoryTest { @SuppressWarnings("unchecked") MultivaluedMap<String, String> mapQueryParams = createMock(MultivaluedMap.class); - Map<String, List<String>> mapProps = new HashMap<String, List<String>>(); + Map<String, List<String>> mapProps = new HashMap<>(); mapProps.put("foo", Collections.singletonList("bar")); - Map<String, String> requestInfoMap = new HashMap<String, String>(); + Map<String, String> requestInfoMap = new HashMap<>(); //expectations expect(uriInfo.getQueryParameters()).andReturn(mapQueryParams).anyTimes(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/RoleAuthorizationServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/RoleAuthorizationServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/RoleAuthorizationServiceTest.java index 7dcb180..517a6a0 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/RoleAuthorizationServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/RoleAuthorizationServiceTest.java @@ -38,7 +38,7 @@ import org.apache.ambari.server.api.services.serializers.ResultSerializer; public class RoleAuthorizationServiceTest extends BaseServiceTest { public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); //getAuthorization RoleAuthorizationService service = new TestRoleAuthorizationService("id"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/RootServiceServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/RootServiceServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/RootServiceServiceTest.java index 310d69f..64898c8 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/RootServiceServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/RootServiceServiceTest.java @@ -38,7 +38,7 @@ public class RootServiceServiceTest extends BaseServiceTest { @Override public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); //getServices RootServiceService service = new TestRootServiceService(null, null, null); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/ServiceServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/ServiceServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/ServiceServiceTest.java index b1b2ba2..deda3eb 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/ServiceServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/ServiceServiceTest.java @@ -37,7 +37,7 @@ import org.apache.ambari.server.api.services.serializers.ResultSerializer; public class ServiceServiceTest extends BaseServiceTest { public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); //getService ServiceService service = new TestServiceService("clusterName", "serviceName"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/StacksServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/StacksServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/StacksServiceTest.java index a6bafcc..ff62712 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/StacksServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/StacksServiceTest.java @@ -38,7 +38,7 @@ public class StacksServiceTest extends BaseServiceTest { @Override public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); // getStack StacksService service = new TestStacksService("stackName", null); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/TargetClusterServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/TargetClusterServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/TargetClusterServiceTest.java index 1f8b7bd..a71b062 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/TargetClusterServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/TargetClusterServiceTest.java @@ -39,7 +39,7 @@ public class TargetClusterServiceTest extends BaseServiceTest { public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); //getTargetCluster TargetClusterService targetClusterService = new TestTargetClusterService("targetClusterName"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/TaskAttemptServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/TaskAttemptServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/TaskAttemptServiceTest.java index 91a893a..072cd65 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/TaskAttemptServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/TaskAttemptServiceTest.java @@ -36,7 +36,7 @@ public class TaskAttemptServiceTest extends BaseServiceTest { @Override public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); // getTaskAttempt TestTaskAttemptService service = new TestTaskAttemptService("clusterName", http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/UpgradeItemServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/UpgradeItemServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/UpgradeItemServiceTest.java index 15f23f0..25f67a4 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/UpgradeItemServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/UpgradeItemServiceTest.java @@ -35,7 +35,7 @@ import org.junit.Assert; */ public class UpgradeItemServiceTest extends BaseServiceTest { public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); //updateServices UpgradeItemService service = new TestUpgradeItemService("clusterName", "upgradeId", "upgradeGroupId", 99L); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserAuthorizationServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserAuthorizationServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserAuthorizationServiceTest.java index 8a2f799..c0fb6ff 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserAuthorizationServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserAuthorizationServiceTest.java @@ -40,7 +40,7 @@ import org.junit.Test; public class UserAuthorizationServiceTest extends BaseServiceTest { public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); //getAuthorization UserAuthorizationService service = new TestUserAuthorizationService("id"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserPrivilegeServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserPrivilegeServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserPrivilegeServiceTest.java index 7b0e06d..909a4ba 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserPrivilegeServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/UserPrivilegeServiceTest.java @@ -46,7 +46,7 @@ import junit.framework.Assert; public class UserPrivilegeServiceTest extends BaseServiceTest { public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); UserPrivilegeService userPrivilegeService; Method m; @@ -73,7 +73,7 @@ public class UserPrivilegeServiceTest extends BaseServiceTest { final UriInfo uriInfo = EasyMock.createNiceMock(UriInfo.class); final UserPrivilegeService service = new TestUserPrivilegeService(); - final List<Response> disabledMethods = new ArrayList<Response>(); + final List<Response> disabledMethods = new ArrayList<>(); disabledMethods.add(service.createPrivilege("test", headers, uriInfo)); disabledMethods.add(service.updatePrivilege("test", headers, uriInfo, "test")); disabledMethods.add(service.updatePrivileges("test", headers, uriInfo)); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/ValidationServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/ValidationServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/ValidationServiceTest.java index aec68e6..722e4bc 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/ValidationServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/ValidationServiceTest.java @@ -38,7 +38,7 @@ public class ValidationServiceTest extends BaseServiceTest { @Override public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); //getValidation ValidationService service = new TestValidationService("stackName", "stackVersion"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/ViewPermissionServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/ViewPermissionServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/ViewPermissionServiceTest.java index 7f58fb2..1c9e589 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/ViewPermissionServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/ViewPermissionServiceTest.java @@ -38,7 +38,7 @@ public class ViewPermissionServiceTest extends BaseServiceTest { public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); //getPermission ViewPermissionService permissionService = new TestViewPermissionService("MY_VIEW", "1.0", "permissionName"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/ViewSubResourceServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/ViewSubResourceServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/ViewSubResourceServiceTest.java index 9499466..97943df 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/ViewSubResourceServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/ViewSubResourceServiceTest.java @@ -56,7 +56,7 @@ public class ViewSubResourceServiceTest extends BaseServiceTest { @Override public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); ViewInstanceEntity viewInstanceEntity = ViewInstanceEntityTest.getViewInstanceEntity(); @@ -107,11 +107,11 @@ public class ViewSubResourceServiceTest extends BaseServiceTest { child.setProperty("href", "this is an href"); // resource properties - Map<String, Object> mapRootProps = new LinkedHashMap<String, Object>(); + Map<String, Object> mapRootProps = new LinkedHashMap<>(); mapRootProps.put("prop2", "value2"); mapRootProps.put("prop1", "value1"); - Map<String, Object> mapCategoryProps = new LinkedHashMap<String, Object>(); + Map<String, Object> mapCategoryProps = new LinkedHashMap<>(); mapCategoryProps.put("catProp1", "catValue1"); mapCategoryProps.put("catProp2", "catValue2"); @@ -165,15 +165,15 @@ public class ViewSubResourceServiceTest extends BaseServiceTest { child.setProperty("href", "this is an href"); // resource properties - HashMap<String, Object> mapRootProps = new HashMap<String, Object>(); + HashMap<String, Object> mapRootProps = new HashMap<>(); mapRootProps.put("prop1", "value1"); mapRootProps.put("prop2", "value2"); - HashMap<String, Object> mapCategoryProps = new HashMap<String, Object>(); + HashMap<String, Object> mapCategoryProps = new HashMap<>(); mapCategoryProps.put("catProp1", "catValue1"); mapCategoryProps.put("catProp2", "catValue2"); - Map<String, Map<String, Object>> propertyMap = new HashMap<String, Map<String, Object>>(); + Map<String, Map<String, Object>> propertyMap = new HashMap<>(); propertyMap.put(null, mapRootProps); propertyMap.put("category", mapCategoryProps); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/WorkflowServiceTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/WorkflowServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/WorkflowServiceTest.java index 9969e59..b9cc545 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/WorkflowServiceTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/WorkflowServiceTest.java @@ -36,7 +36,7 @@ public class WorkflowServiceTest extends BaseServiceTest { @Override public List<ServiceTestInvocation> getTestInvocations() throws Exception { - List<ServiceTestInvocation> listInvocations = new ArrayList<ServiceTestInvocation>(); + List<ServiceTestInvocation> listInvocations = new ArrayList<>(); // getWorkflow WorkflowService service = new TestWorkflowService("clusterName"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParserTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParserTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParserTest.java index 548644b..6952de1 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParserTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/parsers/JsonRequestBodyParserTest.java @@ -162,7 +162,7 @@ public class JsonRequestBodyParserTest { Set<NamedPropertySet> setProps = body.getNamedPropertySets(); assertEquals(1, setProps.size()); - Map<String, Object> mapExpected = new HashMap<String, Object>(); + Map<String, Object> mapExpected = new HashMap<>(); mapExpected.put(PropertyHelper.getPropertyId("Services", "service_name"), "HDFS"); mapExpected.put(PropertyHelper.getPropertyId("Services", "display_name"), "HDFS"); mapExpected.put(PropertyHelper.getPropertyId("ServiceInfo", "cluster_name"), "tbmetrictest"); @@ -237,15 +237,15 @@ public class JsonRequestBodyParserTest { boolean cluster2Matches = false; boolean cluster3Matches = false; - Map<String, String> mapCluster1 = new HashMap<String, String>(); + Map<String, String> mapCluster1 = new HashMap<>(); mapCluster1.put(PropertyHelper.getPropertyId("Clusters", "cluster_name"), "unitTestCluster1"); - Map<String, String> mapCluster2 = new HashMap<String, String>(); + Map<String, String> mapCluster2 = new HashMap<>(); mapCluster2.put(PropertyHelper.getPropertyId("Clusters", "cluster_name"), "unitTestCluster2"); mapCluster2.put(PropertyHelper.getPropertyId("Clusters", "property1"), "prop1Value"); - Map<String, String> mapCluster3 = new HashMap<String, String>(); + Map<String, String> mapCluster3 = new HashMap<>(); mapCluster3.put(PropertyHelper.getPropertyId("Clusters", "cluster_name"), "unitTestCluster3"); mapCluster3.put(PropertyHelper.getPropertyId("Clusters/Category", "property2"), null); @@ -289,15 +289,15 @@ public class JsonRequestBodyParserTest { boolean cluster2Matches = false; boolean cluster3Matches = false; - Map<String, String> mapCluster1 = new HashMap<String, String>(); + Map<String, String> mapCluster1 = new HashMap<>(); mapCluster1.put(PropertyHelper.getPropertyId("Clusters", "cluster_name"), "unitTestCluster1"); - Map<String, String> mapCluster2 = new HashMap<String, String>(); + Map<String, String> mapCluster2 = new HashMap<>(); mapCluster2.put(PropertyHelper.getPropertyId("Clusters", "cluster_name"), "unitTestCluster2"); mapCluster2.put(PropertyHelper.getPropertyId("Clusters", "property1"), "prop1Value"); - Map<String, String> mapCluster3 = new HashMap<String, String>(); + Map<String, String> mapCluster3 = new HashMap<>(); mapCluster3.put(PropertyHelper.getPropertyId("Clusters", "cluster_name"), "unitTestCluster3"); mapCluster3.put(PropertyHelper.getPropertyId("Clusters/Category", "property2"), "prop2Value"); @@ -335,7 +335,7 @@ public class JsonRequestBodyParserTest { Set<NamedPropertySet> setProps = body.getNamedPropertySets(); assertEquals(1, setProps.size()); - Map<String, Object> mapExpected = new HashMap<String, Object>(); + Map<String, Object> mapExpected = new HashMap<>(); mapExpected.put(PropertyHelper.getPropertyId("Services", "service_name"), "HDFS"); mapExpected.put(PropertyHelper.getPropertyId("Services", "display_name"), "HDFS"); mapExpected.put(PropertyHelper.getPropertyId("ServiceInfo", "cluster_name"), "tbmetrictest"); @@ -544,7 +544,7 @@ public class JsonRequestBodyParserTest { Set<NamedPropertySet> setProps = body.getNamedPropertySets(); assertEquals(1, setProps.size()); - Map<String, Object> mapExpected = new HashMap<String, Object>(); + Map<String, Object> mapExpected = new HashMap<>(); mapExpected.put(PropertyHelper.getPropertyId("Services", "service_name"), "HDFS"); mapExpected.put(PropertyHelper.getPropertyId("Services", "display_name"), "HDFS"); mapExpected.put(PropertyHelper.getPropertyId("ServiceInfo", "cluster_name"), "tbmetrictest"); @@ -596,7 +596,7 @@ public class JsonRequestBodyParserTest { Assert.assertNotNull(requestBlob); body = parser.parse(requestBlob).iterator().next(); - Map<String, Object> mapExpected = new HashMap<String, Object>(); + Map<String, Object> mapExpected = new HashMap<>(); mapExpected.put(PropertyHelper.getPropertyId("Services", "service_name"), "HDFS"); mapExpected.put(PropertyHelper.getPropertyId("Services", "display_name"), "HDFS"); mapExpected.put(PropertyHelper.getPropertyId("ServiceInfo", "cluster_name"), "tbmetrictest"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/serializers/JsonSerializerTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/serializers/JsonSerializerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/serializers/JsonSerializerTest.java index 533b897..a3248c0 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/serializers/JsonSerializerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/serializers/JsonSerializerTest.java @@ -62,11 +62,11 @@ public class JsonSerializerTest { mapRootProps.put("prop2", "value2"); mapRootProps.put("prop1", "value1"); - Map<String, Object> mapCategoryProps = new LinkedHashMap<String, Object>(); + Map<String, Object> mapCategoryProps = new LinkedHashMap<>(); mapCategoryProps.put("catProp1", "catValue1"); mapCategoryProps.put("catProp2", "catValue2"); - Map<String, Map<String, Object>> propertyMap = new LinkedHashMap<String, Map<String, Object>>(); + Map<String, Map<String, Object>> propertyMap = new LinkedHashMap<>(); propertyMap.put(null, mapRootProps); propertyMap.put("category", mapCategoryProps); @@ -112,15 +112,15 @@ public class JsonSerializerTest { resourcesNode.addChild(resource, "resource1"); // resource properties - Map<String, Object> mapRootProps = new LinkedHashMap<String, Object>(); + Map<String, Object> mapRootProps = new LinkedHashMap<>(); mapRootProps.put("prop2", "value2"); mapRootProps.put("prop1", "value1"); - Map<String, Object> mapCategoryProps = new LinkedHashMap<String, Object>(); + Map<String, Object> mapCategoryProps = new LinkedHashMap<>(); mapCategoryProps.put("catProp1", "catValue1"); mapCategoryProps.put("catProp2", "catValue2"); - Map<String, Map<String, Object>> propertyMap = new LinkedHashMap<String, Map<String, Object>>(); + Map<String, Map<String, Object>> propertyMap = new LinkedHashMap<>(); propertyMap.put(null, mapRootProps); propertyMap.put("category", mapCategoryProps); @@ -168,15 +168,15 @@ public class JsonSerializerTest { //child.addChild(resource2, "sub-resource"); // resource properties - Map<String, Object> mapRootProps = new LinkedHashMap<String, Object>(); + Map<String, Object> mapRootProps = new LinkedHashMap<>(); mapRootProps.put("prop2", "value2"); mapRootProps.put("prop1", "value1"); - Map<String, Object> mapCategoryProps = new LinkedHashMap<String, Object>(); + Map<String, Object> mapCategoryProps = new LinkedHashMap<>(); mapCategoryProps.put("catProp1", "catValue1"); mapCategoryProps.put("catProp2", "catValue2"); - Map<String, Map<String, Object>> propertyMap = new LinkedHashMap<String, Map<String, Object>>(); + Map<String, Map<String, Object>> propertyMap = new LinkedHashMap<>(); propertyMap.put(null, mapRootProps); propertyMap.put("category", mapCategoryProps); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java index 6c912d4..49f070a 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorBlueprintProcessorTest.java @@ -74,7 +74,7 @@ public class StackAdvisorBlueprintProcessorTest { public void testAdviseConfiguration() throws StackAdvisorException, ConfigurationTopologyException { // GIVEN Map<String, Map<String, String>> props = createProps(); - Map<String, AdvisedConfiguration> advisedConfigurations = new HashMap<String, AdvisedConfiguration>(); + Map<String, AdvisedConfiguration> advisedConfigurations = new HashMap<>(); expect(clusterTopology.getBlueprint()).andReturn(blueprint).anyTimes(); expect(clusterTopology.getHostGroupInfo()).andReturn(createHostGroupInfo()).anyTimes(); expect(clusterTopology.getAdvisedConfigurations()).andReturn(advisedConfigurations).anyTimes(); @@ -108,7 +108,7 @@ public class StackAdvisorBlueprintProcessorTest { public void testAdviseConfigurationWithOnlyStackDefaultsApply() throws StackAdvisorException, ConfigurationTopologyException { // GIVEN Map<String, Map<String, String>> props = createProps(); - Map<String, AdvisedConfiguration> advisedConfigurations = new HashMap<String, AdvisedConfiguration>(); + Map<String, AdvisedConfiguration> advisedConfigurations = new HashMap<>(); expect(clusterTopology.getBlueprint()).andReturn(blueprint).anyTimes(); expect(clusterTopology.getHostGroupInfo()).andReturn(createHostGroupInfo()).anyTimes(); expect(clusterTopology.getAdvisedConfigurations()).andReturn(advisedConfigurations).anyTimes(); @@ -143,7 +143,7 @@ public class StackAdvisorBlueprintProcessorTest { // GIVEN Map<String, Map<String, String>> props = createProps(); props.get("core-site").put("dummyKey3", "stackDefaultValue"); - Map<String, AdvisedConfiguration> advisedConfigurations = new HashMap<String, AdvisedConfiguration>(); + Map<String, AdvisedConfiguration> advisedConfigurations = new HashMap<>(); expect(clusterTopology.getBlueprint()).andReturn(blueprint).anyTimes(); expect(clusterTopology.getHostGroupInfo()).andReturn(createHostGroupInfo()).anyTimes(); expect(clusterTopology.getAdvisedConfigurations()).andReturn(advisedConfigurations).anyTimes(); @@ -178,7 +178,7 @@ public class StackAdvisorBlueprintProcessorTest { ConfigurationTopologyException { // GIVEN Map<String, Map<String, String>> props = createProps(); - Map<String, AdvisedConfiguration> advisedConfigurations = new HashMap<String, AdvisedConfiguration>(); + Map<String, AdvisedConfiguration> advisedConfigurations = new HashMap<>(); expect(clusterTopology.getBlueprint()).andReturn(blueprint).anyTimes(); expect(clusterTopology.getHostGroupInfo()).andReturn(createHostGroupInfo()).anyTimes(); expect(clusterTopology.getAdvisedConfigurations()).andReturn(advisedConfigurations).anyTimes(); @@ -210,7 +210,7 @@ public class StackAdvisorBlueprintProcessorTest { public void testAdviseConfigurationWhenConfigurationRecommendFails() throws StackAdvisorException, ConfigurationTopologyException { // GIVEN Map<String, Map<String, String>> props = createProps(); - Map<String, AdvisedConfiguration> advisedConfigurations = new HashMap<String, AdvisedConfiguration>(); + Map<String, AdvisedConfiguration> advisedConfigurations = new HashMap<>(); expect(clusterTopology.getBlueprint()).andReturn(blueprint).anyTimes(); expect(clusterTopology.getHostGroupInfo()).andReturn(createHostGroupInfo()).anyTimes(); expect(clusterTopology.getAdvisedConfigurations()).andReturn(advisedConfigurations).anyTimes(); @@ -239,7 +239,7 @@ public class StackAdvisorBlueprintProcessorTest { public void testAdviseConfigurationWhenConfigurationRecommendHasInvalidResponse() throws StackAdvisorException, ConfigurationTopologyException { // GIVEN Map<String, Map<String, String>> props = createProps(); - Map<String, AdvisedConfiguration> advisedConfigurations = new HashMap<String, AdvisedConfiguration>(); + Map<String, AdvisedConfiguration> advisedConfigurations = new HashMap<>(); expect(clusterTopology.getBlueprint()).andReturn(blueprint).anyTimes(); expect(clusterTopology.getHostGroupInfo()).andReturn(createHostGroupInfo()).anyTimes(); expect(clusterTopology.getAdvisedConfigurations()).andReturn(advisedConfigurations).anyTimes(); @@ -282,7 +282,7 @@ public class StackAdvisorBlueprintProcessorTest { } private Map<String, HostGroupInfo> createHostGroupInfo() { - Map<String, HostGroupInfo> hostGroupInfoMap = new HashMap<String, HostGroupInfo>(); + Map<String, HostGroupInfo> hostGroupInfoMap = new HashMap<>(); HostGroupInfo hgi1 = new HostGroupInfo("hostGroup1"); HostGroupInfo hgi2 = new HostGroupInfo("hostGroup2"); hostGroupInfoMap.put("hg1", hgi1); @@ -292,13 +292,13 @@ public class StackAdvisorBlueprintProcessorTest { private Configuration createStackDefaults() { Map<String, Map<String, String>> stackDefaultProps = - new HashMap<String, Map<String, String>>(); - Map<String, String> coreSiteDefault = new HashMap<String, String>(); + new HashMap<>(); + Map<String, String> coreSiteDefault = new HashMap<>(); coreSiteDefault.put("dummyKey3", "stackDefaultValue"); stackDefaultProps.put("core-site", coreSiteDefault); Map<String, Map<String, Map<String, String>>> stackDefaultAttributes = - new HashMap<String, Map<String, Map<String, String>>>(); + new HashMap<>(); return new Configuration(stackDefaultProps, stackDefaultAttributes); } @@ -307,14 +307,14 @@ public class StackAdvisorBlueprintProcessorTest { RecommendationResponse.Recommendation recommendations = new RecommendationResponse.Recommendation(); RecommendationResponse.Blueprint blueprint = new RecommendationResponse.Blueprint(); Map<String, RecommendationResponse.BlueprintConfigurations> blueprintConfigurationsMap = - new HashMap<String, RecommendationResponse.BlueprintConfigurations>(); + new HashMap<>(); RecommendationResponse.BlueprintConfigurations blueprintConfig = new RecommendationResponse.BlueprintConfigurations(); - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put("dummyKey1", "dummyValue"); properties.put("dummyKey3", "dummyValue-override"); blueprintConfig.setProperties(properties); - Map<String, ValueAttributesInfo> propAttributes = new HashMap<String, ValueAttributesInfo>(); + Map<String, ValueAttributesInfo> propAttributes = new HashMap<>(); ValueAttributesInfo valueAttributesInfo1 = new ValueAttributesInfo(); ValueAttributesInfo valueAttributesInfo2 = new ValueAttributesInfo(); valueAttributesInfo1.setDelete("true"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommandTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommandTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommandTest.java index 172fc6c..8f608aa 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommandTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/api/services/stackadvisor/commands/ConfigurationRecommendationCommandTest.java @@ -46,13 +46,13 @@ public class ConfigurationRecommendationCommandTest { ConfigurationRecommendationCommand command = new ConfigurationRecommendationCommand(file, "1w", "script", 1, saRunner, metaInfo); StackAdvisorRequest request = mock(StackAdvisorRequest.class); - Map<String, Set<String>> componentHostGroupMap = new HashMap<String, Set<String>>(); - Set<String> components1 = new HashSet<String>(); + Map<String, Set<String>> componentHostGroupMap = new HashMap<>(); + Set<String> components1 = new HashSet<>(); components1.add("component1"); components1.add("component4"); components1.add("component5"); componentHostGroupMap.put("group1", components1); - Set<String> components2 = new HashSet<String>(); + Set<String> components2 = new HashSet<>(); components2.add("component2"); components2.add("component3"); componentHostGroupMap.put("group2", components2); @@ -62,7 +62,7 @@ public class ConfigurationRecommendationCommandTest { assertNotNull(hostGroups); assertEquals(2, hostGroups.size()); Map<String, RecommendationResponse.HostGroup> hostGroupMap = - new HashMap<String, RecommendationResponse.HostGroup>(); + new HashMap<>(); for (RecommendationResponse.HostGroup hostGroup : hostGroups) { hostGroupMap.put(hostGroup.getName(), hostGroup); } @@ -71,7 +71,7 @@ public class ConfigurationRecommendationCommandTest { Set<Map<String, String>> host1Components = hostGroup1.getComponents(); assertNotNull(host1Components); assertEquals(3, host1Components.size()); - Set<String> componentNames1 = new HashSet<String>(); + Set<String> componentNames1 = new HashSet<>(); for (Map<String, String> host1Component : host1Components) { assertNotNull(host1Component); assertEquals(1, host1Component.size()); @@ -88,7 +88,7 @@ public class ConfigurationRecommendationCommandTest { Set<Map<String, String>> host2Components = hostGroup2.getComponents(); assertNotNull(host2Components); assertEquals(2, host2Components.size()); - Set<String> componentNames2 = new HashSet<String>(); + Set<String> componentNames2 = new HashSet<>(); for (Map<String, String> host2Component : host2Components) { assertNotNull(host2Component); assertEquals(1, host2Component.size()); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/audit/request/AllPostAndPutCreator.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/audit/request/AllPostAndPutCreator.java b/ambari-server/src/test/java/org/apache/ambari/server/audit/request/AllPostAndPutCreator.java index 45aa1df..06790b6 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/audit/request/AllPostAndPutCreator.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/audit/request/AllPostAndPutCreator.java @@ -30,7 +30,7 @@ public class AllPostAndPutCreator extends AbstractBaseCreator { @Override public Set<Request.Type> getRequestTypes() { - return new HashSet<Request.Type>(Arrays.asList(Request.Type.POST, Request.Type.PUT)); + return new HashSet<>(Arrays.asList(Request.Type.POST, Request.Type.PUT)); } @Override http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/audit/request/creator/RequestEventCreatorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/audit/request/creator/RequestEventCreatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/audit/request/creator/RequestEventCreatorTest.java index 5cf4aef..3678f81 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/audit/request/creator/RequestEventCreatorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/audit/request/creator/RequestEventCreatorTest.java @@ -63,7 +63,7 @@ public class RequestEventCreatorTest extends AuditEventCreatorTestBase{ Result result = AuditEventCreatorTestHelper.createResult(new ResultStatus(ResultStatus.STATUS.OK)); request.getBody().addRequestInfoProperty("command", "MyCommand"); - Map<String, Object> mapProperties = new HashMap<String, Object>(); + Map<String, Object> mapProperties = new HashMap<>(); mapProperties.put(RequestResourceProvider.REQUEST_CLUSTER_NAME_PROPERTY_ID, "mycluster"); NamedPropertySet namedPropSet = new NamedPropertySet("", mapProperties); request.getBody().addPropertySet(namedPropSet); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/bootstrap/BootStrapTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/bootstrap/BootStrapTest.java b/ambari-server/src/test/java/org/apache/ambari/server/bootstrap/BootStrapTest.java index 3299b63..b0ee302 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/bootstrap/BootStrapTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/bootstrap/BootStrapTest.java @@ -85,7 +85,7 @@ public class BootStrapTest extends TestCase { impl.init(); SshHostInfo info = new SshHostInfo(); info.setSshKey("xyz"); - ArrayList<String> hosts = new ArrayList<String>(); + ArrayList<String> hosts = new ArrayList<>(); hosts.add("host1"); hosts.add("host2"); info.setUserRunAs("root"); @@ -161,7 +161,7 @@ public class BootStrapTest extends TestCase { impl.init(); SshHostInfo info = new SshHostInfo(); info.setSshKey("xyz"); - ArrayList<String> hosts = new ArrayList<String>(); + ArrayList<String> hosts = new ArrayList<>(); hosts.add("host1"); hosts.add("host2"); info.setHosts(hosts); @@ -212,7 +212,7 @@ public class BootStrapTest extends TestCase { FileUtils.writeStringToFile(new File(tmpFolder, "host2.done"), "1"); FileUtils.writeStringToFile(new File(tmpFolder, "host2.log"), "err_log_2"); - List<String> listHosts = new ArrayList<String>(); + List<String> listHosts = new ArrayList<>(); listHosts.add("host1"); listHosts.add("host2"); BSHostStatusCollector collector = new BSHostStatusCollector(tmpFolder, http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java index e65b3e4..a96ca6c 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/AbstractCheckDescriptorTest.java @@ -128,7 +128,7 @@ public class AbstractCheckDescriptorTest { Assert.assertEquals("", check.formatEntityList(null)); - final LinkedHashSet<String> failedOn = new LinkedHashSet<String>(); + final LinkedHashSet<String> failedOn = new LinkedHashSet<>(); Assert.assertEquals("", check.formatEntityList(failedOn)); failedOn.add("host1"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java index c535978..05a3c11 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ClientRetryPropertyCheckTest.java @@ -69,7 +69,7 @@ public class ClientRetryPropertyCheckTest { Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster); - Map<String, Service> services = new HashMap<String, Service>(); + Map<String, Service> services = new HashMap<>(); Mockito.when(cluster.getServices()).thenReturn(services); PrereqCheckRequest request = new PrereqCheckRequest("cluster"); @@ -94,12 +94,12 @@ public class ClientRetryPropertyCheckTest { Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster); - Map<String, Service> services = new HashMap<String, Service>(); + Map<String, Service> services = new HashMap<>(); Mockito.when(cluster.getServices()).thenReturn(services); final DesiredConfig desiredConfig = Mockito.mock(DesiredConfig.class); Mockito.when(desiredConfig.getTag()).thenReturn("tag"); - Map<String, DesiredConfig> configMap = new HashMap<String, DesiredConfig>(); + Map<String, DesiredConfig> configMap = new HashMap<>(); configMap.put("hdfs-site", desiredConfig); configMap.put("hive-site", desiredConfig); configMap.put("oozie-env", desiredConfig); @@ -107,7 +107,7 @@ public class ClientRetryPropertyCheckTest { Mockito.when(cluster.getDesiredConfigs()).thenReturn(configMap); final Config config = Mockito.mock(Config.class); Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config); - final Map<String, String> properties = new HashMap<String, String>(); + final Map<String, String> properties = new HashMap<>(); Mockito.when(config.getProperties()).thenReturn(properties); // Add HDFS http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java index 450d74e..7cdd121 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ComponentsInstallationCheckTest.java @@ -106,7 +106,7 @@ public class ComponentsInstallationCheckTest { Mockito.when(tezService.getMaintenanceState()).thenReturn(MaintenanceState.OFF); Mockito.when(amsService.getMaintenanceState()).thenReturn(MaintenanceState.OFF); - HashMap<String, Service> clusterServices = new HashMap<String, Service>(); + HashMap<String, Service> clusterServices = new HashMap<>(); clusterServices.put("HDFS", hdfsService); clusterServices.put("TEZ", tezService); clusterServices.put("AMBARI_METRICS", amsService); @@ -138,7 +138,7 @@ public class ComponentsInstallationCheckTest { // Put Components inside Services // HDFS - Map<String, ServiceComponent> hdfsComponents = new HashMap<String, ServiceComponent>(); + Map<String, ServiceComponent> hdfsComponents = new HashMap<>(); ServiceComponent nameNode = Mockito.mock(ServiceComponent.class); Mockito.when(nameNode.getName()).thenReturn("NAMENODE"); @@ -165,7 +165,7 @@ public class ComponentsInstallationCheckTest { Mockito.when(hdfsService.getServiceComponents()).thenReturn(hdfsComponents); // TEZ - Map<String, ServiceComponent> tezComponents = new HashMap<String, ServiceComponent>(); + Map<String, ServiceComponent> tezComponents = new HashMap<>(); ServiceComponent tezClient = Mockito.mock(ServiceComponent.class); Mockito.when(tezClient.getName()).thenReturn("TEZ_CLIENT"); @@ -177,7 +177,7 @@ public class ComponentsInstallationCheckTest { Mockito.when(tezService.getServiceComponents()).thenReturn(tezComponents); // AMS - Map<String, ServiceComponent> amsComponents = new HashMap<String, ServiceComponent>(); + Map<String, ServiceComponent> amsComponents = new HashMap<>(); ServiceComponent metricsCollector = Mockito.mock(ServiceComponent.class); Mockito.when(metricsCollector.getName()).thenReturn("METRICS_COLLECTOR"); @@ -203,7 +203,7 @@ public class ComponentsInstallationCheckTest { final HostComponentSummary hcsMetricsCollector = Mockito.mock(HostComponentSummary.class); final HostComponentSummary hcsMetricsMonitor = Mockito.mock(HostComponentSummary.class); - List<HostComponentSummary> allHostComponentSummaries = new ArrayList<HostComponentSummary>(); + List<HostComponentSummary> allHostComponentSummaries = new ArrayList<>(); allHostComponentSummaries.add(hcsNameNode); allHostComponentSummaries.add(hcsDataNode1); allHostComponentSummaries.add(hcsDataNode2); @@ -213,7 +213,7 @@ public class ComponentsInstallationCheckTest { allHostComponentSummaries.add(hcsMetricsCollector); allHostComponentSummaries.add(hcsMetricsMonitor); - final Map<String, Host> hosts = new HashMap<String, Host>(); + final Map<String, Host> hosts = new HashMap<>(); final Host host1 = Mockito.mock(Host.class); final Host host2 = Mockito.mock(Host.class); final Host host3 = Mockito.mock(Host.class); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java index 68a0522..1e0405b 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ConfigurationMergeCheckTest.java @@ -57,7 +57,7 @@ public class ConfigurationMergeCheckTest { private static final String CONFIG_PROPERTY = "hdfs.property"; private Clusters clusters = EasyMock.createMock(Clusters.class); - private Map<String, String> m_configMap = new HashMap<String, String>(); + private Map<String, String> m_configMap = new HashMap<>(); private static final StackId stackId_1_0 = new StackId("HDP-1.0"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheckTest.java index cdf13eb..15e3c6d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveDynamicServiceDiscoveryCheckTest.java @@ -69,16 +69,16 @@ public class HiveDynamicServiceDiscoveryCheckTest { final DesiredConfig desiredConfig = Mockito.mock(DesiredConfig.class); Mockito.when(desiredConfig.getTag()).thenReturn("tag"); - Map<String, DesiredConfig> configMap = new HashMap<String, DesiredConfig>(); + Map<String, DesiredConfig> configMap = new HashMap<>(); configMap.put("hive-site", desiredConfig); Mockito.when(cluster.getDesiredConfigs()).thenReturn(configMap); final Config config = Mockito.mock(Config.class); Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config); - final Map<String, String> properties = new HashMap<String, String>(); + final Map<String, String> properties = new HashMap<>(); Mockito.when(config.getProperties()).thenReturn(properties); - Map<String, String> checkProperties = new HashMap<String, String>(); + Map<String, String> checkProperties = new HashMap<>(); checkProperties.put("min-failure-stack-version","HDP-2.3.0.0"); PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class); Mockito.when(prerequisiteCheckConfig.getCheckProperties( http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java index 16f383a..9645389 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HiveMultipleMetastoreCheckTest.java @@ -71,7 +71,7 @@ public class HiveMultipleMetastoreCheckTest { Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster); - Map<String, Service> services = new HashMap<String, Service>(); + Map<String, Service> services = new HashMap<>(); Mockito.when(cluster.getServices()).thenReturn(services); services.put("HDFS", Mockito.mock(Service.class)); @@ -107,7 +107,7 @@ public class HiveMultipleMetastoreCheckTest { Mockito.when(hive.getServiceComponent("HIVE_METASTORE")).thenReturn(metastore); - Map<String, ServiceComponentHost> metastores = new HashMap<String, ServiceComponentHost>(); + Map<String, ServiceComponentHost> metastores = new HashMap<>(); Mockito.when(metastore.getServiceComponentHosts()).thenReturn(metastores); PrerequisiteCheck check = new PrerequisiteCheck(null, null); @@ -129,10 +129,10 @@ public class HiveMultipleMetastoreCheckTest { @Test public void testPerformFail() throws Exception{ final Cluster cluster = Mockito.mock(Cluster.class); - final LinkedHashSet<String> failedOnExpected = new LinkedHashSet<String>(); + final LinkedHashSet<String> failedOnExpected = new LinkedHashSet<>(); Service hive = Mockito.mock(Service.class); ServiceComponent metastore = Mockito.mock(ServiceComponent.class); - Map<String, ServiceComponentHost> metastores = new HashMap<String, ServiceComponentHost>(); + Map<String, ServiceComponentHost> metastores = new HashMap<>(); failedOnExpected.add("HIVE"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java index 9fcb319..7b7d817 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsMasterMaintenanceCheckTest.java @@ -116,7 +116,7 @@ public class HostsMasterMaintenanceCheckTest { hostsMasterMaintenanceCheck.perform(check, new PrereqCheckRequest("cluster")); Assert.assertEquals(PrereqCheckStatus.FAIL, check.getStatus()); - final Map<String, UpgradePack> upgradePacks = new HashMap<String, UpgradePack>(); + final Map<String, UpgradePack> upgradePacks = new HashMap<>(); final UpgradePack upgradePack = Mockito.mock(UpgradePack.class); Mockito.when(upgradePack.getName()).thenReturn(upgradePackName); upgradePacks.put(upgradePack.getName(), upgradePack); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java index 433eee1..4446cc4 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/HostsRepositoryVersionCheckTest.java @@ -97,7 +97,7 @@ public class HostsRepositoryVersionCheckTest { Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(cluster.getDesiredStackVersion()).thenReturn(new StackId()); Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster); - final Map<String, Host> hosts = new HashMap<String, Host>(); + final Map<String, Host> hosts = new HashMap<>(); final Host host1 = Mockito.mock(Host.class); final Host host2 = Mockito.mock(Host.class); final Host host3 = Mockito.mock(Host.class); @@ -177,7 +177,7 @@ public class HostsRepositoryVersionCheckTest { Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(cluster.getDesiredStackVersion()).thenReturn(new StackId()); Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster); - final Map<String, Host> hosts = new HashMap<String, Host>(); + final Map<String, Host> hosts = new HashMap<>(); final Host host1 = Mockito.mock(Host.class); final Host host2 = Mockito.mock(Host.class); final Host host3 = Mockito.mock(Host.class); @@ -234,7 +234,7 @@ public class HostsRepositoryVersionCheckTest { Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(cluster.getDesiredStackVersion()).thenReturn(new StackId()); Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster); - final Map<String, Host> hosts = new HashMap<String, Host>(); + final Map<String, Host> hosts = new HashMap<>(); final Host host1 = Mockito.mock(Host.class); final Host host2 = Mockito.mock(Host.class); final Host host3 = Mockito.mock(Host.class); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java index c45c59d..86a682c 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/InstallPackagesCheckTest.java @@ -136,13 +136,13 @@ public class InstallPackagesCheckTest { Mockito.when(clusterVersionEntity.getState()).thenReturn(RepositoryVersionState.INSTALLED); Mockito.when(clusterVersionDAO.findByClusterAndStackAndVersion( clusterName, targetStackId, repositoryVersion)).thenReturn(clusterVersionEntity); - final List<String> hostNames = new ArrayList<String>(); + final List<String> hostNames = new ArrayList<>(); hostNames.add("host1"); hostNames.add("host2"); hostNames.add("host3"); - final List<Host> hosts = new ArrayList<Host>(); - final List<HostVersionEntity> hostVersionEntities = new ArrayList<HostVersionEntity>(); + final List<Host> hosts = new ArrayList<>(); + final List<HostVersionEntity> hostVersionEntities = new ArrayList<>(); for(String hostName : hostNames) { Host host = Mockito.mock(Host.class); Mockito.when(host.getHostName()).thenReturn(hostName); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java index a48663a..61953a7 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/MapReduce2JobHistoryStatePreservingCheckTest.java @@ -73,7 +73,7 @@ public class MapReduce2JobHistoryStatePreservingCheckTest { Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster); Mockito.when(cluster.getCurrentStackVersion()).thenReturn(new StackId("HDP-2.3")); - Map<String, Service> services = new HashMap<String, Service>(); + Map<String, Service> services = new HashMap<>(); Mockito.when(cluster.getServices()).thenReturn(services); ClusterVersionEntity clusterVersionEntity = Mockito.mock(ClusterVersionEntity.class); @@ -99,14 +99,14 @@ public class MapReduce2JobHistoryStatePreservingCheckTest { final DesiredConfig desiredConfig = Mockito.mock(DesiredConfig.class); Mockito.when(desiredConfig.getTag()).thenReturn("tag"); - Map<String, DesiredConfig> configMap = new HashMap<String, DesiredConfig>(); + Map<String, DesiredConfig> configMap = new HashMap<>(); configMap.put("mapred-site", desiredConfig); configMap.put("yarn-site", desiredConfig); Mockito.when(cluster.getDesiredConfigs()).thenReturn(configMap); final Config config = Mockito.mock(Config.class); Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config); - final Map<String, String> properties = new HashMap<String, String>(); + final Map<String, String> properties = new HashMap<>(); Mockito.when(config.getProperties()).thenReturn(properties); PrerequisiteCheck check = new PrerequisiteCheck(null, null); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerAuditDbCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerAuditDbCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerAuditDbCheckTest.java index 81f243a..e3e14d5 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerAuditDbCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerAuditDbCheckTest.java @@ -87,13 +87,13 @@ public class RangerAuditDbCheckTest { final DesiredConfig desiredConfig = Mockito.mock(DesiredConfig.class); Mockito.when(desiredConfig.getTag()).thenReturn("tag"); - Map<String, DesiredConfig> configMap = new HashMap<String, DesiredConfig>(); + Map<String, DesiredConfig> configMap = new HashMap<>(); configMap.put("ranger-admin-site", desiredConfig); Mockito.when(cluster.getDesiredConfigs()).thenReturn(configMap); final Config config = Mockito.mock(Config.class); Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config); - final Map<String, String> properties = new HashMap<String, String>(); + final Map<String, String> properties = new HashMap<>(); Mockito.when(config.getProperties()).thenReturn(properties); properties.put("ranger.audit.source.type", "db"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerPasswordCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerPasswordCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerPasswordCheckTest.java index e5b231f..91b3296 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerPasswordCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerPasswordCheckTest.java @@ -82,7 +82,7 @@ public class RangerPasswordCheckTest { "]}"; private Clusters m_clusters = EasyMock.createMock(Clusters.class); - private Map<String, String> m_configMap = new HashMap<String, String>(); + private Map<String, String> m_configMap = new HashMap<>(); private RangerPasswordCheck m_rpc = null; private URLStreamProvider m_streamProvider = EasyMock.createMock(URLStreamProvider.class); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerSSLConfigCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerSSLConfigCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerSSLConfigCheckTest.java index 2af5502..327faf9 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerSSLConfigCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/RangerSSLConfigCheckTest.java @@ -88,13 +88,13 @@ public class RangerSSLConfigCheckTest { final DesiredConfig desiredConfig = Mockito.mock(DesiredConfig.class); Mockito.when(desiredConfig.getTag()).thenReturn("tag"); - Map<String, DesiredConfig> configMap = new HashMap<String, DesiredConfig>(); + Map<String, DesiredConfig> configMap = new HashMap<>(); configMap.put("ranger-admin-site", desiredConfig); Mockito.when(cluster.getDesiredConfigs()).thenReturn(configMap); final Config config = Mockito.mock(Config.class); Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config); - final Map<String, String> properties = new HashMap<String, String>(); + final Map<String, String> properties = new HashMap<>(); Mockito.when(config.getProperties()).thenReturn(properties); properties.put("ranger.service.http.enabled","true"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java index 03b0e81..d89f0e5 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicePresenceCheckTest.java @@ -62,7 +62,7 @@ public class ServicePresenceCheckTest { Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster); - Map<String, String> checkProperties = new HashMap<String, String>(); + Map<String, String> checkProperties = new HashMap<>(); checkProperties.put(ServicePresenceCheck.NO_UPGRADE_SUPPORT_SERVICES_PROPERTY_NAME,"MyServiceOne, MyServiceTwo"); checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME,"OldServiceOne, OldServiceTwo"); checkProperties.put(ServicePresenceCheck.NEW_SERVICES_PROPERTY_NAME,"NewServiceOne, NewServiceTwo"); @@ -86,11 +86,11 @@ public class ServicePresenceCheckTest { Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster); - Map<String, Service> services = new HashMap<String, Service>(); + Map<String, Service> services = new HashMap<>(); services.put("ATLAS", Mockito.mock(Service.class)); Mockito.when(cluster.getServices()).thenReturn(services); - Map<String, String> checkProperties = new HashMap<String, String>(); + Map<String, String> checkProperties = new HashMap<>(); checkProperties.put(ServicePresenceCheck.NO_UPGRADE_SUPPORT_SERVICES_PROPERTY_NAME,"Atlas, MyService"); PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class); Mockito.when(prerequisiteCheckConfig.getCheckProperties( @@ -110,12 +110,12 @@ public class ServicePresenceCheckTest { Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster); - Map<String, Service> services = new HashMap<String, Service>(); + Map<String, Service> services = new HashMap<>(); services.put("ATLAS", Mockito.mock(Service.class)); services.put("OLDSERVICE", Mockito.mock(Service.class)); Mockito.when(cluster.getServices()).thenReturn(services); - Map<String, String> checkProperties = new HashMap<String, String>(); + Map<String, String> checkProperties = new HashMap<>(); checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME,"Atlas, OldService"); checkProperties.put(ServicePresenceCheck.NEW_SERVICES_PROPERTY_NAME,"Atlas2, NewService"); @@ -137,11 +137,11 @@ public class ServicePresenceCheckTest { Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster); - Map<String, Service> services = new HashMap<String, Service>(); + Map<String, Service> services = new HashMap<>(); services.put("ATLAS", Mockito.mock(Service.class)); Mockito.when(cluster.getServices()).thenReturn(services); - Map<String, String> checkProperties = new HashMap<String, String>(); + Map<String, String> checkProperties = new HashMap<>(); checkProperties.put(ServicePresenceCheck.NO_UPGRADE_SUPPORT_SERVICES_PROPERTY_NAME,"MyServiceOne, MyServiceTwo"); checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME,"Atlas, OldService"); checkProperties.put(ServicePresenceCheck.NEW_SERVICES_PROPERTY_NAME,"Atlas2, NewService"); @@ -164,11 +164,11 @@ public class ServicePresenceCheckTest { Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster); - Map<String, Service> services = new HashMap<String, Service>(); + Map<String, Service> services = new HashMap<>(); services.put("OLDSERVICE", Mockito.mock(Service.class)); Mockito.when(cluster.getServices()).thenReturn(services); - Map<String, String> checkProperties = new HashMap<String, String>(); + Map<String, String> checkProperties = new HashMap<>(); checkProperties.put(ServicePresenceCheck.NO_UPGRADE_SUPPORT_SERVICES_PROPERTY_NAME,"Atlas, MyService"); checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME,"OldService"); checkProperties.put(ServicePresenceCheck.NEW_SERVICES_PROPERTY_NAME,"NewService"); @@ -191,14 +191,14 @@ public class ServicePresenceCheckTest { Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(m_clusters.getCluster("cluster")).thenReturn(cluster); - Map<String, Service> services = new HashMap<String, Service>(); + Map<String, Service> services = new HashMap<>(); services.put("ATLAS", Mockito.mock(Service.class)); services.put("HDFS", Mockito.mock(Service.class)); services.put("STORM", Mockito.mock(Service.class)); services.put("RANGER", Mockito.mock(Service.class)); Mockito.when(cluster.getServices()).thenReturn(services); - Map<String, String> checkProperties = new HashMap<String, String>(); + Map<String, String> checkProperties = new HashMap<>(); checkProperties.put(ServicePresenceCheck.NO_UPGRADE_SUPPORT_SERVICES_PROPERTY_NAME,"Atlas, HDFS"); checkProperties.put(ServicePresenceCheck.REMOVED_SERVICES_PROPERTY_NAME,"Storm, Ranger"); checkProperties.put(ServicePresenceCheck.NEW_SERVICES_PROPERTY_NAME,"Storm2, Ranger2"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java index 22f2b1b..f6ad846 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesMapReduceDistributedCacheCheckTest.java @@ -93,13 +93,13 @@ public class ServicesMapReduceDistributedCacheCheckTest { final DesiredConfig desiredConfig = Mockito.mock(DesiredConfig.class); Mockito.when(desiredConfig.getTag()).thenReturn("tag"); - Map<String, DesiredConfig> configMap = new HashMap<String, DesiredConfig>(); + Map<String, DesiredConfig> configMap = new HashMap<>(); configMap.put("mapred-site", desiredConfig); configMap.put("core-site", desiredConfig); Mockito.when(cluster.getDesiredConfigs()).thenReturn(configMap); final Config config = Mockito.mock(Config.class); Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config); - final Map<String, String> properties = new HashMap<String, String>(); + final Map<String, String> properties = new HashMap<>(); Mockito.when(config.getProperties()).thenReturn(properties); PrerequisiteCheck check = new PrerequisiteCheck(null, null); @@ -151,16 +151,16 @@ public class ServicesMapReduceDistributedCacheCheckTest { final DesiredConfig desiredConfig = Mockito.mock(DesiredConfig.class); Mockito.when(desiredConfig.getTag()).thenReturn("tag"); - Map<String, DesiredConfig> configMap = new HashMap<String, DesiredConfig>(); + Map<String, DesiredConfig> configMap = new HashMap<>(); configMap.put("mapred-site", desiredConfig); configMap.put("core-site", desiredConfig); Mockito.when(cluster.getDesiredConfigs()).thenReturn(configMap); final Config config = Mockito.mock(Config.class); Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config); - final Map<String, String> properties = new HashMap<String, String>(); + final Map<String, String> properties = new HashMap<>(); Mockito.when(config.getProperties()).thenReturn(properties); - Map<String, String> checkProperties = new HashMap<String, String>(); + Map<String, String> checkProperties = new HashMap<>(); checkProperties.put("dfs-protocols-regex","^([^:]*dfs|wasb|ecs):.*"); PrerequisiteCheckConfig prerequisiteCheckConfig = Mockito.mock(PrerequisiteCheckConfig.class); Mockito.when(prerequisiteCheckConfig.getCheckProperties( http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java index 282ccb9..a2a74bd 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeHighAvailabilityCheckTest.java @@ -88,7 +88,7 @@ public class ServicesNamenodeHighAvailabilityCheckTest { Mockito.when(cluster.getDesiredConfigs()).thenReturn(Collections.singletonMap("hdfs-site", desiredConfig)); final Config config = Mockito.mock(Config.class); Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config); - final Map<String, String> properties = new HashMap<String, String>(); + final Map<String, String> properties = new HashMap<>(); Mockito.when(config.getProperties()).thenReturn(properties); PrerequisiteCheck check = new PrerequisiteCheck(null, null); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java index f43907d..7d1f907 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/checks/ServicesNamenodeTruncateCheckTest.java @@ -50,7 +50,7 @@ public class ServicesNamenodeTruncateCheckTest { private Clusters m_clusters = EasyMock.createMock(Clusters.class); private ServicesNamenodeTruncateCheck m_check = new ServicesNamenodeTruncateCheck(); - private final Map<String, String> m_configMap = new HashMap<String, String>(); + private final Map<String, String> m_configMap = new HashMap<>(); @Before public void setup() throws Exception {