http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/SimplifyingPredicateVisitorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/SimplifyingPredicateVisitorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/SimplifyingPredicateVisitorTest.java index c5ccc3c..0e9ac75 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/SimplifyingPredicateVisitorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/SimplifyingPredicateVisitorTest.java @@ -159,7 +159,7 @@ public class SimplifyingPredicateVisitorTest { verify(provider); reset(provider); expect(provider.checkPropertyIds(capture(propertiesCapture))).andReturn(Collections.<String>emptySet()); - expect(provider.checkPropertyIds(capture(propertiesCapture))).andReturn(Collections.<String>singleton(PROPERTY_D)); + expect(provider.checkPropertyIds(capture(propertiesCapture))).andReturn(Collections.singleton(PROPERTY_D)); replay(provider); // ---
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProviderTest.java index 0ac186d..6191295 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackAdvisorResourceProviderTest.java @@ -52,10 +52,10 @@ public class StackAdvisorResourceProviderTest { keyPropertyIds, ambariManagementController); Request request = mock(Request.class); - Set<Map<String, Object>> propertiesSet = new HashSet<Map<String, Object>>(); - Map<String, Object> propertiesMap = new HashMap<String, Object>(); + Set<Map<String, Object>> propertiesSet = new HashSet<>(); + Map<String, Object> propertiesMap = new HashMap<>(); propertiesMap.put(CONFIGURATIONS_PROPERTY_ID + "site/properties/string_prop", "string"); - List<Object> array = new ArrayList<Object>(); + List<Object> array = new ArrayList<>(); array.add("array1"); array.add("array2"); propertiesMap.put(CONFIGURATIONS_PROPERTY_ID + "site/properties/array_prop", array); @@ -87,10 +87,10 @@ public class StackAdvisorResourceProviderTest { keyPropertyIds, ambariManagementController); Request request = mock(Request.class); - Set<Map<String, Object>> propertiesSet = new HashSet<Map<String, Object>>(); - Map<String, Object> propertiesMap = new HashMap<String, Object>(); + Set<Map<String, Object>> propertiesSet = new HashSet<>(); + Map<String, Object> propertiesMap = new HashMap<>(); propertiesMap.put(CONFIGURATIONS_PROPERTY_ID + "site/properties/string_prop", "string"); - List<Object> array = new ArrayList<Object>(); + List<Object> array = new ArrayList<>(); array.add("array1"); array.add("array2"); propertiesMap.put(USER_CONTEXT_OPERATION_PROPERTY, "op1"); @@ -117,10 +117,10 @@ public class StackAdvisorResourceProviderTest { keyPropertyIds, ambariManagementController); Request request = mock(Request.class); - Set<Map<String, Object>> propertiesSet = new HashSet<Map<String, Object>>(); - Map<String, Object> propertiesMap = new HashMap<String, Object>(); + Set<Map<String, Object>> propertiesSet = new HashSet<>(); + Map<String, Object> propertiesMap = new HashMap<>(); propertiesMap.put(CONFIGURATIONS_PROPERTY_ID + "site/properties/string_prop", null); //null value means no value specified for the property - List<Object> array = new ArrayList<Object>(); + List<Object> array = new ArrayList<>(); array.add("array1"); array.add("array2"); propertiesMap.put(CONFIGURATIONS_PROPERTY_ID + "site/properties/array_prop", array); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProviderTest.java index 149a91c..880f7ec 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackArtifactResourceProviderTest.java @@ -97,7 +97,7 @@ public class StackArtifactResourceProviderTest { StackArtifactResourceProvider resourceProvider = getStackArtifactResourceProvider(managementController); - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add(ARTIFACT_NAME_PROPERTY_ID); propertyIds.add(STACK_NAME_PROPERTY_ID); propertyIds.add(STACK_VERSION_PROPERTY_ID); @@ -142,7 +142,7 @@ public class StackArtifactResourceProviderTest { StackArtifactResourceProvider resourceProvider = getStackArtifactResourceProvider(managementController); - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add(ARTIFACT_NAME_PROPERTY_ID); propertyIds.add(STACK_NAME_PROPERTY_ID); propertyIds.add(STACK_VERSION_PROPERTY_ID); @@ -190,7 +190,7 @@ public class StackArtifactResourceProviderTest { StackArtifactResourceProvider resourceProvider = getStackArtifactResourceProvider(managementController); - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add(ARTIFACT_NAME_PROPERTY_ID); propertyIds.add(STACK_NAME_PROPERTY_ID); propertyIds.add(STACK_VERSION_PROPERTY_ID); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackConfigurationDependencyResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackConfigurationDependencyResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackConfigurationDependencyResourceProviderTest.java index 58a657f..8f241af 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackConfigurationDependencyResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackConfigurationDependencyResourceProviderTest.java @@ -45,7 +45,7 @@ public class StackConfigurationDependencyResourceProviderTest { AmbariManagementController managementController = createMock(AmbariManagementController.class); - Set<StackConfigurationDependencyResponse> allResponse = new HashSet<StackConfigurationDependencyResponse>(); + Set<StackConfigurationDependencyResponse> allResponse = new HashSet<>(); allResponse.add(new StackConfigurationDependencyResponse("depName", "depType")); @@ -62,7 +62,7 @@ public class StackConfigurationDependencyResourceProviderTest { PropertyHelper.getKeyPropertyIds(type), managementController); - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add(StackConfigurationDependencyResourceProvider.STACK_NAME_PROPERTY_ID); propertyIds.add(StackConfigurationDependencyResourceProvider.STACK_VERSION_PROPERTY_ID); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackConfigurationResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackConfigurationResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackConfigurationResourceProviderTest.java index 1f18797..91b8ecc 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackConfigurationResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackConfigurationResourceProviderTest.java @@ -47,14 +47,14 @@ public class StackConfigurationResourceProviderTest { @Test public void testGetResources() throws Exception{ - Map<String, String> attributes = new HashMap<String, String>(); + Map<String, String> attributes = new HashMap<>(); attributes.put("final", "true"); Resource.Type type = Resource.Type.StackConfiguration; AmbariManagementController managementController = createMock(AmbariManagementController.class); - Set<StackConfigurationResponse> allResponse = new HashSet<StackConfigurationResponse>(); + Set<StackConfigurationResponse> allResponse = new HashSet<>(); allResponse.add(new StackConfigurationResponse(PROPERTY_NAME, PROPERTY_VALUE, PROPERTY_DESC, TYPE, attributes)); @@ -71,7 +71,7 @@ public class StackConfigurationResourceProviderTest { PropertyHelper.getKeyPropertyIds(type), managementController); - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add(StackConfigurationResourceProvider.STACK_NAME_PROPERTY_ID); propertyIds.add(StackConfigurationResourceProvider.STACK_VERSION_PROPERTY_ID); @@ -120,13 +120,13 @@ public class StackConfigurationResourceProviderTest { @Test public void testGetResources_noFinal() throws Exception{ - Map<String, String> attributes = new HashMap<String, String>(); + Map<String, String> attributes = new HashMap<>(); Resource.Type type = Resource.Type.StackConfiguration; AmbariManagementController managementController = createMock(AmbariManagementController.class); - Set<StackConfigurationResponse> allResponse = new HashSet<StackConfigurationResponse>(); + Set<StackConfigurationResponse> allResponse = new HashSet<>(); allResponse.add(new StackConfigurationResponse(PROPERTY_NAME, PROPERTY_VALUE, PROPERTY_DESC, TYPE, attributes)); @@ -143,7 +143,7 @@ public class StackConfigurationResourceProviderTest { PropertyHelper.getKeyPropertyIds(type), managementController); - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add(StackConfigurationResourceProvider.STACK_NAME_PROPERTY_ID); propertyIds.add(StackConfigurationResourceProvider.STACK_VERSION_PROPERTY_ID); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java index dc97f9b..74cf0bf 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDefinedPropertyProviderTest.java @@ -143,7 +143,7 @@ public class StackDefinedPropertyProviderTest { clusters.addHost("h1"); Host host = clusters.getHost("h1"); - Map<String, String> hostAttributes = new HashMap<String, String>(); + Map<String, String> hostAttributes = new HashMap<>(); hostAttributes.put("os_family", "redhat"); hostAttributes.put("os_release_version", "6.3"); host.setHostAttributes(hostAttributes); @@ -429,7 +429,7 @@ public class StackDefinedPropertyProviderTest { */ public static class CustomMetricProvider3 implements PropertyProvider { private static CustomMetricProvider3 instance = null; - private Map<String, String> providerProperties = new HashMap<String, String>(); + private Map<String, String> providerProperties = new HashMap<>(); public static CustomMetricProvider3 getInstance(Map<String, String> properties, Map<String, Metric> metrics) { if (null == instance) { @@ -595,7 +595,7 @@ public class StackDefinedPropertyProviderTest { resource.setProperty(HOST_COMPONENT_STATE_PROPERTY_ID, "STARTED"); // only ask for one property - Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); + Map<String, TemporalInfo> temporalInfoMap = new HashMap<>(); Request request = PropertyHelper.getReadRequest(Collections.singleton("metrics/yarn/Queue/root/AvailableMB"), temporalInfoMap); Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size()); @@ -632,7 +632,7 @@ public class StackDefinedPropertyProviderTest { resource.setProperty(HOST_COMPONENT_STATE_PROPERTY_ID, "STARTED"); // only ask for one property - Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); + Map<String, TemporalInfo> temporalInfoMap = new HashMap<>(); Request request = PropertyHelper.getReadRequest(Collections.singleton("metrics/yarn/Queue"), temporalInfoMap); Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size()); @@ -684,7 +684,7 @@ public class StackDefinedPropertyProviderTest { resource.setProperty(HOST_COMPONENT_STATE_PROPERTY_ID, "STARTED"); // only ask for one property - Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); + Map<String, TemporalInfo> temporalInfoMap = new HashMap<>(); Request request = PropertyHelper.getReadRequest(Collections.singleton("metrics/yarn/Queue/root/default"), temporalInfoMap); Assert.assertEquals(1, propertyProvider.populateResources(Collections.singleton(resource), request, null).size()); @@ -989,7 +989,7 @@ public class StackDefinedPropertyProviderTest { String RM_AVAILABLE_MEMORY_PROPERTY = PropertyHelper.getPropertyId(RM_CATEGORY_1, "AvailableMB"); // only ask for one property - Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); + Map<String, TemporalInfo> temporalInfoMap = new HashMap<>(); temporalInfoMap.put(RM_CATEGORY_1, new TemporalInfoImpl(10L, 20L, 1L)); Request request = PropertyHelper.getReadRequest(Collections.singleton(RM_CATEGORY_1), temporalInfoMap); @@ -1086,8 +1086,8 @@ public class StackDefinedPropertyProviderTest { {"metrics/dfs/journalNode", "txnsWritten", 0.0} }; - Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); - Set<String> properties = new LinkedHashSet<String>(); + Map<String, TemporalInfo> temporalInfoMap = new HashMap<>(); + Set<String> properties = new LinkedHashSet<>(); for (Object[] row : testData) { properties.add(PropertyHelper.getPropertyId(row[0].toString(), row[1].toString())); @@ -1152,7 +1152,7 @@ public class StackDefinedPropertyProviderTest { resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "RESOURCEMANAGER"); // only ask for one property - Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); + Map<String, TemporalInfo> temporalInfoMap = new HashMap<>(); temporalInfoMap.put(metric, new TemporalInfoImpl(10L, 20L, 1L)); Request request = PropertyHelper.getReadRequest(Collections.singleton(metric), temporalInfoMap); @@ -1202,7 +1202,7 @@ public class StackDefinedPropertyProviderTest { resource.setProperty(HOST_COMPONENT_COMPONENT_NAME_PROPERTY_ID, "HBASE_REGIONSERVER"); // only ask for one property - Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); + Map<String, TemporalInfo> temporalInfoMap = new HashMap<>(); temporalInfoMap.put(metric, new TemporalInfoImpl(1429824611300L, 1429825241400L, 1L)); Request request = PropertyHelper.getReadRequest(Collections.singleton(metric), temporalInfoMap); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDependencyResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDependencyResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDependencyResourceProviderTest.java index 80976f9..98060d4 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDependencyResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackDependencyResourceProviderTest.java @@ -74,16 +74,16 @@ public class StackDependencyResourceProviderTest { dependencyInfo.setName("service_name/comp_name"); dependencyInfo.setScope("cluster"); - Predicate namePredicate = new EqualsPredicate<String>( - StackDependencyResourceProvider.COMPONENT_NAME_ID, "comp_name"); - Predicate depServicePredicate = new EqualsPredicate<String>( - StackDependencyResourceProvider.DEPENDENT_SERVICE_NAME_ID, "dep_service_name"); - Predicate depCompPredicate = new EqualsPredicate<String>( - StackDependencyResourceProvider.DEPENDENT_COMPONENT_NAME_ID, "dep_comp_name"); - Predicate stackNamePredicate = new EqualsPredicate<String> - (StackDependencyResourceProvider.STACK_NAME_ID, "stack_name"); - Predicate stackVersionPredicate = new EqualsPredicate<String>( - StackDependencyResourceProvider.STACK_VERSION_ID, "stack_version"); + Predicate namePredicate = new EqualsPredicate<>( + StackDependencyResourceProvider.COMPONENT_NAME_ID, "comp_name"); + Predicate depServicePredicate = new EqualsPredicate<>( + StackDependencyResourceProvider.DEPENDENT_SERVICE_NAME_ID, "dep_service_name"); + Predicate depCompPredicate = new EqualsPredicate<>( + StackDependencyResourceProvider.DEPENDENT_COMPONENT_NAME_ID, "dep_comp_name"); + Predicate stackNamePredicate = new EqualsPredicate<> + (StackDependencyResourceProvider.STACK_NAME_ID, "stack_name"); + Predicate stackVersionPredicate = new EqualsPredicate<>( + StackDependencyResourceProvider.STACK_VERSION_ID, "stack_version"); Predicate andPredicate = new AndPredicate(namePredicate, depServicePredicate, depCompPredicate, stackNamePredicate, stackVersionPredicate); @@ -120,18 +120,18 @@ public class StackDependencyResourceProviderTest { dependencyInfo.setName("service_name/comp_name"); dependencyInfo.setScope("cluster"); - Predicate namePredicate = new EqualsPredicate<String>( - StackDependencyResourceProvider.COMPONENT_NAME_ID, "comp_name"); - Predicate name2Predicate = new EqualsPredicate<String>( - StackDependencyResourceProvider.COMPONENT_NAME_ID, "comp_name2"); - Predicate depServicePredicate = new EqualsPredicate<String>( - StackDependencyResourceProvider.DEPENDENT_SERVICE_NAME_ID, "dep_service_name"); - Predicate depCompPredicate = new EqualsPredicate<String>( - StackDependencyResourceProvider.DEPENDENT_COMPONENT_NAME_ID, "dep_comp_name"); - Predicate stackNamePredicate = new EqualsPredicate<String> - (StackDependencyResourceProvider.STACK_NAME_ID, "stack_name"); - Predicate stackVersionPredicate = new EqualsPredicate<String>( - StackDependencyResourceProvider.STACK_VERSION_ID, "stack_version"); + Predicate namePredicate = new EqualsPredicate<>( + StackDependencyResourceProvider.COMPONENT_NAME_ID, "comp_name"); + Predicate name2Predicate = new EqualsPredicate<>( + StackDependencyResourceProvider.COMPONENT_NAME_ID, "comp_name2"); + Predicate depServicePredicate = new EqualsPredicate<>( + StackDependencyResourceProvider.DEPENDENT_SERVICE_NAME_ID, "dep_service_name"); + Predicate depCompPredicate = new EqualsPredicate<>( + StackDependencyResourceProvider.DEPENDENT_COMPONENT_NAME_ID, "dep_comp_name"); + Predicate stackNamePredicate = new EqualsPredicate<> + (StackDependencyResourceProvider.STACK_NAME_ID, "stack_name"); + Predicate stackVersionPredicate = new EqualsPredicate<>( + StackDependencyResourceProvider.STACK_VERSION_ID, "stack_version"); Predicate andPredicate1 = new AndPredicate(namePredicate, depServicePredicate, depCompPredicate, stackNamePredicate, stackVersionPredicate); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackLevelConfigurationResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackLevelConfigurationResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackLevelConfigurationResourceProviderTest.java index 179cc5d..95dffb5 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackLevelConfigurationResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackLevelConfigurationResourceProviderTest.java @@ -47,14 +47,14 @@ public class StackLevelConfigurationResourceProviderTest { @Test public void testGetResources() throws Exception{ - Map<String, String> attributes = new HashMap<String, String>(); + Map<String, String> attributes = new HashMap<>(); attributes.put("final", "true"); Resource.Type type = Resource.Type.StackLevelConfiguration; AmbariManagementController managementController = createMock(AmbariManagementController.class); - Set<StackConfigurationResponse> allResponse = new HashSet<StackConfigurationResponse>(); + Set<StackConfigurationResponse> allResponse = new HashSet<>(); allResponse.add(new StackConfigurationResponse(PROPERTY_NAME, PROPERTY_VALUE, PROPERTY_DESC, TYPE, attributes)); @@ -71,7 +71,7 @@ public class StackLevelConfigurationResourceProviderTest { PropertyHelper.getKeyPropertyIds(type), managementController); - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add(StackLevelConfigurationResourceProvider.STACK_NAME_PROPERTY_ID); propertyIds.add(StackLevelConfigurationResourceProvider.STACK_VERSION_PROPERTY_ID); @@ -114,13 +114,13 @@ public class StackLevelConfigurationResourceProviderTest { @Test public void testGetResources_noFinal() throws Exception{ - Map<String, String> attributes = new HashMap<String, String>(); + Map<String, String> attributes = new HashMap<>(); Resource.Type type = Resource.Type.StackLevelConfiguration; AmbariManagementController managementController = createMock(AmbariManagementController.class); - Set<StackConfigurationResponse> allResponse = new HashSet<StackConfigurationResponse>(); + Set<StackConfigurationResponse> allResponse = new HashSet<>(); allResponse.add(new StackConfigurationResponse(PROPERTY_NAME, PROPERTY_VALUE, PROPERTY_DESC, TYPE, attributes)); @@ -137,7 +137,7 @@ public class StackLevelConfigurationResourceProviderTest { PropertyHelper.getKeyPropertyIds(type), managementController); - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add(StackLevelConfigurationResourceProvider.STACK_NAME_PROPERTY_ID); propertyIds.add(StackLevelConfigurationResourceProvider.STACK_VERSION_PROPERTY_ID); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackResourceProviderTest.java index fb81a61..4a67f8b 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackResourceProviderTest.java @@ -47,7 +47,7 @@ public class StackResourceProviderTest { AmbariManagementController managementController = createMock(AmbariManagementController.class); - Set<StackResponse> allResponse = new HashSet<StackResponse>(); + Set<StackResponse> allResponse = new HashSet<>(); allResponse.add(new StackResponse("Stack1")); allResponse.add(new StackResponse("Stack2")); @@ -63,7 +63,7 @@ public class StackResourceProviderTest { PropertyHelper.getKeyPropertyIds(type), managementController); - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add(StackResourceProvider.STACK_NAME_PROPERTY_ID); @@ -76,7 +76,7 @@ public class StackResourceProviderTest { Assert.assertEquals(2, resources.size()); - Set<String> stackNames = new HashSet<String>(); + Set<String> stackNames = new HashSet<>(); stackNames.add("Stack1"); stackNames.add("Stack2"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackTest.java index b67d019..1803f45 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackTest.java @@ -134,7 +134,7 @@ public class StackTest { public void testConfigPropertyReadsInDependencies() throws Exception { EasyMockSupport mockSupport = new EasyMockSupport(); - Set<PropertyDependencyInfo> setOfDependencyInfo = new HashSet<PropertyDependencyInfo>(); + Set<PropertyDependencyInfo> setOfDependencyInfo = new HashSet<>(); StackConfigurationResponse mockResponse = mockSupport.createMock(StackConfigurationResponse.class); expect(mockResponse.getPropertyName()).andReturn("test-property-one"); @@ -187,8 +187,8 @@ public class StackTest { expect(stackComponentResponse.getComponentCategory()).andReturn("test-site.xml").anyTimes(); expect(controller.getStackConfigurations(capture(stackConfigurationRequestCapture))). - andReturn(new HashSet<StackConfigurationResponse>(Arrays.asList( - stackConfigurationResponse, stackConfigurationResponse2))).anyTimes(); + andReturn(new HashSet<>(Arrays.asList( + stackConfigurationResponse, stackConfigurationResponse2))).anyTimes(); // no stack level configs for this test expect(controller.getStackLevelConfigurations(capture(stackLevelConfigurationRequestCapture))). @@ -335,7 +335,7 @@ public class StackTest { expect(stackServiceResponse.getServiceName()).andReturn(testServiceName).anyTimes(); // Config type test-site is excluded for the service service1 - expect(stackServiceResponse.getExcludedConfigTypes()).andReturn(Collections.<String>singleton(testSiteConfigType)); + expect(stackServiceResponse.getExcludedConfigTypes()).andReturn(Collections.singleton(testSiteConfigType)); // stack components expect(stackComponentResponse.getComponentName()).andReturn("component1").anyTimes(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StageResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StageResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StageResourceProviderTest.java index 38d72e1..c2a6402 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StageResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StageResourceProviderTest.java @@ -298,7 +298,7 @@ public class StageResourceProviderTest { Predicate predicate = new PredicateBuilder().property(StageResourceProvider.STAGE_STAGE_ID).equals(2L).and(). property(StageResourceProvider.STAGE_REQUEST_ID).equals(1L).toPredicate(); - Map<String, Object> requestProps = new HashMap<String, Object>(); + Map<String, Object> requestProps = new HashMap<>(); requestProps.put(StageResourceProvider.STAGE_STATUS, HostRoleStatus.ABORTED.name()); Request request = PropertyHelper.getUpdateRequest(requestProps, null); @@ -331,14 +331,14 @@ public class StageResourceProviderTest { task2.setEndTime(2500L); - Collection<HostRoleCommandEntity> tasks = new HashSet<HostRoleCommandEntity>(); + Collection<HostRoleCommandEntity> tasks = new HashSet<>(); tasks.add(task1); tasks.add(task2); stage.setHostRoleCommands(tasks); stage.setRequestId(1L); - List<StageEntity> entities = new LinkedList<StageEntity>(); + List<StageEntity> entities = new LinkedList<>(); entities.add(stage); return entities; } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProviderTest.java index 4a78ff3..6dbcc9a 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TargetClusterResourceProviderTest.java @@ -50,7 +50,7 @@ public class TargetClusterResourceProviderTest { private static Cluster.Interface interface1 = new Cluster.Interface("write", "hdfs://ec2.a.b.com:8020", "1.1.2.22"); - private static Map<String, String> interfaces = new HashMap<String, String>(); + private static Map<String, String> interfaces = new HashMap<>(); static { interfaces.put("type", interface1.getType()); interfaces.put("endpoint", interface1.getEndpoint()); @@ -59,7 +59,7 @@ public class TargetClusterResourceProviderTest { private static Cluster.Location location1 = new Cluster.Location("location1", "/mirrorthis"); - private static Map<String, String> locations = new HashMap<String, String>(); + private static Map<String, String> locations = new HashMap<>(); static { locations.put("name", location1.getName()); locations.put("path", location1.getPath()); @@ -69,9 +69,9 @@ public class TargetClusterResourceProviderTest { public void testCreateResources() throws Exception { IvoryService service = createMock(IvoryService.class); - Set<Map<String, Object>> propertySet = new HashSet<Map<String, Object>>(); + Set<Map<String, Object>> propertySet = new HashSet<>(); - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(TargetClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID, "Cluster1"); properties.put(TargetClusterResourceProvider.CLUSTER_COLO_PROPERTY_ID, "Colo"); @@ -103,11 +103,11 @@ public class TargetClusterResourceProviderTest { public void testGetResources() throws Exception { IvoryService service = createMock(IvoryService.class); - Set<Map<String, Object>> propertySet = new HashSet<Map<String, Object>>(); + Set<Map<String, Object>> propertySet = new HashSet<>(); - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); - List<String> targetClusterNames = new LinkedList<String>(); + List<String> targetClusterNames = new LinkedList<>(); targetClusterNames.add("Cluster1"); targetClusterNames.add("Cluster2"); targetClusterNames.add("Cluster3"); @@ -152,9 +152,9 @@ public class TargetClusterResourceProviderTest { public void testUpdateResources() throws Exception { IvoryService service = createMock(IvoryService.class); - Set<Map<String, Object>> propertySet = new HashSet<Map<String, Object>>(); + Set<Map<String, Object>> propertySet = new HashSet<>(); - Map<String, Object> properties = new HashMap<String, Object>(); + Map<String, Object> properties = new HashMap<>(); properties.put(TargetClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID, "Cluster1"); properties.put(TargetClusterResourceProvider.CLUSTER_COLO_PROPERTY_ID, "Colo"); @@ -162,7 +162,7 @@ public class TargetClusterResourceProviderTest { properties.put(TargetClusterResourceProvider.CLUSTER_LOCATIONS_PROPERTY_ID, Collections.singleton(locations)); properties.put(TargetClusterResourceProvider.CLUSTER_PROPERTIES_PROPERTY_ID + "/P1", "V1"); - List<String> targetClusterNames = new LinkedList<String>(); + List<String> targetClusterNames = new LinkedList<>(); targetClusterNames.add("Cluster1"); Set<Cluster.Interface> interfaceSet = Collections.singleton(interface1); @@ -199,7 +199,7 @@ public class TargetClusterResourceProviderTest { public void testDeleteResources() throws Exception { IvoryService service = createMock(IvoryService.class); - List<String> targetClusterNames = new LinkedList<String>(); + List<String> targetClusterNames = new LinkedList<>(); targetClusterNames.add("Cluster1"); Cluster.Interface interface1 = new Cluster.Interface("type", "endpoint", "version"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TaskAttemptResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TaskAttemptResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TaskAttemptResourceProviderTest.java index e85d489..992bce0 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TaskAttemptResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TaskAttemptResourceProviderTest.java @@ -52,7 +52,7 @@ public class TaskAttemptResourceProviderTest { public void testGetResources() throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { - Set<Resource> expected = new HashSet<Resource>(); + Set<Resource> expected = new HashSet<>(); expected.add(createTaskAttemptResponse("Cluster100", "workflow1", "job1", "taskAttempt1")); expected.add(createTaskAttemptResponse("Cluster100", "workflow2", "job2", @@ -81,7 +81,7 @@ public class TaskAttemptResourceProviderTest { Set<Resource> resources = provider.getResources(request, predicate); Assert.assertEquals(3, resources.size()); - Set<String> names = new HashSet<String>(); + Set<String> names = new HashSet<>(); for (Resource resource : resources) { String clusterName = (String) resource .getPropertyValue(TaskAttemptResourceProvider.TASK_ATTEMPT_CLUSTER_NAME_PROPERTY_ID); @@ -104,7 +104,7 @@ public class TaskAttemptResourceProviderTest { public void testTaskAttemptFetcher() throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { - Set<String> requestedIds = new HashSet<String>(); + Set<String> requestedIds = new HashSet<>(); requestedIds.add(TaskAttemptResourceProvider.TASK_ATTEMPT_ID_PROPERTY_ID); Map<Resource.Type,String> keyPropertyIds = PropertyHelper http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TaskResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TaskResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TaskResourceProviderTest.java index 0712d99..8a52b8a 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TaskResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TaskResourceProviderTest.java @@ -79,9 +79,9 @@ public class TaskResourceProviderTest { managementController); // add the property map to a set for the request. add more maps for multiple creates - Set<Map<String, Object>> propertySet = new LinkedHashSet<Map<String, Object>>(); + Set<Map<String, Object>> propertySet = new LinkedHashSet<>(); - Map<String, Object> properties = new LinkedHashMap<String, Object>(); + Map<String, Object> properties = new LinkedHashMap<>(); // add properties to the request map properties.put(TaskResourceProvider.TASK_REQUEST_ID_PROPERTY_ID, 100); @@ -134,7 +134,7 @@ public class TaskResourceProviderTest { // replay replay(hostRoleCommandDAO); - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add(TaskResourceProvider.TASK_ID_PROPERTY_ID); propertyIds.add(TaskResourceProvider.TASK_REQUEST_ID_PROPERTY_ID); @@ -198,7 +198,7 @@ public class TaskResourceProviderTest { // replay replay(hostRoleCommandDAO, topologyManager); - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add(TaskResourceProvider.TASK_ID_PROPERTY_ID); propertyIds.add(TaskResourceProvider.TASK_REQUEST_ID_PROPERTY_ID); @@ -242,7 +242,7 @@ public class TaskResourceProviderTest { managementController); // add the property map to a set for the request. - Map<String, Object> properties = new LinkedHashMap<String, Object>(); + Map<String, Object> properties = new LinkedHashMap<>(); // create the request Request request = PropertyHelper.getUpdateRequest(properties, null); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TestIvoryService.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TestIvoryService.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TestIvoryService.java index b56b54c..52f7181 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TestIvoryService.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/TestIvoryService.java @@ -36,12 +36,12 @@ public class TestIvoryService implements IvoryService{ private int instanceCounter = 0; - private final Map<String, Feed> feeds = new HashMap<String, Feed>(); - private final Map<String, Cluster> clusters = new HashMap<String, Cluster>(); - private final Map<String, Map<String, Instance>> instanceMap = new HashMap<String, Map<String, Instance>>(); + private final Map<String, Feed> feeds = new HashMap<>(); + private final Map<String, Cluster> clusters = new HashMap<>(); + private final Map<String, Map<String, Instance>> instanceMap = new HashMap<>(); - private final Map<String, String> suspendedFeedStatusMap = new HashMap<String, String>(); - private final Map<String, String> suspendedInstanceStatusMap = new HashMap<String, String>(); + private final Map<String, String> suspendedFeedStatusMap = new HashMap<>(); + private final Map<String, String> suspendedInstanceStatusMap = new HashMap<>(); public TestIvoryService(Map<String, Feed> feeds, @@ -70,7 +70,7 @@ public class TestIvoryService implements IvoryService{ @Override public List<String> getFeedNames() { - return new LinkedList<String>(feeds.keySet()); + return new LinkedList<>(feeds.keySet()); } @Override @@ -115,7 +115,7 @@ public class TestIvoryService implements IvoryService{ @Override public List<String> getClusterNames() { - return new LinkedList<String>(clusters.keySet()); + return new LinkedList<>(clusters.keySet()); } @Override @@ -132,7 +132,7 @@ public class TestIvoryService implements IvoryService{ public List<Instance> getInstances(String feedName) { Map<String, Instance> instances = instanceMap.get(feedName); if (instances != null) { - return new LinkedList<Instance>(instances.values()); + return new LinkedList<>(instances.values()); } return Collections.emptyList(); } @@ -221,7 +221,7 @@ public class TestIvoryService implements IvoryService{ private void addDummyInstance(String feedName) { Map<String, Instance> instances = instanceMap.get(feedName); if (instances == null) { - instances = new HashMap<String, Instance>(); + instances = new HashMap<>(); instanceMap.put(feedName, instances); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/URLStreamProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/URLStreamProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/URLStreamProviderTest.java index 682ff82..f172eca 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/URLStreamProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/URLStreamProviderTest.java @@ -53,7 +53,7 @@ public class URLStreamProviderTest { expect(urlStreamProvider.getAppCookieManager()).andReturn(appCookieManager).anyTimes(); expect(urlStreamProvider.getConnection("spec")).andReturn(connection); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("Header1", Collections.singletonList("value")); headerMap.put("Cookie", Collections.singletonList("FOO=bar")); @@ -83,7 +83,7 @@ public class URLStreamProviderTest { addMockedMethod("getConnection", String.class). createMock(); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("Header1", Collections.singletonList("value")); headerMap.put("Cookie", Collections.singletonList("FOO=bar")); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProviderTest.java index f009767..19dbb44 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeSummaryResourceProviderTest.java @@ -169,7 +169,7 @@ public class UpgradeSummaryResourceProviderTest { clusters.addHost("h1"); Host host = clusters.getHost("h1"); - Map<String, String> hostAttributes = new HashMap<String, String>(); + Map<String, String> hostAttributes = new HashMap<>(); hostAttributes.put("os_family", "redhat"); hostAttributes.put("os_release_version", "6.4"); host.setHostAttributes(hostAttributes); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProviderTest.java index 5092db5..b023bff 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UserPrivilegeResourceProviderTest.java @@ -395,10 +395,10 @@ public class UserPrivilegeResourceProviderTest extends AbstractPrivilegeResource users.setPrivilegeDAO(privilegeDAO); users.setMemberDAO(memberDAO); - List<PrincipalEntity> rolePrincipals = new LinkedList<PrincipalEntity>(); + List<PrincipalEntity> rolePrincipals = new LinkedList<>(); rolePrincipals.add(rolePrincipalEntity); - List<PrincipalEntity> userPrincipals = new LinkedList<PrincipalEntity>(); + List<PrincipalEntity> userPrincipals = new LinkedList<>(); userPrincipals.add(principalEntity); expect(privilegeDAO.findAllByPrincipal(userPrincipals)). @@ -414,7 +414,7 @@ public class UserPrivilegeResourceProviderTest extends AbstractPrivilegeResource replayAll(); - final Set<String> propertyIds = new HashSet<String>(); + final Set<String> propertyIds = new HashSet<>(); propertyIds.add(UserPrivilegeResourceProvider.PRIVILEGE_USER_NAME_PROPERTY_ID); final Predicate predicate = new PredicateBuilder() .property(UserPrivilegeResourceProvider.PRIVILEGE_USER_NAME_PROPERTY_ID) @@ -457,7 +457,7 @@ public class UserPrivilegeResourceProviderTest extends AbstractPrivilegeResource users.setPrivilegeDAO(privilegeDAO); users.setMemberDAO(memberDAO); - List<PrincipalEntity> userPrincipals = new LinkedList<PrincipalEntity>(); + List<PrincipalEntity> userPrincipals = new LinkedList<>(); userPrincipals.add(principalEntity); expect(privilegeDAO.findAllByPrincipal(userPrincipals)). @@ -490,7 +490,7 @@ public class UserPrivilegeResourceProviderTest extends AbstractPrivilegeResource UserPrivilegeResourceProvider.init(userDAO, clusterDAO, groupDAO, viewInstanceDAO, users); - final Set<String> propertyIds = new HashSet<String>(); + final Set<String> propertyIds = new HashSet<>(); propertyIds.add(UserPrivilegeResourceProvider.PRIVILEGE_USER_NAME_PROPERTY_ID); final Predicate predicate = new PredicateBuilder() http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UserResourceProviderDBTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UserResourceProviderDBTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UserResourceProviderDBTest.java index 240f00b..6f2b907 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UserResourceProviderDBTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UserResourceProviderDBTest.java @@ -116,7 +116,7 @@ public class UserResourceProviderDBTest { SecurityContextHolder.getContext().setAuthentication(authentication); // create a new user viewUser - Map<String, Object> requestProperties = new HashMap<String, Object>(); + Map<String, Object> requestProperties = new HashMap<>(); requestProperties.put(UserResourceProvider.USER_USERNAME_PROPERTY_ID, "viewUser"); requestProperties.put(UserResourceProvider.USER_PASSWORD_PROPERTY_ID, "password"); requestProperties.put(UserResourceProvider.USER_ADMIN_PROPERTY_ID, false); @@ -127,7 +127,7 @@ public class UserResourceProviderDBTest { assertNotNull(requestStatus); // verify the created username - Request getRequest = PropertyHelper.getReadRequest(new HashSet<String>(Arrays.asList("Users"))); + Request getRequest = PropertyHelper.getReadRequest(new HashSet<>(Arrays.asList("Users"))); Predicate predicate = new PredicateBuilder() .property(UserResourceProvider.USER_USERNAME_PROPERTY_ID).equals("viewUser").toPredicate(); Set<Resource> resources = userResourceProvider.getResources(getRequest, predicate); @@ -158,7 +158,7 @@ public class UserResourceProviderDBTest { SecurityContextHolder.getContext().setAuthentication(authentication); /* add a new user */ - Map<String, Object> requestProperties = new HashMap<String, Object>(); + Map<String, Object> requestProperties = new HashMap<>(); requestProperties.put(UserResourceProvider.USER_USERNAME_PROPERTY_ID, "abcd"); requestProperties.put(UserResourceProvider.USER_PASSWORD_PROPERTY_ID, "password"); requestProperties.put(UserResourceProvider.USER_ADMIN_PROPERTY_ID, false); @@ -186,7 +186,7 @@ public class UserResourceProviderDBTest { assertNotNull(requestStatus); // verify that the username was deleted - Request getRequest = PropertyHelper.getReadRequest(new HashSet<String>(Arrays.asList("Users"))); + Request getRequest = PropertyHelper.getReadRequest(new HashSet<>(Arrays.asList("Users"))); Set<Resource> resources = userResourceProvider.getResources(getRequest, null); assertEquals(resources.size(), 0); } @@ -204,7 +204,7 @@ public class UserResourceProviderDBTest { SecurityContextHolder.getContext().setAuthentication(authentication); // create a new user viewUser - Map<String, Object> requestProperties = new HashMap<String, Object>(); + Map<String, Object> requestProperties = new HashMap<>(); requestProperties.put(UserResourceProvider.USER_USERNAME_PROPERTY_ID, "viewUser"); requestProperties.put(UserResourceProvider.USER_PASSWORD_PROPERTY_ID, "password"); requestProperties.put(UserResourceProvider.USER_ADMIN_PROPERTY_ID, false); @@ -215,7 +215,7 @@ public class UserResourceProviderDBTest { assertNotNull(requestStatus); // verify the created username - Request getRequest = PropertyHelper.getReadRequest(new HashSet<String>(Arrays.asList("Users"))); + Request getRequest = PropertyHelper.getReadRequest(new HashSet<>(Arrays.asList("Users"))); Predicate predicate = new PredicateBuilder() .property(UserResourceProvider.USER_USERNAME_PROPERTY_ID).equals("viewuser").toPredicate(); Set<Resource> resources = userResourceProvider.getResources(getRequest, predicate); @@ -248,7 +248,7 @@ public class UserResourceProviderDBTest { List<String> userNames = Arrays.asList("user1", "uSer2", "User3", "useR4"); for (String userName : userNames) { - Map<String, Object> requestProperties = new HashMap<String, Object>(); + Map<String, Object> requestProperties = new HashMap<>(); requestProperties.put(UserResourceProvider.USER_USERNAME_PROPERTY_ID, userName); requestProperties.put(UserResourceProvider.USER_PASSWORD_PROPERTY_ID, "password"); requestProperties.put(UserResourceProvider.USER_ADMIN_PROPERTY_ID, false); @@ -260,7 +260,7 @@ public class UserResourceProviderDBTest { } // verify the created username - Request getRequest = PropertyHelper.getReadRequest(new HashSet<String>(Arrays.asList("Users"))); + Request getRequest = PropertyHelper.getReadRequest(new HashSet<>(Arrays.asList("Users"))); Set<Resource> resources = userResourceProvider.getResources(getRequest, null); assertEquals(resources.size(), userNames.size()); for (Resource resource : resources) { http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java index a297d94..fd20a33 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java @@ -106,8 +106,8 @@ public class VersionDefinitionResourceProviderTest { final ResourceProvider provider = injector.getInstance(ResourceProviderFactory.class) .getRepositoryVersionResourceProvider(); - final Set<Map<String, Object>> propertySet = new LinkedHashSet<Map<String, Object>>(); - final Map<String, Object> properties = new LinkedHashMap<String, Object>(); + final Set<Map<String, Object>> propertySet = new LinkedHashSet<>(); + final Map<String, Object> properties = new LinkedHashMap<>(); properties.put(VersionDefinitionResourceProvider.VERSION_DEF_DEFINITION_BASE64, base64Str); propertySet.add(properties); @@ -180,8 +180,8 @@ public class VersionDefinitionResourceProviderTest { final ResourceProvider provider = injector.getInstance(ResourceProviderFactory.class) .getRepositoryVersionResourceProvider(); - final Set<Map<String, Object>> propertySet = new LinkedHashSet<Map<String, Object>>(); - final Map<String, Object> properties = new LinkedHashMap<String, Object>(); + final Set<Map<String, Object>> propertySet = new LinkedHashSet<>(); + final Map<String, Object> properties = new LinkedHashMap<>(); properties.put(VersionDefinitionResourceProvider.VERSION_DEF_DEFINITION_URL, file.toURI().toURL().toString()); propertySet.add(properties); @@ -349,8 +349,8 @@ public class VersionDefinitionResourceProviderTest { final ResourceProvider versionProvider = new VersionDefinitionResourceProvider(); - final Set<Map<String, Object>> propertySet = new LinkedHashSet<Map<String, Object>>(); - final Map<String, Object> properties = new LinkedHashMap<String, Object>(); + final Set<Map<String, Object>> propertySet = new LinkedHashSet<>(); + final Map<String, Object> properties = new LinkedHashMap<>(); properties.put(VersionDefinitionResourceProvider.VERSION_DEF_DEFINITION_URL, file.toURI().toURL().toString()); propertySet.add(properties); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java index 330d567..97e7bbd 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java @@ -83,14 +83,14 @@ public class ViewInstanceResourceProviderTest { @Test public void testToResource() throws Exception { ViewInstanceResourceProvider provider = new ViewInstanceResourceProvider(); - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add(ViewInstanceResourceProvider.PROPERTIES_PROPERTY_ID); propertyIds.add(ViewInstanceResourceProvider.CLUSTER_HANDLE_PROPERTY_ID); ViewInstanceEntity viewInstanceEntity = createNiceMock(ViewInstanceEntity.class); ViewEntity viewEntity = createNiceMock(ViewEntity.class); expect(viewInstanceEntity.getViewEntity()).andReturn(viewEntity).anyTimes(); - Map<String, String> propertyMap = new HashMap<String, String>(); + Map<String, String> propertyMap = new HashMap<>(); propertyMap.put("par1", "val1"); propertyMap.put("par2", "val2"); @@ -143,9 +143,9 @@ public class ViewInstanceResourceProviderTest { private void testCreateResources(Authentication authentication) throws Exception { ViewInstanceResourceProvider provider = new ViewInstanceResourceProvider(); - Set<Map<String, Object>> properties = new HashSet<Map<String, Object>>(); + Set<Map<String, Object>> properties = new HashSet<>(); - Map<String, Object> propertyMap = new HashMap<String, Object>(); + Map<String, Object> propertyMap = new HashMap<>(); propertyMap.put(ViewInstanceResourceProvider.VIEW_NAME_PROPERTY_ID, "V1"); propertyMap.put(ViewInstanceResourceProvider.VIEW_VERSION_PROPERTY_ID, "1.0.0"); @@ -210,9 +210,9 @@ public class ViewInstanceResourceProviderTest { public void testCreateResources_existingInstance() throws Exception { ViewInstanceResourceProvider provider = new ViewInstanceResourceProvider(); - Set<Map<String, Object>> properties = new HashSet<Map<String, Object>>(); + Set<Map<String, Object>> properties = new HashSet<>(); - Map<String, Object> propertyMap = new HashMap<String, Object>(); + Map<String, Object> propertyMap = new HashMap<>(); propertyMap.put(ViewInstanceResourceProvider.VIEW_NAME_PROPERTY_ID, "V1"); propertyMap.put(ViewInstanceResourceProvider.VIEW_VERSION_PROPERTY_ID, "1.0.0"); @@ -254,9 +254,9 @@ public class ViewInstanceResourceProviderTest { public void testCreateResources_viewNotLoaded() throws Exception { ViewInstanceResourceProvider provider = new ViewInstanceResourceProvider(); - Set<Map<String, Object>> properties = new HashSet<Map<String, Object>>(); + Set<Map<String, Object>> properties = new HashSet<>(); - Map<String, Object> propertyMap = new HashMap<String, Object>(); + Map<String, Object> propertyMap = new HashMap<>(); propertyMap.put(ViewInstanceResourceProvider.VIEW_NAME_PROPERTY_ID, "V1"); propertyMap.put(ViewInstanceResourceProvider.VIEW_VERSION_PROPERTY_ID, "1.0.0"); @@ -297,9 +297,9 @@ public class ViewInstanceResourceProviderTest { public void testUpdateResources_viewNotLoaded() throws Exception { ViewInstanceResourceProvider provider = new ViewInstanceResourceProvider(); - Set<Map<String, Object>> properties = new HashSet<Map<String, Object>>(); + Set<Map<String, Object>> properties = new HashSet<>(); - Map<String, Object> propertyMap = new HashMap<String, Object>(); + Map<String, Object> propertyMap = new HashMap<>(); propertyMap.put(ViewInstanceResourceProvider.ICON_PATH_ID, "path"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewPermissionResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewPermissionResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewPermissionResourceProviderTest.java index 009cb03..bb72a3f 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewPermissionResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewPermissionResourceProviderTest.java @@ -66,7 +66,7 @@ public class ViewPermissionResourceProviderTest { @Test public void testGetResources() throws Exception { - List<PermissionEntity> permissionEntities = new LinkedList<PermissionEntity>(); + List<PermissionEntity> permissionEntities = new LinkedList<>(); PermissionEntity permissionEntity = createNiceMock(PermissionEntity.class); PermissionEntity viewUsePermissionEntity = createNiceMock(PermissionEntity.class); @@ -104,7 +104,7 @@ public class ViewPermissionResourceProviderTest { @Test public void testGetResources_viewNotLoaded() throws Exception { - List<PermissionEntity> permissionEntities = new LinkedList<PermissionEntity>(); + List<PermissionEntity> permissionEntities = new LinkedList<>(); PermissionEntity permissionEntity = createNiceMock(PermissionEntity.class); PermissionEntity viewUsePermissionEntity = createNiceMock(PermissionEntity.class); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewPrivilegeResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewPrivilegeResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewPrivilegeResourceProviderTest.java index ffff348..4dfef39 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewPrivilegeResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewPrivilegeResourceProviderTest.java @@ -111,7 +111,7 @@ public class ViewPrivilegeResourceProviderTest { registry.addInstanceDefinition(viewDefinition, viewInstanceDefinition); - List<PrivilegeEntity> privilegeEntities = new LinkedList<PrivilegeEntity>(); + List<PrivilegeEntity> privilegeEntities = new LinkedList<>(); PrivilegeEntity privilegeEntity = createNiceMock(PrivilegeEntity.class); ResourceEntity resourceEntity = createNiceMock(ResourceEntity.class); @@ -120,10 +120,10 @@ public class ViewPrivilegeResourceProviderTest { PrincipalTypeEntity principalTypeEntity = createNiceMock(PrincipalTypeEntity.class); PermissionEntity permissionEntity = createNiceMock(PermissionEntity.class); - 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(userEntity); privilegeEntities.add(privilegeEntity); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewURLResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewURLResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewURLResourceProviderTest.java index 6080080..12550a7 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewURLResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewURLResourceProviderTest.java @@ -76,7 +76,7 @@ public class ViewURLResourceProviderTest { @Test public void testToResource() throws Exception { ViewURLResourceProvider provider = new ViewURLResourceProvider(); - Set<String> propertyIds = new HashSet<String>(); + Set<String> propertyIds = new HashSet<>(); propertyIds.add(ViewURLResourceProvider.URL_NAME_PROPERTY_ID); propertyIds.add(ViewURLResourceProvider.URL_SUFFIX_PROPERTY_ID); ViewURLEntity viewURLEntity = createNiceMock(ViewURLEntity.class); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProviderTest.java index eb04935..04f7453 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProviderTest.java @@ -171,7 +171,7 @@ public class WidgetLayoutResourceProviderTest { WidgetLayoutResourceProvider provider = createProvider(amc); - Map<String, Object> requestProps = new HashMap<String, Object>(); + Map<String, Object> requestProps = new HashMap<>(); requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_CLUSTER_NAME_PROPERTY_ID, "c1"); requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_LAYOUT_NAME_PROPERTY_ID, "layout_name"); requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_DISPLAY_NAME_PROPERTY_ID, "display_name"); @@ -179,7 +179,7 @@ public class WidgetLayoutResourceProviderTest { requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_USERNAME_PROPERTY_ID, "admin"); requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_SCOPE_PROPERTY_ID, "CLUSTER"); Set<Map<String, String>> widgetsInfo = new LinkedHashSet<>(); - Map<String, String> widget = new HashMap<String, String>(); + Map<String, String> widget = new HashMap<>(); widget.put("id","1"); widgetsInfo.add(widget); requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_WIDGETS_PROPERTY_ID, widgetsInfo); @@ -232,7 +232,7 @@ public class WidgetLayoutResourceProviderTest { replay(amc, clusters, cluster, dao, widgetDAO); - Map<String, Object> requestProps = new HashMap<String, Object>(); + Map<String, Object> requestProps = new HashMap<>(); requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_CLUSTER_NAME_PROPERTY_ID, "c1"); requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_LAYOUT_NAME_PROPERTY_ID, "layout_name"); requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_DISPLAY_NAME_PROPERTY_ID, "display_name"); @@ -240,7 +240,7 @@ public class WidgetLayoutResourceProviderTest { requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_USERNAME_PROPERTY_ID, "admin"); requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_SCOPE_PROPERTY_ID, "CLUSTER"); Set<Map<String, String>> widgetsInfo = new LinkedHashSet<>(); - Map<String, String> widget = new HashMap<String, String>(); + Map<String, String> widget = new HashMap<>(); widget.put("id","1"); widgetsInfo.add(widget); requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_WIDGETS_PROPERTY_ID, widgetsInfo); @@ -274,7 +274,7 @@ public class WidgetLayoutResourceProviderTest { expect(widgetDAO.findById(2L)).andReturn(widgetEntity2).anyTimes(); replay(dao, widgetDAO); - requestProps = new HashMap<String, Object>(); + requestProps = new HashMap<>(); requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_LAYOUT_NAME_PROPERTY_ID, "layout_name_new"); requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_SCOPE_PROPERTY_ID, "USER"); requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_ID_PROPERTY_ID, "1"); @@ -312,7 +312,7 @@ public class WidgetLayoutResourceProviderTest { WidgetLayoutResourceProvider provider = createProvider(amc); - Map<String, Object> requestProps = new HashMap<String, Object>(); + Map<String, Object> requestProps = new HashMap<>(); requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_CLUSTER_NAME_PROPERTY_ID, "c1"); requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_LAYOUT_NAME_PROPERTY_ID, "layout_name"); requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_DISPLAY_NAME_PROPERTY_ID, "display_name"); @@ -372,7 +372,7 @@ public class WidgetLayoutResourceProviderTest { widgetLayoutEntity.setUserName("username"); widgetLayoutEntity.setScope("CLUSTER"); widgetLayoutEntity.setDisplayName("displ_name"); - List<WidgetLayoutUserWidgetEntity> layoutUserWidgetEntityList = new LinkedList<WidgetLayoutUserWidgetEntity>(); + List<WidgetLayoutUserWidgetEntity> layoutUserWidgetEntityList = new LinkedList<>(); widgetLayoutEntity.setListWidgetLayoutUserWidgetEntity(layoutUserWidgetEntityList); return Arrays.asList(widgetLayoutEntity); } http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WorkflowResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WorkflowResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WorkflowResourceProviderTest.java index cfd75b3..337dc46 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WorkflowResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WorkflowResourceProviderTest.java @@ -52,7 +52,7 @@ public class WorkflowResourceProviderTest { public void testGetResources() throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { - Set<Resource> expected = new HashSet<Resource>(); + Set<Resource> expected = new HashSet<>(); expected.add(createWorkflowResponse("Cluster100", "workflow1")); expected.add(createWorkflowResponse("Cluster100", "workflow2")); expected.add(createWorkflowResponse("Cluster100", "workflow3")); @@ -77,7 +77,7 @@ public class WorkflowResourceProviderTest { Set<Resource> resources = provider.getResources(request, predicate); Assert.assertEquals(3, resources.size()); - Set<String> names = new HashSet<String>(); + Set<String> names = new HashSet<>(); for (Resource resource : resources) { String clusterName = (String) resource .getPropertyValue(WorkflowResourceProvider.WORKFLOW_CLUSTER_NAME_PROPERTY_ID); @@ -98,7 +98,7 @@ public class WorkflowResourceProviderTest { public void testWorkflowFetcher() throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException { - Set<String> requestedIds = new HashSet<String>(); + Set<String> requestedIds = new HashSet<>(); requestedIds.add(WorkflowResourceProvider.WORKFLOW_ID_PROPERTY_ID); Map<Resource.Type,String> keyPropertyIds = PropertyHelper http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/ivory/FeedTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/ivory/FeedTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/ivory/FeedTest.java index 359cc2b..e78683c 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/ivory/FeedTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/ivory/FeedTest.java @@ -30,7 +30,7 @@ import org.junit.Test; public class FeedTest { @Test public void testGetName() throws Exception { - Map<String,String> props = new HashMap<String, String>(); + Map<String,String> props = new HashMap<>(); Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props); Assert.assertEquals("Feed1", feed.getName()); @@ -38,7 +38,7 @@ public class FeedTest { @Test public void testGetDescription() throws Exception { - Map<String,String> props = new HashMap<String, String>(); + Map<String,String> props = new HashMap<>(); Feed feed = new Feed("Feed1", "desc", "s", "sch", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props); Assert.assertEquals("desc", feed.getDescription()); @@ -46,7 +46,7 @@ public class FeedTest { @Test public void testGetStatus() throws Exception { - Map<String,String> props = new HashMap<String, String>(); + Map<String,String> props = new HashMap<>(); Feed feed = new Feed("Feed1", "d", "WAITING", "sch", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props); Assert.assertEquals("WAITING", feed.getStatus()); @@ -54,7 +54,7 @@ public class FeedTest { @Test public void testGetSchedule() throws Exception { - Map<String,String> props = new HashMap<String, String>(); + Map<String,String> props = new HashMap<>(); Feed feed = new Feed("Feed1", "d", "WAITING", "frequency", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props); Assert.assertEquals("frequency", feed.getSchedule()); @@ -62,7 +62,7 @@ public class FeedTest { @Test public void testGetSourceClusterName() throws Exception { - Map<String,String> props = new HashMap<String, String>(); + Map<String,String> props = new HashMap<>(); Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props); Assert.assertEquals("source", feed.getSourceClusterName()); @@ -70,7 +70,7 @@ public class FeedTest { @Test public void testGetSourceClusterStart() throws Exception { - Map<String,String> props = new HashMap<String, String>(); + Map<String,String> props = new HashMap<>(); Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "sst", "end", "l", "a", "target", "st", "end", "l", "a", props); Assert.assertEquals("sst", feed.getSourceClusterStart()); @@ -78,7 +78,7 @@ public class FeedTest { @Test public void testGetSourceClusterEnd() throws Exception { - Map<String,String> props = new HashMap<String, String>(); + Map<String,String> props = new HashMap<>(); Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "send", "l", "a", "target", "st", "end", "l", "a", props); Assert.assertEquals("send", feed.getSourceClusterEnd()); @@ -86,7 +86,7 @@ public class FeedTest { @Test public void testGetSourceClusterLimit() throws Exception { - Map<String,String> props = new HashMap<String, String>(); + Map<String,String> props = new HashMap<>(); Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "sl", "a", "target", "st", "end", "l", "a", props); Assert.assertEquals("sl", feed.getSourceClusterLimit()); @@ -94,7 +94,7 @@ public class FeedTest { @Test public void testGetSourceClusterAction() throws Exception { - Map<String,String> props = new HashMap<String, String>(); + Map<String,String> props = new HashMap<>(); Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "l", "sa", "target", "st", "end", "l", "a", props); Assert.assertEquals("sa", feed.getSourceClusterAction()); @@ -102,7 +102,7 @@ public class FeedTest { @Test public void testGetTargetClusterName() throws Exception { - Map<String,String> props = new HashMap<String, String>(); + Map<String,String> props = new HashMap<>(); Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "l", "a", "target", "st", "end", "l", "a", props); Assert.assertEquals("target", feed.getTargetClusterName()); @@ -110,7 +110,7 @@ public class FeedTest { @Test public void testGetTargetClusterStart() throws Exception { - Map<String,String> props = new HashMap<String, String>(); + Map<String,String> props = new HashMap<>(); Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "sst", "end", "l", "a", "target", "tst", "end", "l", "a", props); Assert.assertEquals("tst", feed.getTargetClusterStart()); @@ -118,7 +118,7 @@ public class FeedTest { @Test public void testGetTargetClusterEnd() throws Exception { - Map<String,String> props = new HashMap<String, String>(); + Map<String,String> props = new HashMap<>(); Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "send", "l", "a", "target", "st", "tend", "l", "a", props); Assert.assertEquals("tend", feed.getTargetClusterEnd()); @@ -126,7 +126,7 @@ public class FeedTest { @Test public void testGetTargetClusterLimit() throws Exception { - Map<String,String> props = new HashMap<String, String>(); + Map<String,String> props = new HashMap<>(); Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "sl", "a", "target", "st", "end", "tl", "a", props); Assert.assertEquals("tl", feed.getTargetClusterLimit()); @@ -134,7 +134,7 @@ public class FeedTest { @Test public void testGetTargetClusterAction() throws Exception { - Map<String,String> props = new HashMap<String, String>(); + Map<String,String> props = new HashMap<>(); Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "l", "sa", "target", "st", "end", "l", "ta", props); Assert.assertEquals("ta", feed.getTargetClusterAction()); @@ -142,7 +142,7 @@ public class FeedTest { @Test public void testGetProperties() throws Exception { - Map<String,String> props = new HashMap<String, String>(); + Map<String,String> props = new HashMap<>(); props.put("p1", "v1"); Feed feed = new Feed("Feed1", "d", "s", "sch", "source", "st", "end", "l", "sa", "target", "st", "end", "l", "ta", props); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/jmx/TestStreamProvider.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/jmx/TestStreamProvider.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/jmx/TestStreamProvider.java index 122a86d..9ac4de4 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/jmx/TestStreamProvider.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/jmx/TestStreamProvider.java @@ -30,7 +30,7 @@ import org.apache.ambari.server.controller.internal.URLStreamProvider; public class TestStreamProvider extends URLStreamProvider { - protected static Map<String, String> FILE_MAPPING = new HashMap<String, String>(); + protected static Map<String, String> FILE_MAPPING = new HashMap<>(); static { FILE_MAPPING.put("50070", "hdfs_namenode_jmx.json"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImplTest.java index 71a2d49..69c7a72 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperFactoryImplTest.java @@ -76,7 +76,7 @@ public class LoggingRequestHelperFactoryImplTest { mockSupport.createMock(Configuration.class); Map<String, String> testProperties = - new HashMap<String, String>(); + new HashMap<>(); testProperties.put("logsearch_ui_port", expectedPortNumber); expect(controllerMock.getClusters()).andReturn(clustersMock).atLeastOnce(); @@ -144,7 +144,7 @@ public class LoggingRequestHelperFactoryImplTest { mockSupport.createMock(Configuration.class); Map<String, String> testProperties = - new HashMap<String, String>(); + new HashMap<>(); testProperties.put("logsearch_ui_port", expectedPortNumber); expect(controllerMock.getClusters()).andReturn(clustersMock).atLeastOnce(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImplTest.java index 11e56e2..b24500f 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImplTest.java @@ -144,7 +144,7 @@ public class LoggingRequestHelperImplTest { mockSupport.createMock(Config.class); Map<String, String> testConfigProperties = - new HashMap<String, String>(); + new HashMap<>(); testConfigProperties.put("logsearch_admin_username", EXPECTED_USER_NAME); testConfigProperties.put("logsearch_admin_password", EXPECTED_ADMIN_PASSWORD); @@ -233,7 +233,7 @@ public class LoggingRequestHelperImplTest { mockSupport.createMock(Config.class); Map<String, String> testConfigProperties = - new HashMap<String, String>(); + new HashMap<>(); testConfigProperties.put("logsearch_admin_username", "admin-user"); testConfigProperties.put("logsearch_admin_password", "admin-pwd"); testConfigProperties = Collections.unmodifiableMap(testConfigProperties); @@ -326,7 +326,7 @@ public class LoggingRequestHelperImplTest { mockSupport.createMock(Config.class); Map<String, String> testConfigProperties = - new HashMap<String, String>(); + new HashMap<>(); testConfigProperties.put("logsearch_admin_username", "admin-user"); testConfigProperties.put("logsearch_admin_password", "admin-pwd"); testConfigProperties = Collections.unmodifiableMap(testConfigProperties); @@ -408,13 +408,13 @@ public class LoggingRequestHelperImplTest { mockSupport.createMock(Config.class); Map<String, String> testConfigProperties = - new HashMap<String, String>(); + new HashMap<>(); testConfigProperties.put("logsearch_admin_username", "admin-user"); testConfigProperties.put("logsearch_admin_password", "admin-pwd"); testConfigProperties = Collections.unmodifiableMap(testConfigProperties); - Capture<HttpURLConnection> captureURLConnection = new Capture<HttpURLConnection>(); - Capture<HttpURLConnection> captureURLConnectionForAuthentication = new Capture<HttpURLConnection>(); + Capture<HttpURLConnection> captureURLConnection = new Capture<>(); + Capture<HttpURLConnection> captureURLConnectionForAuthentication = new Capture<>(); expect(clusterMock.getDesiredConfigByType("logsearch-admin-json")).andReturn(adminPropertiesConfigMock).atLeastOnce(); expect(adminPropertiesConfigMock.getProperties()).andReturn(testConfigProperties).atLeastOnce(); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProviderTest.java index 959aa77..1f2322c 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProviderTest.java @@ -152,7 +152,7 @@ public class LoggingSearchPropertyProviderTest { levelQueryResponse.setTotalCount("3"); // setup test data for log levels List<NameValuePair> testListOfLogLevels = - new LinkedList<NameValuePair>(); + new LinkedList<>(); testListOfLogLevels.add(new NameValuePair("ERROR", "150")); testListOfLogLevels.add(new NameValuePair("WARN", "500")); testListOfLogLevels.add(new NameValuePair("INFO", "2200")); @@ -357,7 +357,7 @@ public class LoggingSearchPropertyProviderTest { levelQueryResponse.setTotalCount("3"); // setup test data for log levels List<NameValuePair> testListOfLogLevels = - new LinkedList<NameValuePair>(); + new LinkedList<>(); testListOfLogLevels.add(new NameValuePair("ERROR", "150")); testListOfLogLevels.add(new NameValuePair("WARN", "500")); testListOfLogLevels.add(new NameValuePair("INFO", "2200"));