http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java index 013023d..daabcb3 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewRegistryTest.java @@ -288,7 +288,7 @@ public class ViewRegistryTest { for (ViewInstanceEntity viewInstanceEntity : viewInstanceEntities) { viewInstanceEntity.putInstanceData("p1", "v1"); - Collection<ViewEntityEntity> entities = new HashSet<ViewEntityEntity>(); + Collection<ViewEntityEntity> entities = new HashSet<>(); ViewEntityEntity viewEntityEntity = new ViewEntityEntity(); viewEntityEntity.setId(99L); viewEntityEntity.setIdProperty("id"); @@ -313,7 +313,7 @@ public class ViewRegistryTest { viewInstanceEntity.setResource(resourceEntity); } - Map<String, File> files = new HashMap<String, File>(); + Map<String, File> files = new HashMap<>(); if (System.getProperty("os.name").contains("Windows")) { files.put("\\var\\lib\\ambari-server\\resources\\views\\work", extractedArchiveDir); files.put("\\var\\lib\\ambari-server\\resources\\views\\work\\MY_VIEW{1.0.0}", archiveDir); @@ -331,10 +331,10 @@ public class ViewRegistryTest { files.put("/var/lib/ambari-server/resources/views/work/MY_VIEW{1.0.0}/META-INF", metaInfDir); } - Map<File, FileOutputStream> outputStreams = new HashMap<File, FileOutputStream>(); + Map<File, FileOutputStream> outputStreams = new HashMap<>(); outputStreams.put(entryFile, fos); - Map<File, JarInputStream> jarFiles = new HashMap<File, JarInputStream>(); + Map<File, JarInputStream> jarFiles = new HashMap<>(); jarFiles.put(viewArchive, viewJarFile); // set expectations @@ -414,7 +414,7 @@ public class ViewRegistryTest { expect(autoInstanceDataEntity.getName()).andReturn("p1").anyTimes(); expect(autoInstanceDataEntity.getUser()).andReturn(" ").anyTimes(); - Map<String, Service> serviceMap = new HashMap<String, Service>(); + Map<String, Service> serviceMap = new HashMap<>(); serviceMap.put("HDFS", service); serviceMap.put("HIVE", service); @@ -422,7 +422,7 @@ public class ViewRegistryTest { StackId stackId = new StackId("HDP-2.0"); if(checkAutoInstanceCreation) { - Map<String, Cluster> allClusters = new HashMap<String, Cluster>(); + Map<String, Cluster> allClusters = new HashMap<>(); expect(cluster.getClusterName()).andReturn("c1").anyTimes(); expect(cluster.getCurrentStackVersion()).andReturn(stackId).anyTimes(); expect(cluster.getServices()).andReturn(serviceMap).anyTimes(); @@ -542,7 +542,7 @@ public class ViewRegistryTest { viewInstanceEntity.setResource(resourceEntity); } - Map<String, File> files = new HashMap<String, File>(); + Map<String, File> files = new HashMap<>(); if (System.getProperty("os.name").contains("Windows")) { files.put("\\var\\lib\\ambari-server\\resources\\views\\work", extractedArchiveDir); @@ -561,10 +561,10 @@ public class ViewRegistryTest { files.put("/var/lib/ambari-server/resources/views/work/MY_VIEW{1.0.0}/META-INF", metaInfDir); } - Map<File, FileOutputStream> outputStreams = new HashMap<File, FileOutputStream>(); + Map<File, FileOutputStream> outputStreams = new HashMap<>(); outputStreams.put(entryFile, fos); - Map<File, JarInputStream> jarFiles = new HashMap<File, JarInputStream>(); + Map<File, JarInputStream> jarFiles = new HashMap<>(); jarFiles.put(viewArchive, viewJarFile); // set expectations @@ -831,7 +831,7 @@ public class ViewRegistryTest { Assert.assertEquals(3, subResourceDefinitions.size()); - Set<String> names = new HashSet<String>(); + Set<String> names = new HashSet<>(); for (SubResourceDefinition definition : subResourceDefinitions) { names.add(definition.getType().name()); } @@ -1102,7 +1102,7 @@ public class ViewRegistryTest { ViewInstanceEntity viewInstanceEntity = getViewInstanceEntity(viewEntity, config.getInstances().get(0)); - Map<String, String> instanceProperties = new HashMap<String, String>(); + Map<String, String> instanceProperties = new HashMap<>(); instanceProperties.put("p1", "newV1"); instanceProperties.put("p2", "newV2"); @@ -1339,7 +1339,7 @@ public class ViewRegistryTest { ResourceEntity resourceEntity = createNiceMock(ResourceEntity.class); ResourceTypeEntity resourceTypeEntity = createNiceMock(ResourceTypeEntity.class); - Collection<ViewInstanceEntity> instances = new ArrayList<ViewInstanceEntity>(); + Collection<ViewInstanceEntity> instances = new ArrayList<>(); instances.add(instanceEntity); expect(viewEntity.getInstances()).andReturn(instances); @@ -1360,7 +1360,7 @@ public class ViewRegistryTest { @Test public void testOnAmbariEventServiceCreation() throws Exception { - Set<String> serviceNames = new HashSet<String>(); + Set<String> serviceNames = new HashSet<>(); serviceNames.add("HDFS"); serviceNames.add("HIVE"); @@ -1369,7 +1369,7 @@ public class ViewRegistryTest { @Test public void testOnAmbariEventServiceCreation_widcardStackVersion() throws Exception { - Set<String> serviceNames = new HashSet<String>(); + Set<String> serviceNames = new HashSet<>(); serviceNames.add("HDFS"); serviceNames.add("HIVE"); @@ -1378,7 +1378,7 @@ public class ViewRegistryTest { @Test public void testOnAmbariEventServiceCreation_mismatchStackVersion() throws Exception { - Set<String> serviceNames = new HashSet<String>(); + Set<String> serviceNames = new HashSet<>(); serviceNames.add("HDFS"); serviceNames.add("HIVE"); @@ -1387,7 +1387,7 @@ public class ViewRegistryTest { @Test public void testOnAmbariEventServiceCreation_missingClusterService() throws Exception { - Set<String> serviceNames = new HashSet<String>(); + Set<String> serviceNames = new HashSet<>(); serviceNames.add("STORM"); serviceNames.add("HIVE"); @@ -1545,7 +1545,7 @@ public class ViewRegistryTest { viewInstanceEntity.setResource(resourceEntity); } - Map<String, File> files = new HashMap<String, File>(); + Map<String, File> files = new HashMap<>(); if (System.getProperty("os.name").contains("Windows")) { files.put("\\var\\lib\\ambari-server\\resources\\views\\my_view-1.0.0.jar", viewArchive); @@ -1566,10 +1566,10 @@ public class ViewRegistryTest { files.put("/var/lib/ambari-server/resources/views/work/MY_VIEW{1.0.0}/META-INF", metaInfDir); } - Map<File, FileOutputStream> outputStreams = new HashMap<File, FileOutputStream>(); + Map<File, FileOutputStream> outputStreams = new HashMap<>(); outputStreams.put(entryFile, fos); - Map<File, JarInputStream> jarFiles = new HashMap<File, JarInputStream>(); + Map<File, JarInputStream> jarFiles = new HashMap<>(); jarFiles.put(viewArchive, viewJarFile); // set expectations @@ -1907,7 +1907,7 @@ public class ViewRegistryTest { Cluster cluster = createNiceMock(Cluster.class); Service service = createNiceMock(Service.class); - Map<String, Service> serviceMap = new HashMap<String, Service>(); + Map<String, Service> serviceMap = new HashMap<>(); for (String serviceName : serviceNames) { serviceMap.put(serviceName, service);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/view/ViewSubResourceProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewSubResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewSubResourceProviderTest.java index 5b01834..f1dd2a8 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewSubResourceProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewSubResourceProviderTest.java @@ -127,10 +127,10 @@ public class ViewSubResourceProviderTest { ViewSubResourceProvider viewSubResourceProvider = new ViewSubResourceProvider(type, MyResource.class, "id", viewEntity); - Set<String> requestProperties = new HashSet<String>(); + Set<String> requestProperties = new HashSet<>(); requestProperties.add("metrics/myMetric"); - Map<String, TemporalInfo> temporalInfoMap = new HashMap<String, TemporalInfo>(); + Map<String, TemporalInfo> temporalInfoMap = new HashMap<>(); TemporalInfo temporalInfo = new TemporalInfoImpl(1000L, 1100L, 10L); temporalInfoMap.put("metrics/myMetric", temporalInfo); @@ -193,7 +193,7 @@ public class ViewSubResourceProviderTest { public Set<MyResource> getResources(ReadRequest request) throws SystemException, NoSuchResourceException, UnsupportedPropertyException { - Set<MyResource> resources = new HashSet<MyResource>(); + Set<MyResource> resources = new HashSet<>(); resources.add(new MyResource("1", "foo", getMetricsValue(1, request, "myMetric"))); resources.add(new MyResource("2", "bar", getMetricsValue(2, request, "myMetric"))); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/view/ViewURLStreamProviderTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewURLStreamProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewURLStreamProviderTest.java index 19c3ca6..eeb48e5 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewURLStreamProviderTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewURLStreamProviderTest.java @@ -51,10 +51,10 @@ public class ViewURLStreamProviderTest { InputStream inputStream = createNiceMock(InputStream.class); ViewContext viewContext = createNiceMock(ViewContext.class); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put("header", "headerValue"); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("header", Collections.singletonList("headerValue")); expect(streamProvider.processURL(eq("spec"), eq("requestMethod"), aryEq("params".getBytes()), eq(headerMap))).andReturn(urlConnection); @@ -77,10 +77,10 @@ public class ViewURLStreamProviderTest { InputStream inputStream = createNiceMock(InputStream.class); ViewContext viewContext = createNiceMock(ViewContext.class); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put("header", "headerValue"); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("header", Collections.singletonList("headerValue")); expect(streamProvider.processURL(eq("spec"), eq("requestMethod"), aryEq((byte[]) null), eq(headerMap))).andReturn(urlConnection); @@ -103,10 +103,10 @@ public class ViewURLStreamProviderTest { InputStream inputStream = createNiceMock(InputStream.class); ViewContext viewContext = createNiceMock(ViewContext.class); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put("header", "headerValue"); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("header", Collections.singletonList("headerValue")); expect(streamProvider.processURL(eq("spec?doAs=joe"), eq("requestMethod"), aryEq("params".getBytes()), eq(headerMap))).andReturn(urlConnection); @@ -129,10 +129,10 @@ public class ViewURLStreamProviderTest { InputStream inputStream = createNiceMock(InputStream.class); ViewContext viewContext = createNiceMock(ViewContext.class); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put("header", "headerValue"); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("header", Collections.singletonList("headerValue")); expect(streamProvider.processURL(eq("spec?doAs=joe"), eq("requestMethod"), aryEq("params".getBytes()), eq(headerMap))).andReturn(urlConnection); @@ -158,10 +158,10 @@ public class ViewURLStreamProviderTest { InputStream body = new ByteArrayInputStream("params".getBytes()); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put("header", "headerValue"); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("header", Collections.singletonList("headerValue")); expect(streamProvider.processURL(eq("spec"), eq("requestMethod"), aryEq("params".getBytes()), eq(headerMap))).andReturn(urlConnection); @@ -184,10 +184,10 @@ public class ViewURLStreamProviderTest { InputStream inputStream = createNiceMock(InputStream.class); ViewContext viewContext = createNiceMock(ViewContext.class); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put("header", "headerValue"); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("header", Collections.singletonList("headerValue")); expect(streamProvider.processURL(eq("spec"), eq("requestMethod"), aryEq((byte[]) null), eq(headerMap))).andReturn(urlConnection); @@ -212,10 +212,10 @@ public class ViewURLStreamProviderTest { InputStream body = new ByteArrayInputStream("params".getBytes()); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put("header", "headerValue"); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("header", Collections.singletonList("headerValue")); expect(streamProvider.processURL(eq("spec?doAs=joe"), eq("requestMethod"), aryEq("params".getBytes()), eq(headerMap))).andReturn(urlConnection); @@ -240,10 +240,10 @@ public class ViewURLStreamProviderTest { InputStream body = new ByteArrayInputStream("params".getBytes()); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put("header", "headerValue"); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("header", Collections.singletonList("headerValue")); expect(streamProvider.processURL(eq("spec?doAs=joe"), eq("requestMethod"), aryEq("params".getBytes()), eq(headerMap))).andReturn(urlConnection); @@ -266,10 +266,10 @@ public class ViewURLStreamProviderTest { HttpURLConnection urlConnection = createNiceMock(HttpURLConnection.class); ViewContext viewContext = createNiceMock(ViewContext.class); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put("header", "headerValue"); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("header", Collections.singletonList("headerValue")); expect(streamProvider.processURL(eq("spec"), @@ -293,10 +293,10 @@ public class ViewURLStreamProviderTest { HttpURLConnection urlConnection = createNiceMock(HttpURLConnection.class); ViewContext viewContext = createNiceMock(ViewContext.class); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put("header", "headerValue"); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("header", Collections.singletonList("headerValue")); expect(streamProvider.processURL(eq("spec?doAs=joe"), eq("requestMethod"), aryEq("params".getBytes()), eq(headerMap))).andReturn(urlConnection); @@ -321,10 +321,10 @@ public class ViewURLStreamProviderTest { HttpURLConnection urlConnection = createNiceMock(HttpURLConnection.class); ViewContext viewContext = createNiceMock(ViewContext.class); - Map<String, String> headers = new HashMap<String, String>(); + Map<String, String> headers = new HashMap<>(); headers.put("header", "headerValue"); - Map<String, List<String>> headerMap = new HashMap<String, List<String>>(); + Map<String, List<String>> headerMap = new HashMap<>(); headerMap.put("header", Collections.singletonList("headerValue")); expect(streamProvider.processURL(eq("spec?doAs=joe"), eq("requestMethod"), aryEq("params".getBytes()), eq(headerMap))).andReturn(urlConnection); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/view/events/EventImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/events/EventImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/view/events/EventImplTest.java index f4870b9..ea3b30e 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/view/events/EventImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/view/events/EventImplTest.java @@ -49,7 +49,7 @@ public class EventImplTest { @Test public void testGetProperties() throws Exception { - Map<String, String> properties = new HashMap<String, String>(); + Map<String, String> properties = new HashMap<>(); properties.put("p1", "v1"); properties.put("p2", "v2"); http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/view/persistence/DataStoreImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/persistence/DataStoreImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/view/persistence/DataStoreImplTest.java index a1c910d..fd3f4e4 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/view/persistence/DataStoreImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/view/persistence/DataStoreImplTest.java @@ -635,7 +635,7 @@ public class DataStoreImplTest { "SELECT e FROM DS_DataStoreImplTest$TestEntity_1 e WHERE e.DS_name='foo'")).andReturn(query); entityManager.close(); - List<DynamicEntity> entityList = new LinkedList<DynamicEntity>(); + List<DynamicEntity> entityList = new LinkedList<>(); entityList.add(dynamicEntity1); entityList.add(dynamicEntity2); entityList.add(dynamicEntity3); @@ -698,7 +698,7 @@ public class DataStoreImplTest { // TODO : move to ViewEntityEntity test. private static void setPersistenceEntities(ViewInstanceEntity viewInstanceDefinition) { ViewEntity viewDefinition = viewInstanceDefinition.getViewEntity(); - Collection<ViewEntityEntity> entities = new HashSet<ViewEntityEntity>(); + Collection<ViewEntityEntity> entities = new HashSet<>(); ViewConfig viewConfig = viewDefinition.getConfiguration(); for (EntityConfig entityConfiguration : viewConfig.getPersistence().getEntities()) { http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/view/validation/InstanceValidationResultImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/validation/InstanceValidationResultImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/view/validation/InstanceValidationResultImplTest.java index 5586f48..16b5140 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/view/validation/InstanceValidationResultImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/view/validation/InstanceValidationResultImplTest.java @@ -35,7 +35,7 @@ public class InstanceValidationResultImplTest { @Test public void testGetPropertyResults() throws Exception { ValidationResult result = new ValidationResultImpl(true, "detail"); - Map<String, ValidationResult> propertyResults = new HashMap<String, ValidationResult>(); + Map<String, ValidationResult> propertyResults = new HashMap<>(); propertyResults.put("foo", new ValidationResultImpl(true, "foo detail")); propertyResults.put("bar", new ValidationResultImpl(false, "bar detail"));