You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ad...@apache.org on 2017/03/29 12:43:13 UTC
[17/32] ambari git commit: AMBARI-19149. Code cleanup: redundant type
arguments
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
index 718c7ce..2b5d2f3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
@@ -196,7 +196,7 @@ public class TestActionScheduler {
Host host = mock(Host.class);
HashMap<String, ServiceComponentHost> hosts =
- new HashMap<String, ServiceComponentHost>();
+ new HashMap<>();
hosts.put(hostname, sch);
HostEntity hostEntity = new HostEntity();
hostEntity.setHostName(hostname);
@@ -210,7 +210,7 @@ public class TestActionScheduler {
ActionDBAccessor db = mock(ActionDBAccessorImpl.class);
HostRoleCommandDAO hostRoleCommandDAOMock = mock(HostRoleCommandDAO.class);
Mockito.doNothing().when(hostRoleCommandDAOMock).publishTaskCreateEvent(anyListOf(HostRoleCommand.class));
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
Stage s = StageUtils.getATestStage(1, 977, hostname, CLUSTER_HOST_INFO,
"{\"host_param\":\"param_value\"}", "{\"stage_param\":\"param_value\"}");
stages.add(s);
@@ -295,7 +295,7 @@ public class TestActionScheduler {
when(serviceObj.getCluster()).thenReturn(oneClusterMock);
Host host = mock(Host.class);
HashMap<String, ServiceComponentHost> hosts =
- new HashMap<String, ServiceComponentHost>();
+ new HashMap<>();
hosts.put(hostname, sch);
when(scomp.getServiceComponentHosts()).thenReturn(hosts);
@@ -307,7 +307,7 @@ public class TestActionScheduler {
hostEntity.setHostName(hostname);
hostDAO.create(hostEntity);
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
final Stage s = StageUtils.getATestStage(1, 977, hostname, CLUSTER_HOST_INFO,
"{\"host_param\":\"param_value\"}", "{\"stage_param\":\"param_value\"}");
s.addHostRoleExecutionCommand(hostname, Role.SECONDARY_NAMENODE, RoleCommand.INSTALL,
@@ -389,7 +389,7 @@ public class TestActionScheduler {
when(serviceObj.getCluster()).thenReturn(oneClusterMock);
Host host = mock(Host.class);
HashMap<String, ServiceComponentHost> hosts =
- new HashMap<String, ServiceComponentHost>();
+ new HashMap<>();
hosts.put(hostname, sch);
when(scomp.getServiceComponentHosts()).thenReturn(hosts);
@@ -397,7 +397,7 @@ public class TestActionScheduler {
when(host.getState()).thenReturn(HostState.HEARTBEAT_LOST);
when(host.getHostName()).thenReturn(hostname);
- final List<Stage> stages = new ArrayList<Stage>();
+ final List<Stage> stages = new ArrayList<>();
final Stage s = StageUtils.getATestStage(1, 977, hostname, CLUSTER_HOST_INFO,
"{\"host_param\":\"param_value\"}", "{\"stage_param\":\"param_value\"}");
stages.add(s);
@@ -464,7 +464,7 @@ public class TestActionScheduler {
hostDAO.merge(hostEntity2);
HashMap<String, ServiceComponentHost> hosts =
- new HashMap<String, ServiceComponentHost>();
+ new HashMap<>();
hosts.put(hostname1, sch1);
hosts.put(hostname2, sch2);
when(scomp.getServiceComponentHosts()).thenReturn(hosts);
@@ -484,7 +484,7 @@ public class TestActionScheduler {
when(serviceObj.getServiceComponent(anyString())).thenReturn(scomp);
when(serviceObj.getCluster()).thenReturn(oneClusterMock);
- final List<Stage> stages = new ArrayList<Stage>();
+ final List<Stage> stages = new ArrayList<>();
final Stage stage = stageFactory.createNew(1, "/tmp", "cluster1", 1L, "stageWith2Tasks",
CLUSTER_HOST_INFO, "{\"command_param\":\"param_value\"}", "{\"host_param\":\"param_value\"}");
addInstallTaskToStage(stage, hostname1, "cluster1", Role.DATANODE,
@@ -606,8 +606,8 @@ public class TestActionScheduler {
Clusters fsm = mock(Clusters.class);
UnitOfWork unitOfWork = mock(UnitOfWork.class);
- List<Stage> stages = new ArrayList<Stage>();
- Map<String, String> payload = new HashMap<String, String>();
+ List<Stage> stages = new ArrayList<>();
+ Map<String, String> payload = new HashMap<>();
final Stage s = getStageWithServerAction(1, 977, payload, "test", 1200, false, false);
stages.add(s);
@@ -704,13 +704,13 @@ public class TestActionScheduler {
String hostname1 = "ahost.ambari.apache.org";
String hostname2 = "bhost.ambari.apache.org";
HashMap<String, ServiceComponentHost> hosts =
- new HashMap<String, ServiceComponentHost>();
+ new HashMap<>();
hosts.put(hostname1, sch);
hosts.put(hostname2, sch);
hosts.put(Stage.INTERNAL_HOSTNAME, sch);
when(scomp.getServiceComponentHosts()).thenReturn(hosts);
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
Stage stage01 = createStage(clusterName, 0, 1);
addTask(stage01, Stage.INTERNAL_HOSTNAME, clusterName, Role.AMBARI_SERVER_ACTION, RoleCommand.ACTIONEXECUTE, "AMBARI", 1);
@@ -766,8 +766,8 @@ public class TestActionScheduler {
Clusters fsm = mock(Clusters.class);
UnitOfWork unitOfWork = mock(UnitOfWork.class);
- List<Stage> stages = new ArrayList<Stage>();
- Map<String, String> payload = new HashMap<String, String>();
+ List<Stage> stages = new ArrayList<>();
+ Map<String, String> payload = new HashMap<>();
payload.put(MockServerAction.PAYLOAD_FORCE_FAIL, "timeout");
final Stage s = getStageWithServerAction(1, 977, payload, "test", 2, false, false);
stages.add(s);
@@ -946,7 +946,7 @@ public class TestActionScheduler {
s.getExecutionCommands(null).get(0).getExecutionCommand().setRoleCommand(roleCommand);
aq.enqueue(Stage.INTERNAL_HOSTNAME, s.getExecutionCommands(null).get(0).getExecutionCommand());
- List<ExecutionCommand> commandsToSchedule = new ArrayList<ExecutionCommand>();
+ List<ExecutionCommand> commandsToSchedule = new ArrayList<>();
Multimap<String, AgentCommand> commandsToEnqueue = ArrayListMultimap.create();
boolean taskShouldBeSkipped = stageSupportsAutoSkip && autoSkipFailedTask;
@@ -981,8 +981,8 @@ public class TestActionScheduler {
Clusters fsm = mock(Clusters.class);
UnitOfWork unitOfWork = mock(UnitOfWork.class);
- List<Stage> stages = new ArrayList<Stage>();
- Map<String, String> payload = new HashMap<String, String>();
+ List<Stage> stages = new ArrayList<>();
+ Map<String, String> payload = new HashMap<>();
payload.put(MockServerAction.PAYLOAD_FORCE_FAIL, "exception");
final Stage s = getStageWithServerAction(1, 977, payload, "test", 300, false, false);
stages.add(s);
@@ -1105,14 +1105,14 @@ public class TestActionScheduler {
String hostname3 = "chost.ambari.apache.org";
String hostname4 = "chost.ambari.apache.org";
HashMap<String, ServiceComponentHost> hosts =
- new HashMap<String, ServiceComponentHost>();
+ new HashMap<>();
hosts.put(hostname1, sch);
hosts.put(hostname2, sch);
hosts.put(hostname3, sch);
hosts.put(hostname4, sch);
when(scomp.getServiceComponentHosts()).thenReturn(hosts);
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
stages.add(
getStageWithSingleTask(
hostname1, "cluster1", Role.DATANODE,
@@ -1189,22 +1189,22 @@ public class TestActionScheduler {
String hostname3 = "chost.ambari.apache.org";
String hostname4 = "chost.ambari.apache.org";
HashMap<String, ServiceComponentHost> hosts =
- new HashMap<String, ServiceComponentHost>();
+ new HashMap<>();
hosts.put(hostname1, sch);
hosts.put(hostname2, sch);
hosts.put(hostname3, sch);
hosts.put(hostname4, sch);
when(scomp.getServiceComponentHosts()).thenReturn(hosts);
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
Stage stage = getStageWithSingleTask(
hostname1, "cluster1", Role.HIVE_CLIENT,
RoleCommand.INSTALL, Service.Type.HIVE, 1, 1, 1);
- Map<String, String> hiveSite = new TreeMap<String, String>();
+ Map<String, String> hiveSite = new TreeMap<>();
hiveSite.put("javax.jdo.option.ConnectionPassword", "password");
hiveSite.put("hive.server2.thrift.port", "10000");
Map<String, Map<String, String>> configurations =
- new TreeMap<String, Map<String, String>>();
+ new TreeMap<>();
configurations.put("hive-site", hiveSite);
stage.getExecutionCommands(hostname1).get(0).getExecutionCommand().setConfigurations(configurations);
stages.add(stage);
@@ -1282,12 +1282,12 @@ public class TestActionScheduler {
String hostname1 = "ahost.ambari.apache.org";
String hostname2 = "bhost.ambari.apache.org";
HashMap<String, ServiceComponentHost> hosts =
- new HashMap<String, ServiceComponentHost>();
+ new HashMap<>();
hosts.put(hostname1, sch);
hosts.put(hostname2, sch);
when(scomp.getServiceComponentHosts()).thenReturn(hosts);
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
Stage backgroundStage = null;
stages.add(//stage with background command
backgroundStage = getStageWithSingleTask(
@@ -1352,11 +1352,11 @@ public class TestActionScheduler {
when(serviceObj.getCluster()).thenReturn(oneClusterMock);
HashMap<String, ServiceComponentHost> hosts =
- new HashMap<String, ServiceComponentHost>();
+ new HashMap<>();
hosts.put(hostname, sch);
when(scomp.getServiceComponentHosts()).thenReturn(hosts);
- final List<Stage> stages = new ArrayList<Stage>();
+ final List<Stage> stages = new ArrayList<>();
stages.add(
getStageWithSingleTask(
hostname, "cluster1", Role.NAMENODE, RoleCommand.UPGRADE, Service.Type.HDFS, 1, 1, 1));
@@ -1465,7 +1465,7 @@ public class TestActionScheduler {
scheduler.doWork();
- List<CommandReport> reports = new ArrayList<CommandReport>();
+ List<CommandReport> reports = new ArrayList<>();
reports.add(getCommandReport(HostRoleStatus.FAILED, Role.NAMENODE, Service.Type.HDFS, "1-1", 1));
am.processTaskResponse(hostname, reports, CommandUtils.convertToTaskIdCommandMap(stages.get(0).getOrderedHostRoleCommands()));
@@ -1501,7 +1501,7 @@ public class TestActionScheduler {
String host2 = "host2";
Host host = mock(Host.class);
HashMap<String, ServiceComponentHost> hosts =
- new HashMap<String, ServiceComponentHost>();
+ new HashMap<>();
hosts.put(host1, sch);
hosts.put(host2, sch);
when(scomp.getServiceComponentHosts()).thenReturn(hosts);
@@ -1517,7 +1517,7 @@ public class TestActionScheduler {
hostDAO.create(hostEntity1);
hostDAO.create(hostEntity2);
- final List<Stage> stages = new ArrayList<Stage>();
+ final List<Stage> stages = new ArrayList<>();
long now = System.currentTimeMillis();
Stage stage = stageFactory.createNew(1, "/tmp", "cluster1", 1L,
@@ -1717,7 +1717,7 @@ public class TestActionScheduler {
when(scomp.getServiceComponentHost(anyString())).thenReturn(sch);
when(serviceObj.getCluster()).thenReturn(oneClusterMock);
- final List<Stage> stages = new ArrayList<Stage>();
+ final List<Stage> stages = new ArrayList<>();
long now = System.currentTimeMillis();
Stage stage = stageFactory.createNew(1, "/tmp", "cluster1", 1L, "testRequestFailureBasedOnSuccessFactor",
@@ -1838,7 +1838,7 @@ public class TestActionScheduler {
scheduler.doWork();
- List<CommandReport> reports = new ArrayList<CommandReport>();
+ List<CommandReport> reports = new ArrayList<>();
reports.add(getCommandReport(HostRoleStatus.FAILED, Role.DATANODE, Service.Type.HDFS, "1-1", 1));
am.processTaskResponse("host1", reports, CommandUtils.convertToTaskIdCommandMap(stage.getOrderedHostRoleCommands()));
@@ -1991,7 +1991,7 @@ public class TestActionScheduler {
when(serviceObj.getCluster()).thenReturn(oneClusterMock);
Host host = mock(Host.class);
HashMap<String, ServiceComponentHost> hosts =
- new HashMap<String, ServiceComponentHost>();
+ new HashMap<>();
hosts.put(hostname, sch);
when(scomp.getServiceComponentHosts()).thenReturn(hosts);
@@ -2063,7 +2063,7 @@ public class TestActionScheduler {
when(host1.getHostName()).thenReturn(hostname1);
when(scomp.getServiceComponentHost(hostname1)).thenReturn(sch1);
HashMap<String, ServiceComponentHost> hosts =
- new HashMap<String, ServiceComponentHost>();
+ new HashMap<>();
hosts.put(hostname1, sch1);
when(scomp.getServiceComponentHosts()).thenReturn(hosts);
@@ -2083,7 +2083,7 @@ public class TestActionScheduler {
"dummyService", "dummyComponent", "dummyHostname"));
when(serviceObj.getCluster()).thenReturn(oneClusterMock);
- final List<Stage> stages = new ArrayList<Stage>();
+ final List<Stage> stages = new ArrayList<>();
Stage stage1 = stageFactory.createNew(1, "/tmp", "cluster1", 1L, "stageWith2Tasks",
CLUSTER_HOST_INFO, "", "");
addInstallTaskToStage(stage1, hostname1, "cluster1", Role.HBASE_MASTER,
@@ -2155,8 +2155,8 @@ public class TestActionScheduler {
Clusters fsm = mock(Clusters.class);
UnitOfWork unitOfWork = mock(UnitOfWork.class);
- List<Stage> stages = new ArrayList<Stage>();
- Map<String, String> payload = new HashMap<String, String>();
+ List<Stage> stages = new ArrayList<>();
+ Map<String, String> payload = new HashMap<>();
final Stage s = getStageWithServerAction(1, 977, payload, "test", 300, false, false);
stages.add(s);
@@ -2250,15 +2250,15 @@ public class TestActionScheduler {
hostEntity.setHostName(hostname);
hostDAO.create(hostEntity);
- HashMap<String, ServiceComponentHost> hosts = new HashMap<String, ServiceComponentHost>();
+ HashMap<String, ServiceComponentHost> hosts = new HashMap<>();
hosts.put(hostname, sch);
when(scomp.getServiceComponentHosts()).thenReturn(hosts);
// Create a single request with 3 stages, each with a single task - the first stage will be completed and should not
// be included when cancelling the unfinished tasks of the request
long requestId = 1;
- final List<Stage> allStages = new ArrayList<Stage>();
- final List<Stage> stagesInProgress = new ArrayList<Stage>();
+ final List<Stage> allStages = new ArrayList<>();
+ final List<Stage> stagesInProgress = new ArrayList<>();
final List<HostRoleCommand> tasksInProgress = new ArrayList<>();
final List<HostRoleCommandEntity> hrcEntitiesInProgress = new ArrayList<>();
@@ -2323,7 +2323,7 @@ public class TestActionScheduler {
when(db.getStagesInProgressForRequest(requestId)).thenReturn(stagesInProgress);
when(db.getAllStages(anyLong())).thenReturn(allStages);
- List<HostRoleCommand> requestTasks = new ArrayList<HostRoleCommand>();
+ List<HostRoleCommand> requestTasks = new ArrayList<>();
for (Stage stage : allStages) {
requestTasks.addAll(stage.getOrderedHostRoleCommands());
@@ -2444,7 +2444,7 @@ public class TestActionScheduler {
when(serviceObj.getCluster()).thenReturn(oneClusterMock);
HashMap<String, ServiceComponentHost> hosts =
- new HashMap<String, ServiceComponentHost>();
+ new HashMap<>();
String hostname1 = "hostname1";
String hostname2 = "hostname2";
String hostname3 = "hostname3";
@@ -2458,7 +2458,7 @@ public class TestActionScheduler {
long requestId2 = 2;
long requestId3 = 3;
- final List<Stage> stagesInProgress = new ArrayList<Stage>();
+ final List<Stage> stagesInProgress = new ArrayList<>();
int namenodeCmdTaskId = 1;
stagesInProgress.add(
getStageWithSingleTask(
@@ -2500,7 +2500,7 @@ public class TestActionScheduler {
when(db.getCommandsInProgressCount()).thenReturn(stagesInProgress.size());
when(db.getStagesInProgress()).thenReturn(stagesInProgress);
- List<HostRoleCommand> requestTasks = new ArrayList<HostRoleCommand>();
+ List<HostRoleCommand> requestTasks = new ArrayList<>();
for (Stage stage : stagesInProgress) {
requestTasks.addAll(stage.getOrderedHostRoleCommands());
}
@@ -2547,7 +2547,7 @@ public class TestActionScheduler {
}
});
- final Map<Long, Boolean> startedRequests = new HashMap<Long, Boolean>();
+ final Map<Long, Boolean> startedRequests = new HashMap<>();
doAnswer(new Answer<Void>() {
@Override
public Void answer(InvocationOnMock invocation) throws Throwable {
@@ -2705,7 +2705,7 @@ public class TestActionScheduler {
String hostname1 = "ahost.ambari.apache.org";
- HashMap<String, ServiceComponentHost> hosts = new HashMap<String, ServiceComponentHost>();
+ HashMap<String, ServiceComponentHost> hosts = new HashMap<>();
hosts.put(hostname1, sch);
@@ -2714,7 +2714,7 @@ public class TestActionScheduler {
// create 1 stage with 2 commands and then another stage with 1 command
Stage stage = null;
Stage stage2 = null;
- final List<Stage> stages = new ArrayList<Stage>();
+ final List<Stage> stages = new ArrayList<>();
stages.add(stage = getStageWithSingleTask(hostname1, "cluster1", Role.NAMENODE,
RoleCommand.STOP, Service.Type.HDFS, 1, 1, 1));
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionSchedulerThreading.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionSchedulerThreading.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionSchedulerThreading.java
index 217f95e..bc24246 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionSchedulerThreading.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionSchedulerThreading.java
@@ -102,8 +102,8 @@ public class TestActionSchedulerThreading {
// make sure the stacks are different
Assert.assertFalse(stackId.equals(newStackId));
- Map<String, String> properties = new HashMap<String, String>();
- Map<String, Map<String, String>> propertiesAttributes = new HashMap<String, Map<String, String>>();
+ Map<String, String> properties = new HashMap<>();
+ Map<String, Map<String, String>> propertiesAttributes = new HashMap<>();
ConfigFactory configFactory = injector.getInstance(ConfigFactory.class);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestStage.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestStage.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestStage.java
index c388d08..b76e41e 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestStage.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestStage.java
@@ -66,7 +66,7 @@ public class TestStage {
s.addHostRoleExecutionCommand("h1", Role.HBASE_MASTER, RoleCommand.INSTALL,
null, "c1", "HBASE", false, false);
for (ExecutionCommandWrapper wrapper : s.getExecutionCommands("h1")) {
- Map<String, String> commandParams = new TreeMap<String, String>();
+ Map<String, String> commandParams = new TreeMap<>();
commandParams.put(ExecutionCommand.KeyNames.COMMAND_TIMEOUT, "600");
wrapper.getExecutionCommand().setCommandParams(commandParams);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatProcessorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatProcessorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatProcessorTest.java
index 4a888f0..cff0e34 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatProcessorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatProcessorTest.java
@@ -181,7 +181,7 @@ public class HeartbeatProcessorTest {
hb.setNodeStatus(new HostStatus(HostStatus.Status.HEALTHY, DummyHostStatus));
hb.setHostname(DummyHostname1);
- List<CommandReport> reports = new ArrayList<CommandReport>();
+ List<CommandReport> reports = new ArrayList<>();
CommandReport cr = new CommandReport();
cr.setActionId(StageUtils.getActionId(requestId, stageId));
cr.setServiceName(HDFS);
@@ -246,7 +246,7 @@ public class HeartbeatProcessorTest {
hb.setHostname(DummyHostname1);
- List<CommandReport> reports = new ArrayList<CommandReport>();
+ List<CommandReport> reports = new ArrayList<>();
CommandReport cr = new CommandReport();
cr.setActionId(StageUtils.getActionId(requestId, stageId));
cr.setServiceName(HDFS);
@@ -315,7 +315,7 @@ public class HeartbeatProcessorTest {
hb.setNodeStatus(new HostStatus(HostStatus.Status.HEALTHY, DummyHostStatus));
hb.setHostname(DummyHostname1);
- List<CommandReport> reports = new ArrayList<CommandReport>();
+ List<CommandReport> reports = new ArrayList<>();
CommandReport cr = new CommandReport();
cr.setActionId(StageUtils.getActionId(requestId, stageId));
cr.setServiceName(HDFS);
@@ -401,7 +401,7 @@ public class HeartbeatProcessorTest {
hb.setNodeStatus(new HostStatus(HostStatus.Status.HEALTHY, DummyHostStatus));
hb.setHostname(DummyHostname1);
- List<CommandReport> reports = new ArrayList<CommandReport>();
+ List<CommandReport> reports = new ArrayList<>();
CommandReport cr = new CommandReport();
cr.setActionId(StageUtils.getActionId(requestId, stageId));
cr.setServiceName(HDFS);
@@ -489,7 +489,7 @@ public class HeartbeatProcessorTest {
hb.setHostname(DummyHostname1);
hb.setNodeStatus(new HostStatus(HostStatus.Status.HEALTHY, DummyHostStatus));
hb.setReports(new ArrayList<CommandReport>());
- ArrayList<ComponentStatus> componentStatuses = new ArrayList<ComponentStatus>();
+ ArrayList<ComponentStatus> componentStatuses = new ArrayList<>();
ComponentStatus componentStatus1 = new ComponentStatus();
componentStatus1.setClusterName(DummyCluster);
componentStatus1.setServiceName(HDFS);
@@ -550,7 +550,7 @@ public class HeartbeatProcessorTest {
Assert.assertEquals(stageId, stage.getStageId());
stage.setHostRoleStatus(DummyHostname1, HBASE_MASTER, HostRoleStatus.QUEUED);
db.hostRoleScheduled(stage, DummyHostname1, HBASE_MASTER);
- List<CommandReport> reports = new ArrayList<CommandReport>();
+ List<CommandReport> reports = new ArrayList<>();
CommandReport cr = new CommandReport();
cr.setActionId(StageUtils.getActionId(requestId, stageId));
cr.setTaskId(1);
@@ -606,7 +606,7 @@ public class HeartbeatProcessorTest {
hb.setHostname(DummyHostname1);
hb.setNodeStatus(new HostStatus(HostStatus.Status.HEALTHY, DummyHostStatus));
- List<CommandReport> reports = new ArrayList<CommandReport>();
+ List<CommandReport> reports = new ArrayList<>();
CommandReport cr = new CommandReport();
cr.setActionId(StageUtils.getActionId(requestId, stageId));
cr.setTaskId(1);
@@ -725,7 +725,7 @@ public class HeartbeatProcessorTest {
hb.setHostname(DummyHostname1);
hb.setNodeStatus(new HostStatus(HostStatus.Status.HEALTHY, DummyHostStatus));
- List<CommandReport> reports = new ArrayList<CommandReport>();
+ List<CommandReport> reports = new ArrayList<>();
CommandReport cr = new CommandReport();
cr.setActionId(StageUtils.getActionId(requestId, stageId));
cr.setTaskId(1);
@@ -817,21 +817,21 @@ public class HeartbeatProcessorTest {
hb.setNodeStatus(new HostStatus(HostStatus.Status.HEALTHY, DummyHostStatus));
hb.setReports(new ArrayList<CommandReport>());
- List<Map<String, String>> procs = new ArrayList<Map<String, String>>();
- Map<String, String> proc1info = new HashMap<String, String>();
+ List<Map<String, String>> procs = new ArrayList<>();
+ Map<String, String> proc1info = new HashMap<>();
proc1info.put("name", "a");
proc1info.put("status", "RUNNING");
procs.add(proc1info);
- Map<String, String> proc2info = new HashMap<String, String>();
+ Map<String, String> proc2info = new HashMap<>();
proc2info.put("name", "b");
proc2info.put("status", "NOT_RUNNING");
procs.add(proc2info);
- Map<String, Object> extra = new HashMap<String, Object>();
+ Map<String, Object> extra = new HashMap<>();
extra.put("processes", procs);
- ArrayList<ComponentStatus> componentStatuses = new ArrayList<ComponentStatus>();
+ ArrayList<ComponentStatus> componentStatuses = new ArrayList<>();
ComponentStatus componentStatus1 = new ComponentStatus();
componentStatus1.setClusterName(DummyCluster);
componentStatus1.setServiceName(HDFS);
@@ -935,7 +935,7 @@ public class HeartbeatProcessorTest {
cr2.setStdOut("dummy output");
cr2.setExitCode(0);
cr2.setRoleCommand(RoleCommand.UPGRADE.toString());
- ArrayList<CommandReport> reports = new ArrayList<CommandReport>();
+ ArrayList<CommandReport> reports = new ArrayList<>();
reports.add(cr1);
reports.add(cr2);
hb.setReports(reports);
@@ -1002,7 +1002,7 @@ public class HeartbeatProcessorTest {
new ServiceComponentHostInstallEvent(Role.NAMENODE.toString(),
DummyHostname1, System.currentTimeMillis(), "HDP-1.3.0"),
DummyCluster, "HDFS", false, false);
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
stages.add(s);
Request request = new Request(stages, clusters);
actionDBAccessor.persistActions(request);
@@ -1050,7 +1050,7 @@ public class HeartbeatProcessorTest {
cr2.setStdErr("none");
cr2.setStdOut("dummy output");
cr2.setExitCode(0);
- ArrayList<CommandReport> reports = new ArrayList<CommandReport>();
+ ArrayList<CommandReport> reports = new ArrayList<>();
reports.add(cr1);
reports.add(cr2);
hb.setReports(reports);
@@ -1139,7 +1139,7 @@ public class HeartbeatProcessorTest {
cr2.setStdErr("none");
cr2.setStdOut("dummy output");
cr2.setExitCode(777);
- ArrayList<CommandReport> reports = new ArrayList<CommandReport>();
+ ArrayList<CommandReport> reports = new ArrayList<>();
reports.add(cr1);
reports.add(cr2);
hb.setReports(reports);
@@ -1321,7 +1321,7 @@ public class HeartbeatProcessorTest {
hb.setHostname(DummyHostname1);
hb.setNodeStatus(new HostStatus(HostStatus.Status.HEALTHY, DummyHostStatus));
hb.setReports(new ArrayList<CommandReport>());
- ArrayList<ComponentStatus> componentStatuses = new ArrayList<ComponentStatus>();
+ ArrayList<ComponentStatus> componentStatuses = new ArrayList<>();
ComponentStatus componentStatus1 = new ComponentStatus();
componentStatus1.setClusterName(DummyCluster);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatTestHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatTestHelper.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatTestHelper.java
index 32715de..2e65e8d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatTestHelper.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/HeartbeatTestHelper.java
@@ -200,11 +200,11 @@ public class HeartbeatTestHelper {
cluster.createClusterVersion(stackId, stackId.getStackVersion(), "admin",
RepositoryVersionState.INSTALLING);
- Map<String, String> hostAttributes = new HashMap<String, String>();
+ Map<String, String> hostAttributes = new HashMap<>();
hostAttributes.put("os_family", "redhat");
hostAttributes.put("os_release_version", "6.3");
- List<HostEntity> hostEntities = new ArrayList<HostEntity>();
+ List<HostEntity> hostEntities = new ArrayList<>();
for(String hostName : hostNames) {
clusters.addHost(hostName);
Host host = clusters.getHost(hostName);
@@ -230,7 +230,7 @@ public class HeartbeatTestHelper {
RoleCommand.START,
new ServiceComponentHostStartEvent(Role.HBASE_MASTER.toString(),
DummyHostname1, System.currentTimeMillis()), DummyCluster, HBASE, false, false);
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
stages.add(s);
Request request = new Request(stages, clusters);
db.persistActions(request);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/agent/TestActionQueue.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestActionQueue.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestActionQueue.java
index 9851664..700c472 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestActionQueue.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestActionQueue.java
@@ -110,7 +110,7 @@ public class TestActionQueue {
}
private void updateHostList() throws InterruptedException {
- HashSet<String> hostsWithTasks = new HashSet<String>();
+ HashSet<String> hostsWithTasks = new HashSet<>();
while (shouldRun) {
for (String host: hosts) {
hostsWithTasks.add(host);
@@ -176,8 +176,8 @@ public class TestActionQueue {
ActionQueueOperation[] dequeOperators = new ActionQueueOperation[threadCount];
ActionQueueOperation[] dequeAllOperators = new ActionQueueOperation[threadCount];
- List<Thread> producers = new ArrayList<Thread>();
- List<Thread> consumers = new ArrayList<Thread>();
+ List<Thread> producers = new ArrayList<>();
+ List<Thread> consumers = new ArrayList<>();
for (int i = 0; i < threadCount; i++) {
dequeOperators[i] = new ActionQueueOperation(aq, hosts,
@@ -262,8 +262,8 @@ public class TestActionQueue {
ActionQueueOperation[] hostCheckers = new ActionQueueOperation[threadCount];
ActionQueueOperation[] hostUpdaters = new ActionQueueOperation[threadCount];
- List<Thread> producers = new ArrayList<Thread>();
- List<Thread> consumers = new ArrayList<Thread>();
+ List<Thread> producers = new ArrayList<>();
+ List<Thread> consumers = new ArrayList<>();
for (int i = 0; i < threadCount; i++) {
hostCheckers[i] = new ActionQueueOperation(aq, hosts,
@@ -310,7 +310,7 @@ public class TestActionQueue {
}
LOG.info("Report: totalChecks: " + totalChecks + ", totalUpdates: " + totalUpdates);
- HashSet<String> hostsWithPendingtasks = new HashSet<String>();
+ HashSet<String> hostsWithPendingtasks = new HashSet<>();
aq.updateListOfHostsWithPendingTask(hostsWithPendingtasks);
hostsWithPendingtasks.add("h1");
aq.updateListOfHostsWithPendingTask(hostsWithPendingtasks);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
index ba03ae1..80775c3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatHandler.java
@@ -211,7 +211,7 @@ public class TestHeartbeatHandler {
HeartBeat hb = new HeartBeat();
hb.setResponseId(0);
HostStatus hs = new HostStatus(Status.HEALTHY, DummyHostStatus);
- List<Alert> al = new ArrayList<Alert>();
+ List<Alert> al = new ArrayList<>();
al.add(new Alert());
hb.setNodeStatus(hs);
hb.setHostname(hostname);
@@ -244,7 +244,7 @@ public class TestHeartbeatHandler {
hb.setHostname(DummyHostname1);
hb.setNodeStatus(new HostStatus(Status.HEALTHY, DummyHostStatus));
hb.setReports(new ArrayList<CommandReport>());
- ArrayList<ComponentStatus> componentStatuses = new ArrayList<ComponentStatus>();
+ ArrayList<ComponentStatus> componentStatuses = new ArrayList<>();
hb.setComponentStatus(componentStatuses);
final HostRoleCommand command = hostRoleCommandFactory.create(DummyHostname1,
@@ -309,7 +309,7 @@ public class TestHeartbeatHandler {
hb.setHostname(DummyHostname1);
hb.setNodeStatus(new HostStatus(Status.HEALTHY, DummyHostStatus));
hb.setReports(new ArrayList<CommandReport>());
- ArrayList<ComponentStatus> componentStatuses = new ArrayList<ComponentStatus>();
+ ArrayList<ComponentStatus> componentStatuses = new ArrayList<>();
ComponentStatus componentStatus1 = new ComponentStatus();
componentStatus1.setClusterName(DummyCluster);
@@ -757,7 +757,7 @@ public class TestHeartbeatHandler {
@Test
public void testStateCommandsAtRegistration() throws Exception, InvalidStateTransitionException {
- List<StatusCommand> dummyCmds = new ArrayList<StatusCommand>();
+ List<StatusCommand> dummyCmds = new ArrayList<>();
StatusCommand statusCmd1 = new StatusCommand();
statusCmd1.setClusterName(DummyCluster);
statusCmd1.setServiceName(HDFS);
@@ -814,7 +814,7 @@ public class TestHeartbeatHandler {
hb.setHostname(DummyHostname1);
hb.setNodeStatus(new HostStatus(Status.HEALTHY, DummyHostStatus));
- List<CommandReport> reports = new ArrayList<CommandReport>();
+ List<CommandReport> reports = new ArrayList<>();
CommandReport cr = new CommandReport();
cr.setActionId(StageUtils.getActionId(requestId, stageId));
cr.setTaskId(1);
@@ -872,7 +872,7 @@ public class TestHeartbeatHandler {
new ServiceComponentHostInstallEvent(Role.DATANODE.toString(),
DummyHostname1, System.currentTimeMillis(), "HDP-1.3.0"),
DummyCluster, "HDFS", false, false);
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
stages.add(s);
Request request = new Request(stages, clusters);
actionDBAccessor.persistActions(request);
@@ -884,7 +884,7 @@ public class TestHeartbeatHandler {
hb.setHostname(DummyHostname1);
hb.setNodeStatus(new HostStatus(Status.HEALTHY, DummyHostStatus));
- List<CommandReport> reports = new ArrayList<CommandReport>();
+ List<CommandReport> reports = new ArrayList<>();
CommandReport cr = new CommandReport();
cr.setActionId(StageUtils.getActionId(1, 1));
cr.setTaskId(1);
@@ -959,7 +959,7 @@ public class TestHeartbeatHandler {
hb.setAgentEnv(new AgentEnv());
hb.setMounts(new ArrayList<DiskInfo>());
- ArrayList<ComponentStatus> componentStatuses = new ArrayList<ComponentStatus>();
+ ArrayList<ComponentStatus> componentStatuses = new ArrayList<>();
ComponentStatus componentStatus1 = createComponentStatus(DummyCluster, HDFS, DummyHostStatus, State.STARTED,
SecurityState.UNSECURED, DATANODE, "{\"stackName\":\"HDP\",\"stackVersion\":\"1.3.0\"}");
ComponentStatus componentStatus2 =
@@ -1041,7 +1041,7 @@ public class TestHeartbeatHandler {
hb1.setHostname(DummyHostname1);
RecoveryReport rr = new RecoveryReport();
rr.setSummary("RECOVERABLE");
- List<ComponentRecoveryReport> compRecReports = new ArrayList<ComponentRecoveryReport>();
+ List<ComponentRecoveryReport> compRecReports = new ArrayList<>();
ComponentRecoveryReport compRecReport = new ComponentRecoveryReport();
compRecReport.setLimitReached(Boolean.FALSE);
compRecReport.setName("DATANODE");
@@ -1060,7 +1060,7 @@ public class TestHeartbeatHandler {
hb2.setHostname(DummyHostname1);
rr = new RecoveryReport();
rr.setSummary("UNRECOVERABLE");
- compRecReports = new ArrayList<ComponentRecoveryReport>();
+ compRecReports = new ArrayList<>();
compRecReport = new ComponentRecoveryReport();
compRecReport.setLimitReached(Boolean.TRUE);
compRecReport.setName("DATANODE");
@@ -1122,7 +1122,7 @@ public class TestHeartbeatHandler {
hb1.setResponseId(0);
hb1.setNodeStatus(new HostStatus(Status.HEALTHY, DummyHostStatus));
hb1.setHostname(DummyHostname1);
- List<ComponentStatus> componentStatus = new ArrayList<ComponentStatus>();
+ List<ComponentStatus> componentStatus = new ArrayList<>();
ComponentStatus dataNodeStatus = new ComponentStatus();
dataNodeStatus.setClusterName(cluster.getClusterName());
dataNodeStatus.setServiceName(HDFS);
@@ -1147,7 +1147,7 @@ public class TestHeartbeatHandler {
hb2.setResponseId(1);
hb2.setNodeStatus(new HostStatus(Status.HEALTHY, DummyHostStatus));
hb2.setHostname(DummyHostname1);
- componentStatus = new ArrayList<ComponentStatus>();
+ componentStatus = new ArrayList<>();
dataNodeStatus = new ComponentStatus();
dataNodeStatus.setClusterName(cluster.getClusterName());
dataNodeStatus.setServiceName(HDFS);
@@ -1174,7 +1174,7 @@ public class TestHeartbeatHandler {
hb2a.setResponseId(2);
hb2a.setNodeStatus(new HostStatus(Status.HEALTHY, DummyHostStatus));
hb2a.setHostname(DummyHostname1);
- componentStatus = new ArrayList<ComponentStatus>();
+ componentStatus = new ArrayList<>();
dataNodeStatus = new ComponentStatus();
dataNodeStatus.setClusterName(cluster.getClusterName());
dataNodeStatus.setServiceName(HDFS);
@@ -1202,7 +1202,7 @@ public class TestHeartbeatHandler {
hb3.setResponseId(3);
hb3.setNodeStatus(new HostStatus(Status.HEALTHY, DummyHostStatus));
hb3.setHostname(DummyHostname1);
- componentStatus = new ArrayList<ComponentStatus>();
+ componentStatus = new ArrayList<>();
dataNodeStatus = new ComponentStatus();
dataNodeStatus.setClusterName(cluster.getClusterName());
dataNodeStatus.setServiceName(HDFS);
@@ -1241,7 +1241,7 @@ public class TestHeartbeatHandler {
hb4.setResponseId(5);
hb4.setNodeStatus(new HostStatus(Status.HEALTHY, DummyHostStatus));
hb4.setHostname(DummyHostname1);
- componentStatus = new ArrayList<ComponentStatus>();
+ componentStatus = new ArrayList<>();
dataNodeStatus = new ComponentStatus();
dataNodeStatus.setClusterName(cluster.getClusterName());
dataNodeStatus.setServiceName(HDFS);
@@ -1275,7 +1275,7 @@ public class TestHeartbeatHandler {
cr1.setExitCode(215);
cr1.setRoleCommand("STOP");
cr1.setClusterName(DummyCluster);
- ArrayList<CommandReport> reports = new ArrayList<CommandReport>();
+ ArrayList<CommandReport> reports = new ArrayList<>();
reports.add(cr1);
hb5.setReports(reports);
handler.handleHeartBeat(hb5);
@@ -1309,7 +1309,7 @@ public class TestHeartbeatHandler {
cr2.setStdOut("dummy output");
cr2.setExitCode(0);
- ArrayList<CommandReport> reports = new ArrayList<CommandReport>();
+ ArrayList<CommandReport> reports = new ArrayList<>();
reports.add(cr1);
reports.add(cr2);
@@ -1351,19 +1351,19 @@ public class TestHeartbeatHandler {
InvalidStateTransitionException {
ComponentsResponse expected = new ComponentsResponse();
StackId dummyStackId = new StackId(DummyStackId);
- Map<String, Map<String, String>> dummyComponents = new HashMap<String, Map<String, String>>();
+ Map<String, Map<String, String>> dummyComponents = new HashMap<>();
- Map<String, String> dummyCategoryMap = new HashMap<String, String>();
+ Map<String, String> dummyCategoryMap = new HashMap<>();
dummyCategoryMap.put("PIG", "CLIENT");
dummyComponents.put("PIG", dummyCategoryMap);
- dummyCategoryMap = new HashMap<String, String>();
+ dummyCategoryMap = new HashMap<>();
dummyCategoryMap.put("MAPREDUCE_CLIENT", "CLIENT");
dummyCategoryMap.put("JOBTRACKER", "MASTER");
dummyCategoryMap.put("TASKTRACKER", "SLAVE");
dummyComponents.put("MAPREDUCE", dummyCategoryMap);
- dummyCategoryMap = new HashMap<String, String>();
+ dummyCategoryMap = new HashMap<>();
dummyCategoryMap.put("DATANODE2", "SLAVE");
dummyCategoryMap.put("NAMENODE", "MASTER");
dummyCategoryMap.put("HDFS_CLIENT", "CLIENT");
@@ -1428,7 +1428,7 @@ public class TestHeartbeatHandler {
hb.setNodeStatus(new HostStatus(Status.HEALTHY, DummyHostStatus));
hb.setReports(new ArrayList<CommandReport>());
- ArrayList<ComponentStatus> componentStatuses = new ArrayList<ComponentStatus>();
+ ArrayList<ComponentStatus> componentStatuses = new ArrayList<>();
ComponentStatus componentStatus1 = new ComponentStatus();
componentStatus1.setClusterName(DummyCluster);
componentStatus1.setServiceName(HDFS);
@@ -1516,11 +1516,11 @@ public class TestHeartbeatHandler {
ExecutionCommand executionCommand = new ExecutionCommand();
- Map<String, String> hlp = new HashMap<String, String>();
+ Map<String, String> hlp = new HashMap<>();
hlp.put("custom_command", "SET_KEYTAB");
executionCommand.setHostLevelParams(hlp);
- Map<String, String> commandparams = new HashMap<String, String>();
+ Map<String, String> commandparams = new HashMap<>();
commandparams.put(KerberosServerAction.AUTHENTICATED_USER_NAME, "admin");
commandparams.put(KerberosServerAction.DATA_DIRECTORY, createTestKeytabData().getAbsolutePath());
executionCommand.setCommandParams(commandparams);
@@ -1547,11 +1547,11 @@ public class TestHeartbeatHandler {
ExecutionCommand executionCommand = new ExecutionCommand();
- Map<String, String> hlp = new HashMap<String, String>();
+ Map<String, String> hlp = new HashMap<>();
hlp.put("custom_command", "REMOVE_KEYTAB");
executionCommand.setHostLevelParams(hlp);
- Map<String, String> commandparams = new HashMap<String, String>();
+ Map<String, String> commandparams = new HashMap<>();
commandparams.put(KerberosServerAction.AUTHENTICATED_USER_NAME, "admin");
commandparams.put(KerberosServerAction.DATA_DIRECTORY, createTestKeytabData().getAbsolutePath());
executionCommand.setCommandParams(commandparams);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
index 1b9c28b..caf64be 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/agent/TestHeartbeatMonitor.java
@@ -98,7 +98,7 @@ public class TestHeartbeatMonitor {
}
private void setOsFamily(Host host, String osFamily, String osVersion) {
- Map<String, String> hostAttributes = new HashMap<String, String>();
+ Map<String, String> hostAttributes = new HashMap<>();
hostAttributes.put("os_family", osFamily);
hostAttributes.put("os_release_version", osVersion);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/alerts/AgentHeartbeatAlertRunnableTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/alerts/AgentHeartbeatAlertRunnableTest.java b/ambari-server/src/test/java/org/apache/ambari/server/alerts/AgentHeartbeatAlertRunnableTest.java
index 721db7f..ed2c2b5 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/alerts/AgentHeartbeatAlertRunnableTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/alerts/AgentHeartbeatAlertRunnableTest.java
@@ -106,11 +106,11 @@ public class AgentHeartbeatAlertRunnableTest {
m_synchronizedBus.register(m_listener);
// create the cluster map
- Map<String,Cluster> clusterMap = new HashMap<String, Cluster>();
+ Map<String,Cluster> clusterMap = new HashMap<>();
clusterMap.put(CLUSTER_NAME, m_cluster);
// create the host map
- Map<String, Host> hostMap = new HashMap<String, Host>();
+ Map<String, Host> hostMap = new HashMap<>();
hostMap.put(HOSTNAME, m_host);
// mock the definition for the alert
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/alerts/AmbariPerformanceRunnableTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/alerts/AmbariPerformanceRunnableTest.java b/ambari-server/src/test/java/org/apache/ambari/server/alerts/AmbariPerformanceRunnableTest.java
index facd802..849f94d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/alerts/AmbariPerformanceRunnableTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/alerts/AmbariPerformanceRunnableTest.java
@@ -98,7 +98,7 @@ public class AmbariPerformanceRunnableTest {
private AlertsDAO m_alertsDao;
private AlertDefinitionDAO m_definitionDao;
private AlertDefinitionEntity m_definition;
- private List<AlertCurrentEntity> m_currentAlerts = new ArrayList<AlertCurrentEntity>();
+ private List<AlertCurrentEntity> m_currentAlerts = new ArrayList<>();
private MockEventListener m_listener;
private AlertEventPublisher m_eventPublisher;
@@ -128,7 +128,7 @@ public class AmbariPerformanceRunnableTest {
m_synchronizedBus.register(m_listener);
// create the cluster map
- Map<String,Cluster> clusterMap = new HashMap<String, Cluster>();
+ Map<String,Cluster> clusterMap = new HashMap<>();
clusterMap.put(CLUSTER_NAME, m_cluster);
// mock the definition for the alert
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/alerts/StaleAlertRunnableTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/alerts/StaleAlertRunnableTest.java b/ambari-server/src/test/java/org/apache/ambari/server/alerts/StaleAlertRunnableTest.java
index 2111beb..83ab37c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/alerts/StaleAlertRunnableTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/alerts/StaleAlertRunnableTest.java
@@ -88,7 +88,7 @@ public class StaleAlertRunnableTest {
private AlertsDAO m_alertsDao;
private AlertDefinitionDAO m_definitionDao;
private AlertDefinitionEntity m_definition;
- private List<AlertCurrentEntity> m_currentAlerts = new ArrayList<AlertCurrentEntity>();
+ private List<AlertCurrentEntity> m_currentAlerts = new ArrayList<>();
private MockEventListener m_listener;
private AlertEventPublisher m_eventPublisher;
@@ -119,7 +119,7 @@ public class StaleAlertRunnableTest {
m_synchronizedBus.register(m_listener);
// create the cluster map
- Map<String,Cluster> clusterMap = new HashMap<String, Cluster>();
+ Map<String,Cluster> clusterMap = new HashMap<>();
clusterMap.put(CLUSTER_NAME, m_cluster);
// mock the definition for the alert
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/CreateHandlerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/CreateHandlerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/CreateHandlerTest.java
index 8362325..2236e80 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/CreateHandlerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/CreateHandlerTest.java
@@ -76,7 +76,7 @@ public class CreateHandlerTest {
Resource resource2 = createNiceMock(Resource.class);
Renderer renderer = new DefaultRenderer();
- Set<Resource> setResources = new HashSet<Resource>();
+ Set<Resource> setResources = new HashSet<>();
setResources.add(resource1);
setResources.add(resource2);
@@ -136,7 +136,7 @@ public class CreateHandlerTest {
Resource resource2 = createNiceMock(Resource.class);
Renderer renderer = new DefaultRenderer();
- Set<Resource> setResources = new HashSet<Resource>();
+ Set<Resource> setResources = new HashSet<>();
setResources.add(resource1);
setResources.add(resource2);
@@ -196,7 +196,7 @@ public class CreateHandlerTest {
Resource requestResource = createNiceMock(Resource.class);
Renderer renderer = new DefaultRenderer();
- Set<Resource> setResources = new HashSet<Resource>();
+ Set<Resource> setResources = new HashSet<>();
setResources.add(resource1);
setResources.add(resource2);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/DeleteHandlerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/DeleteHandlerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/DeleteHandlerTest.java
index 5b1ba0b..90dfd24 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/DeleteHandlerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/DeleteHandlerTest.java
@@ -141,7 +141,7 @@ public class DeleteHandlerTest {
Query query = createNiceMock(Query.class);
Renderer renderer = new DefaultRenderer();
- Set<Resource> setResources = new HashSet<Resource>();
+ Set<Resource> setResources = new HashSet<>();
setResources.add(resource1);
setResources.add(resource2);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/QueryCreateHandlerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/QueryCreateHandlerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/QueryCreateHandlerTest.java
index 7f6a03d..d8e807b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/QueryCreateHandlerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/QueryCreateHandlerTest.java
@@ -109,52 +109,52 @@ public class QueryCreateHandlerTest {
// ]
// }
- Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ Map<Resource.Type, String> mapIds = new HashMap<>();
- Set<NamedPropertySet> setRequestProps = new HashSet<NamedPropertySet>();
+ Set<NamedPropertySet> setRequestProps = new HashSet<>();
- Map<String, Object> mapProperties = new HashMap<String, Object>();
- Set<Map<String, Object>> arraySet = new HashSet<Map<String, Object>>();
+ Map<String, Object> mapProperties = new HashMap<>();
+ Set<Map<String, Object>> arraySet = new HashSet<>();
mapProperties.put("components", arraySet);
- Map<String, Object> map = new HashMap<String, Object>();
+ Map<String, Object> map = new HashMap<>();
map.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "SECONDARY_NAMENODE");
arraySet.add(map);
- map = new HashMap<String, Object>();
+ map = new HashMap<>();
map.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "HDFS_CLIENT");
arraySet.add(map);
setRequestProps.add(new NamedPropertySet("", mapProperties));
- Set<Map<String, Object>> setCreateProps = new HashSet<Map<String, Object>>();
- Map<String, Object> map1 = new HashMap<String, Object>();
+ Set<Map<String, Object>> setCreateProps = new HashSet<>();
+ Map<String, Object> map1 = new HashMap<>();
map1.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "SECONDARY_NAMENODE");
map1.put(createKeyProperty, "id1");
setCreateProps.add(map1);
- Map<String, Object> map2 = new HashMap<String, Object>();
+ Map<String, Object> map2 = new HashMap<>();
map2.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "SECONDARY_NAMENODE");
map2.put(createKeyProperty, "id2");
setCreateProps.add(map2);
- Map<String, Object> map3 = new HashMap<String, Object>();
+ Map<String, Object> map3 = new HashMap<>();
map3.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "HDFS_CLIENT");
map3.put(createKeyProperty, "id1");
setCreateProps.add(map3);
- Map<String, Object> map4 = new HashMap<String, Object>();
+ Map<String, Object> map4 = new HashMap<>();
map4.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "HDFS_CLIENT");
map4.put(createKeyProperty, "id2");
setCreateProps.add(map4);
- Map<String, ResourceInstance> mapSubResources = new HashMap<String, ResourceInstance>();
+ Map<String, ResourceInstance> mapSubResources = new HashMap<>();
mapSubResources.put("components", subResource);
- TreeNode<Resource> resultTree = new TreeNodeImpl<Resource>(null, null, "result");
+ TreeNode<Resource> resultTree = new TreeNodeImpl<>(null, null, "result");
resultTree.addChild(resource1, "resource1");
resultTree.addChild(resource2, "resource2");
- Set<Resource> setStatusResources = new HashSet<Resource>();
+ Set<Resource> setStatusResources = new HashSet<>();
setStatusResources.add(statusResource1);
setStatusResources.add(statusResource2);
@@ -273,25 +273,25 @@ public class QueryCreateHandlerTest {
// }
// }
- Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ Map<Resource.Type, String> mapIds = new HashMap<>();
- Set<NamedPropertySet> setRequestProps = new HashSet<NamedPropertySet>();
- Map<String, Object> mapProperties = new HashMap<String, Object>();
- Set<Map<String, Object>> arraySet = new HashSet<Map<String, Object>>();
+ Set<NamedPropertySet> setRequestProps = new HashSet<>();
+ Map<String, Object> mapProperties = new HashMap<>();
+ Set<Map<String, Object>> arraySet = new HashSet<>();
mapProperties.put("", arraySet);
- Map<String, Object> map = new HashMap<String, Object>();
+ Map<String, Object> map = new HashMap<>();
map.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "SECONDARY_NAMENODE");
arraySet.add(map);
- map = new HashMap<String, Object>();
+ map = new HashMap<>();
map.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "HDFS_CLIENT");
arraySet.add(map);
setRequestProps.add(new NamedPropertySet("", mapProperties));
- TreeNode<Resource> resultTree = new TreeNodeImpl<Resource>(null, null, "result");
+ TreeNode<Resource> resultTree = new TreeNodeImpl<>(null, null, "result");
resultTree.addChild(resource1, "resource1");
resultTree.addChild(resource2, "resource2");
@@ -373,28 +373,28 @@ public class QueryCreateHandlerTest {
// ]
// }
- Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ Map<Resource.Type, String> mapIds = new HashMap<>();
- Set<NamedPropertySet> setRequestProps = new HashSet<NamedPropertySet>();
- Map<String, Object> mapProperties = new HashMap<String, Object>();
- Set<Map<String, Object>> arraySet = new HashSet<Map<String, Object>>();
+ Set<NamedPropertySet> setRequestProps = new HashSet<>();
+ Map<String, Object> mapProperties = new HashMap<>();
+ Set<Map<String, Object>> arraySet = new HashSet<>();
mapProperties.put("INVALID", arraySet);
- Map<String, Object> map = new HashMap<String, Object>();
+ Map<String, Object> map = new HashMap<>();
map.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "SECONDARY_NAMENODE");
arraySet.add(map);
- map = new HashMap<String, Object>();
+ map = new HashMap<>();
map.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "HDFS_CLIENT");
arraySet.add(map);
setRequestProps.add(new NamedPropertySet("", mapProperties));
- Map<String, ResourceInstance> mapSubResources = new HashMap<String, ResourceInstance>();
+ Map<String, ResourceInstance> mapSubResources = new HashMap<>();
mapSubResources.put("components", subResource);
- TreeNode<Resource> resultTree = new TreeNodeImpl<Resource>(null, null, "result");
+ TreeNode<Resource> resultTree = new TreeNodeImpl<>(null, null, "result");
resultTree.addChild(resource1, "resource1");
resultTree.addChild(resource2, "resource2");
@@ -463,12 +463,12 @@ public class QueryCreateHandlerTest {
RequestHandler readHandler = createStrictMock(RequestHandler.class);
ResultStatus queryResultStatus = createNiceMock(ResultStatus.class);
- Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ Map<Resource.Type, String> mapIds = new HashMap<>();
- Set<NamedPropertySet> setRequestProps = new HashSet<NamedPropertySet>();
+ Set<NamedPropertySet> setRequestProps = new HashSet<>();
// no body specified so no props
- TreeNode<Resource> resultTree = new TreeNodeImpl<Resource>(null, null, "result");
+ TreeNode<Resource> resultTree = new TreeNodeImpl<>(null, null, "result");
resultTree.addChild(resource1, "resource1");
resultTree.addChild(resource2, "resource2");
@@ -552,32 +552,32 @@ public class QueryCreateHandlerTest {
// ]
// }
- Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ Map<Resource.Type, String> mapIds = new HashMap<>();
- Set<NamedPropertySet> setRequestProps = new HashSet<NamedPropertySet>();
- Map<String, Object> mapProperties = new HashMap<String, Object>();
+ Set<NamedPropertySet> setRequestProps = new HashSet<>();
+ Map<String, Object> mapProperties = new HashMap<>();
- Set<Map<String, Object>> arraySet = new HashSet<Map<String, Object>>();
+ Set<Map<String, Object>> arraySet = new HashSet<>();
mapProperties.put("foo", arraySet);
- Map<String, Object> map = new HashMap<String, Object>();
+ Map<String, Object> map = new HashMap<>();
map.put("prop", "val");
arraySet.add(map);
- arraySet = new HashSet<Map<String, Object>>();
+ arraySet = new HashSet<>();
mapProperties.put("bar", arraySet);
- map = new HashMap<String, Object>();
+ map = new HashMap<>();
map.put("prop", "val");
arraySet.add(map);
setRequestProps.add(new NamedPropertySet("", mapProperties));
- Map<String, ResourceInstance> mapSubResources = new HashMap<String, ResourceInstance>();
+ Map<String, ResourceInstance> mapSubResources = new HashMap<>();
mapSubResources.put("foo", subResource1);
mapSubResources.put("bar", subResource2);
- TreeNode<Resource> resultTree = new TreeNodeImpl<Resource>(null, null, "result");
+ TreeNode<Resource> resultTree = new TreeNodeImpl<>(null, null, "result");
resultTree.addChild(resource1, "resource1");
resultTree.addChild(resource2, "resource2");
@@ -661,29 +661,29 @@ public class QueryCreateHandlerTest {
RequestHandler readHandler = createStrictMock(RequestHandler.class);
ResultStatus resultStatus = createMock(ResultStatus.class);
- Map<Resource.Type, String> mapIds = new HashMap<Resource.Type, String>();
+ Map<Resource.Type, String> mapIds = new HashMap<>();
- Set<NamedPropertySet> setRequestProps = new HashSet<NamedPropertySet>();
+ Set<NamedPropertySet> setRequestProps = new HashSet<>();
- Map<String, Object> mapProperties = new HashMap<String, Object>();
- Set<Map<String, Object>> arraySet = new HashSet<Map<String, Object>>();
+ Map<String, Object> mapProperties = new HashMap<>();
+ Set<Map<String, Object>> arraySet = new HashSet<>();
mapProperties.put("components", arraySet);
- Map<String, Object> map = new HashMap<String, Object>();
+ Map<String, Object> map = new HashMap<>();
map.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "SECONDARY_NAMENODE");
arraySet.add(map);
- map = new HashMap<String, Object>();
+ map = new HashMap<>();
map.put(PropertyHelper.getPropertyId("ServiceComponentInfo", "component_name"), "HDFS_CLIENT");
arraySet.add(map);
setRequestProps.add(new NamedPropertySet("", mapProperties));
- Map<String, ResourceInstance> mapSubResources = new HashMap<String, ResourceInstance>();
+ Map<String, ResourceInstance> mapSubResources = new HashMap<>();
mapSubResources.put("components", subResource);
- TreeNode<Resource> resultTree = new TreeNodeImpl<Resource>(null, null, "result");
+ TreeNode<Resource> resultTree = new TreeNodeImpl<>(null, null, "result");
resultTree.addChild(resource1, "resource1");
resultTree.addChild(resource2, "resource2");
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/ReadHandlerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/ReadHandlerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/ReadHandlerTest.java
index 1b2a080..587389c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/ReadHandlerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/ReadHandlerTest.java
@@ -64,7 +64,7 @@ public class ReadHandlerTest {
ResourceInstance resource = createNiceMock(ResourceInstance.class);
Query query = createStrictMock(Query.class);
- Map<String, TemporalInfo> mapPartialResponseFields = new HashMap<String, TemporalInfo>();
+ Map<String, TemporalInfo> mapPartialResponseFields = new HashMap<>();
mapPartialResponseFields.put("foo/bar", null);
Renderer renderer = new DefaultRenderer();
@@ -103,7 +103,7 @@ public class ReadHandlerTest {
Map<String, String> requestInfoProperties = Collections.singletonMap("directive", "value");
- Map<String, TemporalInfo> mapPartialResponseFields = new HashMap<String, TemporalInfo>();
+ Map<String, TemporalInfo> mapPartialResponseFields = new HashMap<>();
mapPartialResponseFields.put("foo", null);
mapPartialResponseFields.put("bar/c", null);
mapPartialResponseFields.put("bar/d/e", null);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/UpdateHandlerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/UpdateHandlerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/UpdateHandlerTest.java
index 0e11c17..bbbff10 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/UpdateHandlerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/handlers/UpdateHandlerTest.java
@@ -77,7 +77,7 @@ public class UpdateHandlerTest {
Query query = createNiceMock(Query.class);
Renderer renderer = new DefaultRenderer();
- Set<Resource> setResources = new HashSet<Resource>();
+ Set<Resource> setResources = new HashSet<>();
setResources.add(resource1);
setResources.add(resource2);
@@ -138,7 +138,7 @@ public class UpdateHandlerTest {
Query query = createNiceMock(Query.class);
Renderer renderer = new DefaultRenderer();
- Set<Resource> setResources = new HashSet<Resource>();
+ Set<Resource> setResources = new HashSet<>();
setResources.add(resource1);
setResources.add(resource2);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/QueryLexerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/QueryLexerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/QueryLexerTest.java
index ccd9b80..9370589 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/QueryLexerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/QueryLexerTest.java
@@ -37,7 +37,7 @@ public class QueryLexerTest {
@Test
public void testTokens_simple() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "a"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "1"));
@@ -60,7 +60,7 @@ public class QueryLexerTest {
@Test
public void testTokens_multipleBrackets() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "<"));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "a"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "1"));
@@ -92,7 +92,7 @@ public class QueryLexerTest {
QueryLexer lexer = new QueryLexer();
Token[] tokens = lexer.tokens("!foo<5");
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.LOGICAL_UNARY_OPERATOR, "!"));
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "<"));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
@@ -105,7 +105,7 @@ public class QueryLexerTest {
QueryLexer lexer = new QueryLexer();
Token[] tokens = lexer.tokens("foo.in(one, two, 3)");
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR_FUNC, ".in("));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "one, two, 3"));
@@ -119,7 +119,7 @@ public class QueryLexerTest {
QueryLexer lexer = new QueryLexer();
Token[] tokens = lexer.tokens("category1.isEmpty()");
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR_FUNC, ".isEmpty("));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "category1"));
listTokens.add(new Token(Token.TYPE.BRACKET_CLOSE, ")"));
@@ -138,7 +138,7 @@ public class QueryLexerTest {
@Test
public void testTokens_ignoreFieldsSyntax___fieldsFirst() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "1"));
@@ -152,7 +152,7 @@ public class QueryLexerTest {
@Test
public void testTokens_ignoreFieldsSyntax___fieldsLast() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "1"));
@@ -174,7 +174,7 @@ public class QueryLexerTest {
@Test
public void testTokens_ignoreFormatSyntax___formatFirst() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "1"));
@@ -188,7 +188,7 @@ public class QueryLexerTest {
@Test
public void testTokens_ignoreFormatSyntax___formatLast() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "1"));
@@ -210,7 +210,7 @@ public class QueryLexerTest {
@Test
public void testTokens_ignoreUnderscoreSyntax___fieldsFirst() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "1"));
@@ -224,7 +224,7 @@ public class QueryLexerTest {
@Test
public void testTokens_ignoreUnderscoreSyntax___fieldsLast() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "1"));
@@ -237,7 +237,7 @@ public class QueryLexerTest {
@Test
public void testTokens_ignore__multipleIgnoreFields() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "1"));
@@ -250,7 +250,7 @@ public class QueryLexerTest {
@Test
public void testTokens_ignore__multipleConsecutiveIgnoreFields() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "1"));
@@ -263,7 +263,7 @@ public class QueryLexerTest {
@Test
public void testTokens_ignore__multipleConsecutiveIgnoreFields2() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "1"));
@@ -276,7 +276,7 @@ public class QueryLexerTest {
@Test
public void testTokens_ignore__fieldsMiddle() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "1"));
@@ -293,7 +293,7 @@ public class QueryLexerTest {
@Test
public void testTokens_ignore__fieldsMiddle2() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "1"));
@@ -310,7 +310,7 @@ public class QueryLexerTest {
@Test
public void testTokens_ignore__userDefined() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "1"));
@@ -320,7 +320,7 @@ public class QueryLexerTest {
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "2"));
QueryLexer lexer = new QueryLexer();
- Set<String> propertiesToIgnore = new HashSet<String>();
+ Set<String> propertiesToIgnore = new HashSet<>();
propertiesToIgnore.add("ignore1");
propertiesToIgnore.add("otherIgnore");
propertiesToIgnore.add("ba");
@@ -364,7 +364,7 @@ public class QueryLexerTest {
@Test
public void testTokens_matchesRegexp_simple() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR_FUNC, ".matches("));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "StackConfigurations/property_type"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "(.*USER.*)|(.*GROUP.*)"));
@@ -378,7 +378,7 @@ public class QueryLexerTest {
@Test
public void testTokens_matchesRegexp() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.BRACKET_OPEN, "("));
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR_FUNC, ".matches("));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "StackConfigurations/property_type"));
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/QueryParserTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/QueryParserTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/QueryParserTest.java
index 046abcb..9ec43d8 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/QueryParserTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/QueryParserTest.java
@@ -45,7 +45,7 @@ public class QueryParserTest {
@Test
public void testParse_simple() throws Exception {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
//a=b
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "a"));
@@ -54,12 +54,12 @@ public class QueryParserTest {
QueryParser parser = new QueryParser();
Predicate p = parser.parse(listTokens.toArray(new Token[listTokens.size()]));
- assertEquals(new EqualsPredicate<String>("a", "b"), p);
+ assertEquals(new EqualsPredicate<>("a", "b"), p);
}
@Test
public void testParse() throws InvalidQueryException {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
// foo=bar&(a<1&(b<=2|c>3)&d>=100)|e!=5&!(f=6|g=7)
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
@@ -103,14 +103,14 @@ public class QueryParserTest {
QueryParser parser = new QueryParser();
Predicate p = parser.parse(listTokens.toArray(new Token[listTokens.size()]));
- EqualsPredicate<String> fooPred = new EqualsPredicate<String>("foo", "bar");
- LessPredicate<String> aPred = new LessPredicate<String>("a", "1");
- LessEqualsPredicate<String> bPred = new LessEqualsPredicate<String>("b", "2");
- GreaterEqualsPredicate<String> cPred = new GreaterEqualsPredicate<String>("c", "3");
- GreaterEqualsPredicate<String> dPred = new GreaterEqualsPredicate<String>("d", "100");
- NotPredicate ePred = new NotPredicate(new EqualsPredicate<String>("e", "5"));
- EqualsPredicate fPred = new EqualsPredicate<String>("f", "6");
- EqualsPredicate gPRed = new EqualsPredicate<String>("g", "7");
+ EqualsPredicate<String> fooPred = new EqualsPredicate<>("foo", "bar");
+ LessPredicate<String> aPred = new LessPredicate<>("a", "1");
+ LessEqualsPredicate<String> bPred = new LessEqualsPredicate<>("b", "2");
+ GreaterEqualsPredicate<String> cPred = new GreaterEqualsPredicate<>("c", "3");
+ GreaterEqualsPredicate<String> dPred = new GreaterEqualsPredicate<>("d", "100");
+ NotPredicate ePred = new NotPredicate(new EqualsPredicate<>("e", "5"));
+ EqualsPredicate fPred = new EqualsPredicate<>("f", "6");
+ EqualsPredicate gPRed = new EqualsPredicate<>("g", "7");
OrPredicate bORcPred = new OrPredicate(bPred, cPred);
AndPredicate aANDbORcPred = new AndPredicate(aPred, bORcPred);
AndPredicate aANDbORcANDdPred = new AndPredicate(aANDbORcPred, dPred);
@@ -125,7 +125,7 @@ public class QueryParserTest {
@Test
public void testParse_NotOp__simple() throws Exception {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
//!a=b
listTokens.add(new Token(Token.TYPE.LOGICAL_UNARY_OPERATOR, "!"));
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
@@ -135,12 +135,12 @@ public class QueryParserTest {
QueryParser parser = new QueryParser();
Predicate p = parser.parse(listTokens.toArray(new Token[listTokens.size()]));
- assertEquals(new NotPredicate(new EqualsPredicate<String>("a", "b")), p);
+ assertEquals(new NotPredicate(new EqualsPredicate<>("a", "b")), p);
}
@Test
public void testParse_NotOp() throws Exception {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
//a=1&!b=2
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "a"));
@@ -154,8 +154,8 @@ public class QueryParserTest {
QueryParser parser = new QueryParser();
Predicate p = parser.parse(listTokens.toArray(new Token[listTokens.size()]));
- EqualsPredicate aPred = new EqualsPredicate<String>("a", "1");
- EqualsPredicate bPred = new EqualsPredicate<String>("b", "2");
+ EqualsPredicate aPred = new EqualsPredicate<>("a", "1");
+ EqualsPredicate bPred = new EqualsPredicate<>("b", "2");
NotPredicate notPred = new NotPredicate(bPred);
AndPredicate andPred = new AndPredicate(aPred, notPred);
@@ -164,7 +164,7 @@ public class QueryParserTest {
@Test
public void testParse_InOp__simple() throws Exception {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
// foo.in(one,two,3)
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR_FUNC, ".in("));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
@@ -185,7 +185,7 @@ public class QueryParserTest {
@Test
public void testParse_InOp__HostName() throws Exception {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
// foo.in(one,two,3)
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR_FUNC, ".in("));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "HostRoles/host_name"));
@@ -206,7 +206,7 @@ public class QueryParserTest {
@Test
public void testParse_EquOp_HostName() throws Exception {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
//a=1&!b=2
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "HostRoles/host_name"));
@@ -215,7 +215,7 @@ public class QueryParserTest {
QueryParser parser = new QueryParser();
Predicate p = parser.parse(listTokens.toArray(new Token[listTokens.size()]));
- EqualsPredicate equalsPred = new EqualsPredicate<String>("HostRoles/host_name", "host1");
+ EqualsPredicate equalsPred = new EqualsPredicate<>("HostRoles/host_name", "host1");
assertEquals(equalsPred, p);
@@ -223,7 +223,7 @@ public class QueryParserTest {
@Test
public void testParse_InOp__exception() throws Exception {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
// foo.in()
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR_FUNC, ".in("));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
@@ -240,7 +240,7 @@ public class QueryParserTest {
@Test
public void testParse_FilterOp() throws Exception {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR_FUNC, ".matches("));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, ".*"));
@@ -256,7 +256,7 @@ public class QueryParserTest {
@Test
public void testParse_FilterOp_exception() throws Exception {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR_FUNC, ".matches("));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "foo"));
listTokens.add(new Token(Token.TYPE.BRACKET_CLOSE, ")"));
@@ -272,7 +272,7 @@ public class QueryParserTest {
@Test
public void testParse_isEmptyOp__simple() throws Exception {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
// category1.isEmpty()
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR_FUNC, ".isEmpty("));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "category1"));
@@ -286,7 +286,7 @@ public class QueryParserTest {
@Test
public void testParse_isEmptyOp__exception() throws Exception {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
// category1.isEmpty()
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR_FUNC, ".isEmpty("));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "category1"));
@@ -303,7 +303,7 @@ public class QueryParserTest {
@Test
public void testParse_isEmptyOp__exception2() throws Exception {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
// category1.isEmpty()
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR_FUNC, ".isEmpty("));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "category1"));
@@ -326,7 +326,7 @@ public class QueryParserTest {
@Test
public void testParse_mismatchedBrackets() {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
// a=1&(b<=2|c>3
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "a"));
@@ -351,7 +351,7 @@ public class QueryParserTest {
@Test
public void testParse_outOfOrderTokens() {
- List<Token> listTokens = new ArrayList<Token>();
+ List<Token> listTokens = new ArrayList<>();
listTokens.add(new Token(Token.TYPE.RELATIONAL_OPERATOR, "="));
listTokens.add(new Token(Token.TYPE.PROPERTY_OPERAND, "a"));
listTokens.add(new Token(Token.TYPE.VALUE_OPERAND, "1"));
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/AndOperatorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/AndOperatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/AndOperatorTest.java
index c72fdf1..e14fb16 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/AndOperatorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/AndOperatorTest.java
@@ -39,8 +39,8 @@ public class AndOperatorTest {
@Test
public void testToPredicate() {
- EqualsPredicate p1 = new EqualsPredicate<String>("p1", "one");
- EqualsPredicate p2 = new EqualsPredicate<String>("p2", "two");
+ EqualsPredicate p1 = new EqualsPredicate<>("p1", "one");
+ EqualsPredicate p2 = new EqualsPredicate<>("p2", "two");
AndPredicate andPredicate = new AndPredicate(p1, p2);
assertEquals(andPredicate, new AndOperator(1).toPredicate(p1, p2));
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/EqualsOperatorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/EqualsOperatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/EqualsOperatorTest.java
index 8651626..7ee906f 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/EqualsOperatorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/EqualsOperatorTest.java
@@ -38,7 +38,7 @@ public class EqualsOperatorTest {
@Test
public void testToPredicate() {
- assertEquals(new EqualsPredicate<String>("prop", "val"),
+ assertEquals(new EqualsPredicate<>("prop", "val"),
new EqualsOperator().toPredicate("prop", "val"));
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/GreaterEqualsOperatorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/GreaterEqualsOperatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/GreaterEqualsOperatorTest.java
index 7efdeb6..ac142e3 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/GreaterEqualsOperatorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/GreaterEqualsOperatorTest.java
@@ -38,7 +38,7 @@ public class GreaterEqualsOperatorTest {
@Test
public void testToPredicate() {
- assertEquals(new GreaterEqualsPredicate<String>("1", "2"),
+ assertEquals(new GreaterEqualsPredicate<>("1", "2"),
new GreaterEqualsOperator().toPredicate("1", "2"));
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/GreaterOperatorTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/GreaterOperatorTest.java b/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/GreaterOperatorTest.java
index 5690b49..45be489 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/GreaterOperatorTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/api/predicate/operators/GreaterOperatorTest.java
@@ -38,7 +38,7 @@ public class GreaterOperatorTest {
@Test
public void testToPredicate() {
- assertEquals(new GreaterPredicate<String>("1", "2"),
+ assertEquals(new GreaterPredicate<>("1", "2"),
new GreaterOperator().toPredicate("1", "2"));
}