http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractJDBCResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractJDBCResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractJDBCResourceProviderTest.java index 466b998..f546aab 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractJDBCResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractJDBCResourceProviderTest.java @@ -51,7 +51,7 @@ public class AbstractJDBCResourceProviderTest { @Test public void test() throws SQLException { - Set<String> requestedIds = new TreeSet<String>(); + Set<String> requestedIds = new TreeSet<>(); requestedIds.add(property1); requestedIds.add("none1"); requestedIds.add(property2); @@ -129,7 +129,7 @@ public class AbstractJDBCResourceProviderTest { @Override protected Map<String,TestFields> getDBFieldMap() { - Map<String,TestFields> fields = new HashMap<String,TestFields>(); + Map<String,TestFields> fields = new HashMap<>(); fields.put(property1, TestFields.field1); fields.put(property2, TestFields.field2); return fields;
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractResourceProviderTest.java index ed16d68..c761323 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AbstractResourceProviderTest.java @@ -66,7 +66,7 @@ public class AbstractResourceProviderTest { @Test public void testCheckPropertyIds() { - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add("foo"); propertyIds.add("cat1/foo"); propertyIds.add("cat2/bar"); @@ -75,7 +75,7 @@ public class AbstractResourceProviderTest { propertyIds.add("cat4/sub2/sub3/bat"); propertyIds.add("cat5/subcat5/map"); - Map<Resource.Type, String> keyPropertyIds = new HashMap<Resource.Type, String>(); + Map<Resource.Type, String> keyPropertyIds = new HashMap<>(); AmbariManagementController managementController = createMock(AmbariManagementController.class); MaintenanceStateHelper maintenanceStateHelper = createNiceMock(MaintenanceStateHelper.class); @@ -105,7 +105,7 @@ public class AbstractResourceProviderTest { @Test public void testGetPropertyIds() { - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add("p1"); propertyIds.add("foo"); propertyIds.add("cat1/foo"); @@ -114,7 +114,7 @@ public class AbstractResourceProviderTest { propertyIds.add("cat3/sub1/bam"); propertyIds.add("cat4/sub2/sub3/bat"); - Map<Resource.Type, String> keyPropertyIds = new HashMap<Resource.Type, String>(); + Map<Resource.Type, String> keyPropertyIds = new HashMap<>(); AmbariManagementController managementController = createMock(AmbariManagementController.class); MaintenanceStateHelper maintenanceStateHelper = createNiceMock(MaintenanceStateHelper.class); @@ -131,8 +131,8 @@ public class AbstractResourceProviderTest { @Test public void testGetRequestStatus() { - Set<String> propertyIds = new HashSet<String>(); - Map<Resource.Type, String> keyPropertyIds = new HashMap<Resource.Type, String>(); + Set<String> propertyIds = new HashSet<>(); + Map<Resource.Type, String> keyPropertyIds = new HashMap<>(); AmbariManagementController managementController = createMock(AmbariManagementController.class); MaintenanceStateHelper maintenanceStateHelper = createNiceMock(MaintenanceStateHelper.class); replay(maintenanceStateHelper); @@ -177,7 +177,7 @@ public class AbstractResourceProviderTest { public void testGetPropertyMaps() throws Exception { AbstractResourceProvider provider = new TestResourceProvider(); - Map<String, Object> updatePropertyMap = new HashMap<String, Object>(); + Map<String, Object> updatePropertyMap = new HashMap<>(); updatePropertyMap.put("SomeProperty", "SomeUpdateValue"); updatePropertyMap.put("SomeOtherProperty", 99); @@ -797,26 +797,26 @@ public class AbstractResourceProviderTest { private static Resource.Type testResourceType = new Resource.Type("testResource"); private static Set<String> pkPropertyIds = - new HashSet<String>(Arrays.asList(new String[]{ - "ClusterName", - "ResourceName"})); + new HashSet<>(Arrays.asList(new String[]{ + "ClusterName", + "ResourceName"})); private static Set<String> propertyIds = - new HashSet<String>(Arrays.asList(new String[]{ - "ClusterName", - "ResourceName", - "SomeProperty", - "SomeOtherProperty"})); + new HashSet<>(Arrays.asList(new String[]{ + "ClusterName", + "ResourceName", + "SomeProperty", + "SomeOtherProperty"})); private static Map<Resource.Type, String> keyPropertyIds = - new HashMap<Resource.Type, String>(); + new HashMap<>(); static { keyPropertyIds.put(Resource.Type.Cluster, "ClusterName"); keyPropertyIds.put(testResourceType, "ResourceName" ); } - private static Set<Resource> allResources = new HashSet<Resource>(); + private static Set<Resource> allResources = new HashSet<>(); static { Resource resource = new ResourceImpl(testResourceType); @@ -870,7 +870,7 @@ public class AbstractResourceProviderTest { public Set<Resource> getResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { - Set<Resource> resources = new HashSet<Resource>(); + Set<Resource> resources = new HashSet<>(); for(Resource resource : allResources) { if (predicate.evaluate(resource)) { http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ActionResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ActionResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ActionResourceProviderTest.java index 061f06a..340e804 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ActionResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ActionResourceProviderTest.java @@ -96,7 +96,7 @@ public class ActionResourceProviderTest { AmbariManagementController managementController = createNiceMock(AmbariManagementController.class); expect(managementController.getAmbariMetaInfo()).andReturn(am).anyTimes(); - List<ActionDefinition> allDefinition = new ArrayList<ActionDefinition>(); + List<ActionDefinition> allDefinition = new ArrayList<>(); allDefinition.add(new ActionDefinition( "a1", ActionType.SYSTEM, "fileName", "HDFS", "DATANODE", "Does file exist", TargetHostType.ANY, Short.valueOf("100"), null)); @@ -107,7 +107,7 @@ public class ActionResourceProviderTest { "a3", ActionType.SYSTEM, "fileName", "HDFS", "DATANODE", "Does file exist", TargetHostType.ANY, Short.valueOf("100"), null)); - Set<ActionResponse> allResponse = new HashSet<ActionResponse>(); + Set<ActionResponse> allResponse = new HashSet<>(); for (ActionDefinition definition : allDefinition) { allResponse.add(definition.convertToResponse()); } @@ -116,7 +116,7 @@ public class ActionResourceProviderTest { "a1", ActionType.SYSTEM, "fileName", "HDFS", "DATANODE", "Does file exist", TargetHostType.ANY, Short.valueOf("100"), null); - Set<ActionResponse> nameResponse = new HashSet<ActionResponse>(); + Set<ActionResponse> nameResponse = new HashSet<>(); nameResponse.add(namedDefinition.convertToResponse()); expect(am.getAllActionDefinition()).andReturn(allDefinition).once(); @@ -130,7 +130,7 @@ public class ActionResourceProviderTest { PropertyHelper.getKeyPropertyIds(type), managementController); - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add(ActionResourceProvider.ACTION_NAME_PROPERTY_ID); propertyIds.add(ActionResourceProvider.ACTION_TYPE_PROPERTY_ID); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProviderTest.java index 05fdb01..152fafe 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertDefinitionResourceProviderTest.java @@ -438,7 +438,7 @@ public class AlertDefinitionResourceProviderTest { MetricSource source = (MetricSource)getMockSource(); AlertDefinitionResourceProvider provider = createProvider(amc); - Map<String, Object> requestProps = new HashMap<String, Object>(); + Map<String, Object> requestProps = new HashMap<>(); requestProps.put(AlertDefinitionResourceProvider.ALERT_DEF_CLUSTER_NAME, "c1"); requestProps.put(AlertDefinitionResourceProvider.ALERT_DEF_INTERVAL, "1"); requestProps.put(AlertDefinitionResourceProvider.ALERT_DEF_NAME, "my_def"); @@ -586,7 +586,7 @@ public class AlertDefinitionResourceProviderTest { MetricSource source = (MetricSource) getMockSource(); - Map<String, Object> requestProps = new HashMap<String, Object>(); + Map<String, Object> requestProps = new HashMap<>(); requestProps.put(AlertDefinitionResourceProvider.ALERT_DEF_CLUSTER_NAME, "c1"); requestProps.put(AlertDefinitionResourceProvider.ALERT_DEF_INTERVAL, "1"); requestProps.put(AlertDefinitionResourceProvider.ALERT_DEF_NAME, "my_def"); @@ -655,7 +655,7 @@ public class AlertDefinitionResourceProviderTest { expect(dao.merge((AlertDefinitionEntity) anyObject())).andReturn(entity).anyTimes(); replay(dao); - requestProps = new HashMap<String, Object>(); + requestProps = new HashMap<>(); requestProps.put(AlertDefinitionResourceProvider.ALERT_DEF_ID, "1"); requestProps.put(AlertDefinitionResourceProvider.ALERT_DEF_CLUSTER_NAME, "c1"); requestProps.put(AlertDefinitionResourceProvider.ALERT_DEF_INTERVAL, "2"); @@ -719,7 +719,7 @@ public class AlertDefinitionResourceProviderTest { SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createAdministrator()); MetricSource source = (MetricSource) getMockSource(); - Map<String, Object> requestProps = new HashMap<String, Object>(); + Map<String, Object> requestProps = new HashMap<>(); requestProps.put(AlertDefinitionResourceProvider.ALERT_DEF_CLUSTER_NAME, "c1"); requestProps.put(AlertDefinitionResourceProvider.ALERT_DEF_INTERVAL, "1"); requestProps.put(AlertDefinitionResourceProvider.ALERT_DEF_NAME, "my_def"); @@ -804,7 +804,7 @@ public class AlertDefinitionResourceProviderTest { AlertDefinitionResourceProvider provider = createProvider(amc); - Map<String, Object> requestProps = new HashMap<String, Object>(); + Map<String, Object> requestProps = new HashMap<>(); requestProps.put(AlertDefinitionResourceProvider.ALERT_DEF_CLUSTER_NAME, "c1"); requestProps.put(AlertDefinitionResourceProvider.ALERT_DEF_INTERVAL, "1"); requestProps.put(AlertDefinitionResourceProvider.ALERT_DEF_NAME, "my_def"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProviderTest.java index 8ad5df2..a5c4228 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertGroupResourceProviderTest.java @@ -436,19 +436,19 @@ public class AlertGroupResourceProviderTest { Capture<List<AlertGroupEntity>> listCapture = EasyMock.newCapture(); // the definition IDs to associate with the group - List<Long> definitionIds = new ArrayList<Long>(); + List<Long> definitionIds = new ArrayList<>(); definitionIds.add(ALERT_DEF_ID); // the target IDs to associate with the group - List<Long> targetIds = new ArrayList<Long>(); + List<Long> targetIds = new ArrayList<>(); targetIds.add(ALERT_TARGET_ID); // definition entities to return from DAO - List<AlertDefinitionEntity> definitionEntities = new ArrayList<AlertDefinitionEntity>(); + List<AlertDefinitionEntity> definitionEntities = new ArrayList<>(); definitionEntities.addAll(getMockDefinitions()); // target entities to return from DAO - List<AlertTargetEntity> targetEntities = new ArrayList<AlertTargetEntity>(); + List<AlertTargetEntity> targetEntities = new ArrayList<>(); targetEntities.addAll(getMockTargets()); // expect create group @@ -469,7 +469,7 @@ public class AlertGroupResourceProviderTest { AlertGroupResourceProvider provider = createProvider(m_amc); - Map<String, Object> requestProps = new HashMap<String, Object>(); + Map<String, Object> requestProps = new HashMap<>(); requestProps.put(AlertGroupResourceProvider.ALERT_GROUP_NAME, ALERT_GROUP_NAME); @@ -528,19 +528,19 @@ public class AlertGroupResourceProviderTest { Capture<AlertGroupEntity> entityCapture = EasyMock.newCapture(); // the definition IDs to associate with the group - List<Long> definitionIds = new ArrayList<Long>(); + List<Long> definitionIds = new ArrayList<>(); definitionIds.add(ALERT_DEF_ID); // the target IDs to associate with the group - List<Long> targetIds = new ArrayList<Long>(); + List<Long> targetIds = new ArrayList<>(); targetIds.add(ALERT_TARGET_ID); // definition entities to return from DAO - List<AlertDefinitionEntity> definitionEntities = new ArrayList<AlertDefinitionEntity>(); + List<AlertDefinitionEntity> definitionEntities = new ArrayList<>(); definitionEntities.addAll(getMockDefinitions()); // target entities to return from DAO - List<AlertTargetEntity> targetEntities = new ArrayList<AlertTargetEntity>(); + List<AlertTargetEntity> targetEntities = new ArrayList<>(); targetEntities.addAll(getMockTargets()); m_dao.createGroups(EasyMock.<List<AlertGroupEntity>>anyObject()); @@ -565,7 +565,7 @@ public class AlertGroupResourceProviderTest { SecurityContextHolder.getContext().setAuthentication(authentication); AlertGroupResourceProvider provider = createProvider(m_amc); - Map<String, Object> requestProps = new HashMap<String, Object>(); + Map<String, Object> requestProps = new HashMap<>(); requestProps.put(AlertGroupResourceProvider.ALERT_GROUP_NAME, ALERT_GROUP_NAME); @@ -579,7 +579,7 @@ public class AlertGroupResourceProviderTest { // create new properties, and include the ID since we're not going through // a service layer which would add it for us automatically - requestProps = new HashMap<String, Object>(); + requestProps = new HashMap<>(); requestProps.put(AlertGroupResourceProvider.ALERT_GROUP_ID, ALERT_GROUP_ID.toString()); @@ -642,19 +642,19 @@ public class AlertGroupResourceProviderTest { Capture<AlertGroupEntity> entityCapture = EasyMock.newCapture(); // the definition IDs to associate with the group - List<Long> definitionIds = new ArrayList<Long>(); + List<Long> definitionIds = new ArrayList<>(); definitionIds.add(ALERT_DEF_ID); // the target IDs to associate with the group - List<Long> targetIds = new ArrayList<Long>(); + List<Long> targetIds = new ArrayList<>(); targetIds.add(ALERT_TARGET_ID); // definition entities to return from DAO - List<AlertDefinitionEntity> definitionEntities = new ArrayList<AlertDefinitionEntity>(); + List<AlertDefinitionEntity> definitionEntities = new ArrayList<>(); definitionEntities.addAll(getMockDefinitions()); // target entities to return from DAO - List<AlertTargetEntity> newTargetEntities = new ArrayList<AlertTargetEntity>(); + List<AlertTargetEntity> newTargetEntities = new ArrayList<>(); newTargetEntities.addAll(getMockTargets()); Set<AlertTargetEntity> mockTargets2 = getMockTargets(); @@ -686,7 +686,7 @@ public class AlertGroupResourceProviderTest { // create new properties, and include the ID since we're not going through // a service layer which would add it for us automatically - Map<String, Object> requestProps = new HashMap<String, Object>(); + Map<String, Object> requestProps = new HashMap<>(); requestProps.put(AlertGroupResourceProvider.ALERT_GROUP_ID, ALERT_GROUP_ID.toString()); @@ -762,7 +762,7 @@ public class AlertGroupResourceProviderTest { AlertGroupResourceProvider provider = createProvider(m_amc); - Map<String, Object> requestProps = new HashMap<String, Object>(); + Map<String, Object> requestProps = new HashMap<>(); requestProps.put(AlertGroupResourceProvider.ALERT_GROUP_NAME, ALERT_GROUP_NAME); @@ -902,7 +902,7 @@ public class AlertGroupResourceProviderTest { entity.setSourceType(SourceType.METRIC); entity.setSource("{\"type\" : \"METRIC\"}"); - Set<AlertDefinitionEntity> definitions = new HashSet<AlertDefinitionEntity>(); + Set<AlertDefinitionEntity> definitions = new HashSet<>(); definitions.add(entity); return definitions; @@ -920,7 +920,7 @@ public class AlertGroupResourceProviderTest { entity.setTargetName(ALERT_TARGET_NAME); entity.setNotificationType(ALERT_TARGET_TYPE); - Set<AlertTargetEntity> targets = new HashSet<AlertTargetEntity>(); + Set<AlertTargetEntity> targets = new HashSet<>(); targets.add(entity); return targets; http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertResourceProviderTest.java index 63b201b..a93ecc9 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertResourceProviderTest.java @@ -566,7 +566,7 @@ public class AlertResourceProviderTest { SecurityContextHolder.getContext().setAuthentication(TestAuthenticationFactory.createAdministrator()); - Set<String> requestProperties = new HashSet<String>(); + Set<String> requestProperties = new HashSet<>(); requestProperties.add(AlertResourceProvider.ALERT_ID); requestProperties.add(AlertResourceProvider.ALERT_DEFINITION_NAME); @@ -653,7 +653,7 @@ public class AlertResourceProviderTest { int unknown = 3; int total = ok + warning + critical + unknown; - List<AlertCurrentEntity> currents = new ArrayList<AlertCurrentEntity>(total); + List<AlertCurrentEntity> currents = new ArrayList<>(total); for (int i = 0; i < total; i++) { AlertState state = AlertState.OK; http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProviderTest.java index 96b81fe..1b68775 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertTargetResourceProviderTest.java @@ -356,7 +356,7 @@ public class AlertTargetResourceProviderTest { */ private void testCreateResourcesWithGroups(Authentication authentication) throws Exception { List<Long> groupIds = Arrays.asList(1L, 2L, 3L); - List<AlertGroupEntity> groups = new ArrayList<AlertGroupEntity>(); + List<AlertGroupEntity> groups = new ArrayList<>(); AlertGroupEntity group1 = new AlertGroupEntity(); AlertGroupEntity group2 = new AlertGroupEntity(); AlertGroupEntity group3 = new AlertGroupEntity(); @@ -573,8 +573,8 @@ public class AlertTargetResourceProviderTest { Map<String, Object> requestProps = getCreationProperties(); requestProps.put( AlertTargetResourceProvider.ALERT_TARGET_STATES, - new ArrayList<String>(Arrays.asList(AlertState.OK.name(), - AlertState.UNKNOWN.name()))); + new ArrayList<>(Arrays.asList(AlertState.OK.name(), + AlertState.UNKNOWN.name()))); Request request = PropertyHelper.getCreateRequest(Collections.singleton(requestProps), null); @@ -649,7 +649,7 @@ public class AlertTargetResourceProviderTest { // create new properties, and include the ID since we're not going through // a service layer which would add it for us automatically - requestProps = new HashMap<String, Object>(); + requestProps = new HashMap<>(); requestProps.put(AlertTargetResourceProvider.ALERT_TARGET_ID, ALERT_TARGET_ID.toString()); @@ -711,7 +711,7 @@ public class AlertTargetResourceProviderTest { expect(m_dao.findTargetById(ALERT_TARGET_ID)).andReturn(target).times(1); List<Long> groupIds = Arrays.asList(1L, 2L, 3L); - List<AlertGroupEntity> groups = new ArrayList<AlertGroupEntity>(); + List<AlertGroupEntity> groups = new ArrayList<>(); AlertGroupEntity group1 = new AlertGroupEntity(); AlertGroupEntity group2 = new AlertGroupEntity(); AlertGroupEntity group3 = new AlertGroupEntity(); @@ -735,7 +735,7 @@ public class AlertTargetResourceProviderTest { // create new properties, and include the ID since we're not going through // a service layer which would add it for us automatically - requestProps = new HashMap<String, Object>(); + requestProps = new HashMap<>(); requestProps.put(AlertTargetResourceProvider.ALERT_TARGET_ID, ALERT_TARGET_ID.toString()); @@ -864,7 +864,7 @@ public class AlertTargetResourceProviderTest { Map<String, Object> requestProps = getCreationProperties(); // mock out the directive - Map<String, String> requestInfoProperties = new HashMap<String, String>(); + Map<String, String> requestInfoProperties = new HashMap<>(); requestInfoProperties.put( AlertTargetResourceDefinition.OVERWRITE_DIRECTIVE, "true"); @@ -926,7 +926,7 @@ public class AlertTargetResourceProviderTest { Collections.singleton(requestProps), null); provider.createResources(request); - requestProps = new HashMap<String, Object>(); + requestProps = new HashMap<>(); requestProps.put(AlertTargetResourceProvider.ALERT_TARGET_ID, ALERT_TARGET_ID.toString()); //selecting CUSTOM option for Groups, 2 group ids selected from the available options @@ -982,7 +982,7 @@ public class AlertTargetResourceProviderTest { Collections.singleton(requestProps), null); provider.createResources(request); - requestProps = new HashMap<String, Object>(); + requestProps = new HashMap<>(); requestProps.put(AlertTargetResourceProvider.ALERT_TARGET_ID, ALERT_TARGET_ID.toString()); //selecting ALL option for Groups @@ -1042,7 +1042,7 @@ public class AlertTargetResourceProviderTest { * @throws Exception */ private Map<String, Object> getCreationProperties() throws Exception { - Map<String, Object> requestProps = new HashMap<String, Object>(); + Map<String, Object> requestProps = new HashMap<>(); requestProps.put(AlertTargetResourceProvider.ALERT_TARGET_NAME, ALERT_TARGET_NAME); @@ -1070,7 +1070,7 @@ public class AlertTargetResourceProviderTest { * @throws Exception */ private Map<String, Object> getRecipientCreationProperties() throws Exception { - Map<String, Object> requestProps = new HashMap<String, Object>(); + Map<String, Object> requestProps = new HashMap<>(); requestProps.put(AlertTargetResourceProvider.ALERT_TARGET_NAME, ALERT_TARGET_NAME); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariPrivilegeResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariPrivilegeResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariPrivilegeResourceProviderTest.java index 84b1959..d177d9f 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariPrivilegeResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AmbariPrivilegeResourceProviderTest.java @@ -254,17 +254,17 @@ public class AmbariPrivilegeResourceProviderTest extends EasyMockSupport { expect(clusterEntity.getResource()).andReturn(clusterResourceEntity).anyTimes(); expect(clusterEntity.getClusterName()).andReturn("cluster1").anyTimes(); - List<UserEntity> userEntities = new LinkedList<UserEntity>(); + List<UserEntity> userEntities = new LinkedList<>(); userEntities.add(ambariUserEntity); userEntities.add(viewUserEntity); userEntities.add(clusterUserEntity); - List<PrivilegeEntity> privilegeEntities = new LinkedList<PrivilegeEntity>(); + List<PrivilegeEntity> privilegeEntities = new LinkedList<>(); privilegeEntities.add(ambariPrivilegeEntity); privilegeEntities.add(viewPrivilegeEntity); privilegeEntities.add(clusterPrivilegeEntity); - List<ClusterEntity> clusterEntities = new LinkedList<ClusterEntity>(); + List<ClusterEntity> clusterEntities = new LinkedList<>(); clusterEntities.add(clusterEntity); ClusterDAO clusterDAO = injector.getInstance(ClusterDAO.class); @@ -287,7 +287,7 @@ public class AmbariPrivilegeResourceProviderTest extends EasyMockSupport { Assert.assertEquals(3, resources.size()); - Map<Object, Resource> resourceMap = new HashMap<Object, Resource>(); + Map<Object, Resource> resourceMap = new HashMap<>(); for (Resource resource : resources) { resourceMap.put(resource.getPropertyValue(AmbariPrivilegeResourceProvider.PRIVILEGE_ID_PROPERTY_ID), resource); @@ -360,7 +360,7 @@ public class AmbariPrivilegeResourceProviderTest extends EasyMockSupport { Map<Long, UserEntity> userEntities = new HashMap<>(); Map<Long, GroupEntity> groupEntities = new HashMap<>(); Map<Long, PermissionEntity> roleEntities = new HashMap<>(); - Map<Long, Object> resourceEntities = new HashMap<Long, Object>(); + Map<Long, Object> resourceEntities = new HashMap<>(); AmbariPrivilegeResourceProvider provider = new AmbariPrivilegeResourceProvider(); Resource resource = provider.toResource(privilegeEntity, userEntities, groupEntities, roleEntities, resourceEntities, provider.getPropertyIds()); @@ -405,7 +405,7 @@ public class AmbariPrivilegeResourceProviderTest extends EasyMockSupport { Map<Long, GroupEntity> groupEntities = new HashMap<>(); Map<Long, PermissionEntity> roleEntities = new HashMap<>(); - Map<Long, Object> resourceEntities = new HashMap<Long, Object>(); + Map<Long, Object> resourceEntities = new HashMap<>(); resourceEntities.put(resourceEntity.getId(), clusterEntity); AmbariPrivilegeResourceProvider provider = new AmbariPrivilegeResourceProvider(); @@ -457,7 +457,7 @@ public class AmbariPrivilegeResourceProviderTest extends EasyMockSupport { Map<Long, GroupEntity> groupEntities = new HashMap<>(); Map<Long, PermissionEntity> roleEntities = new HashMap<>(); - Map<Long, Object> resourceEntities = new HashMap<Long, Object>(); + Map<Long, Object> resourceEntities = new HashMap<>(); resourceEntities.put(resourceEntity.getId(), viewInstanceEntity); AmbariPrivilegeResourceProvider provider = new AmbariPrivilegeResourceProvider(); @@ -511,7 +511,7 @@ public class AmbariPrivilegeResourceProviderTest extends EasyMockSupport { Map<Long, GroupEntity> groupEntities = new HashMap<>(); Map<Long, PermissionEntity> roleEntities = new HashMap<>(); - Map<Long, Object> resourceEntities = new HashMap<Long, Object>(); + Map<Long, Object> resourceEntities = new HashMap<>(); resourceEntities.put(resourceEntity.getId(), viewInstanceEntity); AmbariPrivilegeResourceProvider provider = new AmbariPrivilegeResourceProvider(); @@ -536,7 +536,7 @@ public class AmbariPrivilegeResourceProviderTest extends EasyMockSupport { PrivilegeEntity privilegeEntity = createMockPrivilegeEntity(2, clusterResourceEntity, principalEntity, permissionEntity); - Set<PrivilegeEntity> privilegeEntities = new HashSet<PrivilegeEntity>(); + Set<PrivilegeEntity> privilegeEntities = new HashSet<>(); privilegeEntities.add(privilegeEntity); expect(principalEntity.getPrivileges()).andReturn(privilegeEntities).atLeastOnce(); @@ -571,7 +571,7 @@ public class AmbariPrivilegeResourceProviderTest extends EasyMockSupport { SecurityContextHolder.getContext().setAuthentication(authentication); // add the property map to a set for the request. - Map<String, Object> properties = new LinkedHashMap<String, Object>(); + Map<String, Object> properties = new LinkedHashMap<>(); properties.put(PrivilegeResourceProvider.PERMISSION_NAME_PROPERTY_ID, "CLUSTER.OPERATOR"); properties.put(PrivilegeResourceProvider.PRINCIPAL_NAME_PROPERTY_ID, "User1"); properties.put(PrivilegeResourceProvider.PRINCIPAL_TYPE_PROPERTY_ID, "USER"); @@ -588,14 +588,14 @@ public class AmbariPrivilegeResourceProviderTest extends EasyMockSupport { private void getResourcesTest(Authentication authentication) throws Exception { Injector injector = createInjector(); - List<PrivilegeEntity> privilegeEntities = new LinkedList<PrivilegeEntity>(); + List<PrivilegeEntity> privilegeEntities = new LinkedList<>(); PrincipalEntity principalEntity = createMockPrincipalEntity(1L, createMockPrincipalTypeEntity("USER")); - List<PrincipalEntity> principalEntities = new LinkedList<PrincipalEntity>(); + List<PrincipalEntity> principalEntities = new LinkedList<>(); principalEntities.add(principalEntity); - List<UserEntity> userEntities = new LinkedList<UserEntity>(); + List<UserEntity> userEntities = new LinkedList<>(); userEntities.add(createMockUserEntity(principalEntity, "User1")); ResourceTypeEntity ambariResourceTypeEntity = createMockResourceTypeEntity(ResourceType.AMBARI); @@ -640,11 +640,11 @@ public class AmbariPrivilegeResourceProviderTest extends EasyMockSupport { PrincipalEntity principalEntity1 = createMockPrincipalEntity(1L, createMockPrincipalTypeEntity("USER")); PrincipalEntity principalEntity2 = createMockPrincipalEntity(2L, createMockPrincipalTypeEntity("USER")); - List<PrincipalEntity> principalEntities = new LinkedList<PrincipalEntity>(); + List<PrincipalEntity> principalEntities = new LinkedList<>(); principalEntities.add(principalEntity1); principalEntities.add(principalEntity2); - List<UserEntity> userEntities = new LinkedList<UserEntity>(); + List<UserEntity> userEntities = new LinkedList<>(); userEntities.add(createMockUserEntity(principalEntity1, requestedUsername)); userEntities.add(createMockUserEntity(principalEntity2, "Not" + requestedUsername)); @@ -652,7 +652,7 @@ public class AmbariPrivilegeResourceProviderTest extends EasyMockSupport { ResourceEntity clusterResourceEntity = createMockResourceEntity(1L, clusterResourceTypeEntity); PermissionEntity permissionEntity = createMockPermissionEntity("CLUSTER.OPERATOR", "Cluster Operator", clusterResourceTypeEntity); - List<PrivilegeEntity> privilegeEntities = new LinkedList<PrivilegeEntity>(); + List<PrivilegeEntity> privilegeEntities = new LinkedList<>(); privilegeEntities.add(createMockPrivilegeEntity(1, clusterResourceEntity, principalEntity1, permissionEntity)); privilegeEntities.add(createMockPrivilegeEntity(2, clusterResourceEntity, principalEntity2, permissionEntity)); @@ -662,7 +662,7 @@ public class AmbariPrivilegeResourceProviderTest extends EasyMockSupport { UserDAO userDAO = injector.getInstance(UserDAO.class); expect(userDAO.findUsersByPrincipal(principalEntities)).andReturn(userEntities).atLeastOnce(); - List<ClusterEntity> clusterEntities = new ArrayList<ClusterEntity>(); + List<ClusterEntity> clusterEntities = new ArrayList<>(); clusterEntities.add(createMockClusterEntity("c1", clusterResourceEntity)); ClusterDAO clusterDAO = injector.getInstance(ClusterDAO.class); @@ -700,13 +700,13 @@ public class AmbariPrivilegeResourceProviderTest extends EasyMockSupport { PrivilegeEntity privilegeEntity1 = createMockPrivilegeEntity(1, clusterResourceEntity, principalEntity1, permissionEntity); PrivilegeEntity privilegeEntity2 = createMockPrivilegeEntity(2, clusterResourceEntity, principalEntity2, permissionEntity); - Set<PrivilegeEntity> privilege1Entities = new HashSet<PrivilegeEntity>(); + Set<PrivilegeEntity> privilege1Entities = new HashSet<>(); privilege1Entities.add(privilegeEntity1); - Set<PrivilegeEntity> privilege2Entities = new HashSet<PrivilegeEntity>(); + Set<PrivilegeEntity> privilege2Entities = new HashSet<>(); privilege2Entities.add(privilegeEntity2); - List<PrivilegeEntity> privilegeEntities = new LinkedList<PrivilegeEntity>(); + List<PrivilegeEntity> privilegeEntities = new LinkedList<>(); privilegeEntities.addAll(privilege1Entities); privilegeEntities.addAll(privilege2Entities); @@ -742,7 +742,7 @@ public class AmbariPrivilegeResourceProviderTest extends EasyMockSupport { SecurityContextHolder.getContext().setAuthentication(authentication); // add the property map to a set for the request. - Map<String, Object> properties = new LinkedHashMap<String, Object>(); + Map<String, Object> properties = new LinkedHashMap<>(); properties.put(PrivilegeResourceProvider.PERMISSION_NAME_PROPERTY_ID, "CLUSTER.OPERATOR"); properties.put(PrivilegeResourceProvider.PRINCIPAL_NAME_PROPERTY_ID, requestedUsername); properties.put(PrivilegeResourceProvider.PRINCIPAL_TYPE_PROPERTY_ID, "USER"); @@ -767,7 +767,7 @@ public class AmbariPrivilegeResourceProviderTest extends EasyMockSupport { PrivilegeEntity privilegeEntity1 = createMockPrivilegeEntity(1, clusterResourceEntity, principalEntity1, permissionEntity); - Set<PrivilegeEntity> privilege1Entities = new HashSet<PrivilegeEntity>(); + Set<PrivilegeEntity> privilege1Entities = new HashSet<>(); privilege1Entities.add(privilegeEntity1); expect(principalEntity1.getPrivileges()).andReturn(privilege1Entities).atLeastOnce(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ArtifactResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ArtifactResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ArtifactResourceProviderTest.java index 72b36b9..fe12e9c 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ArtifactResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ArtifactResourceProviderTest.java @@ -89,26 +89,26 @@ public class ArtifactResourceProviderTest { @Test public void testGetResources_instance() throws Exception { - Set<String> propertyIds = new HashSet<String>(); - TreeMap<String, String> foreignKeys = new TreeMap<String, String>(); + Set<String> propertyIds = new HashSet<>(); + TreeMap<String, String> foreignKeys = new TreeMap<>(); foreignKeys.put("cluster", "500"); - Map<String, Object> childMap = new TreeMap<String, Object>(); + Map<String, Object> childMap = new TreeMap<>(); childMap.put("childKey", "childValue"); - Map<String, Object> child2Map = new TreeMap<String, Object>(); + Map<String, Object> child2Map = new TreeMap<>(); childMap.put("child2", child2Map); child2Map.put("child2Key", "child2Value"); - Map<String, Object> child3Map = new TreeMap<String, Object>(); + Map<String, Object> child3Map = new TreeMap<>(); child2Map.put("child3", child3Map); - Map<String, Object> child4Map = new TreeMap<String, Object>(); + Map<String, Object> child4Map = new TreeMap<>(); child3Map.put("child4", child4Map); child4Map.put("child4Key", "child4Value"); - Map<String, Object> artifact_data = new TreeMap<String, Object>(); + Map<String, Object> artifact_data = new TreeMap<>(); artifact_data.put("foo", "bar"); artifact_data.put("child", childMap); - Map<String, String> responseForeignKeys = new HashMap<String, String>(); + Map<String, String> responseForeignKeys = new HashMap<>(); responseForeignKeys.put("cluster", "500"); // expectations @@ -152,18 +152,18 @@ public class ArtifactResourceProviderTest { @Test public void testGetResources_collection() throws Exception { - Set<String> propertyIds = new HashSet<String>(); - TreeMap<String, String> foreignKeys = new TreeMap<String, String>(); + Set<String> propertyIds = new HashSet<>(); + TreeMap<String, String> foreignKeys = new TreeMap<>(); foreignKeys.put("cluster", "500"); - List<ArtifactEntity> entities = new ArrayList<ArtifactEntity>(); + List<ArtifactEntity> entities = new ArrayList<>(); entities.add(entity); entities.add(entity2); Map<String, Object> artifact_data = Collections.<String, Object>singletonMap("foo", "bar"); Map<String, Object> artifact_data2 = Collections.<String, Object>singletonMap("foo2", "bar2"); - Map<String, String> responseForeignKeys = new HashMap<String, String>(); + Map<String, String> responseForeignKeys = new HashMap<>(); responseForeignKeys.put("cluster", "500"); // expectations @@ -215,37 +215,37 @@ public class ArtifactResourceProviderTest { @Test public void testCreateResource() throws Exception { Capture<ArtifactEntity> createEntityCapture = newCapture(); - Map<String, Object> outerMap = new TreeMap<String, Object>(); - Map<String, Object> childMap = new TreeMap<String, Object>(); + Map<String, Object> outerMap = new TreeMap<>(); + Map<String, Object> childMap = new TreeMap<>(); outerMap.put("child", childMap); childMap.put("childKey", "childValue"); - Map<String, Object> child2Map = new TreeMap<String, Object>(); + Map<String, Object> child2Map = new TreeMap<>(); childMap.put("child2", child2Map); child2Map.put("child2Key", "child2Value"); - Map<String, Object> child3Map = new TreeMap<String, Object>(); + Map<String, Object> child3Map = new TreeMap<>(); child2Map.put("child3", child3Map); - Map<String, Object> child4Map = new TreeMap<String, Object>(); + Map<String, Object> child4Map = new TreeMap<>(); child3Map.put("child4", child4Map); child4Map.put("child4Key", "child4Value"); - Set<Map<String, Object>> propertySet = new HashSet<Map<String, Object>>(); + Set<Map<String, Object>> propertySet = new HashSet<>(); propertySet.add(outerMap); propertySet.add(child4Map); - Map<String, Object> artifact_data = new TreeMap<String, Object>(); + Map<String, Object> artifact_data = new TreeMap<>(); artifact_data.put("foo", "bar"); artifact_data.put("child", childMap); artifact_data.put("collection", propertySet); - TreeMap<String, String> foreignKeys = new TreeMap<String, String>(); + TreeMap<String, String> foreignKeys = new TreeMap<>(); foreignKeys.put("cluster", "500"); - Map<String, String> requestInfoProps = new HashMap<String, String>(); + Map<String, String> requestInfoProps = new HashMap<>(); requestInfoProps.put(Request.REQUEST_INFO_BODY_PROPERTY, bodyJson); // map with flattened properties - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put("Artifacts/artifact_name", "test-artifact"); properties.put("Artifacts/cluster_name", "test-cluster"); properties.put("artifact_data/foo", "bar"); @@ -253,18 +253,18 @@ public class ArtifactResourceProviderTest { properties.put("artifact_data/child/child2/child2Key", "child2Value"); properties.put("artifact_data/child/child2/child3/child4/child4Key", "child4Value"); - Collection<Object> collectionProperties = new HashSet<Object>(); + Collection<Object> collectionProperties = new HashSet<>(); properties.put("artifact_data/collection", collectionProperties); // collection with maps of flattened properties - Map<String, Object> map1 = new TreeMap<String, Object>(); + Map<String, Object> map1 = new TreeMap<>(); collectionProperties.add(map1); map1.put("foo", "bar"); map1.put("child/childKey", "childValue"); map1.put("child/child2/child2Key", "child2Value"); map1.put("child/child2/child3/child4/child4Key", "child4Value"); - Map<String, Object> map2 = new TreeMap<String, Object>(); + Map<String, Object> map2 = new TreeMap<>(); collectionProperties.add(map2); map2.put("child4Key", "child4Value"); @@ -303,27 +303,27 @@ public class ArtifactResourceProviderTest { @Test public void testUpdateResources() throws Exception { - Map<String, String> requestInfoProps = new HashMap<String, String>(); + Map<String, String> requestInfoProps = new HashMap<>(); requestInfoProps.put(Request.REQUEST_INFO_BODY_PROPERTY, bodyJson); Capture<ArtifactEntity> updateEntityCapture = newCapture(); Capture<ArtifactEntity> updateEntityCapture2 = newCapture(); - Set<String> propertyIds = new HashSet<String>(); - TreeMap<String, String> foreignKeys = new TreeMap<String, String>(); + Set<String> propertyIds = new HashSet<>(); + TreeMap<String, String> foreignKeys = new TreeMap<>(); foreignKeys.put("cluster", "500"); - List<ArtifactEntity> entities = new ArrayList<ArtifactEntity>(); + List<ArtifactEntity> entities = new ArrayList<>(); entities.add(entity); entities.add(entity2); Map<String, Object> artifact_data = Collections.<String, Object>singletonMap("foo", "bar"); Map<String, Object> artifact_data2 = Collections.<String, Object>singletonMap("foo2", "bar2"); - Map<String, String> responseForeignKeys = new HashMap<String, String>(); + Map<String, String> responseForeignKeys = new HashMap<>(); responseForeignKeys.put("cluster", "500"); // map with flattened properties - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put("Artifacts/artifact_name", "test-artifact"); properties.put("Artifacts/cluster_name", "test-cluster"); properties.put("artifact_data/foo", "bar"); @@ -396,17 +396,17 @@ public class ArtifactResourceProviderTest { Capture<ArtifactEntity> deleteEntityCapture = newCapture(); Capture<ArtifactEntity> deleteEntityCapture2 = newCapture(); - TreeMap<String, String> foreignKeys = new TreeMap<String, String>(); + TreeMap<String, String> foreignKeys = new TreeMap<>(); foreignKeys.put("cluster", "500"); - List<ArtifactEntity> entities = new ArrayList<ArtifactEntity>(); + List<ArtifactEntity> entities = new ArrayList<>(); entities.add(entity); entities.add(entity2); Map<String, Object> artifact_data = Collections.<String, Object>singletonMap("foo", "bar"); Map<String, Object> artifact_data2 = Collections.<String, Object>singletonMap("foo2", "bar2"); - Map<String, String> responseForeignKeys = new HashMap<String, String>(); + Map<String, String> responseForeignKeys = new HashMap<>(); responseForeignKeys.put("cluster", "500"); // expectations http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BaseBlueprintProcessorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BaseBlueprintProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BaseBlueprintProcessorTest.java index 028f28c..da8b01c 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BaseBlueprintProcessorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BaseBlueprintProcessorTest.java @@ -73,7 +73,7 @@ public class BaseBlueprintProcessorTest { String component) { // simulate the dependencies in a given stack by overriding this method if (component.equals("FAKE_MONITORING_SERVER")) { - Set<DependencyInfo> setOfDependencies = new HashSet<DependencyInfo>(); + Set<DependencyInfo> setOfDependencies = new HashSet<>(); setOfDependencies.add(hCatDependency); setOfDependencies.add(yarnClientDependency); @@ -174,7 +174,7 @@ public class BaseBlueprintProcessorTest { String component) { // simulate the dependencies in a given stack by overriding this method if (component.equals("FAKE_MONITORING_SERVER")) { - Set<DependencyInfo> setOfDependencies = new HashSet<DependencyInfo>(); + Set<DependencyInfo> setOfDependencies = new HashSet<>(); setOfDependencies.add(yarnClientDependency); setOfDependencies.add(tezClientDependency); @@ -272,7 +272,7 @@ public class BaseBlueprintProcessorTest { String component) { // simulate the dependencies in a given stack by overriding this method if (component.equals("FAKE_MONITORING_SERVER")) { - Set<DependencyInfo> setOfDependencies = new HashSet<DependencyInfo>(); + Set<DependencyInfo> setOfDependencies = new HashSet<>(); setOfDependencies.add(hCatDependency); setOfDependencies.add(tezClientDependency); @@ -368,7 +368,7 @@ public class BaseBlueprintProcessorTest { String component) { // simulate the dependencies in a given stack by overriding this method if (component.equals("FAKE_MONITORING_SERVER")) { - Set<DependencyInfo> setOfDependencies = new HashSet<DependencyInfo>(); + Set<DependencyInfo> setOfDependencies = new HashSet<>(); setOfDependencies.add(hCatDependency); setOfDependencies.add(yarnClientDependency); @@ -466,7 +466,7 @@ public class BaseBlueprintProcessorTest { String component) { // simulate the dependencies in a given stack by overriding this method if (component.equals("FAKE_MONITORING_SERVER")) { - Set<DependencyInfo> setOfDependencies = new HashSet<DependencyInfo>(); + Set<DependencyInfo> setOfDependencies = new HashSet<>(); setOfDependencies.add(hCatDependency); setOfDependencies.add(yarnClientDependency); @@ -562,7 +562,7 @@ public class BaseBlueprintProcessorTest { String component) { // simulate the dependencies in a given stack by overriding this method if (component.equals("FAKE_MONITORING_SERVER")) { - Set<DependencyInfo> setOfDependencies = new HashSet<DependencyInfo>(); + Set<DependencyInfo> setOfDependencies = new HashSet<>(); setOfDependencies.add(hCatDependency); setOfDependencies.add(yarnClientDependency); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BaseProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BaseProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BaseProviderTest.java index 4995fa6..0b60be2 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BaseProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/BaseProviderTest.java @@ -42,7 +42,7 @@ import org.junit.Test; public class BaseProviderTest { @Test public void testGetProperties() { - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add("foo"); propertyIds.add("bar"); propertyIds.add("cat1/prop1"); @@ -57,7 +57,7 @@ public class BaseProviderTest { @Test public void testCheckPropertyIds() { - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add("foo"); propertyIds.add("bar"); propertyIds.add("cat1/prop1"); @@ -93,7 +93,7 @@ public class BaseProviderTest { @Test public void testGetRequestPropertyIds() { - Set<String> providerPropertyIds = new HashSet<String>(); + Set<String> providerPropertyIds = new HashSet<>(); providerPropertyIds.add("foo"); providerPropertyIds.add("bar"); providerPropertyIds.add("cat1/sub1"); @@ -136,7 +136,7 @@ public class BaseProviderTest { @Test public void testSetResourceProperty() { - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add("p1"); propertyIds.add("foo"); propertyIds.add("cat1/foo"); @@ -172,7 +172,7 @@ public class BaseProviderTest { @Test public void testIsPropertyRequested() { - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add("p1"); propertyIds.add("foo"); propertyIds.add("cat1/foo"); @@ -200,7 +200,7 @@ public class BaseProviderTest { @Test public void testSetResourcePropertyWithMaps() { - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add("cat1/emptyMapProperty"); propertyIds.add("cat1/mapProperty"); propertyIds.add("cat2/mapMapProperty"); @@ -211,11 +211,11 @@ public class BaseProviderTest { Resource resource = new ResourceImpl(Resource.Type.Service); // Adding an empty Map as a property should add the actual Map as a property - Map<String, String> emptyMapProperty = new HashMap<String, String>(); + Map<String, String> emptyMapProperty = new HashMap<>(); BaseProvider.setResourceProperty(resource, "cat1/emptyMapProperty", emptyMapProperty, propertyIds); assertTrue(resource.getPropertiesMap().containsKey("cat1/emptyMapProperty")); - Map<String, String> mapProperty = new HashMap<String, String>(); + Map<String, String> mapProperty = new HashMap<>(); mapProperty.put("key1", "value1"); mapProperty.put("key2", "value2"); mapProperty.put("key3", "value3"); @@ -228,18 +228,18 @@ public class BaseProviderTest { assertEquals("value2", resource.getPropertyValue("cat1/mapProperty/key2")); assertEquals("value3", resource.getPropertyValue("cat1/mapProperty/key3")); - Map<String, Map<String, String>> mapMapProperty = new HashMap<String, Map<String, String>>(); - Map<String, String> mapSubProperty1 = new HashMap<String, String>(); + Map<String, Map<String, String>> mapMapProperty = new HashMap<>(); + Map<String, String> mapSubProperty1 = new HashMap<>(); mapSubProperty1.put("key1", "value11"); mapSubProperty1.put("key2", "value12"); mapSubProperty1.put("key3", "value13"); mapMapProperty.put("subMap1", mapSubProperty1); - Map<String, String> mapSubProperty2 = new HashMap<String, String>(); + Map<String, String> mapSubProperty2 = new HashMap<>(); mapSubProperty2.put("key1", "value21"); mapSubProperty2.put("key2", "value22"); mapSubProperty2.put("key3", "value23"); mapMapProperty.put("subMap2", mapSubProperty2); - Map<String, String> mapSubProperty3 = new HashMap<String, String>(); + Map<String, String> mapSubProperty3 = new HashMap<>(); mapMapProperty.put("subMap3", mapSubProperty3); // Map of maps ... adding a property of type Map should add all of its keys as sub properties @@ -263,7 +263,7 @@ public class BaseProviderTest { assertEquals("value23", resource.getPropertyValue("cat2/mapMapProperty/subMap2/key3")); - Map<String, String> mapProperty3 = new HashMap<String, String>(); + Map<String, String> mapProperty3 = new HashMap<>(); mapProperty3.put("key1", "value1"); mapProperty3.put("key2", "value2"); mapProperty3.put("key3", "value3"); @@ -277,7 +277,7 @@ public class BaseProviderTest { assertEquals("value2", resource.getPropertyValue("cat3/mapProperty3/key2")); assertNull(resource.getPropertyValue("cat3/mapProperty3/key3")); - Map<String, Map<String, String>> mapMapProperty4 = new HashMap<String, Map<String, String>>(); + Map<String, Map<String, String>> mapMapProperty4 = new HashMap<>(); mapMapProperty4.put("subMap1", mapSubProperty1); mapMapProperty4.put("subMap2", mapSubProperty2); // Map of maps ... adding a property of type Map shouldn't add the map if it wasn't requested and @@ -301,7 +301,7 @@ public class BaseProviderTest { @Test public void testRegexpMethods() { - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); String regexp = "cat/$1.replaceAll(\\\"([.])\\\",\\\"/\\\")/key"; String propertyId = "cat/sub/key"; String regexp2 = "cat/$1.replaceAll(\\\"([.])\\\",\\\"/\\\")/something/$2/key"; @@ -323,7 +323,7 @@ public class BaseProviderTest { @Test public void testComplexMetricParsing() { - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add("metrics/flume/$1.substring(0)/CHANNEL/$2.replaceAll(\"[^-]+\",\"\")EventPutSuccessCount/rate/sum"); propertyIds.add("metrics/yarn/Queue/$1.replaceAll(\"([.])\",\"/\")/AppsCompleted"); propertyIds.add("metrics/yarn/Queue/$1.replaceAll(\",q(\\d+)=\",\"/\").substring(1)/AppsFailed");