You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/12/16 22:02:18 UTC
[10/51] [abbrv] ambari git commit: AMBARI-19149. Code cleanup:
compiler warnings (Attila Doroszlai via ncole)
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProviderTest.java
index 534a899..2f8c69f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigurationResourceProviderTest.java
@@ -49,6 +49,7 @@ import org.apache.ambari.server.controller.utilities.PropertyHelper;
import org.apache.ambari.server.security.TestAuthenticationFactory;
import org.apache.ambari.server.state.StackId;
import org.easymock.Capture;
+import org.easymock.EasyMock;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
@@ -170,8 +171,8 @@ public class ConfigurationResourceProviderTest {
orResponse.add(new ConfigurationResponse("Cluster100", stackId, "type",
"tag2", 2L, null, null));
- Capture<Set<ConfigurationRequest>> configRequestCapture1 = new Capture<Set<ConfigurationRequest>>();
- Capture<Set<ConfigurationRequest>> configRequestCapture2 = new Capture<Set<ConfigurationRequest>>();
+ Capture<Set<ConfigurationRequest>> configRequestCapture1 = EasyMock.newCapture();
+ Capture<Set<ConfigurationRequest>> configRequestCapture2 = EasyMock.newCapture();
// set expectations
//equals predicate
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java
index 377d160..977c3f8 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostResourceProviderTest.java
@@ -74,7 +74,9 @@ import org.apache.ambari.server.state.HostConfig;
import org.apache.ambari.server.state.HostHealthStatus;
import org.apache.ambari.server.state.HostHealthStatus.HealthStatus;
import org.apache.ambari.server.state.MaintenanceState;
+import org.apache.ambari.server.state.ServiceComponentHost;
import org.apache.ambari.server.state.stack.OsFamily;
+import org.apache.ambari.server.topology.LogicalRequest;
import org.apache.ambari.server.topology.TopologyManager;
import org.easymock.EasyMock;
import org.easymock.EasyMockSupport;
@@ -1074,7 +1076,7 @@ public class HostResourceProviderTest extends EasyMockSupport {
expect(clusters.getHost("Host100")).andReturn(host1).anyTimes();
expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
expect(clusters.getClustersForHost("Host100")).andReturn(clusterSet).anyTimes();
- expect(cluster.getServiceComponentHosts("Host100")).andReturn(Collections.EMPTY_LIST);
+ expect(cluster.getServiceComponentHosts("Host100")).andReturn(Collections.<ServiceComponentHost>emptyList());
expect(cluster.getClusterId()).andReturn(100L).anyTimes();
expect(cluster.getDesiredConfigs()).andReturn(new HashMap<String, DesiredConfig>()).anyTimes();
clusters.deleteHost("Host100");
@@ -1082,7 +1084,7 @@ public class HostResourceProviderTest extends EasyMockSupport {
expect(host1.getHostName()).andReturn("Host100").anyTimes();
expect(healthStatus.getHealthStatus()).andReturn(HostHealthStatus.HealthStatus.HEALTHY).anyTimes();
expect(healthStatus.getHealthReport()).andReturn("HEALTHY").anyTimes();
- expect(topologyManager.getRequests(Collections.EMPTY_LIST)).andReturn(Collections.EMPTY_LIST).anyTimes();
+ expect(topologyManager.getRequests(Collections.<Long>emptyList())).andReturn(Collections.<LogicalRequest>emptyList()).anyTimes();
// replay
replayAll();
@@ -1334,7 +1336,7 @@ public class HostResourceProviderTest extends EasyMockSupport {
public static void deleteHosts(AmbariManagementController controller, Set<HostRequest> requests)
throws AmbariException {
TopologyManager topologyManager = EasyMock.createNiceMock(TopologyManager.class);
- expect(topologyManager.getRequests(Collections.EMPTY_LIST)).andReturn(Collections.EMPTY_LIST).anyTimes();
+ expect(topologyManager.getRequests(Collections.<Long>emptyList())).andReturn(Collections.<LogicalRequest>emptyList()).anyTimes();
replay(topologyManager);
@@ -1347,7 +1349,7 @@ public class HostResourceProviderTest extends EasyMockSupport {
Set<HostRequest> requests, boolean dryRun, boolean forceDelete)
throws AmbariException {
TopologyManager topologyManager = EasyMock.createNiceMock(TopologyManager.class);
- expect(topologyManager.getRequests(Collections.EMPTY_LIST)).andReturn(Collections.EMPTY_LIST).anyTimes();
+ expect(topologyManager.getRequests(Collections.<Long>emptyList())).andReturn(Collections.<LogicalRequest>emptyList()).anyTimes();
replay(topologyManager);
@@ -1415,7 +1417,7 @@ public class HostResourceProviderTest extends EasyMockSupport {
try {
expect(host.getDesiredHostConfigs(EasyMock.<Cluster> anyObject(),
- EasyMock.<Map> anyObject())).andReturn(desiredConfigs).anyTimes();
+ EasyMock.<Map<String, DesiredConfig>> anyObject())).andReturn(desiredConfigs).anyTimes();
} catch (AmbariException e) {
Assert.fail(e.getMessage());
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProviderTest.java
index 7fc8a90..b7fd051 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProviderTest.java
@@ -71,6 +71,7 @@ import org.apache.ambari.server.state.StackId;
import org.apache.ambari.server.state.cluster.ClusterImpl;
import org.apache.ambari.server.topology.TopologyManager;
import org.apache.ambari.server.utils.StageUtils;
+import org.easymock.EasyMock;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -223,9 +224,9 @@ public class HostStackVersionResourceProviderTest {
expect(managementController.getActionManager()).andReturn(actionManager).anyTimes();
expect(managementController.getJdkResourceUrl()).andReturn("/JdkResourceUrl").anyTimes();
expect(managementController.getPackagesForServiceHost(anyObject(ServiceInfo.class),
- anyObject(Map.class), anyObject(String.class))).andReturn(packages).anyTimes();
+ EasyMock.<Map<String, String>>anyObject(), anyObject(String.class))).andReturn(packages).anyTimes();
- expect(resourceProviderFactory.getHostResourceProvider(anyObject(Set.class), anyObject(Map.class),
+ expect(resourceProviderFactory.getHostResourceProvider(EasyMock.<Set<String>>anyObject(), EasyMock.<Map<Resource.Type, String>>anyObject(),
eq(managementController))).andReturn(csvResourceProvider).anyTimes();
expect(clusters.getCluster(anyObject(String.class))).andReturn(cluster);
@@ -317,9 +318,9 @@ public class HostStackVersionResourceProviderTest {
expect(managementController.getActionManager()).andReturn(actionManager).anyTimes();
expect(managementController.getJdkResourceUrl()).andReturn("/JdkResourceUrl").anyTimes();
expect(managementController.getPackagesForServiceHost(anyObject(ServiceInfo.class),
- anyObject(Map.class), anyObject(String.class))).andReturn(packages).anyTimes();
+ EasyMock.<Map<String, String>>anyObject(), anyObject(String.class))).andReturn(packages).anyTimes();
- expect(resourceProviderFactory.getHostResourceProvider(anyObject(Set.class), anyObject(Map.class),
+ expect(resourceProviderFactory.getHostResourceProvider(EasyMock.<Set<String>>anyObject(), EasyMock.<Map<Resource.Type, String>>anyObject(),
eq(managementController))).andReturn(csvResourceProvider).anyTimes();
expect(clusters.getCluster(anyObject(String.class))).andReturn(cluster);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/KerberosDescriptorResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/KerberosDescriptorResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/KerberosDescriptorResourceProviderTest.java
index 747c379..d9b3af7 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/KerberosDescriptorResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/KerberosDescriptorResourceProviderTest.java
@@ -11,6 +11,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.ambari.server.controller.spi.Request;
+import org.apache.ambari.server.controller.spi.Resource;
import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
import org.apache.ambari.server.orm.dao.KerberosDescriptorDAO;
import org.apache.ambari.server.orm.entities.KerberosDescriptorEntity;
@@ -80,7 +81,7 @@ public class KerberosDescriptorResourceProviderTest {
EasyMock.replay(request);
kerberosDescriptorResourceProvider = new KerberosDescriptorResourceProvider(kerberosDescriptorDAO,
- kerberosDescriptorFactory, Collections.EMPTY_SET, Collections.EMPTY_MAP, null);
+ kerberosDescriptorFactory, Collections.<String>emptySet(), Collections.<Resource.Type, String>emptyMap(), null);
// WHEN
kerberosDescriptorResourceProvider.createResources(request);
@@ -97,7 +98,7 @@ public class KerberosDescriptorResourceProviderTest {
EasyMock.replay(request);
kerberosDescriptorResourceProvider = new KerberosDescriptorResourceProvider(kerberosDescriptorDAO,
- kerberosDescriptorFactory, Collections.EMPTY_SET, Collections.EMPTY_MAP, null);
+ kerberosDescriptorFactory, Collections.<String>emptySet(), Collections.<Resource.Type, String>emptyMap(), null);
// WHEN
kerberosDescriptorResourceProvider.createResources(request);
@@ -112,7 +113,7 @@ public class KerberosDescriptorResourceProviderTest {
// GIVEN
kerberosDescriptorResourceProvider = new KerberosDescriptorResourceProvider(kerberosDescriptorDAO,
- kerberosDescriptorFactory, Collections.EMPTY_SET, Collections.EMPTY_MAP, null);
+ kerberosDescriptorFactory, Collections.<String>emptySet(), Collections.<Resource.Type, String>emptyMap(), null);
EasyMock.expect(request.getProperties())
.andReturn(requestPropertySet(KERBEROS_DESCRIPTORS_KERBEROS_DESCRIPTOR_NAME, TEST_KERBEROS_DESCRIPTOR_NAME))
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/MemberResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/MemberResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/MemberResourceProviderTest.java
index a0bc694..438e073 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/MemberResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/MemberResourceProviderTest.java
@@ -45,6 +45,7 @@ import org.apache.ambari.server.controller.utilities.PredicateBuilder;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
import org.apache.ambari.server.security.TestAuthenticationFactory;
import org.apache.ambari.server.security.authorization.AuthorizationException;
+import org.easymock.EasyMock;
import org.junit.Before;
import org.junit.Test;
import org.springframework.security.core.Authentication;
@@ -79,7 +80,7 @@ public class MemberResourceProviderTest {
AbstractControllerResourceProvider.init(resourceProviderFactory);
- expect(resourceProviderFactory.getMemberResourceProvider(anyObject(Set.class), anyObject(Map.class), eq(managementController)))
+ expect(resourceProviderFactory.getMemberResourceProvider(EasyMock.<Set<String>>anyObject(), EasyMock.<Map<Resource.Type, String>>anyObject(), eq(managementController)))
.andReturn(new MemberResourceProvider(PropertyHelper.getPropertyIds(type), PropertyHelper.getKeyPropertyIds(type), managementController)).anyTimes();
managementController.createMembers(AbstractResourceProviderTest.Matcher.getMemberRequestSet("engineering", "joe"));
@@ -135,7 +136,7 @@ public class MemberResourceProviderTest {
AbstractControllerResourceProvider.init(resourceProviderFactory);
- expect(resourceProviderFactory.getMemberResourceProvider(anyObject(Set.class), anyObject(Map.class), eq(managementController)))
+ expect(resourceProviderFactory.getMemberResourceProvider(EasyMock.<Set<String>>anyObject(), EasyMock.<Map<Resource.Type, String>>anyObject(), eq(managementController)))
.andReturn(new MemberResourceProvider(PropertyHelper.getPropertyIds(type), PropertyHelper.getKeyPropertyIds(type), managementController)).anyTimes();
expect(managementController.getMembers(AbstractResourceProviderTest.Matcher.getMemberRequestSet(null, null)))
@@ -184,7 +185,7 @@ public class MemberResourceProviderTest {
AbstractControllerResourceProvider.init(resourceProviderFactory);
// set expectations
- expect(resourceProviderFactory.getMemberResourceProvider(anyObject(Set.class), anyObject(Map.class), eq(managementController)))
+ expect(resourceProviderFactory.getMemberResourceProvider(EasyMock.<Set<String>>anyObject(), EasyMock.<Map<Resource.Type, String>>anyObject(), eq(managementController)))
.andReturn(new MemberResourceProvider(PropertyHelper.getPropertyIds(type), PropertyHelper.getKeyPropertyIds(type), managementController)).anyTimes();
managementController.updateMembers(AbstractResourceProviderTest.Matcher.getMemberRequestSet("engineering", "joe"));
@@ -239,7 +240,7 @@ public class MemberResourceProviderTest {
AbstractControllerResourceProvider.init(resourceProviderFactory);
// set expectations
- expect(resourceProviderFactory.getMemberResourceProvider(anyObject(Set.class), anyObject(Map.class), eq(managementController)))
+ expect(resourceProviderFactory.getMemberResourceProvider(EasyMock.<Set<String>>anyObject(), EasyMock.<Map<Resource.Type, String>>anyObject(), eq(managementController)))
.andReturn(new MemberResourceProvider(PropertyHelper.getPropertyIds(type), PropertyHelper.getKeyPropertyIds(type), managementController)).anyTimes();
managementController.deleteMembers(AbstractResourceProviderTest.Matcher.getMemberRequestSet("engineering", null));
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RemoteClusterResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RemoteClusterResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RemoteClusterResourceProviderTest.java
index 1d44fc0..65e122a 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RemoteClusterResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RemoteClusterResourceProviderTest.java
@@ -168,7 +168,7 @@ public class RemoteClusterResourceProviderTest {
setField(RemoteClusterResourceProvider.class.getDeclaredField("remoteAmbariClusterDAO"), clusterDAO);
- EqualsPredicate equalsPredicate = new EqualsPredicate(RemoteClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID,"test");
+ EqualsPredicate equalsPredicate = new EqualsPredicate<>(RemoteClusterResourceProvider.CLUSTER_NAME_PROPERTY_ID,"test");
RemoteAmbariClusterRegistry clusterRegistry = createMock(RemoteAmbariClusterRegistry.class);
setField(RemoteClusterResourceProvider.class.getDeclaredField("remoteAmbariClusterRegistry"), clusterRegistry);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java
index f7dff11..e6f2ed5 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestResourceProviderTest.java
@@ -612,7 +612,7 @@ public class RequestResourceProviderTest {
expect(requestMock1.getRequestContext()).andReturn("this is a context").anyTimes();
expect(requestMock1.getRequestId()).andReturn(101L).anyTimes();
- Capture<Collection<Long>> requestIdsCapture = new Capture<Collection<Long>>();
+ Capture<Collection<Long>> requestIdsCapture = EasyMock.newCapture();
// set expectations
expect(managementController.getActionManager()).andReturn(actionManager).anyTimes();
@@ -692,7 +692,7 @@ public class RequestResourceProviderTest {
expect(requestMock1.getRequestContext()).andReturn("this is a context").anyTimes();
expect(requestMock1.getRequestId()).andReturn(101L).anyTimes();
- Capture<Collection<Long>> requestIdsCapture = new Capture<Collection<Long>>();
+ Capture<Collection<Long>> requestIdsCapture = EasyMock.newCapture();
// set expectations
expect(managementController.getActionManager()).andReturn(actionManager).anyTimes();
@@ -1124,10 +1124,10 @@ public class RequestResourceProviderTest {
public void testCreateResourcesForCommandWithHostPredicate() throws Exception {
Resource.Type type = Resource.Type.Request;
- Capture<ExecuteActionRequest> actionRequest = new Capture<ExecuteActionRequest>();
- Capture<HashMap<String, String>> propertyMap = new Capture<HashMap<String, String>>();
- Capture<Request> requestCapture = new Capture<>();
- Capture<Predicate> predicateCapture = new Capture<>();
+ Capture<ExecuteActionRequest> actionRequest = EasyMock.newCapture();
+ Capture<HashMap<String, String>> propertyMap = EasyMock.newCapture();
+ Capture<Request> requestCapture = EasyMock.newCapture();
+ Capture<Predicate> predicateCapture = EasyMock.newCapture();
AmbariManagementController managementController = createMock(AmbariManagementController.class);
RequestStatusResponse response = createNiceMock(RequestStatusResponse.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestScheduleResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestScheduleResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestScheduleResourceProviderTest.java
index 8a1e1f0..e3fec23 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestScheduleResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RequestScheduleResourceProviderTest.java
@@ -49,6 +49,7 @@ import org.apache.ambari.server.state.scheduler.RequestExecution;
import org.apache.ambari.server.state.scheduler.RequestExecutionFactory;
import org.apache.ambari.server.state.scheduler.Schedule;
import org.easymock.Capture;
+import org.easymock.EasyMock;
import org.easymock.IAnswer;
import org.junit.Test;
@@ -91,9 +92,9 @@ public class RequestScheduleResourceProviderTest {
expect(managementController.getAuthName()).andReturn("admin").anyTimes();
expect(managementController.getAuthId()).andReturn(1).anyTimes();
- Capture<Cluster> clusterCapture = new Capture<Cluster>();
- Capture<Batch> batchCapture = new Capture<Batch>();
- Capture<Schedule> scheduleCapture = new Capture<Schedule>();
+ Capture<Cluster> clusterCapture = EasyMock.newCapture();
+ Capture<Batch> batchCapture = EasyMock.newCapture();
+ Capture<Schedule> scheduleCapture = EasyMock.newCapture();
expect(executionFactory.createNew(capture(clusterCapture),
capture(batchCapture), capture(scheduleCapture))).andReturn(requestExecution);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceHostComponentResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceHostComponentResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceHostComponentResourceProviderTest.java
index cb7051c..9ce2b7b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceHostComponentResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/RootServiceHostComponentResourceProviderTest.java
@@ -44,6 +44,7 @@ import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Clusters;
import org.apache.ambari.server.state.Host;
import org.apache.ambari.server.state.HostHealthStatus;
+import org.easymock.EasyMock;
import org.junit.Test;
public class RootServiceHostComponentResourceProviderTest {
@@ -78,7 +79,7 @@ public class RootServiceHostComponentResourceProviderTest {
expect(managementController.getClusters()).andReturn(clusters).anyTimes();
expect(clusters.getHosts()).andReturn(hosts).anyTimes();
- expect(factory.getRootServiceHostComponent((RootServiceHostComponentRequest) anyObject(), (Set<HostResponse>) anyObject())).
+ expect(factory.getRootServiceHostComponent((RootServiceHostComponentRequest) anyObject(), EasyMock.<Set<HostResponse>>anyObject())).
andReturn(responseSet).anyTimes();
expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java
index 716be62..994f221 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ServiceResourceProviderTest.java
@@ -529,7 +529,7 @@ public class ServiceResourceProviderTest {
// set expectations
expect(managementController.getClusters()).andReturn(clusters).anyTimes();
expect(managementController.getAmbariMetaInfo()).andReturn(ambariMetaInfo).anyTimes();
- expect(managementController.getHostComponents((Set<ServiceComponentHostRequest>) anyObject())).
+ expect(managementController.getHostComponents(EasyMock.<Set<ServiceComponentHostRequest>>anyObject())).
andReturn(Collections.<ServiceComponentHostResponse>emptySet()).anyTimes();
expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/SimplifyingPredicateVisitorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/SimplifyingPredicateVisitorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/SimplifyingPredicateVisitorTest.java
index 9fad095..c5ccc3c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/SimplifyingPredicateVisitorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/SimplifyingPredicateVisitorTest.java
@@ -38,6 +38,7 @@ import org.apache.ambari.server.controller.utilities.PredicateBuilder;
import org.apache.ambari.server.controller.utilities.PredicateHelper;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
import org.easymock.Capture;
+import org.easymock.EasyMock;
import org.junit.Test;
import junit.framework.Assert;
@@ -73,7 +74,7 @@ public class SimplifyingPredicateVisitorTest {
public void testVisit() {
ResourceProvider provider = createStrictMock(ResourceProvider.class);
- Capture<Set<String>> propertiesCapture = new Capture<Set<String>>();
+ Capture<Set<String>> propertiesCapture = EasyMock.newCapture();
SimplifyingPredicateVisitor visitor = new SimplifyingPredicateVisitor(provider);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackServiceResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackServiceResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackServiceResourceProviderTest.java
index bb8527a..9cca08d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackServiceResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackServiceResourceProviderTest.java
@@ -19,7 +19,6 @@
package org.apache.ambari.server.controller.internal;
-import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.createNiceMock;
import static org.easymock.EasyMock.expect;
import static org.easymock.EasyMock.replay;
@@ -31,6 +30,7 @@ import java.util.Map;
import java.util.Set;
import org.apache.ambari.server.controller.AmbariManagementController;
+import org.apache.ambari.server.controller.StackServiceRequest;
import org.apache.ambari.server.controller.StackServiceResponse;
import org.apache.ambari.server.controller.spi.Request;
import org.apache.ambari.server.controller.spi.Resource;
@@ -38,6 +38,7 @@ import org.apache.ambari.server.controller.spi.ResourceProvider;
import org.apache.ambari.server.controller.utilities.PropertyHelper;
import org.apache.ambari.server.state.ServiceInfo;
import org.apache.ambari.server.state.ServicePropertyInfo;
+import org.easymock.EasyMock;
import org.junit.Before;
import org.junit.Test;
@@ -78,7 +79,7 @@ public class StackServiceResourceProviderTest {
StackServiceResponse stackServiceResponse = createNiceMock(StackServiceResponse.class);
expect(stackServiceResponse.getServiceProperties()).andReturn(TEST_SERVICE_PROPERTIES);
- expect(managementController.getStackServices(anyObject(Set.class)))
+ expect(managementController.getStackServices(EasyMock.<Set<StackServiceRequest>>anyObject()))
.andReturn(ImmutableSet.of(stackServiceResponse));
replay(managementController, stackServiceResponse);
@@ -121,7 +122,7 @@ public class StackServiceResourceProviderTest {
- expect(managementController.getStackServices(anyObject(Set.class)))
+ expect(managementController.getStackServices(EasyMock.<Set<StackServiceRequest>>anyObject()))
.andReturn(ImmutableSet.of(stackServiceResponse));
replay(managementController);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackTest.java
index 0f4ea96..b67d019 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/StackTest.java
@@ -18,7 +18,6 @@
package org.apache.ambari.server.controller.internal;
-import static org.easymock.EasyMock.anyObject;
import static org.easymock.EasyMock.capture;
import static org.easymock.EasyMock.expect;
import static org.junit.Assert.assertEquals;
@@ -68,12 +67,12 @@ public class StackTest {
public void testTestXmlExtensionStrippedOff() throws Exception {
AmbariManagementController controller = createNiceMock(AmbariManagementController.class);
AmbariMetaInfo metaInfo = createNiceMock(AmbariMetaInfo.class);
- Capture<Set<StackServiceRequest>> stackServiceRequestCapture = new Capture<Set<StackServiceRequest>>();
+ Capture<Set<StackServiceRequest>> stackServiceRequestCapture = EasyMock.newCapture();
StackServiceResponse stackServiceResponse = createNiceMock(StackServiceResponse.class);
- Capture<Set<StackServiceComponentRequest>> stackComponentRequestCapture = new Capture<Set<StackServiceComponentRequest>>();
+ Capture<Set<StackServiceComponentRequest>> stackComponentRequestCapture = EasyMock.newCapture();
StackServiceComponentResponse stackComponentResponse = createNiceMock(StackServiceComponentResponse.class);
- Capture<Set<StackConfigurationRequest>> stackConfigurationRequestCapture = new Capture<Set<StackConfigurationRequest>>();
- Capture<Set<StackLevelConfigurationRequest>> stackLevelConfigurationRequestCapture = new Capture<Set<StackLevelConfigurationRequest>>();
+ Capture<Set<StackConfigurationRequest>> stackConfigurationRequestCapture = EasyMock.newCapture();
+ Capture<Set<StackLevelConfigurationRequest>> stackLevelConfigurationRequestCapture = EasyMock.newCapture();
StackConfigurationResponse stackConfigurationResponse = EasyMock.createNiceMock(StackConfigurationResponse.class);
expect(controller.getStackServices(capture(stackServiceRequestCapture))).
@@ -163,12 +162,12 @@ public class StackTest {
public void testGetRequiredProperties_serviceAndPropertyType() throws Exception {
AmbariManagementController controller = createNiceMock(AmbariManagementController.class);
AmbariMetaInfo metaInfo = createNiceMock(AmbariMetaInfo.class);
- Capture<Set<StackServiceRequest>> stackServiceRequestCapture = new Capture<Set<StackServiceRequest>>();
+ Capture<Set<StackServiceRequest>> stackServiceRequestCapture = EasyMock.newCapture();
StackServiceResponse stackServiceResponse = createNiceMock(StackServiceResponse.class);
- Capture<Set<StackServiceComponentRequest>> stackComponentRequestCapture = new Capture<Set<StackServiceComponentRequest>>();
+ Capture<Set<StackServiceComponentRequest>> stackComponentRequestCapture = EasyMock.newCapture();
StackServiceComponentResponse stackComponentResponse = createNiceMock(StackServiceComponentResponse.class);
- Capture<Set<StackConfigurationRequest>> stackConfigurationRequestCapture = new Capture<Set<StackConfigurationRequest>>();
- Capture<Set<StackLevelConfigurationRequest>> stackLevelConfigurationRequestCapture = new Capture<Set<StackLevelConfigurationRequest>>();
+ Capture<Set<StackConfigurationRequest>> stackConfigurationRequestCapture = EasyMock.newCapture();
+ Capture<Set<StackLevelConfigurationRequest>> stackLevelConfigurationRequestCapture = EasyMock.newCapture();
StackConfigurationResponse stackConfigurationResponse = EasyMock.createNiceMock(StackConfigurationResponse.class);
StackConfigurationResponse stackConfigurationResponse2 = EasyMock.createNiceMock(StackConfigurationResponse.class);
@@ -263,14 +262,14 @@ public class StackTest {
expect(controller.getAmbariMetaInfo()).andReturn(metaInfo).anyTimes();
- expect(controller.getStackServices(anyObject(Set.class))).andReturn(Collections.singleton(stackServiceResponse)).anyTimes();
+ expect(controller.getStackServices(EasyMock.<Set<StackServiceRequest>>anyObject())).andReturn(Collections.singleton(stackServiceResponse)).anyTimes();
expect(stackServiceResponse.getServiceName()).andReturn(testServiceName).anyTimes();
expect(stackServiceResponse.getExcludedConfigTypes()).andReturn(Collections.<String>emptySet());
// stack components
expect(stackComponentResponse.getComponentName()).andReturn("component1").anyTimes();
expect(stackComponentResponse.getComponentCategory()).andReturn(testSiteConfigFile).anyTimes();
- expect(controller.getStackComponents(anyObject(Set.class))).andReturn(Collections.singleton(stackComponentResponse)).anyTimes();
+ expect(controller.getStackComponents(EasyMock.<Set<StackServiceComponentRequest>>anyObject())).andReturn(Collections.singleton(stackComponentResponse)).anyTimes();
// stack configurations
@@ -289,13 +288,13 @@ public class StackTest {
expect(stackConfigurationResponse2.getPropertyAttributes()).andReturn(Collections.<String, String>emptyMap()).anyTimes();
expect(stackConfigurationResponse2.isRequired()).andReturn(true).anyTimes();
- expect(controller.getStackConfigurations(anyObject(Set.class))).andReturn(Sets.newHashSet(stackConfigurationResponse1, stackConfigurationResponse2)).anyTimes();
+ expect(controller.getStackConfigurations(EasyMock.<Set<StackConfigurationRequest>>anyObject())).andReturn(Sets.newHashSet(stackConfigurationResponse1, stackConfigurationResponse2)).anyTimes();
// empty stack service config type
expect(stackServiceResponse.getConfigTypes()).andReturn(Collections.singletonMap(testEmptyConfigType, Collections.<String, Map<String,String>>emptyMap()));
// no stack level configs for this test
- expect(controller.getStackLevelConfigurations(anyObject(Set.class))).andReturn(Collections.<StackConfigurationResponse>emptySet()).anyTimes();
+ expect(controller.getStackLevelConfigurations(EasyMock.<Set<StackLevelConfigurationRequest>>anyObject())).andReturn(Collections.<StackConfigurationResponse>emptySet()).anyTimes();
expect(metaInfo.getComponentDependencies("test", "1.0", "service1", "component1")).andReturn(Collections.<DependencyInfo>emptyList()).anyTimes();
@@ -332,7 +331,7 @@ public class StackTest {
expect(controller.getAmbariMetaInfo()).andReturn(metaInfo).anyTimes();
- expect(controller.getStackServices(anyObject(Set.class))).andReturn(Collections.singleton(stackServiceResponse)).anyTimes();
+ expect(controller.getStackServices(EasyMock.<Set<StackServiceRequest>>anyObject())).andReturn(Collections.singleton(stackServiceResponse)).anyTimes();
expect(stackServiceResponse.getServiceName()).andReturn(testServiceName).anyTimes();
// Config type test-site is excluded for the service service1
@@ -341,7 +340,7 @@ public class StackTest {
// stack components
expect(stackComponentResponse.getComponentName()).andReturn("component1").anyTimes();
expect(stackComponentResponse.getComponentCategory()).andReturn(testSiteConfigFile).anyTimes();
- expect(controller.getStackComponents(anyObject(Set.class))).andReturn(Collections.singleton(stackComponentResponse)).anyTimes();
+ expect(controller.getStackComponents(EasyMock.<Set<StackServiceComponentRequest>>anyObject())).andReturn(Collections.singleton(stackComponentResponse)).anyTimes();
expect(stackConfigurationResponse1.getPropertyName()).andReturn("prop1").anyTimes();
expect(stackConfigurationResponse1.getPropertyValue()).andReturn(null).anyTimes();
@@ -350,13 +349,13 @@ public class StackTest {
expect(stackConfigurationResponse1.getPropertyAttributes()).andReturn(Collections.<String, String>emptyMap()).anyTimes();
expect(stackConfigurationResponse1.isRequired()).andReturn(true).anyTimes();
- expect(controller.getStackConfigurations(anyObject(Set.class))).andReturn(Collections.singleton(stackConfigurationResponse1)).anyTimes();
+ expect(controller.getStackConfigurations(EasyMock.<Set<StackConfigurationRequest>>anyObject())).andReturn(Collections.singleton(stackConfigurationResponse1)).anyTimes();
// empty stack service config type
expect(stackServiceResponse.getConfigTypes()).andReturn(Collections.singletonMap(testEmptyConfigType, Collections.<String, Map<String, String>>emptyMap()));
// no stack level configs for this test
- expect(controller.getStackLevelConfigurations(anyObject(Set.class))).andReturn(Collections.<StackConfigurationResponse>emptySet()).anyTimes();
+ expect(controller.getStackLevelConfigurations(EasyMock.<Set<StackLevelConfigurationRequest>>anyObject())).andReturn(Collections.<StackConfigurationResponse>emptySet()).anyTimes();
expect(metaInfo.getComponentDependencies("test", "1.0", "service1", "component1")).andReturn(Collections.<DependencyInfo>emptyList()).anyTimes();
replay(controller, stackServiceResponse, stackComponentResponse, stackConfigurationResponse1, metaInfo);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
index e23ba62..1861c0e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/UpgradeResourceProviderTest.java
@@ -719,7 +719,7 @@ public class UpgradeResourceProviderTest {
Gson gson = new Gson();
for (StageEntity se : stages) {
- Map<String, String> map = gson.fromJson(se.getCommandParamsStage(), Map.class);
+ Map<String, String> map = gson.<Map<String, String>>fromJson(se.getCommandParamsStage(), Map.class);
assertTrue(map.containsKey("upgrade_direction"));
assertEquals("downgrade", map.get("upgrade_direction"));
}
@@ -1169,7 +1169,7 @@ public class UpgradeResourceProviderTest {
configHelper.getDefaultProperties(EasyMock.eq(stack220), EasyMock.anyObject(Cluster.class), EasyMock.anyBoolean())).andReturn(
stack220Configs).anyTimes();
- Capture<Map<String, Map<String, String>>> expectedConfigurationsCapture = new Capture<Map<String, Map<String, String>>>();
+ Capture<Map<String, Map<String, String>>> expectedConfigurationsCapture = EasyMock.newCapture();
configHelper.createConfigTypes(EasyMock.anyObject(Cluster.class),
EasyMock.anyObject(AmbariManagementController.class),
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java
index b954c7c..330d567 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewInstanceResourceProviderTest.java
@@ -54,6 +54,7 @@ import org.apache.ambari.server.view.ViewRegistry;
import org.apache.ambari.server.view.configuration.ViewConfig;
import org.apache.ambari.view.ViewDefinition;
import org.easymock.Capture;
+import org.easymock.EasyMock;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
@@ -173,12 +174,12 @@ public class ViewInstanceResourceProviderTest {
expect(viewregistry.getDefinition("V1", "1.0.0")).andReturn(viewEntity).anyTimes();
expect(viewregistry.getDefinition("V1", null)).andReturn(viewEntity).anyTimes();
- Capture<Map<String, String>> captureProperties = new Capture<Map<String, String>>();
+ Capture<Map<String, String>> captureProperties = EasyMock.newCapture();
viewregistry.setViewInstanceProperties(eq(viewInstanceEntity), capture(captureProperties),
anyObject(ViewConfig.class), anyObject(ClassLoader.class));
- Capture<ViewInstanceEntity> instanceEntityCapture = new Capture<ViewInstanceEntity>();
+ Capture<ViewInstanceEntity> instanceEntityCapture = EasyMock.newCapture();
viewregistry.installViewInstance(capture(instanceEntityCapture));
expectLastCall().anyTimes();
@@ -362,4 +363,4 @@ public class ViewInstanceResourceProviderTest {
verify(viewregistry);
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewURLResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewURLResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewURLResourceProviderTest.java
index 6c589b5..6080080 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewURLResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ViewURLResourceProviderTest.java
@@ -245,7 +245,7 @@ public class ViewURLResourceProviderTest {
ViewURLResourceProvider provider = new ViewURLResourceProvider();
ViewURLEntity viewURLEntity = createNiceMock(ViewURLEntity.class);
ViewURLDAO viewURLDAO = createNiceMock(ViewURLDAO.class);
- EqualsPredicate equalsPredicate = new EqualsPredicate(ViewURLResourceProvider.URL_NAME_PROPERTY_ID,"test");
+ EqualsPredicate<String> equalsPredicate = new EqualsPredicate<>(ViewURLResourceProvider.URL_NAME_PROPERTY_ID,"test");
setDao(ViewURLResourceProvider.class.getDeclaredField("viewURLDAO"), viewURLDAO);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProviderTest.java
index 33603d7..eb04935 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetLayoutResourceProviderTest.java
@@ -158,7 +158,7 @@ public class WidgetLayoutResourceProviderTest {
expect(clusters.getCluster((String) anyObject())).andReturn(cluster).atLeastOnce();
expect(cluster.getClusterId()).andReturn(Long.valueOf(1)).anyTimes();
- Capture<WidgetLayoutEntity> entityCapture = new Capture<WidgetLayoutEntity>();
+ Capture<WidgetLayoutEntity> entityCapture = EasyMock.newCapture();
dao.create(capture(entityCapture));
expectLastCall();
@@ -178,7 +178,7 @@ public class WidgetLayoutResourceProviderTest {
requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_SECTION_NAME_PROPERTY_ID, "section_name");
requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_USERNAME_PROPERTY_ID, "admin");
requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_SCOPE_PROPERTY_ID, "CLUSTER");
- Set widgetsInfo = new LinkedHashSet();
+ Set<Map<String, String>> widgetsInfo = new LinkedHashSet<>();
Map<String, String> widget = new HashMap<String, String>();
widget.put("id","1");
widgetsInfo.add(widget);
@@ -218,7 +218,7 @@ public class WidgetLayoutResourceProviderTest {
expect(clusters.getCluster((String) anyObject())).andReturn(cluster).atLeastOnce();
expect(cluster.getClusterId()).andReturn(Long.valueOf(1)).atLeastOnce();
- Capture<WidgetLayoutEntity> entityCapture = new Capture<WidgetLayoutEntity>();
+ Capture<WidgetLayoutEntity> entityCapture = EasyMock.newCapture();
dao.create(capture(entityCapture));
expectLastCall();
@@ -239,7 +239,7 @@ public class WidgetLayoutResourceProviderTest {
requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_SECTION_NAME_PROPERTY_ID, "section_name");
requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_USERNAME_PROPERTY_ID, "admin");
requestProps.put(WidgetLayoutResourceProvider.WIDGETLAYOUT_SCOPE_PROPERTY_ID, "CLUSTER");
- Set widgetsInfo = new LinkedHashSet();
+ Set<Map<String, String>> widgetsInfo = new LinkedHashSet<>();
Map<String, String> widget = new HashMap<String, String>();
widget.put("id","1");
widgetsInfo.add(widget);
@@ -304,7 +304,7 @@ public class WidgetLayoutResourceProviderTest {
expect(clusters.getCluster((String) anyObject())).andReturn(cluster).atLeastOnce();
expect(cluster.getClusterId()).andReturn(Long.valueOf(1)).anyTimes();
- Capture<WidgetLayoutEntity> entityCapture = new Capture<WidgetLayoutEntity>();
+ Capture<WidgetLayoutEntity> entityCapture = EasyMock.newCapture();
dao.create(capture(entityCapture));
expectLastCall();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetResourceProviderTest.java
index 3ff7da7..a4f6469 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/WidgetResourceProviderTest.java
@@ -222,7 +222,7 @@ public class WidgetResourceProviderTest {
expect(clusters.getCluster((String) anyObject())).andReturn(cluster).atLeastOnce();
expect(cluster.getClusterId()).andReturn(Long.valueOf(1)).anyTimes();
- Capture<WidgetEntity> entityCapture = new Capture<WidgetEntity>();
+ Capture<WidgetEntity> entityCapture = EasyMock.newCapture();
dao.create(capture(entityCapture));
expectLastCall();
@@ -236,8 +236,8 @@ public class WidgetResourceProviderTest {
requestProps.put(WidgetResourceProvider.WIDGET_WIDGET_TYPE_PROPERTY_ID, "GAUGE");
requestProps.put(WidgetResourceProvider.WIDGET_AUTHOR_PROPERTY_ID, "admin");
requestProps.put(WidgetResourceProvider.WIDGET_SCOPE_PROPERTY_ID, "USER");
- Set testSet = new LinkedHashSet();
- HashMap testMap = new HashMap();
+ Set<Map<String, String>> testSet = new LinkedHashSet<>();
+ Map<String, String> testMap = new HashMap<>();
testMap.put("name","value");
testMap.put("name2","value2");
testSet.add(testMap);
@@ -279,7 +279,7 @@ public class WidgetResourceProviderTest {
expect(clusters.getCluster((String) anyObject())).andReturn(cluster).atLeastOnce();
expect(cluster.getClusterId()).andReturn(Long.valueOf(1)).atLeastOnce();
- Capture<WidgetEntity> entityCapture = new Capture<WidgetEntity>();
+ Capture<WidgetEntity> entityCapture = EasyMock.newCapture();
dao.create(capture(entityCapture));
expectLastCall();
@@ -291,8 +291,8 @@ public class WidgetResourceProviderTest {
requestProps.put(WidgetResourceProvider.WIDGET_WIDGET_TYPE_PROPERTY_ID, "GAUGE");
requestProps.put(WidgetResourceProvider.WIDGET_AUTHOR_PROPERTY_ID, "admin");
requestProps.put(WidgetResourceProvider.WIDGET_SCOPE_PROPERTY_ID, "USER");
- Set testSet = new LinkedHashSet();
- HashMap testMap = new HashMap();
+ Set<Map<String, String>> testSet = new LinkedHashSet<>();
+ Map<String, String> testMap = new HashMap<>();
testMap.put("name","value");
testMap.put("name2","value2");
testSet.add(testMap);
@@ -336,8 +336,8 @@ public class WidgetResourceProviderTest {
requestProps.put(WidgetResourceProvider.WIDGET_WIDGET_TYPE_PROPERTY_ID, "GAUGE");
requestProps.put(WidgetResourceProvider.WIDGET_AUTHOR_PROPERTY_ID, "admin");
requestProps.put(WidgetResourceProvider.WIDGET_SCOPE_PROPERTY_ID, "USER");
- testSet = new LinkedHashSet();
- testMap = new HashMap();
+ testSet = new LinkedHashSet<>();
+ testMap = new HashMap<>();
testMap.put("name","new_value");
testMap.put("new_name","new_value2");
testSet.add(testMap);
@@ -374,7 +374,7 @@ public class WidgetResourceProviderTest {
expect(clusters.getCluster((String) anyObject())).andReturn(cluster).atLeastOnce();
expect(cluster.getClusterId()).andReturn(Long.valueOf(1)).anyTimes();
- Capture<WidgetEntity> entityCapture = new Capture<WidgetEntity>();
+ Capture<WidgetEntity> entityCapture = EasyMock.newCapture();
dao.create(capture(entityCapture));
expectLastCall();
@@ -388,8 +388,8 @@ public class WidgetResourceProviderTest {
requestProps.put(WidgetResourceProvider.WIDGET_WIDGET_TYPE_PROPERTY_ID, "GAUGE");
requestProps.put(WidgetResourceProvider.WIDGET_AUTHOR_PROPERTY_ID, "admin");
requestProps.put(WidgetResourceProvider.WIDGET_SCOPE_PROPERTY_ID, "USER");
- Set testSet = new LinkedHashSet();
- HashMap testMap = new HashMap();
+ Set<Map<String, String>> testSet = new LinkedHashSet<>();
+ Map<String, String> testMap = new HashMap<>();
testMap.put("name","value");
testMap.put("name2","value2");
testSet.add(testMap);
@@ -439,7 +439,7 @@ public class WidgetResourceProviderTest {
WidgetResourceProvider widgetResourceProvider = PowerMock.createPartialMock(WidgetResourceProvider.class, "isScopeAllowedForUser");
PowerMock.expectPrivate(widgetResourceProvider, "isScopeAllowedForUser", "CLUSTER").andReturn(false);
- Capture<WidgetEntity> entityCapture = new Capture<WidgetEntity>();
+ Capture<WidgetEntity> entityCapture = EasyMock.newCapture();
dao.create(capture(entityCapture));
expectLastCall();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogSearchDataRetrievalServiceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogSearchDataRetrievalServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogSearchDataRetrievalServiceTest.java
index 59aa9c8..1b365e5 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogSearchDataRetrievalServiceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LogSearchDataRetrievalServiceTest.java
@@ -313,7 +313,7 @@ public class LogSearchDataRetrievalServiceTest {
expect(helperFactoryMock.getHelper(controllerMock, expectedClusterName)).andReturn(helperMock);
// return null to simulate an error occurring during the LogSearch data request
- expect(helperMock.sendGetLogFileNamesRequest(expectedComponentName, expectedHostName)).andReturn(Collections.EMPTY_SET);
+ expect(helperMock.sendGetLogFileNamesRequest(expectedComponentName, expectedHostName)).andReturn(Collections.<String>emptySet());
// expect that the completed request is removed from the current request set,
// even in the event of a failure to obtain the LogSearch data
expect(currentRequestsMock.remove(expectedComponentAndHostName)).andReturn(true).once();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImplTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImplTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImplTest.java
index 654c02d..cb65780 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImplTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/LoggingRequestHelperImplTest.java
@@ -38,6 +38,7 @@ import org.apache.ambari.server.state.Cluster;
import org.apache.ambari.server.state.Config;
import org.apache.commons.codec.binary.Base64;
import org.easymock.Capture;
+import org.easymock.EasyMock;
import org.easymock.EasyMockSupport;
import org.junit.Test;
@@ -149,8 +150,8 @@ public class LoggingRequestHelperImplTest {
testConfigProperties.put("logsearch_admin_password", EXPECTED_ADMIN_PASSWORD);
testConfigProperties = Collections.unmodifiableMap(testConfigProperties);
- Capture<HttpURLConnection> captureURLConnection = new Capture<HttpURLConnection>();
- Capture<HttpURLConnection> captureURLConnectionForAuthentication = new Capture<HttpURLConnection>();
+ Capture<HttpURLConnection> captureURLConnection = EasyMock.newCapture();
+ Capture<HttpURLConnection> captureURLConnectionForAuthentication = EasyMock.newCapture();
expect(clusterMock.getDesiredConfigByType("logsearch-admin-json")).andReturn(adminPropertiesConfigMock).atLeastOnce();
expect(adminPropertiesConfigMock.getProperties()).andReturn(testConfigProperties).atLeastOnce();
@@ -328,8 +329,8 @@ public class LoggingRequestHelperImplTest {
testConfigProperties.put("logsearch_admin_password", "admin-pwd");
testConfigProperties = Collections.unmodifiableMap(testConfigProperties);
- Capture<HttpURLConnection> captureURLConnection = new Capture<HttpURLConnection>();
- Capture<HttpURLConnection> captureURLConnectionForAuthentication = new Capture<HttpURLConnection>();
+ Capture<HttpURLConnection> captureURLConnection = EasyMock.newCapture();
+ Capture<HttpURLConnection> captureURLConnectionForAuthentication = EasyMock.newCapture();
expect(clusterMock.getDesiredConfigByType("logsearch-admin-json")).andReturn(adminPropertiesConfigMock).atLeastOnce();
expect(adminPropertiesConfigMock.getProperties()).andReturn(testConfigProperties).atLeastOnce();
@@ -421,8 +422,8 @@ public class LoggingRequestHelperImplTest {
testConfigProperties.put("logsearch_admin_password", "admin-pwd");
testConfigProperties = Collections.unmodifiableMap(testConfigProperties);
- Capture<HttpURLConnection> captureURLConnection = new Capture<HttpURLConnection>();
- Capture<HttpURLConnection> captureURLConnectionForAuthentication = new Capture<HttpURLConnection>();
+ Capture<HttpURLConnection> captureURLConnection = EasyMock.newCapture();
+ Capture<HttpURLConnection> captureURLConnectionForAuthentication = EasyMock.newCapture();
expect(clusterMock.getDesiredConfigByType("logsearch-admin-json")).andReturn(adminPropertiesConfigMock).atLeastOnce();
expect(adminPropertiesConfigMock.getProperties()).andReturn(testConfigProperties).atLeastOnce();
@@ -584,8 +585,8 @@ public class LoggingRequestHelperImplTest {
Config adminPropertiesConfigMock =
mockSupport.createMock(Config.class);
- Capture<HttpURLConnection> captureURLConnection = new Capture<HttpURLConnection>();
- Capture<HttpURLConnection> captureURLConnectionForAuthentication = new Capture<HttpURLConnection>();
+ Capture<HttpURLConnection> captureURLConnection = EasyMock.newCapture();
+ Capture<HttpURLConnection> captureURLConnectionForAuthentication = EasyMock.newCapture();
expect(clusterMock.getDesiredConfigByType("logsearch-admin-json")).andReturn(adminPropertiesConfigMock).atLeastOnce();
expect(clusterMock.getClusterName()).andReturn(expectedClusterName).atLeastOnce();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/UtilsTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/UtilsTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/UtilsTest.java
index 60f4725..1507e8b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/UtilsTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/logging/UtilsTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertSame;
import java.util.concurrent.atomic.AtomicInteger;
import org.easymock.Capture;
+import org.easymock.EasyMock;
import org.easymock.EasyMockSupport;
import org.junit.Test;
import org.slf4j.Logger;
@@ -148,7 +149,7 @@ public class UtilsTest {
AtomicInteger testAtomicInteger = new AtomicInteger(0);
- Capture<Exception> exceptionCaptureOne = new Capture<Exception>();
+ Capture<Exception> exceptionCaptureOne = EasyMock.newCapture();
// expect that the the call to the logger is only
// executed once in this test
@@ -180,8 +181,8 @@ public class UtilsTest {
AtomicInteger testAtomicInteger = new AtomicInteger(0);
- Capture<Exception> exceptionCaptureOne = new Capture<Exception>();
- Capture<Exception> exceptionCaptureTwo = new Capture<Exception>();
+ Capture<Exception> exceptionCaptureOne = EasyMock.newCapture();
+ Capture<Exception> exceptionCaptureTwo = EasyMock.newCapture();
// expect that the the call to the logger is only
// executed twice in this test
@@ -215,7 +216,7 @@ public class UtilsTest {
AtomicInteger testAtomicInteger = new AtomicInteger(0);
- Capture<Exception> exceptionCaptureOne = new Capture<Exception>();
+ Capture<Exception> exceptionCaptureOne = EasyMock.newCapture();
// expect that the the call to the logger is only
// executed once in this test
@@ -247,8 +248,8 @@ public class UtilsTest {
AtomicInteger testAtomicInteger = new AtomicInteger(0);
- Capture<Exception> exceptionCaptureOne = new Capture<Exception>();
- Capture<Exception> exceptionCaptureTwo = new Capture<Exception>();
+ Capture<Exception> exceptionCaptureOne = EasyMock.newCapture();
+ Capture<Exception> exceptionCaptureTwo = EasyMock.newCapture();
// expect that the the call to the logger is only
// executed twice in this test
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/MetricsRequestHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/MetricsRequestHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/MetricsRequestHelperTest.java
index 653cae1..5d55e41 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/MetricsRequestHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/metrics/timeline/MetricsRequestHelperTest.java
@@ -24,6 +24,7 @@ import static org.easymock.EasyMock.replay;
import java.io.InputStream;
import java.net.HttpURLConnection;
+import java.util.List;
import java.util.Map;
import java.util.TreeMap;
@@ -72,7 +73,7 @@ public class MetricsRequestHelperTest {
URLStreamProvider urlStreamProviderMock = createMock(URLStreamProvider.class);
expect(urlStreamProviderMock.processURL(EasyMock.isA(String.class), EasyMock.isA(String.class),
- isNull(String.class), EasyMock.isA(Map.class))).andReturn(httpURLConnectionMock).once();
+ isNull(String.class), EasyMock.<Map<String, List<String>>>anyObject())).andReturn(httpURLConnectionMock).once();
replay(httpURLConnectionMock, urlStreamProviderMock);
@@ -103,7 +104,7 @@ public class MetricsRequestHelperTest {
urlStreamProviderMock = createMock(URLStreamProvider.class);
expect(urlStreamProviderMock.processURL(EasyMock.isA(String.class), EasyMock.isA(String.class),
- isNull(String.class), EasyMock.isA(Map.class))).andReturn(httpURLConnectionMock).times(2);
+ isNull(String.class), EasyMock.<Map<String, List<String>>>anyObject())).andReturn(httpURLConnectionMock).times(2);
replay(httpURLConnectionMock, urlStreamProviderMock);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/hooks/users/UserHookServiceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/hooks/users/UserHookServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/hooks/users/UserHookServiceTest.java
index 293b22a..834f930 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/hooks/users/UserHookServiceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/hooks/users/UserHookServiceTest.java
@@ -207,7 +207,7 @@ public class UserHookServiceTest extends EasyMockSupport {
// TBD refine expectations to validate the logic / eg capture arguments
stageMock.addServerActionCommand(EasyMock.anyString(), EasyMock.anyString(), EasyMock.anyObject(Role.class), EasyMock.anyObject(RoleCommand.class), EasyMock.anyString(), EasyMock.anyObject(ServiceComponentHostServerActionEvent.class),
- EasyMock.anyObject(Map.class), EasyMock.anyString(), EasyMock.anyObject(Map.class), EasyMock.anyInt(), EasyMock.anyBoolean(), EasyMock.anyBoolean());
+ EasyMock.<Map<String, String>>anyObject(), EasyMock.anyString(), EasyMock.<Map<String, Map<String, String>>>anyObject(), EasyMock.anyInt(), EasyMock.anyBoolean(), EasyMock.anyBoolean());
EasyMock.expect(requestFactoryMock.createNewFromStages(Arrays.asList(stageMock))).andReturn(null);
EasyMock.expect(stageFactoryMock.createNew(1, "/var/lib/ambari-server/tmp:1", "test-cluster", 1, "Post user creation hook for [ 1 ] users", "{}", "{}", "{}")).andReturn(stageMock);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcherTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcherTest.java b/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcherTest.java
index 1caa0bf..6cf4990 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcherTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/AmbariSNMPDispatcherTest.java
@@ -35,7 +35,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import org.apache.ambari.server.notifications.DispatchCallback;
@@ -75,7 +74,7 @@ public class AmbariSNMPDispatcherTest {
AmbariSNMPDispatcher dispatcher = new AmbariSNMPDispatcher(DEFAULT_SNMP_PORT);
Notification notification = mock(AlertNotification.class);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
dispatcher.dispatch(notification);
verify(notification.Callback).onFailure(notification.CallbackIds);
verify(notification.Callback, never()).onSuccess(notification.CallbackIds);
@@ -87,7 +86,7 @@ public class AmbariSNMPDispatcherTest {
AmbariSNMPDispatcher.SnmpVersion snmpVersion = AmbariSNMPDispatcher.SnmpVersion.SNMPv1;
Notification notification = mock(AlertNotification.class);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
Map<String, String> properties = new HashMap<String, String>();
properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "3");
properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "4");
@@ -106,7 +105,7 @@ public class AmbariSNMPDispatcherTest {
AmbariSNMPDispatcher dispatcher = new AmbariSNMPDispatcher(DEFAULT_SNMP_PORT);
Notification notification = mock(AlertNotification.class);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
notification.DispatchProperties = new HashMap<String, String>();
dispatcher.dispatch(notification);
verify(notification.Callback).onFailure(notification.CallbackIds);
@@ -118,7 +117,7 @@ public class AmbariSNMPDispatcherTest {
AmbariSNMPDispatcher dispatcher = new AmbariSNMPDispatcher(DEFAULT_SNMP_PORT);
Notification notification = getAlertNotification(true);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
Map<String, String> properties = new HashMap<String, String>();
properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "3");
properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "4");
@@ -134,7 +133,7 @@ public class AmbariSNMPDispatcherTest {
AmbariSNMPDispatcher dispatcher = new AmbariSNMPDispatcher(DEFAULT_SNMP_PORT);
Notification notification = getAlertNotification(true);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
Map<String, String> properties = new HashMap<String, String>();
properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "3");
properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "4");
@@ -151,7 +150,7 @@ public class AmbariSNMPDispatcherTest {
AmbariSNMPDispatcher dispatcher = spy(new AmbariSNMPDispatcher(DEFAULT_SNMP_PORT));
Notification notification = mock(AlertNotification.class);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
Map<String, String> properties = new HashMap<String, String>();
properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "3");
properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "4");
@@ -169,7 +168,7 @@ public class AmbariSNMPDispatcherTest {
AmbariSNMPDispatcher dispatcher = spy(new AmbariSNMPDispatcher(DEFAULT_SNMP_PORT));
Notification notification = mock(AlertNotification.class);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
Map<String, String> properties = new HashMap<String, String>();
properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "3");
properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "4");
@@ -187,7 +186,7 @@ public class AmbariSNMPDispatcherTest {
AmbariSNMPDispatcher.SnmpVersion snmpVersion = AmbariSNMPDispatcher.SnmpVersion.SNMPv1;
Notification notification = mock(AlertNotification.class);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
Map<String, String> properties = new HashMap<String, String>();
properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "3");
properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "4");
@@ -206,7 +205,7 @@ public class AmbariSNMPDispatcherTest {
AmbariSNMPDispatcher.SnmpVersion snmpVersion = AmbariSNMPDispatcher.SnmpVersion.SNMPv2c;
Notification notification = mock(AlertNotification.class);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
Map<String, String> properties = new HashMap<String, String>();
properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "3");
properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "4");
@@ -224,7 +223,7 @@ public class AmbariSNMPDispatcherTest {
AmbariSNMPDispatcher dispatcher = new AmbariSNMPDispatcher(DEFAULT_SNMP_PORT);
Notification notification = getAlertNotification(true);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
Map<String, String> properties = new HashMap<String, String>();
properties.put(AmbariSNMPDispatcher.PORT_PROPERTY, "162");
properties.put(AmbariSNMPDispatcher.COMMUNITY_PROPERTY, "public");
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/SNMPDispatcherTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/SNMPDispatcherTest.java b/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/SNMPDispatcherTest.java
index c06472f..22d677c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/SNMPDispatcherTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/notifications/dispatchers/SNMPDispatcherTest.java
@@ -34,7 +34,6 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
-import java.util.List;
import java.util.Map;
import org.apache.ambari.server.notifications.DispatchCallback;
@@ -59,7 +58,7 @@ public class SNMPDispatcherTest {
SNMPDispatcher dispatcher = new SNMPDispatcher(DEFAULT_SNMP_PORT);
Notification notification = mock(Notification.class);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
dispatcher.dispatch(notification);
verify(notification.Callback).onFailure(notification.CallbackIds);
verify(notification.Callback, never()).onSuccess(notification.CallbackIds);
@@ -71,7 +70,7 @@ public class SNMPDispatcherTest {
SNMPDispatcher.SnmpVersion snmpVersion = SNMPDispatcher.SnmpVersion.SNMPv1;
Notification notification = mock(Notification.class);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
Map<String, String> properties = new HashMap<String, String>();
properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1");
properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2");
@@ -95,7 +94,7 @@ public class SNMPDispatcherTest {
SNMPDispatcher dispatcher = new SNMPDispatcher(DEFAULT_SNMP_PORT);
Notification notification = mock(Notification.class);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
notification.DispatchProperties = new HashMap<String, String>();
dispatcher.dispatch(notification);
verify(notification.Callback).onFailure(notification.CallbackIds);
@@ -107,7 +106,7 @@ public class SNMPDispatcherTest {
SNMPDispatcher dispatcher = new SNMPDispatcher(DEFAULT_SNMP_PORT);
Notification notification = mock(Notification.class);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
Map<String, String> properties = new HashMap<String, String>();
properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1");
properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2");
@@ -128,7 +127,7 @@ public class SNMPDispatcherTest {
SNMPDispatcher dispatcher = new SNMPDispatcher(DEFAULT_SNMP_PORT);
Notification notification = mock(Notification.class);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
Map<String, String> properties = new HashMap<String, String>();
properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1");
properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2");
@@ -150,7 +149,7 @@ public class SNMPDispatcherTest {
SNMPDispatcher dispatcher = spy(new SNMPDispatcher(DEFAULT_SNMP_PORT));
Notification notification = mock(Notification.class);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
Map<String, String> properties = new HashMap<String, String>();
properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1");
properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2");
@@ -173,7 +172,7 @@ public class SNMPDispatcherTest {
SNMPDispatcher dispatcher = spy(new SNMPDispatcher(DEFAULT_SNMP_PORT));
Notification notification = mock(Notification.class);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
Map<String, String> properties = new HashMap<String, String>();
properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1");
properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2");
@@ -196,7 +195,7 @@ public class SNMPDispatcherTest {
SNMPDispatcher.SnmpVersion snmpVersion = SNMPDispatcher.SnmpVersion.SNMPv1;
Notification notification = mock(Notification.class);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
Map<String, String> properties = new HashMap<String, String>();
properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1");
properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2");
@@ -220,7 +219,7 @@ public class SNMPDispatcherTest {
SNMPDispatcher.SnmpVersion snmpVersion = SNMPDispatcher.SnmpVersion.SNMPv2c;
Notification notification = mock(Notification.class);
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
Map<String, String> properties = new HashMap<String, String>();
properties.put(SNMPDispatcher.SUBJECT_OID_PROPERTY, "1");
properties.put(SNMPDispatcher.BODY_OID_PROPERTY, "2");
@@ -243,7 +242,7 @@ public class SNMPDispatcherTest {
SNMPDispatcher dispatcher = new SNMPDispatcher(DEFAULT_SNMP_PORT);
Notification notification = new Notification();
notification.Callback = mock(DispatchCallback.class);
- notification.CallbackIds = mock(List.class);
+ notification.CallbackIds = new ArrayList<>();
notification.Body = "body";
notification.Subject = "subject";
Map<String, String> properties = new HashMap<String, String>();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptorTest.java
index d0f9513..3f5286d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/orm/AmbariJpaLocalTxnInterceptorTest.java
@@ -39,7 +39,7 @@ public class AmbariJpaLocalTxnInterceptorTest extends EasyMockSupport {
EntityTransaction transaction = createStrictMock(EntityTransaction.class);
expect(transaction.getRollbackOnly()).andReturn(false);
- expect(transactional.rollbackOn()).andReturn(new Class[0]);
+ expect(transactional.rollbackOn()).andReturn(asArray());
replayAll();
@@ -55,7 +55,7 @@ public class AmbariJpaLocalTxnInterceptorTest extends EasyMockSupport {
EntityTransaction transaction = createStrictMock(EntityTransaction.class);
expect(transaction.getRollbackOnly()).andReturn(false);
- expect(transactional.rollbackOn()).andReturn(new Class[] { IllegalArgumentException.class });
+ expect(transactional.rollbackOn()).andReturn(asArray(IllegalArgumentException.class));
replayAll();
@@ -71,10 +71,8 @@ public class AmbariJpaLocalTxnInterceptorTest extends EasyMockSupport {
EntityTransaction transaction = createStrictMock(EntityTransaction.class);
expect(transaction.getRollbackOnly()).andReturn(false);
- expect(transactional.rollbackOn()).andReturn(new Class[] {
- NullPointerException.class, IllegalArgumentException.class
- });
- expect(transactional.ignore()).andReturn(new Class[0]);
+ expect(transactional.rollbackOn()).andReturn(asArray(NullPointerException.class, IllegalArgumentException.class));
+ expect(transactional.ignore()).andReturn(asArray());
transaction.rollback();
replayAll();
@@ -91,8 +89,8 @@ public class AmbariJpaLocalTxnInterceptorTest extends EasyMockSupport {
EntityTransaction transaction = createStrictMock(EntityTransaction.class);
expect(transaction.getRollbackOnly()).andReturn(false);
- expect(transactional.rollbackOn()).andReturn(new Class[] { RuntimeException.class });
- expect(transactional.ignore()).andReturn(new Class[0]);
+ expect(transactional.rollbackOn()).andReturn(asArray(RuntimeException.class));
+ expect(transactional.ignore()).andReturn(asArray());
transaction.rollback();
replayAll();
@@ -109,8 +107,8 @@ public class AmbariJpaLocalTxnInterceptorTest extends EasyMockSupport {
EntityTransaction transaction = createStrictMock(EntityTransaction.class);
expect(transaction.getRollbackOnly()).andReturn(false);
- expect(transactional.rollbackOn()).andReturn(new Class[] { IllegalArgumentException.class });
- expect(transactional.ignore()).andReturn(new Class[] { NumberFormatException.class });
+ expect(transactional.rollbackOn()).andReturn(asArray(IllegalArgumentException.class));
+ expect(transactional.ignore()).andReturn(asArray(NumberFormatException.class));
replayAll();
@@ -126,8 +124,8 @@ public class AmbariJpaLocalTxnInterceptorTest extends EasyMockSupport {
EntityTransaction transaction = createStrictMock(EntityTransaction.class);
expect(transaction.getRollbackOnly()).andReturn(false);
- expect(transactional.rollbackOn()).andReturn(new Class[] { Exception.class });
- expect(transactional.ignore()).andReturn(new Class[] { IOException.class });
+ expect(transactional.rollbackOn()).andReturn(asArray(Exception.class));
+ expect(transactional.ignore()).andReturn(asArray(IOException.class));
replayAll();
@@ -153,4 +151,9 @@ public class AmbariJpaLocalTxnInterceptorTest extends EasyMockSupport {
verifyAll();
}
+ @SafeVarargs
+ private static Class<? extends Exception>[] asArray(Class<? extends Exception>... exceptions) {
+ return exceptions;
+ }
+
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edce0b11/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java
index c77f28d..aa6ab1c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/scheduler/ExecutionScheduleManagerTest.java
@@ -464,7 +464,7 @@ public class ExecutionScheduleManagerTest {
long requestId = 5L;
String clusterName = "mycluster";
String apiUri = "api/v1/clusters/mycluster/requests/5";
- Capture<String> uriCapture = new Capture<String>();
+ Capture<String> uriCapture = EasyMock.newCapture();
BatchRequestResponse batchRequestResponse = new BatchRequestResponse();
batchRequestResponse.setStatus(HostRoleStatus.IN_PROGRESS.toString());
@@ -618,10 +618,10 @@ public class ExecutionScheduleManagerTest {
expect(jobDataMap.getWrappedMap()).andReturn(new HashMap<String,Object>());
expect(scheduleManagerMock.continueOnMisfire(context)).andReturn(true);
- executionJob.doWork((Map<String, Object>) anyObject());
+ executionJob.doWork(EasyMock.<Map<String, Object>>anyObject());
expectLastCall().andThrow(new AmbariException("Test Exception")).anyTimes();
- executionJob.finalizeExecution((Map<String, Object>) anyObject());
+ executionJob.finalizeExecution(EasyMock.<Map<String, Object>>anyObject());
expectLastCall().once();
replay(scheduleManagerMock, executionJob, context, jobDataMap, jobDetail);