http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java index 226cedd..771b89f 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterConfigurationRequestTest.java @@ -32,7 +32,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.util.ArrayList; -import java.util.Collection; import java.util.Collections; import java.util.HashMap; import java.util.HashSet; @@ -43,7 +42,6 @@ import java.util.Set; import org.apache.ambari.server.AmbariException; import org.apache.ambari.server.api.services.stackadvisor.StackAdvisorBlueprintProcessor; import org.apache.ambari.server.controller.AmbariManagementController; -import org.apache.ambari.server.controller.ConfigurationRequest; import org.apache.ambari.server.controller.KerberosHelper; import org.apache.ambari.server.controller.internal.ConfigurationTopologyException; import org.apache.ambari.server.controller.internal.Stack; @@ -216,13 +214,13 @@ public class ClusterConfigurationRequestTest { Map<String, Map<String, String>> existingConfig = new HashMap<>(); Configuration stackDefaultConfig = new Configuration(existingConfig, - new HashMap<String, Map<String, Map<String, String>>>()); + new HashMap<>()); if (stackPropertyValue != null) { stackDefaultConfig.setProperty("testConfigType", "testProperty", stackPropertyValue); } Configuration blueprintConfig = new Configuration(stackDefaultConfig.getFullProperties(), - new HashMap<String, Map<String, Map<String, String>>>()); + new HashMap<>()); if (blueprintPropertyValue != null) { blueprintConfig.setProperty("testConfigType", "testProperty", blueprintPropertyValue); } @@ -242,9 +240,8 @@ public class ClusterConfigurationRequestTest { expect(stack.getServiceForConfigType("testConfigType")).andReturn("KERBEROS").anyTimes(); expect(stack.getAllConfigurationTypes(anyString())).andReturn(Collections.singletonList("testConfigType") ).anyTimes(); - expect(stack.getExcludedConfigurationTypes(anyString())).andReturn(Collections.<String>emptySet()).anyTimes(); - expect(stack.getConfigurationPropertiesWithMetadata(anyString(), anyString())).andReturn(Collections.<String, - Stack.ConfigProperty>emptyMap()).anyTimes(); + expect(stack.getExcludedConfigurationTypes(anyString())).andReturn(Collections.emptySet()).anyTimes(); + expect(stack.getConfigurationPropertiesWithMetadata(anyString(), anyString())).andReturn(Collections.emptyMap()).anyTimes(); Set<String> services = new HashSet<>(); services.add("HDFS"); @@ -270,15 +267,15 @@ public class ClusterConfigurationRequestTest { expect(blueprint.isValidConfigType("testConfigType")).andReturn(true).anyTimes(); expect(topology.getConfiguration()).andReturn(blueprintConfig).anyTimes(); - expect(topology.getHostGroupInfo()).andReturn(Collections.<String, HostGroupInfo>emptyMap()).anyTimes(); + expect(topology.getHostGroupInfo()).andReturn(Collections.emptyMap()).anyTimes(); expect(topology.getClusterId()).andReturn(Long.valueOf(1)).anyTimes(); - expect(topology.getHostGroupsForComponent(anyString())).andReturn(Collections.<String>emptyList()) + expect(topology.getHostGroupsForComponent(anyString())).andReturn(Collections.emptyList()) .anyTimes(); expect(ambariContext.getConfigHelper()).andReturn(configHelper).anyTimes(); expect(ambariContext.getClusterName(Long.valueOf(1))).andReturn("testCluster").anyTimes(); - expect(ambariContext.createConfigurationRequests(EasyMock.<Map<String, Object>>anyObject())).andReturn(Collections - .<ConfigurationRequest>emptyList()).anyTimes(); + expect(ambariContext.createConfigurationRequests(EasyMock.anyObject())).andReturn(Collections + .emptyList()).anyTimes(); expect(configHelper.getDefaultStackProperties( EasyMock.eq(new StackId(STACK_NAME, STACK_VERSION)))).andReturn(stackProperties).anyTimes(); @@ -289,10 +286,10 @@ public class ClusterConfigurationRequestTest { properties.put("testProperty", "KERBEROStestValue"); kerberosConfig.put("testConfigType", properties); } - expect(kerberosHelper.ensureHeadlessIdentities(anyObject(Cluster.class), EasyMock.<Map<String, Map<String, String>>>anyObject(), - EasyMock.<Set<String>>anyObject())).andReturn(true).once(); - expect(kerberosHelper.getServiceConfigurationUpdates(anyObject(Cluster.class), EasyMock.<Map<String, Map<String, String>>>anyObject(), - EasyMock.<Map<String, Set<String>>>anyObject(), EasyMock.<Map<String, Collection<String>>>anyObject(), EasyMock.<Set<String>>anyObject(), anyBoolean(), eq(false))).andReturn(kerberosConfig).once(); + expect(kerberosHelper.ensureHeadlessIdentities(anyObject(Cluster.class), EasyMock.anyObject(), + EasyMock.anyObject())).andReturn(true).once(); + expect(kerberosHelper.getServiceConfigurationUpdates(anyObject(Cluster.class), EasyMock.anyObject(), + EasyMock.anyObject(), EasyMock.anyObject(), EasyMock.anyObject(), anyBoolean(), eq(false))).andReturn(kerberosConfig).once(); Capture<? extends String> captureClusterName = newCapture(CaptureType.ALL); Capture<? extends Set<String>> captureUpdatedConfigTypes = newCapture(CaptureType.ALL); @@ -320,7 +317,7 @@ public class ClusterConfigurationRequestTest { Map<String, Map<String, String>> existingConfig = new HashMap<>(); Configuration stackConfig = new Configuration(existingConfig, - new HashMap<String, Map<String, Map<String, String>>>()); + new HashMap<>()); PowerMock.mockStatic(AmbariContext.class); AmbariContext.getController(); @@ -332,10 +329,9 @@ public class ClusterConfigurationRequestTest { expect(blueprint.getStack()).andReturn(stack).anyTimes(); expect(stack.getName()).andReturn(STACK_NAME).anyTimes(); expect(stack.getVersion()).andReturn(STACK_VERSION).anyTimes(); - expect(stack.getAllConfigurationTypes(anyString())).andReturn(Collections.<String>singletonList("testConfigType")).anyTimes(); - expect(stack.getExcludedConfigurationTypes(anyString())).andReturn(Collections.<String>emptySet()).anyTimes(); - expect(stack.getConfigurationPropertiesWithMetadata(anyString(), anyString())).andReturn(Collections.<String, - Stack.ConfigProperty>emptyMap()).anyTimes(); + expect(stack.getAllConfigurationTypes(anyString())).andReturn(Collections.singletonList("testConfigType")).anyTimes(); + expect(stack.getExcludedConfigurationTypes(anyString())).andReturn(Collections.emptySet()).anyTimes(); + expect(stack.getConfigurationPropertiesWithMetadata(anyString(), anyString())).andReturn(Collections.emptyMap()).anyTimes(); Set<String> services = new HashSet<>(); services.add("HDFS"); @@ -358,13 +354,13 @@ public class ClusterConfigurationRequestTest { expect(topology.getConfigRecommendationStrategy()).andReturn(ConfigRecommendationStrategy.NEVER_APPLY).anyTimes(); expect(topology.getBlueprint()).andReturn(blueprint).anyTimes(); expect(topology.getConfiguration()).andReturn(stackConfig).anyTimes(); - expect(topology.getHostGroupInfo()).andReturn(Collections.<String, HostGroupInfo>emptyMap()).anyTimes(); + expect(topology.getHostGroupInfo()).andReturn(Collections.emptyMap()).anyTimes(); expect(topology.getClusterId()).andReturn(Long.valueOf(1)).anyTimes(); expect(ambariContext.getConfigHelper()).andReturn(configHelper).anyTimes(); expect(ambariContext.getClusterName(Long.valueOf(1))).andReturn("testCluster").anyTimes(); - expect(ambariContext.createConfigurationRequests(EasyMock.<Map<String, Object>>anyObject())).andReturn(Collections - .<ConfigurationRequest>emptyList()).anyTimes(); + expect(ambariContext.createConfigurationRequests(EasyMock.anyObject())).andReturn(Collections + .emptyList()).anyTimes(); expect(configHelper.getDefaultStackProperties( EasyMock.eq(new StackId(STACK_NAME, STACK_VERSION)))).andReturn(stackProperties).anyTimes(); @@ -428,8 +424,8 @@ public class ClusterConfigurationRequestTest { public void testProcessClusterConfigRequestWithOnlyHostGroupConfigRemoveUnusedConfigTypes() throws Exception { // Given Map<String, Map<String, String>> config = Maps.newHashMap(); - config.put("cluster-env", new HashMap<String, String>()); - config.put("global", new HashMap<String, String>()); + config.put("cluster-env", new HashMap<>()); + config.put("global", new HashMap<>()); Map<String, Map<String, Map<String, String>>> attributes = Maps.newHashMap(); Configuration configuration = new Configuration(config, attributes); @@ -476,18 +472,18 @@ public class ClusterConfigurationRequestTest { private Configuration createConfigurations() { Map<String, Map<String, String>> firstLevelConfig = Maps.newHashMap(); - firstLevelConfig.put("hdfs-site", new HashMap<String, String>()); - firstLevelConfig.put("yarn-site", new HashMap<String, String>()); - firstLevelConfig.put("cluster-env", new HashMap<String, String>()); - firstLevelConfig.put("global", new HashMap<String, String>()); + firstLevelConfig.put("hdfs-site", new HashMap<>()); + firstLevelConfig.put("yarn-site", new HashMap<>()); + firstLevelConfig.put("cluster-env", new HashMap<>()); + firstLevelConfig.put("global", new HashMap<>()); Map<String, Map<String, Map<String, String>>> firstLevelAttributes = Maps.newHashMap(); - firstLevelAttributes.put("hdfs-site", new HashMap<String, Map<String, String>>()); + firstLevelAttributes.put("hdfs-site", new HashMap<>()); Map<String, Map<String, String>> secondLevelConfig = Maps.newHashMap(); - secondLevelConfig.put("admin-properties", new HashMap<String, String>()); + secondLevelConfig.put("admin-properties", new HashMap<>()); Map<String, Map<String, Map<String, String>>> secondLevelAttributes = Maps.newHashMap(); - secondLevelAttributes.put("admin-properties", new HashMap<String, Map<String, String>>()); + secondLevelAttributes.put("admin-properties", new HashMap<>()); Configuration secondLevelConf = new Configuration(secondLevelConfig, secondLevelAttributes); @@ -496,18 +492,18 @@ public class ClusterConfigurationRequestTest { private Configuration createConfigurationsForHostGroup() { Map<String, Map<String, String>> firstLevelConfig = Maps.newHashMap(); - firstLevelConfig.put("hdfs-site", new HashMap<String, String>()); - firstLevelConfig.put("spark-env", new HashMap<String, String>()); - firstLevelConfig.put("cluster-env", new HashMap<String, String>()); - firstLevelConfig.put("global", new HashMap<String, String>()); + firstLevelConfig.put("hdfs-site", new HashMap<>()); + firstLevelConfig.put("spark-env", new HashMap<>()); + firstLevelConfig.put("cluster-env", new HashMap<>()); + firstLevelConfig.put("global", new HashMap<>()); Map<String, Map<String, Map<String, String>>> firstLevelAttributes = Maps.newHashMap(); - firstLevelAttributes.put("hdfs-site", new HashMap<String, Map<String, String>>()); + firstLevelAttributes.put("hdfs-site", new HashMap<>()); Map<String, Map<String, String>> secondLevelConfig = Maps.newHashMap(); - secondLevelConfig.put("admin-properties", new HashMap<String, String>()); + secondLevelConfig.put("admin-properties", new HashMap<>()); Map<String, Map<String, Map<String, String>>> secondLevelAttributes = Maps.newHashMap(); - secondLevelAttributes.put("admin-properties", new HashMap<String, Map<String, String>>()); + secondLevelAttributes.put("admin-properties", new HashMap<>()); Configuration secondLevelConf = new Configuration(secondLevelConfig, secondLevelAttributes);
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java index a03012a..6c3f097 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterDeployWithStartOnlyTest.java @@ -160,21 +160,21 @@ public class ClusterDeployWithStartOnlyTest extends EasyMockSupport { private TopologyValidatorService topologyValidatorServiceMock; - private final Configuration stackConfig = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>()); - private final Configuration bpConfiguration = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), stackConfig); - private final Configuration topoConfiguration = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpConfiguration); - private final Configuration bpGroup1Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpConfiguration); - private final Configuration bpGroup2Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpConfiguration); - - private final Configuration topoGroup1Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpGroup1Config); - private final Configuration topoGroup2Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpGroup2Config); + private final Configuration stackConfig = new Configuration(new HashMap<>(), + new HashMap<>()); + private final Configuration bpConfiguration = new Configuration(new HashMap<>(), + new HashMap<>(), stackConfig); + private final Configuration topoConfiguration = new Configuration(new HashMap<>(), + new HashMap<>(), bpConfiguration); + private final Configuration bpGroup1Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpConfiguration); + private final Configuration bpGroup2Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpConfiguration); + + private final Configuration topoGroup1Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpGroup1Config); + private final Configuration topoGroup2Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpGroup2Config); private HostGroupInfo group1Info = new HostGroupInfo("group1"); private HostGroupInfo group2Info = new HostGroupInfo("group2"); @@ -252,7 +252,7 @@ public class ClusterDeployWithStartOnlyTest extends EasyMockSupport { expect(blueprint.getServices()).andReturn(Arrays.asList("service1", "service2")).anyTimes(); expect(blueprint.getStack()).andReturn(stack).anyTimes(); expect(blueprint.isValidConfigType(anyString())).andReturn(true).anyTimes(); - expect(blueprint.getRepositorySettings()).andReturn(new ArrayList<RepositorySetting>()).anyTimes(); + expect(blueprint.getRepositorySettings()).andReturn(new ArrayList<>()).anyTimes(); // don't expect toEntity() expect(stack.getAllConfigurationTypes("service1")).andReturn(Arrays.asList("service1-site", "service1-env")).anyTimes(); @@ -282,8 +282,8 @@ public class ClusterDeployWithStartOnlyTest extends EasyMockSupport { expect(stack.getVersion()).andReturn(STACK_VERSION).anyTimes(); expect(stack.getServiceForConfigType("service1-site")).andReturn("service1").anyTimes(); expect(stack.getServiceForConfigType("service2-site")).andReturn("service2").anyTimes(); - expect(stack.getExcludedConfigurationTypes("service1")).andReturn(Collections.<String>emptySet()).anyTimes(); - expect(stack.getExcludedConfigurationTypes("service2")).andReturn(Collections.<String>emptySet()).anyTimes(); + expect(stack.getExcludedConfigurationTypes("service1")).andReturn(Collections.emptySet()).anyTimes(); + expect(stack.getExcludedConfigurationTypes("service2")).andReturn(Collections.emptySet()).anyTimes(); expect(request.getBlueprint()).andReturn(blueprint).anyTimes(); expect(request.getClusterId()).andReturn(CLUSTER_ID).anyTimes(); @@ -300,7 +300,7 @@ public class ClusterDeployWithStartOnlyTest extends EasyMockSupport { expect(group1.getCardinality()).andReturn("test cardinality").anyTimes(); expect(group1.containsMasterComponent()).andReturn(true).anyTimes(); expect(group1.getComponentNames()).andReturn(group1Components).anyTimes(); - expect(group1.getComponentNames(anyObject(ProvisionAction.class))).andReturn(Collections.<String>emptyList()).anyTimes(); + expect(group1.getComponentNames(anyObject(ProvisionAction.class))).andReturn(Collections.emptyList()).anyTimes(); expect(group1.getComponents("service1")).andReturn(group1ServiceComponents.get("service1")).anyTimes(); expect(group1.getComponents("service2")).andReturn(group1ServiceComponents.get("service1")).anyTimes(); expect(group1.getConfiguration()).andReturn(topoGroup1Config).anyTimes(); @@ -312,7 +312,7 @@ public class ClusterDeployWithStartOnlyTest extends EasyMockSupport { expect(group2.getCardinality()).andReturn("test cardinality").anyTimes(); expect(group2.containsMasterComponent()).andReturn(false).anyTimes(); expect(group2.getComponentNames()).andReturn(group2Components).anyTimes(); - expect(group2.getComponentNames(anyObject(ProvisionAction.class))).andReturn(Collections.<String>emptyList()).anyTimes(); + expect(group2.getComponentNames(anyObject(ProvisionAction.class))).andReturn(Collections.emptyList()).anyTimes(); expect(group2.getComponents("service1")).andReturn(group2ServiceComponents.get("service1")).anyTimes(); expect(group2.getComponents("service2")).andReturn(group2ServiceComponents.get("service2")).anyTimes(); expect(group2.getConfiguration()).andReturn(topoGroup2Config).anyTimes(); @@ -394,8 +394,7 @@ public class ClusterDeployWithStartOnlyTest extends EasyMockSupport { expect(executor.submit(anyObject(AsyncCallableService.class))).andReturn(mockFuture).times(2); persistedTopologyRequest = new PersistedTopologyRequest(1, request); - expect(persistedState.getAllRequests()).andReturn(Collections.<ClusterTopology, - List<LogicalRequest>>emptyMap()).once(); + expect(persistedState.getAllRequests()).andReturn(Collections.emptyMap()).once(); expect(persistedState.persistTopologyRequest(request)).andReturn(persistedTopologyRequest).once(); persistedState.persistLogicalRequest((LogicalRequest) anyObject(), anyLong()); expectLastCall().once(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java index 42cecad..929f5af 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartOnComponentLevelTest.java @@ -156,21 +156,21 @@ public class ClusterInstallWithoutStartOnComponentLevelTest extends EasyMockSupp @Mock private TopologyValidatorService topologyValidatorServiceMock; - private final Configuration stackConfig = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>()); - private final Configuration bpConfiguration = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), stackConfig); - private final Configuration topoConfiguration = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpConfiguration); - private final Configuration bpGroup1Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpConfiguration); - private final Configuration bpGroup2Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpConfiguration); - - private final Configuration topoGroup1Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpGroup1Config); - private final Configuration topoGroup2Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpGroup2Config); + private final Configuration stackConfig = new Configuration(new HashMap<>(), + new HashMap<>()); + private final Configuration bpConfiguration = new Configuration(new HashMap<>(), + new HashMap<>(), stackConfig); + private final Configuration topoConfiguration = new Configuration(new HashMap<>(), + new HashMap<>(), bpConfiguration); + private final Configuration bpGroup1Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpConfiguration); + private final Configuration bpGroup2Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpConfiguration); + + private final Configuration topoGroup1Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpGroup1Config); + private final Configuration topoGroup2Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpGroup2Config); private HostGroupInfo group1Info = new HostGroupInfo("group1"); private HostGroupInfo group2Info = new HostGroupInfo("group2"); @@ -248,7 +248,7 @@ public class ClusterInstallWithoutStartOnComponentLevelTest extends EasyMockSupp expect(blueprint.getServices()).andReturn(Arrays.asList("service1", "service2")).anyTimes(); expect(blueprint.getStack()).andReturn(stack).anyTimes(); expect(blueprint.isValidConfigType(anyString())).andReturn(true).anyTimes(); - expect(blueprint.getRepositorySettings()).andReturn(new ArrayList<RepositorySetting>()).anyTimes(); + expect(blueprint.getRepositorySettings()).andReturn(new ArrayList<>()).anyTimes(); // don't expect toEntity() expect(stack.getAllConfigurationTypes("service1")).andReturn(Arrays.asList("service1-site", "service1-env")).anyTimes(); @@ -278,8 +278,8 @@ public class ClusterInstallWithoutStartOnComponentLevelTest extends EasyMockSupp expect(stack.getVersion()).andReturn(STACK_VERSION).anyTimes(); expect(stack.getServiceForConfigType("service1-site")).andReturn("service1").anyTimes(); expect(stack.getServiceForConfigType("service2-site")).andReturn("service2").anyTimes(); - expect(stack.getExcludedConfigurationTypes("service1")).andReturn(Collections.<String>emptySet()).anyTimes(); - expect(stack.getExcludedConfigurationTypes("service2")).andReturn(Collections.<String>emptySet()).anyTimes(); + expect(stack.getExcludedConfigurationTypes("service1")).andReturn(Collections.emptySet()).anyTimes(); + expect(stack.getExcludedConfigurationTypes("service2")).andReturn(Collections.emptySet()).anyTimes(); expect(request.getBlueprint()).andReturn(blueprint).anyTimes(); expect(request.getClusterId()).andReturn(CLUSTER_ID).anyTimes(); @@ -298,7 +298,7 @@ public class ClusterInstallWithoutStartOnComponentLevelTest extends EasyMockSupp expect(group1.getComponentNames()).andReturn(group1Components).anyTimes(); expect(group1.getComponentNames(ProvisionAction.INSTALL_ONLY)).andReturn(Arrays.asList("component1")) .anyTimes(); - expect(group1.getComponentNames(ProvisionAction.START_ONLY)).andReturn(Collections.<String>emptyList()) + expect(group1.getComponentNames(ProvisionAction.START_ONLY)).andReturn(Collections.emptyList()) .anyTimes(); expect(group1.getComponents("service1")).andReturn(group1ServiceComponents.get("service1")).anyTimes(); @@ -312,8 +312,8 @@ public class ClusterInstallWithoutStartOnComponentLevelTest extends EasyMockSupp expect(group2.getCardinality()).andReturn("test cardinality").anyTimes(); expect(group2.containsMasterComponent()).andReturn(false).anyTimes(); expect(group2.getComponentNames()).andReturn(group2Components).anyTimes(); - expect(group2.getComponentNames(ProvisionAction.INSTALL_ONLY)).andReturn(Collections.<String>emptyList()).anyTimes(); - expect(group2.getComponentNames(ProvisionAction.START_ONLY)).andReturn(Collections.<String>emptyList()) + expect(group2.getComponentNames(ProvisionAction.INSTALL_ONLY)).andReturn(Collections.emptyList()).anyTimes(); + expect(group2.getComponentNames(ProvisionAction.START_ONLY)).andReturn(Collections.emptyList()) .anyTimes(); expect(group2.getComponents("service1")).andReturn(group2ServiceComponents.get("service1")).anyTimes(); expect(group2.getComponents("service2")).andReturn(group2ServiceComponents.get("service2")).anyTimes(); @@ -371,8 +371,7 @@ public class ClusterInstallWithoutStartOnComponentLevelTest extends EasyMockSupp expect(executor.submit(anyObject(AsyncCallableService.class))).andReturn(mockFuture).times(2); persistedTopologyRequest = new PersistedTopologyRequest(1, request); - expect(persistedState.getAllRequests()).andReturn(Collections.<ClusterTopology, - List<LogicalRequest>>emptyMap()).once(); + expect(persistedState.getAllRequests()).andReturn(Collections.emptyMap()).once(); expect(persistedState.persistTopologyRequest(request)).andReturn(persistedTopologyRequest).once(); persistedState.persistLogicalRequest((LogicalRequest) anyObject(), anyLong()); expectLastCall().once(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java index 541c2dd..389ce06 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterInstallWithoutStartTest.java @@ -158,21 +158,21 @@ public class ClusterInstallWithoutStartTest extends EasyMockSupport { @Mock private TopologyValidatorService topologyValidatorServiceMock; - private final Configuration stackConfig = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>()); - private final Configuration bpConfiguration = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), stackConfig); - private final Configuration topoConfiguration = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpConfiguration); - private final Configuration bpGroup1Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpConfiguration); - private final Configuration bpGroup2Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpConfiguration); - - private final Configuration topoGroup1Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpGroup1Config); - private final Configuration topoGroup2Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpGroup2Config); + private final Configuration stackConfig = new Configuration(new HashMap<>(), + new HashMap<>()); + private final Configuration bpConfiguration = new Configuration(new HashMap<>(), + new HashMap<>(), stackConfig); + private final Configuration topoConfiguration = new Configuration(new HashMap<>(), + new HashMap<>(), bpConfiguration); + private final Configuration bpGroup1Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpConfiguration); + private final Configuration bpGroup2Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpConfiguration); + + private final Configuration topoGroup1Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpGroup1Config); + private final Configuration topoGroup2Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpGroup2Config); private HostGroupInfo group1Info = new HostGroupInfo("group1"); private HostGroupInfo group2Info = new HostGroupInfo("group2"); @@ -250,7 +250,7 @@ public class ClusterInstallWithoutStartTest extends EasyMockSupport { expect(blueprint.getServices()).andReturn(Arrays.asList("service1", "service2")).anyTimes(); expect(blueprint.getStack()).andReturn(stack).anyTimes(); expect(blueprint.isValidConfigType(anyString())).andReturn(true).anyTimes(); - expect(blueprint.getRepositorySettings()).andReturn(new ArrayList<RepositorySetting>()).anyTimes(); + expect(blueprint.getRepositorySettings()).andReturn(new ArrayList<>()).anyTimes(); // don't expect toEntity() expect(stack.getAllConfigurationTypes("service1")).andReturn(Arrays.asList("service1-site", "service1-env")).anyTimes(); @@ -280,8 +280,8 @@ public class ClusterInstallWithoutStartTest extends EasyMockSupport { expect(stack.getVersion()).andReturn(STACK_VERSION).anyTimes(); expect(stack.getServiceForConfigType("service1-site")).andReturn("service1").anyTimes(); expect(stack.getServiceForConfigType("service2-site")).andReturn("service2").anyTimes(); - expect(stack.getExcludedConfigurationTypes("service1")).andReturn(Collections.<String>emptySet()).anyTimes(); - expect(stack.getExcludedConfigurationTypes("service2")).andReturn(Collections.<String>emptySet()).anyTimes(); + expect(stack.getExcludedConfigurationTypes("service1")).andReturn(Collections.emptySet()).anyTimes(); + expect(stack.getExcludedConfigurationTypes("service2")).andReturn(Collections.emptySet()).anyTimes(); expect(request.getBlueprint()).andReturn(blueprint).anyTimes(); expect(request.getClusterId()).andReturn(CLUSTER_ID).anyTimes(); @@ -298,7 +298,7 @@ public class ClusterInstallWithoutStartTest extends EasyMockSupport { expect(group1.getCardinality()).andReturn("test cardinality").anyTimes(); expect(group1.containsMasterComponent()).andReturn(true).anyTimes(); expect(group1.getComponentNames()).andReturn(group1Components).anyTimes(); - expect(group1.getComponentNames(anyObject(ProvisionAction.class))).andReturn(Collections.<String>emptyList()).anyTimes(); + expect(group1.getComponentNames(anyObject(ProvisionAction.class))).andReturn(Collections.emptyList()).anyTimes(); expect(group1.getComponents("service1")).andReturn(group1ServiceComponents.get("service1")).anyTimes(); expect(group1.getComponents("service2")).andReturn(group1ServiceComponents.get("service1")).anyTimes(); @@ -311,7 +311,7 @@ public class ClusterInstallWithoutStartTest extends EasyMockSupport { expect(group2.getCardinality()).andReturn("test cardinality").anyTimes(); expect(group2.containsMasterComponent()).andReturn(false).anyTimes(); expect(group2.getComponentNames()).andReturn(group2Components).anyTimes(); - expect(group2.getComponentNames(anyObject(ProvisionAction.class))).andReturn(Collections.<String>emptyList()).anyTimes(); + expect(group2.getComponentNames(anyObject(ProvisionAction.class))).andReturn(Collections.emptyList()).anyTimes(); expect(group2.getComponents("service1")).andReturn(group2ServiceComponents.get("service1")).anyTimes(); expect(group2.getComponents("service2")).andReturn(group2ServiceComponents.get("service2")).anyTimes(); expect(group2.getConfiguration()).andReturn(topoGroup2Config).anyTimes(); @@ -366,8 +366,7 @@ public class ClusterInstallWithoutStartTest extends EasyMockSupport { expect(executor.submit(anyObject(AsyncCallableService.class))).andReturn(mockFuture).times(2); persistedTopologyRequest = new PersistedTopologyRequest(1, request); - expect(persistedState.getAllRequests()).andReturn(Collections.<ClusterTopology, - List<LogicalRequest>>emptyMap()).once(); + expect(persistedState.getAllRequests()).andReturn(Collections.emptyMap()).once(); expect(persistedState.persistTopologyRequest(request)).andReturn(persistedTopologyRequest).once(); persistedState.persistLogicalRequest((LogicalRequest) anyObject(), anyLong()); expectLastCall().once(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java index 7f4a08d..e51ce5f 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ClusterTopologyImplTest.java @@ -58,10 +58,10 @@ public class ClusterTopologyImplTest { @Before public void setUp() throws Exception { - configuration = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>()); - bpconfiguration = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>()); + configuration = new Configuration(new HashMap<>(), + new HashMap<>()); + bpconfiguration = new Configuration(new HashMap<>(), + new HashMap<>()); HostGroupInfo group1Info = new HostGroupInfo("group1"); HostGroupInfo group2Info = new HostGroupInfo("group2"); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigureClusterTaskTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigureClusterTaskTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigureClusterTaskTest.java index 99d702b..feefcab 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigureClusterTaskTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/ConfigureClusterTaskTest.java @@ -73,8 +73,8 @@ public class ConfigureClusterTaskTest { Exception { // GIVEN // is it OK to handle the non existence of hostgroups as a success?! - expect(clusterConfigurationRequest.getRequiredHostGroups()).andReturn(Collections.<String>emptyList()); - expect(clusterTopology.getHostGroupInfo()).andReturn(Collections.<String, HostGroupInfo>emptyMap()); + expect(clusterConfigurationRequest.getRequiredHostGroups()).andReturn(Collections.emptyList()); + expect(clusterTopology.getHostGroupInfo()).andReturn(Collections.emptyMap()); // this is only called if the "prerequisites" are satisfied clusterConfigurationRequest.process(); @@ -93,8 +93,8 @@ public class ConfigureClusterTaskTest { public void testsShouldConfigureClusterTaskExecuteWhenCalledFromAsyncCallableService() throws Exception { // GIVEN // is it OK to handle the non existence of hostgroups as a success?! - expect(clusterConfigurationRequest.getRequiredHostGroups()).andReturn(Collections.<String>emptyList()); - expect(clusterTopology.getHostGroupInfo()).andReturn(Collections.<String, HostGroupInfo>emptyMap()); + expect(clusterConfigurationRequest.getRequiredHostGroups()).andReturn(Collections.emptyList()); + expect(clusterTopology.getHostGroupInfo()).andReturn(Collections.emptyMap()); // this is only called if the "prerequisites" are satisfied clusterConfigurationRequest.process(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/topology/LogicalRequestTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/LogicalRequestTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/LogicalRequestTest.java index 8aac927..a5265f6 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/LogicalRequestTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/LogicalRequestTest.java @@ -36,7 +36,6 @@ import org.apache.ambari.server.controller.internal.ProvisionAction; import org.apache.ambari.server.orm.entities.TopologyHostGroupEntity; import org.apache.ambari.server.orm.entities.TopologyHostInfoEntity; import org.apache.ambari.server.orm.entities.TopologyHostRequestEntity; -import org.apache.ambari.server.orm.entities.TopologyHostTaskEntity; import org.apache.ambari.server.orm.entities.TopologyLogicalRequestEntity; import org.apache.ambari.server.orm.entities.TopologyRequestEntity; import org.apache.ambari.server.state.Cluster; @@ -159,7 +158,7 @@ public class LogicalRequestTest extends EasyMockSupport { hostRequestEntityHost1Matched.setId(1L); hostRequestEntityHost1Matched.setHostName(host1.getFqdn()); //host request matched host1 hostRequestEntityHost1Matched.setTopologyHostGroupEntity(hostGroupEntity1); - hostRequestEntityHost1Matched.setTopologyHostTaskEntities(Collections.<TopologyHostTaskEntity>emptySet()); + hostRequestEntityHost1Matched.setTopologyHostTaskEntities(Collections.emptySet()); expect(ambariContext.isHostRegisteredWithCluster(eq(clusterId), eq(host1.getFqdn()))).andReturn(true).anyTimes(); @@ -167,20 +166,20 @@ public class LogicalRequestTest extends EasyMockSupport { hostRequestEntityHost2Matched.setId(2L); hostRequestEntityHost2Matched.setHostName(host2.getFqdn()); // host request matched host2 hostRequestEntityHost2Matched.setTopologyHostGroupEntity(hostGroupEntity1); - hostRequestEntityHost2Matched.setTopologyHostTaskEntities(Collections.<TopologyHostTaskEntity>emptySet()); + hostRequestEntityHost2Matched.setTopologyHostTaskEntities(Collections.emptySet()); expect(ambariContext.isHostRegisteredWithCluster(eq(clusterId), eq(host2.getFqdn()))).andReturn(true).anyTimes(); // host request that hasn't been matched to any registered host yet TopologyHostRequestEntity hostRequestEntityHost3NotMatched = new TopologyHostRequestEntity(); hostRequestEntityHost3NotMatched.setId(3L); hostRequestEntityHost3NotMatched.setTopologyHostGroupEntity(hostGroupEntity1); - hostRequestEntityHost3NotMatched.setTopologyHostTaskEntities(Collections.<TopologyHostTaskEntity>emptySet()); + hostRequestEntityHost3NotMatched.setTopologyHostTaskEntities(Collections.emptySet()); expect(ambariContext.isHostRegisteredWithCluster(eq(clusterId), eq(host3.getFqdn()))).andReturn(false).anyTimes(); TopologyHostRequestEntity hostRequestEntityHost4NotMatched = new TopologyHostRequestEntity(); hostRequestEntityHost4NotMatched.setId(4L); hostRequestEntityHost4NotMatched.setTopologyHostGroupEntity(hostGroupEntity1); - hostRequestEntityHost4NotMatched.setTopologyHostTaskEntities(Collections.<TopologyHostTaskEntity>emptySet()); + hostRequestEntityHost4NotMatched.setTopologyHostTaskEntities(Collections.emptySet()); expect(ambariContext.isHostRegisteredWithCluster(eq(clusterId), eq(host4.getFqdn()))).andReturn(false).anyTimes(); Collection<TopologyHostRequestEntity> reservedHostRequestEntities = ImmutableSet.of( @@ -262,7 +261,7 @@ public class LogicalRequestTest extends EasyMockSupport { hostRequestEntityHost1Matched.setId(1L); hostRequestEntityHost1Matched.setHostName("host1"); //host request matched host1 hostRequestEntityHost1Matched.setTopologyHostGroupEntity(hostGroupEntity2); - hostRequestEntityHost1Matched.setTopologyHostTaskEntities(Collections.<TopologyHostTaskEntity>emptySet()); + hostRequestEntityHost1Matched.setTopologyHostTaskEntities(Collections.emptySet()); expect(ambariContext.isHostRegisteredWithCluster(eq(clusterId), eq("host1"))).andReturn(true).anyTimes(); @@ -270,20 +269,20 @@ public class LogicalRequestTest extends EasyMockSupport { hostRequestEntityHost2Matched.setId(2L); hostRequestEntityHost2Matched.setHostName("host2"); // host request matched host2 hostRequestEntityHost2Matched.setTopologyHostGroupEntity(hostGroupEntity2); - hostRequestEntityHost2Matched.setTopologyHostTaskEntities(Collections.<TopologyHostTaskEntity>emptySet()); + hostRequestEntityHost2Matched.setTopologyHostTaskEntities(Collections.emptySet()); expect(ambariContext.isHostRegisteredWithCluster(eq(clusterId), eq("host2"))).andReturn(true).anyTimes(); // host request that hasn't been matched to any registered host yet TopologyHostRequestEntity hostRequestEntityHost3NotMatched = new TopologyHostRequestEntity(); hostRequestEntityHost3NotMatched.setId(3L); hostRequestEntityHost3NotMatched.setTopologyHostGroupEntity(hostGroupEntity2); - hostRequestEntityHost3NotMatched.setTopologyHostTaskEntities(Collections.<TopologyHostTaskEntity>emptySet()); + hostRequestEntityHost3NotMatched.setTopologyHostTaskEntities(Collections.emptySet()); expect(ambariContext.isHostRegisteredWithCluster(eq(clusterId), eq("host3"))).andReturn(false).anyTimes(); TopologyHostRequestEntity hostRequestEntityHost4NotMatched = new TopologyHostRequestEntity(); hostRequestEntityHost4NotMatched.setId(4L); hostRequestEntityHost4NotMatched.setTopologyHostGroupEntity(hostGroupEntity2); - hostRequestEntityHost4NotMatched.setTopologyHostTaskEntities(Collections.<TopologyHostTaskEntity>emptySet()); + hostRequestEntityHost4NotMatched.setTopologyHostTaskEntities(Collections.emptySet()); expect(ambariContext.isHostRegisteredWithCluster(eq(clusterId), eq("host4"))).andReturn(false).anyTimes(); Collection<TopologyHostRequestEntity> reservedHostRequestEntities = ImmutableSet.of( @@ -372,7 +371,7 @@ public class LogicalRequestTest extends EasyMockSupport { hostRequestEntityHost1Matched.setId(1L); hostRequestEntityHost1Matched.setHostName(host1.getFqdn()); //host request matched host1 hostRequestEntityHost1Matched.setTopologyHostGroupEntity(hostGroupEntity1); - hostRequestEntityHost1Matched.setTopologyHostTaskEntities(Collections.<TopologyHostTaskEntity>emptySet()); + hostRequestEntityHost1Matched.setTopologyHostTaskEntities(Collections.emptySet()); expect(ambariContext.isHostRegisteredWithCluster(eq(clusterId), eq(host1.getFqdn()))).andReturn(true).anyTimes(); @@ -380,14 +379,14 @@ public class LogicalRequestTest extends EasyMockSupport { hostRequestEntityHost2Matched.setId(2L); hostRequestEntityHost2Matched.setHostName(host2.getFqdn()); // host request matched host2 hostRequestEntityHost2Matched.setTopologyHostGroupEntity(hostGroupEntity1); - hostRequestEntityHost2Matched.setTopologyHostTaskEntities(Collections.<TopologyHostTaskEntity>emptySet()); + hostRequestEntityHost2Matched.setTopologyHostTaskEntities(Collections.emptySet()); expect(ambariContext.isHostRegisteredWithCluster(eq(clusterId), eq(host2.getFqdn()))).andReturn(true).anyTimes(); // host request that hasn't been matched to any registered host yet TopologyHostRequestEntity hostRequestEntityHost3NotMatched = new TopologyHostRequestEntity(); hostRequestEntityHost3NotMatched.setId(3L); hostRequestEntityHost3NotMatched.setTopologyHostGroupEntity(hostGroupEntity1); - hostRequestEntityHost3NotMatched.setTopologyHostTaskEntities(Collections.<TopologyHostTaskEntity>emptySet()); + hostRequestEntityHost3NotMatched.setTopologyHostTaskEntities(Collections.emptySet()); expect(ambariContext.isHostRegisteredWithCluster(eq(clusterId), eq(host3.getFqdn()))).andReturn(false).anyTimes(); @@ -395,7 +394,7 @@ public class LogicalRequestTest extends EasyMockSupport { hostRequestEntityHost4Matched.setId(4L); hostRequestEntityHost4Matched.setHostName(host4.getFqdn()); // host request matched host4 hostRequestEntityHost4Matched.setTopologyHostGroupEntity(hostGroupEntity1); - hostRequestEntityHost4Matched.setTopologyHostTaskEntities(Collections.<TopologyHostTaskEntity>emptySet()); + hostRequestEntityHost4Matched.setTopologyHostTaskEntities(Collections.emptySet()); expect(ambariContext.isHostRegisteredWithCluster(eq(clusterId), eq(host4.getFqdn()))).andReturn(true).anyTimes(); Collection<TopologyHostRequestEntity> reservedHostRequestEntities = ImmutableSet.of( @@ -486,7 +485,7 @@ public class LogicalRequestTest extends EasyMockSupport { hostRequestEntityHost1Matched.setId(1L); hostRequestEntityHost1Matched.setHostName(host1.getFqdn()); //host request matched host1 hostRequestEntityHost1Matched.setTopologyHostGroupEntity(hostGroupEntity1); - hostRequestEntityHost1Matched.setTopologyHostTaskEntities(Collections.<TopologyHostTaskEntity>emptySet()); + hostRequestEntityHost1Matched.setTopologyHostTaskEntities(Collections.emptySet()); expect(ambariContext.isHostRegisteredWithCluster(eq(clusterId), eq(host1.getFqdn()))).andReturn(true).anyTimes(); @@ -494,7 +493,7 @@ public class LogicalRequestTest extends EasyMockSupport { TopologyHostRequestEntity hostRequestEntityHost2NotMatched = new TopologyHostRequestEntity(); hostRequestEntityHost2NotMatched.setId(2L); hostRequestEntityHost2NotMatched.setTopologyHostGroupEntity(hostGroupEntity1); - hostRequestEntityHost2NotMatched.setTopologyHostTaskEntities(Collections.<TopologyHostTaskEntity>emptySet()); + hostRequestEntityHost2NotMatched.setTopologyHostTaskEntities(Collections.emptySet()); expect(ambariContext.isHostRegisteredWithCluster(eq(clusterId), eq(host2.getFqdn()))).andReturn(false).anyTimes(); @@ -590,7 +589,7 @@ public class LogicalRequestTest extends EasyMockSupport { TopologyHostRequestEntity hostRequestEntity = new TopologyHostRequestEntity(); hostRequestEntity.setId(i); hostRequestEntity.setTopologyHostGroupEntity(hostGroupEntity); - hostRequestEntity.setTopologyHostTaskEntities(Collections.<TopologyHostTaskEntity>emptySet()); + hostRequestEntity.setTopologyHostTaskEntities(Collections.emptySet()); hostRequests.add(hostRequestEntity); } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/topology/RequiredPasswordValidatorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/RequiredPasswordValidatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/RequiredPasswordValidatorTest.java index e52e66a..c474493 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/RequiredPasswordValidatorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/RequiredPasswordValidatorTest.java @@ -91,26 +91,26 @@ public class RequiredPasswordValidatorTest extends EasyMockSupport { @Before public void setup() { - stackDefaults = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>()); + stackDefaults = new Configuration(new HashMap<>(), + new HashMap<>()); - bpClusterConfig = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), stackDefaults); + bpClusterConfig = new Configuration(new HashMap<>(), + new HashMap<>(), stackDefaults); - topoClusterConfig = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpClusterConfig); + topoClusterConfig = new Configuration(new HashMap<>(), + new HashMap<>(), bpClusterConfig); - bpGroup1Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), topoClusterConfig); + bpGroup1Config = new Configuration(new HashMap<>(), + new HashMap<>(), topoClusterConfig); - bpGroup2Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), topoClusterConfig); + bpGroup2Config = new Configuration(new HashMap<>(), + new HashMap<>(), topoClusterConfig); - topoGroup1Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpGroup1Config); + topoGroup1Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpGroup1Config); - topoGroup2Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpGroup2Config); + topoGroup2Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpGroup2Config); service1RequiredPwdConfigs.clear(); service2RequiredPwdConfigs.clear(); @@ -151,9 +151,9 @@ public class RequiredPasswordValidatorTest extends EasyMockSupport { expect(group2.getComponentNames()).andReturn(group2Components).anyTimes(); expect(group1.getComponents("service1")).andReturn(Arrays.asList("component1", "component2")).anyTimes(); expect(group1.getComponents("service2")).andReturn(Arrays.asList("component3")).anyTimes(); - expect(group1.getComponents("service3")).andReturn(Collections.<String>emptySet()).anyTimes(); + expect(group1.getComponents("service3")).andReturn(Collections.emptySet()).anyTimes(); expect(group2.getComponents("service1")).andReturn(Arrays.asList("component1")).anyTimes(); - expect(group2.getComponents("service2")).andReturn(Collections.<String>emptySet()).anyTimes(); + expect(group2.getComponents("service2")).andReturn(Collections.emptySet()).anyTimes(); expect(group2.getComponents("service3")).andReturn(Arrays.asList("component4")).anyTimes(); expect(stack.getServiceForComponent("component1")).andReturn("service1").anyTimes(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java index a0c8382..9a58b88 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java @@ -162,21 +162,21 @@ public class TopologyManagerTest { @Mock private TopologyValidatorService topologyValidatorService; - private final Configuration stackConfig = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>()); - private final Configuration bpConfiguration = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), stackConfig); - private final Configuration topoConfiguration = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpConfiguration); - private final Configuration bpGroup1Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpConfiguration); - private final Configuration bpGroup2Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpConfiguration); + private final Configuration stackConfig = new Configuration(new HashMap<>(), + new HashMap<>()); + private final Configuration bpConfiguration = new Configuration(new HashMap<>(), + new HashMap<>(), stackConfig); + private final Configuration topoConfiguration = new Configuration(new HashMap<>(), + new HashMap<>(), bpConfiguration); + private final Configuration bpGroup1Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpConfiguration); + private final Configuration bpGroup2Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpConfiguration); //todo: topo config hierarchy is wrong: bpGroupConfigs should extend topo cluster config - private final Configuration topoGroup1Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpGroup1Config); - private final Configuration topoGroup2Config = new Configuration(new HashMap<String, Map<String, String>>(), - new HashMap<String, Map<String, Map<String, String>>>(), bpGroup2Config); + private final Configuration topoGroup1Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpGroup1Config); + private final Configuration topoGroup2Config = new Configuration(new HashMap<>(), + new HashMap<>(), bpGroup2Config); private HostGroupInfo group1Info = new HostGroupInfo("group1"); private HostGroupInfo group2Info = new HostGroupInfo("group2"); @@ -253,7 +253,7 @@ public class TopologyManagerTest { expect(blueprint.getName()).andReturn(BLUEPRINT_NAME).anyTimes(); expect(blueprint.getServices()).andReturn(Arrays.asList("service1", "service2")).anyTimes(); expect(blueprint.getStack()).andReturn(stack).anyTimes(); - expect(blueprint.getRepositorySettings()).andReturn(new ArrayList<RepositorySetting>()).anyTimes(); + expect(blueprint.getRepositorySettings()).andReturn(new ArrayList<>()).anyTimes(); // don't expect toEntity() expect(stack.getAllConfigurationTypes("service1")).andReturn(Arrays.asList("service1-site", "service1-env")).anyTimes(); @@ -274,8 +274,8 @@ public class TopologyManagerTest { expect(stack.getConfiguration()).andReturn(stackConfig).anyTimes(); expect(stack.getName()).andReturn(STACK_NAME).anyTimes(); expect(stack.getVersion()).andReturn(STACK_VERSION).anyTimes(); - expect(stack.getExcludedConfigurationTypes("service1")).andReturn(Collections.<String>emptySet()).anyTimes(); - expect(stack.getExcludedConfigurationTypes("service2")).andReturn(Collections.<String>emptySet()).anyTimes(); + expect(stack.getExcludedConfigurationTypes("service1")).andReturn(Collections.emptySet()).anyTimes(); + expect(stack.getExcludedConfigurationTypes("service2")).andReturn(Collections.emptySet()).anyTimes(); expect(request.getBlueprint()).andReturn(blueprint).anyTimes(); expect(request.getClusterId()).andReturn(CLUSTER_ID).anyTimes(); @@ -381,8 +381,7 @@ public class TopologyManagerTest { @Test public void testProvisionCluster() throws Exception { - expect(persistedState.getAllRequests()).andReturn(Collections.<ClusterTopology, - List<LogicalRequest>>emptyMap()).anyTimes(); + expect(persistedState.getAllRequests()).andReturn(Collections.emptyMap()).anyTimes(); replayAll(); topologyManager.provisionCluster(request); @@ -396,7 +395,7 @@ public class TopologyManagerTest { requestList.add(logicalRequest); expect(logicalRequest.hasPendingHostRequests()).andReturn(false).anyTimes(); allRequests.put(clusterTopologyMock, requestList); - expect(requestStatusResponse.getTasks()).andReturn(Collections.<ShortTaskStatus>emptyList()).anyTimes(); + expect(requestStatusResponse.getTasks()).andReturn(Collections.emptyList()).anyTimes(); expect(clusterTopologyMock.isClusterKerberosEnabled()).andReturn(true); expect(clusterTopologyMock.getClusterId()).andReturn(CLUSTER_ID).anyTimes(); expect(clusterTopologyMock.getBlueprint()).andReturn(blueprint).anyTimes(); @@ -426,8 +425,7 @@ public class TopologyManagerTest { tasks.add(t3); expect(requestStatusResponse.getTasks()).andReturn(tasks).anyTimes(); - expect(persistedState.getAllRequests()).andReturn(Collections.<ClusterTopology, - List<LogicalRequest>>emptyMap()).anyTimes(); + expect(persistedState.getAllRequests()).andReturn(Collections.emptyMap()).anyTimes(); expect(persistedState.getProvisionRequest(CLUSTER_ID)).andReturn(logicalRequest).anyTimes(); replayAll(); topologyManager.provisionCluster(request); @@ -449,8 +447,7 @@ public class TopologyManagerTest { tasks.add(t3); expect(requestStatusResponse.getTasks()).andReturn(tasks).anyTimes(); - expect(persistedState.getAllRequests()).andReturn(Collections.<ClusterTopology, - List<LogicalRequest>>emptyMap()).anyTimes(); + expect(persistedState.getAllRequests()).andReturn(Collections.emptyMap()).anyTimes(); expect(persistedState.getProvisionRequest(CLUSTER_ID)).andReturn(logicalRequest).anyTimes(); replayAll(); topologyManager.provisionCluster(request); @@ -472,8 +469,7 @@ public class TopologyManagerTest { tasks.add(t3); expect(requestStatusResponse.getTasks()).andReturn(tasks).anyTimes(); - expect(persistedState.getAllRequests()).andReturn(Collections.<ClusterTopology, - List<LogicalRequest>>emptyMap()).anyTimes(); + expect(persistedState.getAllRequests()).andReturn(Collections.emptyMap()).anyTimes(); expect(persistedState.getProvisionRequest(CLUSTER_ID)).andReturn(logicalRequest).anyTimes(); replayAll(); topologyManager.provisionCluster(request); @@ -546,8 +542,7 @@ public class TopologyManagerTest { EasyMock.expect(bpfMock.getBlueprint(BLUEPRINT_NAME)).andReturn(blueprint).anyTimes(); ScaleClusterRequest.init(bpfMock); replay(bpfMock); - expect(persistedState.getAllRequests()).andReturn(Collections.<ClusterTopology, - List<LogicalRequest>>emptyMap()).anyTimes(); + expect(persistedState.getAllRequests()).andReturn(Collections.emptyMap()).anyTimes(); replayAll(); topologyManager.provisionCluster(request); topologyManager.scaleHosts(new ScaleClusterRequest(propertySet)); @@ -556,8 +551,7 @@ public class TopologyManagerTest { @Test public void testProvisionCluster_QuickLinkProfileIsSavedTheFirstTime() throws Exception { - expect(persistedState.getAllRequests()).andReturn(Collections.<ClusterTopology, - List<LogicalRequest>>emptyMap()).anyTimes(); + expect(persistedState.getAllRequests()).andReturn(Collections.emptyMap()).anyTimes(); // request has a quicklinks profile expect(request.getQuickLinksProfileJson()).andReturn(SAMPLE_QUICKLINKS_PROFILE_1).anyTimes(); @@ -580,8 +574,7 @@ public class TopologyManagerTest { @Test public void testProvisionCluster_ExistingQuickLinkProfileIsOverwritten() throws Exception { - expect(persistedState.getAllRequests()).andReturn(Collections.<ClusterTopology, - List<LogicalRequest>>emptyMap()).anyTimes(); + expect(persistedState.getAllRequests()).andReturn(Collections.emptyMap()).anyTimes(); // request has a quicklinks profile expect(request.getQuickLinksProfileJson()).andReturn(SAMPLE_QUICKLINKS_PROFILE_2).anyTimes(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/HiveServiceValidatorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/HiveServiceValidatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/HiveServiceValidatorTest.java index 3308333..74c3ae5 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/HiveServiceValidatorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/HiveServiceValidatorTest.java @@ -65,7 +65,7 @@ public class HiveServiceValidatorTest extends EasyMockSupport { // GIVEN EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(blueprintMock); - EasyMock.expect(blueprintMock.getServices()).andReturn(Collections.<String>emptySet()); + EasyMock.expect(blueprintMock.getServices()).andReturn(Collections.emptySet()); replayAll(); // WHEN @@ -83,7 +83,7 @@ public class HiveServiceValidatorTest extends EasyMockSupport { EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(blueprintMock); EasyMock.expect(blueprintMock.getServices()).andReturn(blueprintServices); EasyMock.expect(clusterTopologyMock.getConfiguration()).andReturn(configurationMock); - EasyMock.expect(configurationMock.getAllConfigTypes()).andReturn(Collections.<String>emptySet()); + EasyMock.expect(configurationMock.getAllConfigTypes()).andReturn(Collections.emptySet()); replayAll(); @@ -122,7 +122,7 @@ public class HiveServiceValidatorTest extends EasyMockSupport { Collection<String> configTypes = Arrays.asList("hive-env", "core-site", "hadoop-env"); EasyMock.expect(clusterTopologyMock.getBlueprint()).andReturn(blueprintMock).anyTimes(); EasyMock.expect(blueprintMock.getServices()).andReturn(blueprintServices).anyTimes(); - EasyMock.expect(blueprintMock.getComponents("HIVE")).andReturn(Collections.<String>emptyList()).anyTimes(); + EasyMock.expect(blueprintMock.getComponents("HIVE")).andReturn(Collections.emptyList()).anyTimes(); EasyMock.expect(clusterTopologyMock.getConfiguration()).andReturn(configurationMock); EasyMock.expect(configurationMock.getAllConfigTypes()).andReturn(configTypes); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidatorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidatorTest.java index 82a4ed0..4853a4d 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidatorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/RequiredConfigPropertiesValidatorTest.java @@ -144,7 +144,7 @@ public class RequiredConfigPropertiesValidatorTest extends EasyMockSupport { // GIVEN // all the configuration comes from the bp, cct hg configs are empty - topologyConfigurationMap.put("kerberos-env", new HashMap<String, String>()); + topologyConfigurationMap.put("kerberos-env", new HashMap<>()); topologyConfigurationMap.get("kerberos-env").put("realm", "etwas"); topologyConfigurationMap.get("kerberos-env").put("kdc_type", "mit-kdc"); @@ -173,12 +173,12 @@ public class RequiredConfigPropertiesValidatorTest extends EasyMockSupport { // GIVEN // configuration from the blueprint / cluster creation template - topologyConfigurationMap.put("kerberos-env", new HashMap<String, String>()); + topologyConfigurationMap.put("kerberos-env", new HashMap<>()); topologyConfigurationMap.get("kerberos-env").put("realm", "etwas"); // note, that tehe kdc_type is mssing from the operational config - topologyConfigurationMap.put("krb5-conf", new HashMap<String, String>()); + topologyConfigurationMap.put("krb5-conf", new HashMap<>()); topologyConfigurationMap.get("krb5-conf").put("domains", "smthg"); missingProps.put("master", Collections.singletonList("kdc_type")); @@ -206,8 +206,8 @@ public class RequiredConfigPropertiesValidatorTest extends EasyMockSupport { public void testShouldValidationFailWhenHostGroupConfigurationProvidedAndRequiredConfigTypesAreMissingFromBothHostgroups() throws Exception { // GIVEN // configuration come in the host groups, there are missing config types in both hostgroups - missingProps.put("master", Sets.newTreeSet(Lists.<String>newArrayList("kdc_type", "domains", "realm"))); - missingProps.put("slave", Sets.newTreeSet(Lists.<String>newArrayList("kdc_type", "domains", "realm"))); + missingProps.put("master", Sets.newTreeSet(Lists.newArrayList("kdc_type", "domains", "realm"))); + missingProps.put("slave", Sets.newTreeSet(Lists.newArrayList("kdc_type", "domains", "realm"))); replayAll(); @@ -229,13 +229,13 @@ public class RequiredConfigPropertiesValidatorTest extends EasyMockSupport { public void testShouldValidationFailWhenHostGroupConfigurationProvidedAndRequiredConfigTypesAreMissingFromSlaveHostgroup() throws Exception { // GIVEN // configuration come in the host groups, there are missing config types in both hostgroups - masterHostGroupConfigurationMap.put("kerberos-env", new HashMap<String, String>()); + masterHostGroupConfigurationMap.put("kerberos-env", new HashMap<>()); masterHostGroupConfigurationMap.get("kerberos-env").put("realm", "etwas"); masterHostGroupConfigurationMap.get("kerberos-env").put("kdc_type", "mit-kdc"); - masterHostGroupConfigurationMap.put("krb5-conf", new HashMap<String, String>()); + masterHostGroupConfigurationMap.put("krb5-conf", new HashMap<>()); masterHostGroupConfigurationMap.get("krb5-conf").put("domains", "smthg"); - missingProps.put("slave", Sets.<String>newTreeSet(Lists.<String>newArrayList("kdc_type", "domains", "realm"))); + missingProps.put("slave", Sets.newTreeSet(Lists.newArrayList("kdc_type", "domains", "realm"))); replayAll(); @@ -257,16 +257,16 @@ public class RequiredConfigPropertiesValidatorTest extends EasyMockSupport { public void testShouldValidationPassWhenAllRequiredPropertiesAreProvidedInHostGroupConfiguration() throws Exception { // GIVEN - masterHostGroupConfigurationMap.put("kerberos-env", new HashMap<String, String>()); + masterHostGroupConfigurationMap.put("kerberos-env", new HashMap<>()); masterHostGroupConfigurationMap.get("kerberos-env").put("realm", "etwas"); masterHostGroupConfigurationMap.get("kerberos-env").put("kdc_type", "mit-kdc"); - masterHostGroupConfigurationMap.put("krb5-conf", new HashMap<String, String>()); + masterHostGroupConfigurationMap.put("krb5-conf", new HashMap<>()); masterHostGroupConfigurationMap.get("krb5-conf").put("domains", "smthg"); - slaveHostGroupConfigurationMap.put("kerberos-env", new HashMap<String, String>()); + slaveHostGroupConfigurationMap.put("kerberos-env", new HashMap<>()); slaveHostGroupConfigurationMap.get("kerberos-env").put("realm", "etwas"); slaveHostGroupConfigurationMap.get("kerberos-env").put("kdc_type", "mit-kdc"); - slaveHostGroupConfigurationMap.put("krb5-conf", new HashMap<String, String>()); + slaveHostGroupConfigurationMap.put("krb5-conf", new HashMap<>()); slaveHostGroupConfigurationMap.get("krb5-conf").put("domains", "smthg"); replayAll(); @@ -285,11 +285,11 @@ public class RequiredConfigPropertiesValidatorTest extends EasyMockSupport { public void testShouldValidationPassWhenAllRequiredPropertiesAreProvidedInTopologyConfiguration() throws Exception { // GIVEN // configuration from the blueprint / cluster creation template - topologyConfigurationMap.put("kerberos-env", new HashMap<String, String>()); + topologyConfigurationMap.put("kerberos-env", new HashMap<>()); topologyConfigurationMap.get("kerberos-env").put("realm", "etwas"); topologyConfigurationMap.get("kerberos-env").put("kdc_type", "value"); - topologyConfigurationMap.put("krb5-conf", new HashMap<String, String>()); + topologyConfigurationMap.put("krb5-conf", new HashMap<>()); topologyConfigurationMap.get("krb5-conf").put("domains", "smthg"); replayAll(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/StackConfigTypeValidatorTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/StackConfigTypeValidatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/StackConfigTypeValidatorTest.java index 4a70448..a807b42 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/StackConfigTypeValidatorTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/validators/StackConfigTypeValidatorTest.java @@ -95,7 +95,7 @@ public class StackConfigTypeValidatorTest extends EasyMockSupport { // GIVEN EasyMock.expect(stackMock.getConfiguration()).andReturn(stackConfigurationMock); EasyMock.expect(stackConfigurationMock.getAllConfigTypes()).andReturn(new HashSet<>(Arrays.asList("core-site", "yarn-site"))); - EasyMock.expect(clusterConfigurationMock.getAllConfigTypes()).andReturn(new HashSet<>(Collections.<String>emptyList())); + EasyMock.expect(clusterConfigurationMock.getAllConfigTypes()).andReturn(new HashSet<>(Collections.emptyList())); replayAll(); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog251Test.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog251Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog251Test.java index 5750e04..3978f95 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog251Test.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog251Test.java @@ -239,7 +239,7 @@ public class UpgradeCatalog251Test { expect(mockClusters.getClusters()).andReturn(Collections.singletonMap("normal", mockClusterExpected)).atLeastOnce(); expect(mockClusterExpected.getDesiredConfigByType("kafka-broker")).andReturn(kafkaBroker).atLeastOnce(); expect(mockClusterExpected.getSecurityType()).andReturn(SecurityType.KERBEROS).atLeastOnce(); - expect(mockClusterExpected.getServices()).andReturn(Collections.<String, Service>singletonMap("KAFKA", null)).atLeastOnce(); + expect(mockClusterExpected.getServices()).andReturn(Collections.singletonMap("KAFKA", null)).atLeastOnce(); UpgradeCatalog251 upgradeCatalog251 = createMockBuilder(UpgradeCatalog251.class) .withConstructor(Injector.class) http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java index b7d78ae..baae4c5 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/upgrade/UpgradeCatalog300Test.java @@ -309,7 +309,7 @@ public class UpgradeCatalog300Test { expect(confLogSearchConf2.getProperties()).andReturn(oldLogSearchConf).once(); Capture<Map<String, String>> logSearchConfCapture = EasyMock.newCapture(CaptureType.ALL); expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(logSearchConfCapture), anyString(), - EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).times(2); + EasyMock.anyObject())).andReturn(config).times(2); Map<String, String> oldLogSearchProperties = ImmutableMap.of( "logsearch.logfeeder.include.default.level", "FATAL,ERROR,WARN" @@ -321,17 +321,17 @@ public class UpgradeCatalog300Test { Config logFeederPropertiesConf = easyMockSupport.createNiceMock(Config.class); expect(cluster.getDesiredConfigByType("logfeeder-properties")).andReturn(logFeederPropertiesConf).times(2); - expect(logFeederPropertiesConf.getProperties()).andReturn(Collections.<String, String> emptyMap()).once(); + expect(logFeederPropertiesConf.getProperties()).andReturn(Collections.emptyMap()).once(); Capture<Map<String, String>> logFeederPropertiesCapture = EasyMock.newCapture(); expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), eq("logfeeder-properties"), capture(logFeederPropertiesCapture), - anyString(), EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once(); + anyString(), EasyMock.anyObject())).andReturn(config).once(); Config logSearchPropertiesConf = easyMockSupport.createNiceMock(Config.class); expect(cluster.getDesiredConfigByType("logsearch-properties")).andReturn(logSearchPropertiesConf).times(2); expect(logSearchPropertiesConf.getProperties()).andReturn(oldLogSearchProperties).times(2); Capture<Map<String, String>> logSearchPropertiesCapture = EasyMock.newCapture(); expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), eq("logsearch-properties"), capture(logSearchPropertiesCapture), - anyString(), EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once(); + anyString(), EasyMock.anyObject())).andReturn(config).once(); Map<String, String> oldLogFeederLog4j = ImmutableMap.of( "content", "<!DOCTYPE log4j:configuration SYSTEM \"log4j.dtd\">"); @@ -344,7 +344,7 @@ public class UpgradeCatalog300Test { expect(logFeederLog4jConf.getProperties()).andReturn(oldLogFeederLog4j).anyTimes(); Capture<Map<String, String>> logFeederLog4jCapture = EasyMock.newCapture(); expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(logFeederLog4jCapture), anyString(), - EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once(); + EasyMock.anyObject())).andReturn(config).once(); Map<String, String> oldLogSearchLog4j = ImmutableMap.of( "content", "<!DOCTYPE log4j:configuration SYSTEM \"log4j.dtd\">"); @@ -357,7 +357,7 @@ public class UpgradeCatalog300Test { expect(logSearchLog4jConf.getProperties()).andReturn(oldLogSearchLog4j).anyTimes(); Capture<Map<String, String>> logSearchLog4jCapture = EasyMock.newCapture(); expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(logSearchLog4jCapture), anyString(), - EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once(); + EasyMock.anyObject())).andReturn(config).once(); Map<String, String> oldLogSearchServiceLogsConf = ImmutableMap.of( "content", "<before/><requestHandler name=\"/admin/\" class=\"solr.admin.AdminHandlers\" /><after/>"); @@ -370,7 +370,7 @@ public class UpgradeCatalog300Test { expect(logSearchServiceLogsConf.getProperties()).andReturn(oldLogSearchServiceLogsConf).anyTimes(); Capture<Map<String, String>> logSearchServiceLogsConfCapture = EasyMock.newCapture(); expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(logSearchServiceLogsConfCapture), anyString(), - EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once(); + EasyMock.anyObject())).andReturn(config).once(); Map<String, String> oldLogSearchAuditLogsConf = ImmutableMap.of( "content", "<before/><requestHandler name=\"/admin/\" class=\"solr.admin.AdminHandlers\" /><after/>"); @@ -383,7 +383,7 @@ public class UpgradeCatalog300Test { expect(logSearchAuditLogsConf.getProperties()).andReturn(oldLogSearchAuditLogsConf).anyTimes(); Capture<Map<String, String>> logSearchAuditLogsConfCapture = EasyMock.newCapture(); expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(logSearchAuditLogsConfCapture), anyString(), - EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once(); + EasyMock.anyObject())).andReturn(config).once(); Map<String, String> oldLogFeederOutputConf = ImmutableMap.of( "content", @@ -412,7 +412,7 @@ public class UpgradeCatalog300Test { expect(logFeederOutputConf.getProperties()).andReturn(oldLogFeederOutputConf).anyTimes(); Capture<Map<String, String>> logFeederOutputConfCapture = EasyMock.newCapture(); expect(controller.createConfig(anyObject(Cluster.class), anyObject(StackId.class), anyString(), capture(logFeederOutputConfCapture), anyString(), - EasyMock.<Map<String, Map<String, String>>>anyObject())).andReturn(config).once(); + EasyMock.anyObject())).andReturn(config).once(); replay(clusters, cluster); replay(controller, injector2); @@ -427,14 +427,14 @@ public class UpgradeCatalog300Test { List<Map<String, String>> updatedLogSearchConfs = logSearchConfCapture.getValues(); assertEquals(updatedLogSearchConfs.size(), 2); for (Map<String, String> updatedLogSearchConf : updatedLogSearchConfs) { - assertTrue(Maps.difference(Collections.<String, String> emptyMap(), updatedLogSearchConf).areEqual()); + assertTrue(Maps.difference(Collections.emptyMap(), updatedLogSearchConf).areEqual()); } Map<String,String> newLogFeederProperties = logFeederPropertiesCapture.getValue(); assertTrue(Maps.difference(expectedLogFeederProperties, newLogFeederProperties).areEqual()); Map<String,String> newLogSearchProperties = logSearchPropertiesCapture.getValue(); - assertTrue(Maps.difference(Collections.<String, String> emptyMap(), newLogSearchProperties).areEqual()); + assertTrue(Maps.difference(Collections.emptyMap(), newLogSearchProperties).areEqual()); Map<String, String> updatedLogFeederLog4j = logFeederLog4jCapture.getValue(); assertTrue(Maps.difference(expectedLogFeederLog4j, updatedLogFeederLog4j).areEqual()); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/utils/SynchronousThreadPoolExecutor.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/utils/SynchronousThreadPoolExecutor.java b/ambari-server/src/test/java/org/apache/ambari/server/utils/SynchronousThreadPoolExecutor.java index f69d1ec..718917b 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/utils/SynchronousThreadPoolExecutor.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/utils/SynchronousThreadPoolExecutor.java @@ -33,7 +33,7 @@ public class SynchronousThreadPoolExecutor extends ThreadPoolExecutor { * */ public SynchronousThreadPoolExecutor() { - super(1, 1, 0L, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>()); + super(1, 1, 0L, TimeUnit.MINUTES, new LinkedBlockingQueue<>()); } /** http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/utils/TestParallel.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/utils/TestParallel.java b/ambari-server/src/test/java/org/apache/ambari/server/utils/TestParallel.java index 393de0a..b4a32cc 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/utils/TestParallel.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/utils/TestParallel.java @@ -51,7 +51,7 @@ public class TestParallel { Assert.assertTrue(nullLoopResult.getResult().isEmpty()); ParallelLoopResult<Integer> emptyLoopResult = Parallel.forLoop( - new ArrayList<Integer>(), + new ArrayList<>(), new LoopBody<Integer, Integer>() { @Override public Integer run(Integer integer) { http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/view/RemoteAmbariClusterTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/RemoteAmbariClusterTest.java b/ambari-server/src/test/java/org/apache/ambari/server/view/RemoteAmbariClusterTest.java index 69a643d..3e060e6 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/view/RemoteAmbariClusterTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/view/RemoteAmbariClusterTest.java @@ -30,7 +30,6 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.util.List; -import java.util.Map; import org.apache.ambari.server.orm.entities.RemoteAmbariClusterEntity; import org.apache.ambari.view.AmbariHttpException; @@ -60,7 +59,7 @@ public class RemoteAmbariClusterTest { final String clusterPath = "/api/v1/clusters/Test"; expect(clusterStreamProvider.readFrom(eq( clusterPath + "?fields=services/ServiceInfo,hosts,Clusters"), - eq("GET"), (String) isNull(), EasyMock.<Map<String, String>>anyObject())).andAnswer(new IAnswer<InputStream>() { + eq("GET"), (String) isNull(), EasyMock.anyObject())).andAnswer(new IAnswer<InputStream>() { @Override public InputStream answer() throws Throwable { desiredConfigPolls[0] += 1; @@ -69,7 +68,7 @@ public class RemoteAmbariClusterTest { }).anyTimes(); expect(clusterStreamProvider.readFrom(eq(clusterPath + "/configurations?(type=test-site&tag=TAG)"), - eq("GET"), (String)isNull(), EasyMock.<Map<String, String>>anyObject())).andAnswer(new IAnswer<InputStream>() { + eq("GET"), (String)isNull(), EasyMock.anyObject())).andAnswer(new IAnswer<InputStream>() { @Override public InputStream answer() throws Throwable { testConfigPolls[0] += 1; @@ -113,7 +112,7 @@ public class RemoteAmbariClusterTest { expect(clusterStreamProvider.readFrom(eq(String.format("%s/services/%s/components/%s?" + "fields=host_components/HostRoles/host_name", clusterPath, service, component)), - eq("GET"), (String) isNull(), EasyMock.<Map<String, String>>anyObject())) + eq("GET"), (String) isNull(), EasyMock.anyObject())) .andReturn(new ByteArrayInputStream(componentHostsString.getBytes())); RemoteAmbariClusterEntity entity = createNiceMock(RemoteAmbariClusterEntity.class); http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/ambari-server/src/test/java/org/apache/ambari/server/view/ViewDataMigrationUtilityTest.java ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewDataMigrationUtilityTest.java b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewDataMigrationUtilityTest.java index 1d73483..62b562c 100644 --- a/ambari-server/src/test/java/org/apache/ambari/server/view/ViewDataMigrationUtilityTest.java +++ b/ambari-server/src/test/java/org/apache/ambari/server/view/ViewDataMigrationUtilityTest.java @@ -118,14 +118,14 @@ public class ViewDataMigrationUtilityTest { } private static ViewDataMigrationContextImpl getViewDataMigrationContext(int currentVersion, int originVersion) { - Map<String, Class> entities = Collections.<String, Class>singletonMap("MyEntityClass", Object.class); + Map<String, Class> entities = Collections.singletonMap("MyEntityClass", Object.class); ViewDataMigrationContextImpl context = createNiceMock(ViewDataMigrationContextImpl.class); expect(context.getOriginDataVersion()).andReturn(originVersion).anyTimes(); expect(context.getCurrentDataVersion()).andReturn(currentVersion).anyTimes(); expect(context.getOriginEntityClasses()).andReturn(entities).anyTimes(); expect(context.getCurrentEntityClasses()).andReturn(entities).anyTimes(); - expect(context.getCurrentInstanceDataByUser()).andReturn(new HashMap<String, Map<String, String>>()); + expect(context.getCurrentInstanceDataByUser()).andReturn(new HashMap<>()); replay(context); return context; } http://git-wip-us.apache.org/repos/asf/ambari/blob/ab8d58ba/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 8342158..a28d419 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 @@ -435,11 +435,11 @@ public class ViewRegistryTest { expect(viewInstanceDAO.findByName("MY_VIEW{1.0.0}", "AUTO-INSTANCE")).andReturn(viewAutoInstanceEntity).anyTimes(); expect(viewAutoInstanceEntity.getInstanceData("p1")).andReturn(autoInstanceDataEntity).anyTimes(); } else { - expect(clusters.getClusters()).andReturn(new HashMap<String, Cluster>()); + expect(clusters.getClusters()).andReturn(new HashMap<>()); } if (removeUndeployed) { - expect(viewDAO.findAll()).andReturn(Collections.<ViewEntity>emptyList()); + expect(viewDAO.findAll()).andReturn(Collections.emptyList()); } // replay mocks @@ -668,7 +668,7 @@ public class ViewRegistryTest { TestListener listener = new TestListener(); registry.registerListener(listener, "MY_VIEW", "1.0.0"); - EventImpl event = EventImplTest.getEvent("MyEvent", Collections.<String, String>emptyMap(), VIEW_XML_1); + EventImpl event = EventImplTest.getEvent("MyEvent", Collections.emptyMap(), VIEW_XML_1); registry.fireEvent(event); @@ -677,7 +677,7 @@ public class ViewRegistryTest { listener.clear(); // fire an event for a different view - event = EventImplTest.getEvent("MyEvent", Collections.<String, String>emptyMap(), VIEW_XML_2); + event = EventImplTest.getEvent("MyEvent", Collections.emptyMap(), VIEW_XML_2); registry.fireEvent(event); @@ -686,7 +686,7 @@ public class ViewRegistryTest { // un-register the listener registry.unregisterListener(listener, "MY_VIEW", "1.0.0"); - event = EventImplTest.getEvent("MyEvent", Collections.<String, String>emptyMap(), VIEW_XML_1); + event = EventImplTest.getEvent("MyEvent", Collections.emptyMap(), VIEW_XML_1); registry.fireEvent(event); @@ -700,7 +700,7 @@ public class ViewRegistryTest { TestListener listener = new TestListener(); registry.registerListener(listener, "MY_VIEW", null); // all versions of MY_VIEW - EventImpl event = EventImplTest.getEvent("MyEvent", Collections.<String, String>emptyMap(), VIEW_XML_1); + EventImpl event = EventImplTest.getEvent("MyEvent", Collections.emptyMap(), VIEW_XML_1); registry.fireEvent(event); @@ -709,7 +709,7 @@ public class ViewRegistryTest { listener.clear(); // fire an event for a different view - event = EventImplTest.getEvent("MyEvent", Collections.<String, String>emptyMap(), VIEW_XML_2); + event = EventImplTest.getEvent("MyEvent", Collections.emptyMap(), VIEW_XML_2); registry.fireEvent(event); @@ -720,13 +720,13 @@ public class ViewRegistryTest { // un-register the listener registry.unregisterListener(listener, "MY_VIEW", null); // all versions of MY_VIEW - event = EventImplTest.getEvent("MyEvent", Collections.<String, String>emptyMap(), VIEW_XML_1); + event = EventImplTest.getEvent("MyEvent", Collections.emptyMap(), VIEW_XML_1); registry.fireEvent(event); Assert.assertNull(listener.getLastEvent()); - event = EventImplTest.getEvent("MyEvent", Collections.<String, String>emptyMap(), VIEW_XML_2); + event = EventImplTest.getEvent("MyEvent", Collections.emptyMap(), VIEW_XML_2); registry.fireEvent(event); @@ -1303,7 +1303,7 @@ public class ViewRegistryTest { ViewRegistry registry = ViewRegistry.getInstance(); ViewEntity viewEntity = createNiceMock(ViewEntity.class); - expect(viewEntity.getInstances()).andReturn(Collections.<ViewInstanceEntity>emptyList()).anyTimes(); + expect(viewEntity.getInstances()).andReturn(Collections.emptyList()).anyTimes(); replay(viewEntity, configuration);