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 2017/03/29 22:40:47 UTC
[29/50] [abbrv] ambari git commit: AMBARI-19149. Code cleanup:
redundant type arguments
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
index 3d263cf..c235cf8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog221.java
@@ -393,7 +393,7 @@ public class UpgradeCatalog221 extends AbstractUpgradeCatalog {
VersionUtils.compareVersions(stackId.getStackVersion(), "2.3") >= 0);
if (isStackNotLess23) {
- Map<String, String> updates = new HashMap<String, String>();
+ Map<String, String> updates = new HashMap<>();
if (tezCountersMaxProperty != null && tezCountersMaxProperty.equals("2000")) {
updates.put(TEZ_COUNTERS_MAX, "10000");
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java
index ab3b493..f0f9253 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog222.java
@@ -226,7 +226,7 @@ public class UpgradeCatalog222 extends AbstractUpgradeCatalog {
if (zooEnv != null && zooEnv.getProperties().containsKey("zk_server_heapsize")) {
String heapSizeValue = zooEnv.getProperties().get("zk_server_heapsize");
if(!heapSizeValue.endsWith("m")) {
- Map<String, String> updates = new HashMap<String, String>();
+ Map<String, String> updates = new HashMap<>();
updates.put("zk_server_heapsize", heapSizeValue+"m");
updateConfigurationPropertiesForCluster(cluster, "zookeeper-env", updates, true, false);
}
@@ -290,7 +290,7 @@ public class UpgradeCatalog222 extends AbstractUpgradeCatalog {
for (final Cluster cluster : clusterMap.values()) {
if (cluster.getDesiredConfigByType("storm-site") != null && cluster.getDesiredConfigByType("storm-site").getProperties().containsKey("storm.zookeeper.superACL")
&& cluster.getDesiredConfigByType("storm-site").getProperties().get("storm.zookeeper.superACL").equals("sasl:{{storm_base_jaas_principal}}")) {
- Map<String, String> newStormProps = new HashMap<String, String>();
+ Map<String, String> newStormProps = new HashMap<>();
newStormProps.put("storm.zookeeper.superACL", "sasl:{{storm_bare_jaas_principal}}");
updateConfigurationPropertiesForCluster(cluster, "storm-site", newStormProps, true, false);
}
@@ -669,7 +669,7 @@ public class UpgradeCatalog222 extends AbstractUpgradeCatalog {
VersionUtils.compareVersions(stackId.getStackVersion(), "2.3") >= 0);
List<ServiceComponentHost> atlasHost = cluster.getServiceComponentHosts("ATLAS", "ATLAS_SERVER");
- Map<String, String> updates = new HashMap<String, String>();
+ Map<String, String> updates = new HashMap<>();
if (isStackNotLess23 && atlasHost.size() != 0 && hiveSiteConfig != null) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog230.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog230.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog230.java
index 6cda590..a53ac95 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog230.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog230.java
@@ -279,7 +279,7 @@ public class UpgradeCatalog230 extends AbstractUpgradeCatalog {
Collection<PermissionEntity> administratorOnly = Collections.singleton(administratorPermission);
// A map of the authorizations to the relevant roles
- Map<String, Collection<PermissionEntity>> map = new HashMap<String, Collection<PermissionEntity>>();
+ Map<String, Collection<PermissionEntity>> map = new HashMap<>();
map.put("VIEW.USE", viewUserAndAdministrator);
map.put("SERVICE.VIEW_METRICS", clusterUserAndUp);
map.put("SERVICE.VIEW_STATUS_INFO", clusterUserAndUp);
@@ -351,14 +351,14 @@ public class UpgradeCatalog230 extends AbstractUpgradeCatalog {
// Add roleauthorization table
LOG.info("Creating " + ROLE_AUTHORIZATION_TABLE + " table");
- columns = new ArrayList<DBColumnInfo>();
+ columns = new ArrayList<>();
columns.add(new DBColumnInfo(ROLE_AUTHORIZATION_ID_COL, String.class, 100, null, false));
columns.add(new DBColumnInfo(ROLE_AUTHORIZATION_NAME_COL, String.class, 255, null, false));
dbAccessor.createTable(ROLE_AUTHORIZATION_TABLE, columns, ROLE_AUTHORIZATION_ID_COL);
// Add permission_roleauthorization table to map roleauthorizations to permissions (aka roles)
LOG.info("Creating " + PERMISSION_ROLE_AUTHORIZATION_TABLE + " table");
- columns = new ArrayList<DBColumnInfo>();
+ columns = new ArrayList<>();
columns.add(new DBColumnInfo(PERMISSION_ID_COL, Long.class, null, null, false));
columns.add(new DBColumnInfo(ROLE_AUTHORIZATION_ID_COL, String.class, 100, null, false));
dbAccessor.createTable(PERMISSION_ROLE_AUTHORIZATION_TABLE, columns, PERMISSION_ID_COL, ROLE_AUTHORIZATION_ID_COL);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
index 66bdd76..8488795 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog240.java
@@ -195,7 +195,7 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
static {
// Manually create role order since there really isn't any mechanism for this
- ROLE_ORDER = new HashMap<String, Integer>();
+ ROLE_ORDER = new HashMap<>();
ROLE_ORDER.put("AMBARI.ADMINISTRATOR", 1);
ROLE_ORDER.put("CLUSTER.ADMINISTRATOR", 2);
ROLE_ORDER.put("CLUSTER.OPERATOR", 3);
@@ -2174,7 +2174,7 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
Map<String, Cluster> clusterMap = getCheckedClusterMap(clusters);
for (final Cluster cluster : clusterMap.values()) {
Config yarnEnvConfig = cluster.getDesiredConfigByType(YARN_ENV_CONFIG);
- Map<String, String> yarnEnvProps = new HashMap<String, String>();
+ Map<String, String> yarnEnvProps = new HashMap<>();
if (yarnEnvConfig != null) {
String content = yarnEnvConfig.getProperties().get("content");
// comment old property
@@ -2248,8 +2248,8 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
// Update the kerberos-env properties to change kdc_host to kdc_hosts
config = cluster.getDesiredConfigByType("kerberos-env");
if (config != null) {
- Map<String, String> updates = new HashMap<String, String>();
- Set<String> removes = new HashSet<String>();
+ Map<String, String> updates = new HashMap<>();
+ Set<String> removes = new HashSet<>();
// Rename kdc_host to kdc_hosts
String value = config.getProperties().get("kdc_host");
@@ -2490,7 +2490,7 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
Set<PrivilegeEntity> privileges = principal.getPrivileges();
if (privileges != null) {
- Map<ResourceEntity, Set<PrivilegeEntity>> resourceExplicitPrivileges = new HashMap<ResourceEntity, Set<PrivilegeEntity>>();
+ Map<ResourceEntity, Set<PrivilegeEntity>> resourceExplicitPrivileges = new HashMap<>();
PrivilegeEntity ambariAdministratorPrivilege = null;
// Find the set of explicitly assigned roles per cluster
@@ -2509,7 +2509,7 @@ public class UpgradeCatalog240 extends AbstractUpgradeCatalog {
Set<PrivilegeEntity> explicitPrivileges = resourceExplicitPrivileges.get(resource);
if (explicitPrivileges == null) {
- explicitPrivileges = new HashSet<PrivilegeEntity>();
+ explicitPrivileges = new HashSet<>();
resourceExplicitPrivileges.put(resource, explicitPrivileges);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog242.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog242.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog242.java
index 6f927ab..ecf64a2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog242.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog242.java
@@ -195,7 +195,7 @@ public class UpgradeCatalog242 extends AbstractUpgradeCatalog {
PrincipalDAO principalDAO = injector.getInstance(PrincipalDAO.class);
PrincipalTypeDAO principalTypeDAO = injector.getInstance(PrincipalTypeDAO.class);
- Map<String, String> principalTypeToRole = new HashMap<String, String>();
+ Map<String, String> principalTypeToRole = new HashMap<>();
principalTypeToRole.put("ALL.CLUSTER.ADMINISTRATOR", "CLUSTER.ADMINISTRATOR");
principalTypeToRole.put("ALL.CLUSTER.OPERATOR", "CLUSTER.OPERATOR");
principalTypeToRole.put("ALL.CLUSTER.USER", "CLUSTER.USER");
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
index 7c6ca0f..36c4b24 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/upgrade/UpgradeCatalog250.java
@@ -832,7 +832,7 @@ public class UpgradeCatalog250 extends AbstractUpgradeCatalog {
if (clusters != null) {
Map<String, Cluster> clusterMap = clusters.getClusters();
- Map<String, String> prop = new HashMap<String, String>();
+ Map<String, String> prop = new HashMap<>();
if (clusterMap != null && !clusterMap.isEmpty()) {
for (final Cluster cluster : clusterMap.values()) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/utils/HTTPUtils.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/HTTPUtils.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/HTTPUtils.java
index fec4c1b..850a40b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/HTTPUtils.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/HTTPUtils.java
@@ -50,7 +50,7 @@ public class HTTPUtils {
URLStreamProvider urlStreamProvider = new URLStreamProvider(ProxyService.URL_CONNECT_TIMEOUT,
ProxyService.URL_READ_TIMEOUT, ComponentSSLConfiguration.instance());
- Map<String, List<String>> headers = new HashMap<String, List<String>>();
+ Map<String, List<String>> headers = new HashMap<>();
HttpURLConnection connection = urlStreamProvider.processURL(url, "GET", (String) null, headers);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyListAdapter.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyListAdapter.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyListAdapter.java
index c6f4be8..586e44c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyListAdapter.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyListAdapter.java
@@ -47,7 +47,7 @@ public class JaxbMapKeyListAdapter extends
if (list == null) {
return null;
}
- Map<String, List<String>> m = new TreeMap<String, List<String>>();
+ Map<String, List<String>> m = new TreeMap<>();
for (JaxbMapKeyList jaxbMap : list) {
m.put(jaxbMap.key, jaxbMap.value);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyMapAdapter.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyMapAdapter.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyMapAdapter.java
index 32aeee6..a593784 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyMapAdapter.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyMapAdapter.java
@@ -49,7 +49,7 @@ public class JaxbMapKeyMapAdapter extends
if (list == null) {
return null;
}
- Map<String, Map<String, String>> map = new TreeMap<String, Map<String, String>>();
+ Map<String, Map<String, String>> map = new TreeMap<>();
for (JaxbMapKeyMap jaxbkeyMap : list) {
map.put(jaxbkeyMap.key, mapAdapter.unmarshal(jaxbkeyMap.value));
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyValAdapter.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyValAdapter.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyValAdapter.java
index ff3cc0b..acd9edb 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyValAdapter.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/JaxbMapKeyValAdapter.java
@@ -44,7 +44,7 @@ public class JaxbMapKeyValAdapter extends
if (jm == null) {
return null;
}
- Map<String, String> m = new TreeMap<String, String>();
+ Map<String, String> m = new TreeMap<>();
for (JaxbMapKeyVal jaxbMap : jm) {
m.put(jaxbMap.key, jaxbMap.value);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/utils/Parallel.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/Parallel.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/Parallel.java
index ee69681..e4e9e0d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/Parallel.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/Parallel.java
@@ -92,7 +92,7 @@ public class Parallel {
*/
private static ExecutorService initExecutor() {
- BlockingQueue<Runnable> blockingQueue = new SynchronousQueue<Runnable>(); // Using synchronous queue
+ BlockingQueue<Runnable> blockingQueue = new SynchronousQueue<>(); // Using synchronous queue
// Create thread pool
ThreadPoolExecutor threadPool = new ThreadPoolExecutor(
@@ -163,19 +163,19 @@ public class Parallel {
if(source.size() == 1 || (endIndex - startIndex) == 1) {
// Don't spawn a new thread for a single element list
List<R> result = Collections.singletonList(loopBody.run(source.get(startIndex)));
- return new ParallelLoopResult<R>(true, result);
+ return new ParallelLoopResult<>(true, result);
}
// Create a completion service for each call
- CompletionService<ResultWrapper<R>> completionService = new ExecutorCompletionService<ResultWrapper<R>>(executor);
+ CompletionService<ResultWrapper<R>> completionService = new ExecutorCompletionService<>(executor);
- List<Future<ResultWrapper<R>>> futures = new LinkedList<Future<ResultWrapper<R>>>();
+ List<Future<ResultWrapper<R>>> futures = new LinkedList<>();
for (int i = startIndex; i < endIndex; i++) {
final Integer k = i;
Future<ResultWrapper<R>> future = completionService.submit(new Callable<ResultWrapper<R>>() {
@Override
public ResultWrapper<R> call() throws Exception {
- ResultWrapper<R> res = new ResultWrapper<R>();
+ ResultWrapper<R> res = new ResultWrapper<>();
res.index = k;
res.result = loopBody.run(source.get(k));
return res;
@@ -233,7 +233,7 @@ public class Parallel {
}
}
// Return parallel loop result
- return new ParallelLoopResult<R>(completed, Arrays.asList(result));
+ return new ParallelLoopResult<>(completed, Arrays.asList(result));
}
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/utils/SetUtils.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/SetUtils.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/SetUtils.java
index 9b31e96..5c534ee 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/SetUtils.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/SetUtils.java
@@ -47,11 +47,11 @@ public class SetUtils {
}
int subsetCount = (int) (Math.ceil((double)original.size() / subsetSize));
- ArrayList<Set<T>> subsets = new ArrayList<Set<T>>(subsetCount);
+ ArrayList<Set<T>> subsets = new ArrayList<>(subsetCount);
Iterator<T> iterator = original.iterator();
for(int i = 0; i < subsetCount; i++) {
- Set<T> subset = new LinkedHashSet<T>(subsetSize);
+ Set<T> subset = new LinkedHashSet<>(subsetSize);
for(int j = 0; j < subsetSize && iterator.hasNext(); j++) {
subset.add(iterator.next());
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/utils/ShellCommandUtil.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/ShellCommandUtil.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/ShellCommandUtil.java
index bbf73da..a4408de 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/ShellCommandUtil.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/ShellCommandUtil.java
@@ -340,7 +340,7 @@ public class ShellCommandUtil {
if (pathExists(directoryPath, sudo).isSuccessful()) {
return new Result(0, "The directory already exists, skipping.", ""); // Success!
} else {
- ArrayList<String> command = new ArrayList<String>();
+ ArrayList<String> command = new ArrayList<>();
command.add("/bin/mkdir");
@@ -365,7 +365,7 @@ public class ShellCommandUtil {
* @return the shell command result
*/
public static Result copyFile(String srcFile, String destFile, boolean force, boolean sudo) throws IOException, InterruptedException {
- ArrayList<String> command = new ArrayList<String>();
+ ArrayList<String> command = new ArrayList<>();
if (WINDOWS) {
command.add("copy");
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
index 240bfc7..6a88aea 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java
@@ -83,9 +83,9 @@ public class StageUtils {
protected static final String RACKS = "all_racks";
protected static final String IPV4_ADDRESSES = "all_ipv4_ips";
private static Map<String, String> componentToClusterInfoKeyMap =
- new HashMap<String, String>();
+ new HashMap<>();
private static Map<String, String> decommissionedToClusterInfoKeyMap =
- new HashMap<String, String>();
+ new HashMap<>();
private volatile static Gson gson;
@Inject
@@ -216,32 +216,32 @@ public class StageUtils {
ExecutionCommand execCmd = s.getExecutionCommandWrapper(hostname, "NAMENODE").getExecutionCommand();
execCmd.setRequestAndStage(s.getRequestId(), s.getStageId());
- List<String> slaveHostList = new ArrayList<String>();
+ List<String> slaveHostList = new ArrayList<>();
slaveHostList.add(hostname);
slaveHostList.add("host2");
- Map<String, String> hdfsSite = new TreeMap<String, String>();
+ Map<String, String> hdfsSite = new TreeMap<>();
hdfsSite.put("dfs.block.size", "2560000000");
Map<String, Map<String, String>> configurations =
- new TreeMap<String, Map<String, String>>();
+ new TreeMap<>();
configurations.put("hdfs-site", hdfsSite);
execCmd.setConfigurations(configurations);
Map<String, Map<String, Map<String, String>>> configurationAttributes =
- new TreeMap<String, Map<String, Map<String, String>>>();
- Map<String, Map<String, String>> hdfsSiteAttributes = new TreeMap<String, Map<String, String>>();
- Map<String, String> finalAttribute = new TreeMap<String, String>();
+ new TreeMap<>();
+ Map<String, Map<String, String>> hdfsSiteAttributes = new TreeMap<>();
+ Map<String, String> finalAttribute = new TreeMap<>();
finalAttribute.put("dfs.block.size", "true");
hdfsSiteAttributes.put("final", finalAttribute);
configurationAttributes.put("hdfsSite", hdfsSiteAttributes);
execCmd.setConfigurationAttributes(configurationAttributes);
- Map<String, String> params = new TreeMap<String, String>();
+ Map<String, String> params = new TreeMap<>();
params.put("jdklocation", "/x/y/z");
params.put("stack_version", "1.2.0");
params.put("stack_name", "HDP");
execCmd.setHostLevelParams(params);
- Map<String, String> roleParams = new TreeMap<String, String>();
+ Map<String, String> roleParams = new TreeMap<>();
roleParams.put("format", "false");
execCmd.setRoleParams(roleParams);
- Map<String, String> commandParams = new TreeMap<String, String>();
+ Map<String, String> commandParams = new TreeMap<>();
commandParams.put(ExecutionCommand.KeyNames.COMMAND_TIMEOUT, "600");
execCmd.setCommandParams(commandParams);
return s;
@@ -266,10 +266,10 @@ public class StageUtils {
public static Map<String, Set<String>> getClusterHostInfo(Cluster cluster) throws AmbariException {
//Fill hosts and ports lists
- Set<String> hostsSet = new LinkedHashSet<String>();
- List<Integer> portsList = new ArrayList<Integer>();
- List<String> rackList = new ArrayList<String>();
- List<String> ipV4List = new ArrayList<String>();
+ Set<String> hostsSet = new LinkedHashSet<>();
+ List<Integer> portsList = new ArrayList<>();
+ List<String> rackList = new ArrayList<>();
+ List<String> ipV4List = new ArrayList<>();
Collection<Host> allHosts = cluster.getHosts();
for (Host host : allHosts) {
@@ -297,11 +297,11 @@ public class StageUtils {
}
}
- List<String> hostsList = new ArrayList<String>(hostsSet);
- Map<String, String> additionalComponentToClusterInfoKeyMap = new HashMap<String, String>();
+ List<String> hostsList = new ArrayList<>(hostsSet);
+ Map<String, String> additionalComponentToClusterInfoKeyMap = new HashMap<>();
// Fill hosts for services
- Map<String, SortedSet<Integer>> hostRolesInfo = new HashMap<String, SortedSet<Integer>>();
+ Map<String, SortedSet<Integer>> hostRolesInfo = new HashMap<>();
for (Map.Entry<String, Service> serviceEntry : cluster.getServices().entrySet()) {
Service service = serviceEntry.getValue();
@@ -332,7 +332,7 @@ public class StageUtils {
SortedSet<Integer> hostsForComponentsHost = hostRolesInfo.get(roleName);
if (hostsForComponentsHost == null) {
- hostsForComponentsHost = new TreeSet<Integer>();
+ hostsForComponentsHost = new TreeSet<>();
hostRolesInfo.put(roleName, hostsForComponentsHost);
}
@@ -347,7 +347,7 @@ public class StageUtils {
SortedSet<Integer> hostsForComponentsHost = hostRolesInfo.get(decomRoleName);
if (hostsForComponentsHost == null) {
- hostsForComponentsHost = new TreeSet<Integer>();
+ hostsForComponentsHost = new TreeSet<>();
hostRolesInfo.put(decomRoleName, hostsForComponentsHost);
}
@@ -387,7 +387,7 @@ public class StageUtils {
SortedSet<Integer> hostsForComponentsHost = hostRolesInfo.get(roleName);
if (hostsForComponentsHost == null) {
- hostsForComponentsHost = new TreeSet<Integer>();
+ hostsForComponentsHost = new TreeSet<>();
hostRolesInfo.put(roleName, hostsForComponentsHost);
}
@@ -406,10 +406,10 @@ public class StageUtils {
}
}
- Map<String, Set<String>> clusterHostInfo = new HashMap<String, Set<String>>();
+ Map<String, Set<String>> clusterHostInfo = new HashMap<>();
for (Map.Entry<String, SortedSet<Integer>> entry : hostRolesInfo.entrySet()) {
- TreeSet<Integer> sortedSet = new TreeSet<Integer>(entry.getValue());
+ TreeSet<Integer> sortedSet = new TreeSet<>(entry.getValue());
Set<String> replacedRangesSet = replaceRanges(sortedSet);
@@ -452,7 +452,7 @@ public class StageUtils {
* @throws AmbariException if an index fails to map to a host name
*/
public static Map<String, Set<String>> substituteHostIndexes(Map<String, Set<String>> clusterHostInfo) throws AmbariException {
- Set<String> keysToSkip = new HashSet<String>(Arrays.asList(HOSTS_LIST, PORTS, AMBARI_SERVER_HOST, AMBARI_SERVER_PORT, AMBARI_SERVER_USE_SSL, RACKS, IPV4_ADDRESSES));
+ Set<String> keysToSkip = new HashSet<>(Arrays.asList(HOSTS_LIST, PORTS, AMBARI_SERVER_HOST, AMBARI_SERVER_PORT, AMBARI_SERVER_USE_SSL, RACKS, IPV4_ADDRESSES));
String[] allHosts = {};
if (clusterHostInfo.get(HOSTS_LIST) != null) {
allHosts = clusterHostInfo.get(HOSTS_LIST).toArray(new String[clusterHostInfo.get(HOSTS_LIST).size()]);
@@ -462,7 +462,7 @@ public class StageUtils {
if (keysToSkip.contains(key)) {
continue;
}
- Set<String> hosts = new HashSet<String>();
+ Set<String> hosts = new HashSet<>();
Set<String> currentHostsIndexes = clusterHostInfo.get(key);
if (currentHostsIndexes == null) {
continue;
@@ -497,7 +497,7 @@ public class StageUtils {
return null;
}
- Set<String> rangedSet = new HashSet<String>();
+ Set<String> rangedSet = new HashSet<>();
Integer prevElement = null;
Integer startOfRange = set.first();
@@ -528,7 +528,7 @@ public class StageUtils {
*/
public static <T> Set<String> replaceMappedRanges(List<T> values) {
- Map<T, SortedSet<Integer>> convolutedValues = new HashMap<T, SortedSet<Integer>>();
+ Map<T, SortedSet<Integer>> convolutedValues = new HashMap<>();
int valueIndex = 0;
@@ -537,14 +537,14 @@ public class StageUtils {
SortedSet<Integer> correspValues = convolutedValues.get(value);
if (correspValues == null) {
- correspValues = new TreeSet<Integer>();
+ correspValues = new TreeSet<>();
convolutedValues.put(value, correspValues);
}
correspValues.add(valueIndex);
valueIndex++;
}
- Set<String> result = new HashSet<String>();
+ Set<String> result = new HashSet<>();
for (Entry<T, SortedSet<Integer>> entry : convolutedValues.entrySet()) {
Set<String> replacedRanges = replaceRanges(entry.getValue());
@@ -567,7 +567,7 @@ public class StageUtils {
* @return a set of integers representing the original range
*/
private static Set<Integer> rangeToSet(String range) {
- Set<Integer> indexSet = new HashSet<Integer>();
+ Set<Integer> indexSet = new HashSet<>();
int startIndex;
int endIndex;
if (range.contains("-")) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/utils/VersionUtils.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/utils/VersionUtils.java b/ambari-server/src/main/java/org/apache/ambari/server/utils/VersionUtils.java
index af0e030..bd4c058 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/utils/VersionUtils.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/utils/VersionUtils.java
@@ -88,8 +88,8 @@ public class VersionUtils {
int length = Math.max(version1Parts.length, version2Parts.length);
length = maxLengthToCompare == 0 || maxLengthToCompare > length ? length : maxLengthToCompare;
- List<Integer> stack1Parts = new ArrayList<Integer>();
- List<Integer> stack2Parts = new ArrayList<Integer>();
+ List<Integer> stack1Parts = new ArrayList<>();
+ List<Integer> stack2Parts = new ArrayList<>();
for (int i = 0; i < length; i++) {
// Robust enough to handle strings in the version
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/view/ClusterImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ClusterImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ClusterImpl.java
index 9b2f38f..b172a4c 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ClusterImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ClusterImpl.java
@@ -75,7 +75,7 @@ public class ClusterImpl implements Cluster {
@Override
public List<String> getHostsForServiceComponent(String serviceName, String componentName){
List<ServiceComponentHost> serviceComponentHosts = cluster.getServiceComponentHosts(serviceName, componentName);
- List<String> hosts = new ArrayList<String>();
+ List<String> hosts = new ArrayList<>();
for (ServiceComponentHost serviceComponentHost : serviceComponentHosts) {
hosts.add(serviceComponentHost.getHostName());
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/view/RemoteAmbariCluster.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/RemoteAmbariCluster.java b/ambari-server/src/main/java/org/apache/ambari/server/view/RemoteAmbariCluster.java
index 9f9f3b8..04937a5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/RemoteAmbariCluster.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/RemoteAmbariCluster.java
@@ -193,7 +193,7 @@ public class RemoteAmbariCluster implements Cluster {
String url = String.format("%s/services/%s/components/%s?" +
"fields=host_components/HostRoles/host_name", this.clusterPath, serviceName, componentName);
- List<String> hosts = new ArrayList<String>();
+ List<String> hosts = new ArrayList<>();
try {
JsonElement response = configurationCache.get(url);
@@ -223,7 +223,7 @@ public class RemoteAmbariCluster implements Cluster {
* @return list of services Available on cluster
*/
public Set<String> getServices() throws IOException, AmbariHttpException {
- Set<String> services = new HashSet<String>();
+ Set<String> services = new HashSet<>();
String path = this.clusterPath + "?fields=services/ServiceInfo/service_name";
JsonElement config = configurationCache.getUnchecked(path);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/view/RemoteAmbariClusterRegistry.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/RemoteAmbariClusterRegistry.java b/ambari-server/src/main/java/org/apache/ambari/server/view/RemoteAmbariClusterRegistry.java
index c8e00c3..44fa58a 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/RemoteAmbariClusterRegistry.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/RemoteAmbariClusterRegistry.java
@@ -42,7 +42,7 @@ import org.apache.ambari.view.AmbariHttpException;
@Singleton
public class RemoteAmbariClusterRegistry {
- private ConcurrentHashMap<Long,RemoteAmbariCluster> clusterMap = new ConcurrentHashMap<Long,RemoteAmbariCluster>();
+ private ConcurrentHashMap<Long,RemoteAmbariCluster> clusterMap = new ConcurrentHashMap<>();
@Inject
private RemoteAmbariClusterDAO remoteAmbariClusterDAO;
@@ -108,7 +108,7 @@ public class RemoteAmbariClusterRegistry {
throw new AmbariException("User must be Ambari or Cluster Adminstrator.");
}
- Collection<RemoteAmbariClusterServiceEntity> serviceEntities = new ArrayList<RemoteAmbariClusterServiceEntity>();
+ Collection<RemoteAmbariClusterServiceEntity> serviceEntities = new ArrayList<>();
for (String service : services) {
RemoteAmbariClusterServiceEntity serviceEntity = new RemoteAmbariClusterServiceEntity();
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/view/RemoteAmbariStreamProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/RemoteAmbariStreamProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/view/RemoteAmbariStreamProvider.java
index 7b38cae..162f07e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/RemoteAmbariStreamProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/RemoteAmbariStreamProvider.java
@@ -90,7 +90,7 @@ public class RemoteAmbariStreamProvider implements AmbariStreamProvider {
}
private Map<String,List<String>> modifyHeaders(Map<String,String> headers){
- Map<String, List<String>> headerMap = new HashMap<String, List<String>>();
+ Map<String, List<String>> headerMap = new HashMap<>();
for (Map.Entry<String, String> entry : headers.entrySet()) {
headerMap.put(entry.getKey(), Collections.singletonList(entry.getValue()));
}
@@ -98,7 +98,7 @@ public class RemoteAmbariStreamProvider implements AmbariStreamProvider {
}
private Map<String, List<String>> addHeaders(Map<String, String> customHeaders) {
- HashMap<String, String> newHeaders = new HashMap<String, String>();
+ HashMap<String, String> newHeaders = new HashMap<>();
if (customHeaders != null)
newHeaders.putAll(customHeaders);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/view/ViewAmbariStreamProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewAmbariStreamProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewAmbariStreamProvider.java
index 5dc8e31..715774d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewAmbariStreamProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewAmbariStreamProvider.java
@@ -106,7 +106,7 @@ public class ViewAmbariStreamProvider implements AmbariStreamProvider {
if (headers == null || headers.isEmpty()) {
headers = Collections.singletonMap(URLStreamProvider.COOKIE, ambariSessionCookie);
} else {
- headers = new HashMap<String, String>(headers);
+ headers = new HashMap<>(headers);
String cookies = headers.get(URLStreamProvider.COOKIE);
@@ -115,7 +115,7 @@ public class ViewAmbariStreamProvider implements AmbariStreamProvider {
}
// adapt the headers for the internal URLStreamProvider signature
- Map<String, List<String>> headerMap = new HashMap<String, List<String>>();
+ Map<String, List<String>> headerMap = new HashMap<>();
for (Map.Entry<String, String> entry : headers.entrySet()) {
headerMap.put(entry.getKey(), Collections.singletonList(entry.getValue()));
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java
index ecb5ed9..5b8e046 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewContextImpl.java
@@ -344,7 +344,7 @@ public class ViewContextImpl implements ViewContext, ViewController {
@Override
public Collection<ViewInstanceDefinition> getViewInstanceDefinitions() {
- Collection<ViewInstanceEntity> instanceDefinitions = new HashSet<ViewInstanceEntity>();
+ Collection<ViewInstanceEntity> instanceDefinitions = new HashSet<>();
for (ViewEntity viewEntity : viewRegistry.getDefinitions()) {
instanceDefinitions.addAll(viewRegistry.getInstanceDefinitions(viewEntity));
}
@@ -429,7 +429,7 @@ public class ViewContextImpl implements ViewContext, ViewController {
private Map<String, String> getPropertyValues() {
Map<String, String> properties = viewInstanceEntity.getPropertyMap();
- Map<String, ParameterConfig> parameters = new HashMap<String, ParameterConfig>();
+ Map<String, ParameterConfig> parameters = new HashMap<>();
for (ParameterConfig paramConfig : viewEntity.getConfiguration().getParameters()) {
parameters.put(paramConfig.getName(), paramConfig);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExternalSubResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExternalSubResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExternalSubResourceProvider.java
index a09d9ef..c8c8cad 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExternalSubResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExternalSubResourceProvider.java
@@ -60,7 +60,7 @@ public class ViewExternalSubResourceProvider extends AbstractResourceProvider {
/**
* The names of the external resources for the view.
*/
- private final Set<String> resourceNames = new HashSet<String>();
+ private final Set<String> resourceNames = new HashSet<>();
/**
* The set of key property ids.
@@ -85,7 +85,7 @@ public class ViewExternalSubResourceProvider extends AbstractResourceProvider {
super(_getPropertyIds(), _getKeyPropertyIds(type));
this.type = type;
- this.pkPropertyIds = new HashSet<String>(getKeyPropertyIds().values());
+ this.pkPropertyIds = new HashSet<>(getKeyPropertyIds().values());
this.viewDefinition = viewDefinition;
}
@@ -101,9 +101,9 @@ public class ViewExternalSubResourceProvider extends AbstractResourceProvider {
throws SystemException, UnsupportedPropertyException,
NoSuchResourceException, NoSuchParentResourceException {
- Set<Resource> resourceSet = new HashSet<Resource>();
+ Set<Resource> resourceSet = new HashSet<>();
- Set<ViewInstanceEntity> instanceDefinitions = new HashSet<ViewInstanceEntity>();
+ Set<ViewInstanceEntity> instanceDefinitions = new HashSet<>();
Set<Map<String, Object>> propertyMaps = getPropertyMaps(predicate);
int size = propertyMaps.size();
@@ -176,7 +176,7 @@ public class ViewExternalSubResourceProvider extends AbstractResourceProvider {
// get the key property ids for the resource
private static Map<Resource.Type, String> _getKeyPropertyIds(Resource.Type type) {
- Map<Resource.Type, String> keyPropertyIds = new HashMap<Resource.Type, String>();
+ Map<Resource.Type, String> keyPropertyIds = new HashMap<>();
keyPropertyIds.put(Resource.Type.View, VIEW_NAME_PROPERTY_ID);
keyPropertyIds.put(Resource.Type.ViewVersion, VIEW_VERSION_PROPERTY_ID);
@@ -188,7 +188,7 @@ public class ViewExternalSubResourceProvider extends AbstractResourceProvider {
// get the property ids for the resource
private static Set<String> _getPropertyIds() {
- Set<String> propertyIds = new HashSet<String>();
+ Set<String> propertyIds = new HashSet<>();
propertyIds.add(INSTANCE_NAME_PROPERTY_ID);
propertyIds.add(VIEW_NAME_PROPERTY_ID);
propertyIds.add(VIEW_VERSION_PROPERTY_ID);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java
index 27f9cf5..65332a3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewExtractor.java
@@ -192,7 +192,7 @@ public class ViewExtractor {
throws IOException {
String archivePath = archiveDir.getAbsolutePath();
- List<URL> urlList = new LinkedList<URL>();
+ List<URL> urlList = new LinkedList<>();
// include the classes directory
String classesPath = archivePath + File.separator + ARCHIVE_CLASSES_DIR;
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
index bc3e721..5b58abc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewRegistry.java
@@ -168,31 +168,31 @@ public class ViewRegistry {
/**
* Mapping of view names to view definitions.
*/
- private Map<String, ViewEntity> viewDefinitions = new HashMap<String, ViewEntity>();
+ private Map<String, ViewEntity> viewDefinitions = new HashMap<>();
/**
* Mapping of view instances to view definition and instance name.
*/
private Map<ViewEntity, Map<String, ViewInstanceEntity>> viewInstanceDefinitions =
- new HashMap<ViewEntity, Map<String, ViewInstanceEntity>>();
+ new HashMap<>();
/**
* Mapping of view names to sub-resources.
*/
private final Map<String, Set<SubResourceDefinition>> subResourceDefinitionsMap =
- new ConcurrentHashMap<String, Set<SubResourceDefinition>>();
+ new ConcurrentHashMap<>();
/**
* Mapping of view types to resource providers.
*/
private final Map<Resource.Type, ResourceProvider> resourceProviders =
- new ConcurrentHashMap<Resource.Type, ResourceProvider>();
+ new ConcurrentHashMap<>();
/**
* Mapping of view names to registered listeners.
*/
private final Map<String, Set<Listener>> listeners =
- new ConcurrentHashMap<String, Set<Listener>>();
+ new ConcurrentHashMap<>();
/**
* The singleton view registry instance.
@@ -454,7 +454,7 @@ public class ViewRegistry {
public void addInstanceDefinition(ViewEntity definition, ViewInstanceEntity instanceDefinition) {
Map<String, ViewInstanceEntity> instanceDefinitions = viewInstanceDefinitions.get(definition);
if (instanceDefinitions == null) {
- instanceDefinitions = new HashMap<String, ViewInstanceEntity>();
+ instanceDefinitions = new HashMap<>();
viewInstanceDefinitions.put(definition, instanceDefinitions);
}
@@ -902,7 +902,7 @@ public class ViewRegistry {
try {
Masker masker = getMasker(viewConfig.getMaskerClass(classLoader));
- Map<String, ParameterConfig> parameterConfigMap = new HashMap<String, ParameterConfig>();
+ Map<String, ParameterConfig> parameterConfigMap = new HashMap<>();
for (ParameterConfig paramConfig : viewConfig.getParameters()) {
parameterConfigMap.put(paramConfig.getName(), paramConfig);
}
@@ -1155,7 +1155,7 @@ public class ViewRegistry {
List<ParameterConfig> parameterConfigurations = viewConfig.getParameters();
- Collection<ViewParameterEntity> parameters = new HashSet<ViewParameterEntity>();
+ Collection<ViewParameterEntity> parameters = new HashSet<>();
String viewName = viewDefinition.getName();
@@ -1189,7 +1189,7 @@ public class ViewRegistry {
ResourceInstanceFactoryImpl.addResourceDefinition(externalResourceType,
new ViewExternalSubResourceDefinition(externalResourceType));
- Collection<ViewResourceEntity> resources = new HashSet<ViewResourceEntity>();
+ Collection<ViewResourceEntity> resources = new HashSet<>();
for (ResourceConfig resourceConfiguration : resourceConfigurations) {
ViewResourceEntity viewResourceEntity = new ViewResourceEntity();
@@ -1233,7 +1233,7 @@ public class ViewRegistry {
List<PermissionConfig> permissionConfigurations = viewConfig.getPermissions();
- Collection<PermissionEntity> permissions = new HashSet<PermissionEntity>();
+ Collection<PermissionEntity> permissions = new HashSet<>();
for (PermissionConfig permissionConfiguration : permissionConfigurations) {
PermissionEntity permissionEntity = new PermissionEntity();
@@ -1255,7 +1255,7 @@ public class ViewRegistry {
viewDefinition.setValidator(validator);
viewDefinition.setMask(viewConfig.getMasker());
- Set<SubResourceDefinition> subResourceDefinitions = new HashSet<SubResourceDefinition>();
+ Set<SubResourceDefinition> subResourceDefinitions = new HashSet<>();
for (Resource.Type type : viewDefinition.getViewResourceTypes()) {
subResourceDefinitions.add(new SubResourceDefinition(type));
}
@@ -1282,7 +1282,7 @@ public class ViewRegistry {
ViewInstanceEntity viewInstanceDefinition =
new ViewInstanceEntity(viewDefinition, instanceConfig);
- Map<String, String> properties = new HashMap<String, String>();
+ Map<String, String> properties = new HashMap<>();
for (PropertyConfig propertyConfig : instanceConfig.getProperties()) {
properties.put(propertyConfig.getKey(), propertyConfig.getValue());
@@ -1335,7 +1335,7 @@ public class ViewRegistry {
ViewEntity viewDefinition = viewInstanceDefinition.getViewEntity();
ViewConfig viewConfig = viewDefinition.getConfiguration();
- Collection<ViewEntityEntity> entities = new HashSet<ViewEntityEntity>();
+ Collection<ViewEntityEntity> entities = new HashSet<>();
if (viewConfig != null) {
PersistenceConfig persistenceConfig = viewConfig.getPersistence();
@@ -1686,7 +1686,7 @@ public class ViewRegistry {
if (files != null) {
- Set<Runnable> extractionRunnables = new HashSet<Runnable>();
+ Set<Runnable> extractionRunnables = new HashSet<>();
final String serverVersion = ambariMetaInfoProvider.get().getServerVersion();
@@ -1791,7 +1791,7 @@ public class ViewRegistry {
if (checkViewVersions(viewDefinition, serverVersion)) {
setupViewDefinition(viewDefinition, cl);
- Set<ViewInstanceEntity> instanceDefinitions = new HashSet<ViewInstanceEntity>();
+ Set<ViewInstanceEntity> instanceDefinitions = new HashSet<>();
for (InstanceConfig instanceConfig : viewConfig.getInstances()) {
ViewInstanceEntity instanceEntity = createViewInstanceDefinition(viewConfig, viewDefinition, instanceConfig);
@@ -2098,7 +2098,7 @@ public class ViewRegistry {
// Get the view extraction thread pool
private static synchronized ExecutorService getExecutorService(Configuration configuration) {
if (executorService == null) {
- LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<Runnable>();
+ LinkedBlockingQueue<Runnable> queue = new LinkedBlockingQueue<>();
ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(
configuration.getViewExtractionThreadPoolCoreSize(),
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/view/ViewSubResourceDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewSubResourceDefinition.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewSubResourceDefinition.java
index 85ea1fb..3c57332 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewSubResourceDefinition.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewSubResourceDefinition.java
@@ -79,7 +79,7 @@ public class ViewSubResourceDefinition extends BaseResourceDefinition {
@Override
public synchronized Set<SubResourceDefinition> getSubResourceDefinitions() {
if (definitions == null) {
- definitions = new HashSet<SubResourceDefinition>();
+ definitions = new HashSet<>();
List<String> subResourceNames = resourceConfiguration.getSubResourceNames();
if (subResourceNames != null) {
for (String subType : subResourceNames) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/view/ViewSubResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewSubResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewSubResourceProvider.java
index 040b4dd..f2381cd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewSubResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewSubResourceProvider.java
@@ -85,7 +85,7 @@ public class ViewSubResourceProvider extends AbstractResourceProvider {
super(discoverPropertyIds(clazz), getKeyPropertyIds(pkField, type));
this.pkField = pkField;
this.viewDefinition = viewDefinition;
- this.pkPropertyIds = new HashSet<String>(getKeyPropertyIds().values());
+ this.pkPropertyIds = new HashSet<>(getKeyPropertyIds().values());
this.type = type;
this.descriptorMap = getDescriptorMap(clazz);
}
@@ -125,7 +125,7 @@ public class ViewSubResourceProvider extends AbstractResourceProvider {
Set<String> requestedIds = getRequestPropertyIds(request, predicate);
- Set<ViewInstanceEntity> instanceDefinitions = new HashSet<ViewInstanceEntity>();
+ Set<ViewInstanceEntity> instanceDefinitions = new HashSet<>();
try {
@@ -158,7 +158,7 @@ public class ViewSubResourceProvider extends AbstractResourceProvider {
}
}
- Set<Resource> results = new HashSet<Resource>();
+ Set<Resource> results = new HashSet<>();
ReadRequest readRequest = new ViewReadRequest(request, requestedIds, predicate == null ? "" : predicate.toString());
for (ViewInstanceEntity instanceDefinition : instanceDefinitions) {
@@ -274,7 +274,7 @@ public class ViewSubResourceProvider extends AbstractResourceProvider {
// discover the property ids for the given bean class
private static Set<String> discoverPropertyIds(Class<?> clazz) throws IntrospectionException {
- Set<String> propertyIds = new HashSet<String>(getDescriptorMap(clazz).keySet());
+ Set<String> propertyIds = new HashSet<>(getDescriptorMap(clazz).keySet());
propertyIds.add(INSTANCE_NAME_PROPERTY_ID);
propertyIds.add(VIEW_NAME_PROPERTY_ID);
propertyIds.add(VIEW_VERSION_PROPERTY_ID);
@@ -284,7 +284,7 @@ public class ViewSubResourceProvider extends AbstractResourceProvider {
// get a descriptor map for the given bean class
private static Map<String, PropertyDescriptor> getDescriptorMap(Class<?> clazz) throws IntrospectionException {
- Map<String, PropertyDescriptor> descriptorMap = new HashMap<String, PropertyDescriptor>();
+ Map<String, PropertyDescriptor> descriptorMap = new HashMap<>();
for (PropertyDescriptor pd : Introspector.getBeanInfo(clazz).getPropertyDescriptors()) {
String name = pd.getName();
@@ -298,7 +298,7 @@ public class ViewSubResourceProvider extends AbstractResourceProvider {
// get the key property ids for the resource
private static Map<Resource.Type, String> getKeyPropertyIds(String pkField, Resource.Type type) {
- Map<Resource.Type, String> keyPropertyIds = new HashMap<Resource.Type, String>();
+ Map<Resource.Type, String> keyPropertyIds = new HashMap<>();
keyPropertyIds.put(Resource.Type.View, VIEW_NAME_PROPERTY_ID);
keyPropertyIds.put(Resource.Type.ViewVersion, VIEW_VERSION_PROPERTY_ID);
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java
index 2d7d8a6..4fdd6dc 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/ViewURLStreamProvider.java
@@ -232,7 +232,7 @@ public class ViewURLStreamProvider implements org.apache.ambari.view.URLStreamPr
// adapt the headers to the internal URLStreamProvider processURL signature
- Map<String, List<String>> headerMap = new HashMap<String, List<String>>();
+ Map<String, List<String>> headerMap = new HashMap<>();
for (Map.Entry<String, String> entry : headers.entrySet()) {
headerMap.put(entry.getKey(), Collections.singletonList(entry.getValue()));
}
@@ -314,7 +314,7 @@ public class ViewURLStreamProvider implements org.apache.ambari.view.URLStreamPr
*/
private void initializeAllowedHostPorts() {
boolean proxyCallRestricted = false;
- Map<String, HashSet<String>> allowed = new HashMap<String, HashSet<String>>();
+ Map<String, HashSet<String>> allowed = new HashMap<>();
if (StringUtils.isNotBlank(allowedHostPortsValue)) {
String allowedStr = allowedHostPortsValue.toLowerCase();
if (!allowedStr.equals(Configuration.PROXY_ALLOWED_HOST_PORTS.getDefaultValue())) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/main/java/org/apache/ambari/server/view/persistence/DataStoreImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/view/persistence/DataStoreImpl.java b/ambari-server/src/main/java/org/apache/ambari/server/view/persistence/DataStoreImpl.java
index 3a69e06..e03f7a3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/view/persistence/DataStoreImpl.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/view/persistence/DataStoreImpl.java
@@ -99,17 +99,17 @@ public class DataStoreImpl implements DataStore {
/**
* Map of dynamic entity names keyed by view entity class.
*/
- private final Map<Class, String> entityClassMap = new LinkedHashMap<Class, String>();
+ private final Map<Class, String> entityClassMap = new LinkedHashMap<>();
/**
* Map of entity primary key fields keyed by dynamic entity name.
*/
- private final Map<String, ViewEntityEntity> entityMap = new LinkedHashMap<String, ViewEntityEntity>();
+ private final Map<String, ViewEntityEntity> entityMap = new LinkedHashMap<>();
/**
* Map of dynamic entity type builders keyed by dynamic entity name.
*/
- private final Map<String, JPADynamicTypeBuilder> typeBuilderMap = new LinkedHashMap<String, JPADynamicTypeBuilder>();
+ private final Map<String, JPADynamicTypeBuilder> typeBuilderMap = new LinkedHashMap<>();
/**
* Indicates whether or not the data store has been initialized.
@@ -150,7 +150,7 @@ public class DataStoreImpl implements DataStore {
DynamicEntity dynamicEntity = persistEntity(entity, em, new HashSet<DynamicEntity>());
em.getTransaction().commit();
Map<String, Object> props = getEntityProperties(entity);
- List<String> keys = new ArrayList<String>(props.keySet());
+ List<String> keys = new ArrayList<>(props.keySet());
for( String key : keys){
String attribute = getAttributeName(key);
try {
@@ -233,7 +233,7 @@ public class DataStoreImpl implements DataStore {
EntityManager em = getEntityManager();
try {
- Collection<T> resources = new HashSet<T>();
+ Collection<T> resources = new HashSet<>();
DynamicType type = getDynamicEntityType(clazz);
if (type != null) {
@@ -485,7 +485,7 @@ public class DataStoreImpl implements DataStore {
IllegalAccessException, InstantiationException, NoSuchFieldException {
T resource = clazz.newInstance();
- Map<String, Object> properties = new HashMap<String, Object>();
+ Map<String, Object> properties = new HashMap<>();
for (String attributeName : type.getPropertiesNames()) {
String fieldName = getFieldName(attributeName);
@@ -528,7 +528,7 @@ public class DataStoreImpl implements DataStore {
// get a map of properties from the given view entity
private Map<String, Object> getEntityProperties(Object entity)
throws IntrospectionException, InvocationTargetException, IllegalAccessException {
- Map<String, Object> properties = new HashMap<String, Object>();
+ Map<String, Object> properties = new HashMap<>();
for (PropertyDescriptor pd : Introspector.getBeanInfo(entity.getClass()).getPropertyDescriptors()) {
String name = pd.getName();
@@ -555,7 +555,7 @@ public class DataStoreImpl implements DataStore {
Object value = properties.get(name);
if (value instanceof Collection) {
- Set<Object> newCollection = new HashSet<Object>();
+ Set<Object> newCollection = new HashSet<>();
for (Object collectionValue: (Collection)value) {
@@ -613,7 +613,7 @@ public class DataStoreImpl implements DataStore {
// get a descriptor map for the given bean class
private static Map<String, PropertyDescriptor> getDescriptorMap(Class<?> clazz) throws IntrospectionException {
- Map<String, PropertyDescriptor> descriptorMap = new HashMap<String, PropertyDescriptor>();
+ Map<String, PropertyDescriptor> descriptorMap = new HashMap<>();
for (PropertyDescriptor pd : Introspector.getBeanInfo(clazz).getPropertyDescriptors()) {
String name = pd.getName();
@@ -626,7 +626,7 @@ public class DataStoreImpl implements DataStore {
// get the property names for the given view entity class
private static Set<String> getPropertyNames(Class clazz) throws IntrospectionException {
- Set<String> propertyNames = new HashSet<String>();
+ Set<String> propertyNames = new HashSet<>();
for (PropertyDescriptor pd : Introspector.getBeanInfo(clazz).getPropertyDescriptors()) {
propertyNames.add(pd.getName());
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
index 893c3fb..89ec32b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/ExecutionCommandWrapperTest.java
@@ -109,25 +109,25 @@ public class ExecutionCommandWrapperTest {
Cluster cluster1 = clusters.getCluster(CLUSTER1);
- SERVICE_SITE_CLUSTER = new HashMap<String, String>();
+ SERVICE_SITE_CLUSTER = new HashMap<>();
SERVICE_SITE_CLUSTER.put(SERVICE_SITE_NAME1, SERVICE_SITE_VAL1);
SERVICE_SITE_CLUSTER.put(SERVICE_SITE_NAME2, SERVICE_SITE_VAL2);
SERVICE_SITE_CLUSTER.put(SERVICE_SITE_NAME3, SERVICE_SITE_VAL3);
SERVICE_SITE_CLUSTER.put(SERVICE_SITE_NAME4, SERVICE_SITE_VAL4);
- SERVICE_SITE_SERVICE = new HashMap<String, String>();
+ SERVICE_SITE_SERVICE = new HashMap<>();
SERVICE_SITE_SERVICE.put(SERVICE_SITE_NAME1, SERVICE_SITE_VAL1_S);
SERVICE_SITE_SERVICE.put(SERVICE_SITE_NAME5, SERVICE_SITE_VAL5_S);
- SERVICE_SITE_HOST = new HashMap<String, String>();
+ SERVICE_SITE_HOST = new HashMap<>();
SERVICE_SITE_HOST.put(SERVICE_SITE_NAME2, SERVICE_SITE_VAL2_H);
SERVICE_SITE_HOST.put(SERVICE_SITE_NAME6, SERVICE_SITE_VAL6_H);
- GLOBAL_CLUSTER = new HashMap<String, String>();
+ GLOBAL_CLUSTER = new HashMap<>();
GLOBAL_CLUSTER.put(GLOBAL_NAME1, GLOBAL_CLUSTER_VAL1);
GLOBAL_CLUSTER.put(GLOBAL_NAME2, GLOBAL_CLUSTER_VAL2);
- CONFIG_ATTRIBUTES = new HashMap<String, Map<String,String>>();
+ CONFIG_ATTRIBUTES = new HashMap<>();
//Cluster level global config
configFactory.createNew(cluster1, GLOBAL_CONFIG, CLUSTER_VERSION_TAG, GLOBAL_CLUSTER, CONFIG_ATTRIBUTES);
@@ -155,7 +155,7 @@ public class ExecutionCommandWrapperTest {
RoleCommand.START,
new ServiceComponentHostStartEvent(Role.NAMENODE.toString(),
hostName, System.currentTimeMillis()), clusterName, "HDFS", 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);
@@ -165,13 +165,13 @@ public class ExecutionCommandWrapperTest {
public void testGetExecutionCommand() throws JSONException, AmbariException {
- Map<String, Map<String, String>> confs = new HashMap<String, Map<String, String>>();
- Map<String, String> configurationsGlobal = new HashMap<String, String>();
+ Map<String, Map<String, String>> confs = new HashMap<>();
+ Map<String, String> configurationsGlobal = new HashMap<>();
configurationsGlobal.put(GLOBAL_NAME1, GLOBAL_VAL1);
confs.put(GLOBAL_CONFIG, configurationsGlobal);
- Map<String, Map<String, String>> confTags = new HashMap<String, Map<String, String>>();
- Map<String, String> confTagServiceSite = new HashMap<String, String>();
+ Map<String, Map<String, String>> confTags = new HashMap<>();
+ Map<String, String> confTagServiceSite = new HashMap<>();
confTagServiceSite.put("tag", CLUSTER_VERSION_TAG);
confTagServiceSite.put("service_override_tag", SERVICE_VERSION_TAG);
@@ -223,7 +223,7 @@ public class ExecutionCommandWrapperTest {
//Union of all keys of service site configs
- Set<String> serviceSiteKeys = new HashSet<String>();
+ Set<String> serviceSiteKeys = new HashSet<>();
serviceSiteKeys.addAll(SERVICE_SITE_CLUSTER.keySet());
serviceSiteKeys.addAll(SERVICE_SITE_SERVICE.keySet());
serviceSiteKeys.addAll(SERVICE_SITE_HOST.keySet());
@@ -234,7 +234,7 @@ public class ExecutionCommandWrapperTest {
@Test
public void testGetMergedConfig() {
- Map<String, String> baseConfig = new HashMap<String, String>();
+ Map<String, String> baseConfig = new HashMap<>();
baseConfig.put(SERVICE_SITE_NAME1, SERVICE_SITE_VAL1);
baseConfig.put(SERVICE_SITE_NAME2, SERVICE_SITE_VAL2);
@@ -242,7 +242,7 @@ public class ExecutionCommandWrapperTest {
baseConfig.put(SERVICE_SITE_NAME4, SERVICE_SITE_VAL4);
baseConfig.put(SERVICE_SITE_NAME5, SERVICE_SITE_VAL5);
- Map<String, String> overrideConfig = new HashMap<String, String>();
+ Map<String, String> overrideConfig = new HashMap<>();
overrideConfig.put(SERVICE_SITE_NAME2, SERVICE_SITE_VAL2_H);
overrideConfig.put(SERVICE_SITE_NAME6, SERVICE_SITE_VAL6_H);
@@ -252,7 +252,7 @@ public class ExecutionCommandWrapperTest {
overrideConfig);
- Set<String> configsKeys = new HashSet<String>();
+ Set<String> configsKeys = new HashSet<>();
configsKeys.addAll(baseConfig.keySet());
configsKeys.addAll(overrideConfig.keySet());
http://git-wip-us.apache.org/repos/asf/ambari/blob/edbb5492/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java
index edc5683..81eef3b 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionDBAccessorImpl.java
@@ -137,7 +137,7 @@ public class TestActionDBAccessorImpl {
Assert.assertEquals(stageId, stage.getStageId());
stage.setHostRoleStatus(hostname, "HBASE_MASTER", HostRoleStatus.QUEUED);
db.hostRoleScheduled(stage, hostname, "HBASE_MASTER");
- List<CommandReport> reports = new ArrayList<CommandReport>();
+ List<CommandReport> reports = new ArrayList<>();
CommandReport cr = new CommandReport();
cr.setTaskId(1);
cr.setActionId(StageUtils.getActionId(requestId, stageId));
@@ -165,7 +165,7 @@ public class TestActionDBAccessorImpl {
Assert.assertEquals(stageId, stage.getStageId());
stage.setHostRoleStatus(hostname, "HBASE_MASTER", HostRoleStatus.ABORTED);
db.hostRoleScheduled(stage, hostname, "HBASE_MASTER");
- List<CommandReport> reports = new ArrayList<CommandReport>();
+ List<CommandReport> reports = new ArrayList<>();
CommandReport cr = new CommandReport();
cr.setTaskId(1);
cr.setActionId(StageUtils.getActionId(requestId, stageId));
@@ -190,7 +190,7 @@ public class TestActionDBAccessorImpl {
@Test
public void testGetStagesInProgress() throws AmbariException {
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
stages.add(createStubStage(hostName, requestId, stageId));
stages.add(createStubStage(hostName, requestId, stageId + 1));
Request request = new Request(stages, clusters);
@@ -452,7 +452,7 @@ public class TestActionDBAccessorImpl {
@Test
public void testGetRequestsByStatus() throws AmbariException {
- List<Long> requestIds = new ArrayList<Long>();
+ List<Long> requestIds = new ArrayList<>();
requestIds.add(requestId + 1);
requestIds.add(requestId);
populateActionDB(db, hostName, requestId, stageId);
@@ -473,7 +473,7 @@ public class TestActionDBAccessorImpl {
*/
@Test
public void testGetCompletedRequests() throws AmbariException {
- List<Long> requestIds = new ArrayList<Long>();
+ List<Long> requestIds = new ArrayList<>();
requestIds.add(requestId);
requestIds.add(requestId + 1);
@@ -500,7 +500,7 @@ public class TestActionDBAccessorImpl {
@Test
public void testGetRequestsByStatusWithParams() throws AmbariException {
- List<Long> ids = new ArrayList<Long>();
+ List<Long> ids = new ArrayList<>();
for (long l = 1; l <= 10; l++) {
ids.add(l);
@@ -515,20 +515,20 @@ public class TestActionDBAccessorImpl {
// Select all requests
actual = db.getRequestsByStatus(null, BaseRequest.DEFAULT_PAGE_SIZE, false);
- expected = reverse(new ArrayList<Long>(ids));
+ expected = reverse(new ArrayList<>(ids));
assertEquals("Request IDs not matches", expected, actual);
actual = db.getRequestsByStatus(null, 4, false);
- expected = reverse(new ArrayList<Long>(ids.subList(ids.size() - 4, ids.size())));
+ expected = reverse(new ArrayList<>(ids.subList(ids.size() - 4, ids.size())));
assertEquals("Request IDs not matches", expected, actual);
actual = db.getRequestsByStatus(null, 7, true);
- expected = new ArrayList<Long>(ids.subList(0, 7));
+ expected = new ArrayList<>(ids.subList(0, 7));
assertEquals("Request IDs not matches", expected, actual);
}
private <T> List<T> reverse(List<T> list) {
- List<T> result = new ArrayList<T>(list);
+ List<T> result = new ArrayList<>(list);
Collections.reverse(result);
@@ -565,7 +565,7 @@ public class TestActionDBAccessorImpl {
RoleCommand.START,
new ServiceComponentHostStartEvent(Role.HBASE_REGIONSERVER
.toString(), "host4", System.currentTimeMillis()), "cluster1", "HBASE", false, false);
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
stages.add(s);
s.getOrderedHostRoleCommands().get(0).setStatus(HostRoleStatus.PENDING);
s.getOrderedHostRoleCommands().get(1).setStatus(HostRoleStatus.IN_PROGRESS);
@@ -579,7 +579,7 @@ public class TestActionDBAccessorImpl {
db.persistActions(request);
db.abortOperation(requestId);
- List<Long> aborted = new ArrayList<Long>();
+ List<Long> aborted = new ArrayList<>();
List<HostRoleCommand> commands = db.getRequestTasks(requestId);
for(HostRoleCommand command : commands) {
@@ -614,7 +614,7 @@ public class TestActionDBAccessorImpl {
*/
@Test
public void testEntitiesCreatedWithIDs() throws Exception {
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
Stage stage = createStubStage(hostName, requestId, stageId);
stages.add(stage);
@@ -678,7 +678,7 @@ public class TestActionDBAccessorImpl {
RoleCommand.START, null, "cluster1", "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);
@@ -687,7 +687,7 @@ public class TestActionDBAccessorImpl {
hostRoleCommandDAO.findByRequest(request.getRequestId());
assertEquals(1002, entities.size());
- List<Long> taskIds = new ArrayList<Long>();
+ List<Long> taskIds = new ArrayList<>();
for (HostRoleCommandEntity entity : entities) {
taskIds.add(entity.getTaskId());
}
@@ -706,7 +706,7 @@ public class TestActionDBAccessorImpl {
private void populateActionDB(ActionDBAccessor db, String hostname,
long requestId, long stageId) throws AmbariException {
Stage s = createStubStage(hostname, requestId, stageId);
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
stages.add(s);
Request request = new Request(stages, clusters);
db.persistActions(request);
@@ -716,7 +716,7 @@ public class TestActionDBAccessorImpl {
ActionDBAccessor db, String hostname, long requestId, long stageId)
throws AmbariException {
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
for (int i = 0; i < numberOfStages; i++) {
Stage stage = createStubStage(hostname, requestId, stageId + i);
stages.add(stage);
@@ -730,7 +730,7 @@ public class TestActionDBAccessorImpl {
long requestId, long stageId) throws AmbariException {
Stage s = createStubStage(hostname, requestId, stageId);
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
stages.add(s);
Request request = new Request(stages, clusters);
@@ -743,7 +743,7 @@ public class TestActionDBAccessorImpl {
long requestId, long stageId) throws AmbariException {
Stage s = createStubStage(hostname, requestId, stageId);
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
stages.add(s);
Request request = new Request(stages, clusters);
@@ -779,7 +779,7 @@ public class TestActionDBAccessorImpl {
RoleCommand.ACTIONEXECUTE,
new ServiceComponentHostStartEvent(Role.HBASE_MASTER.toString(),
hostname, System.currentTimeMillis()), "cluster1", "HBASE", false, false);
- List<Stage> stages = new ArrayList<Stage>();
+ List<Stage> stages = new ArrayList<>();
stages.add(s);
final RequestResourceFilter resourceFilter = new RequestResourceFilter("HBASE", "HBASE_MASTER", null);
List<RequestResourceFilter> resourceFilters = new
@@ -795,7 +795,7 @@ public class TestActionDBAccessorImpl {
s.setStageId(stageId);
s.addServerActionCommand(serverActionName, null, Role.AMBARI_SERVER_ACTION,
RoleCommand.ACTIONEXECUTE, clusterName, null, null, "command details", null, 300, 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/actionmanager/TestActionManager.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionManager.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionManager.java
index d5f2475..e12461d 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionManager.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionManager.java
@@ -102,7 +102,7 @@ public class TestActionManager {
Assert.assertEquals(stageId, stage.getStageId());
stage.setHostRoleStatus(hostname, "HBASE_MASTER", HostRoleStatus.QUEUED);
db.hostRoleScheduled(stage, hostname, "HBASE_MASTER");
- List<CommandReport> reports = new ArrayList<CommandReport>();
+ List<CommandReport> reports = new ArrayList<>();
CommandReport cr = new CommandReport();
cr.setTaskId(1);
cr.setActionId(StageUtils.getActionId(requestId, stageId));
@@ -143,7 +143,7 @@ public class TestActionManager {
Assert.assertEquals(stageId, stage.getStageId());
stage.setHostRoleStatus(hostname, "HBASE_MASTER", HostRoleStatus.QUEUED);
db.hostRoleScheduled(stage, hostname, "HBASE_MASTER");
- List<CommandReport> reports = new ArrayList<CommandReport>();
+ List<CommandReport> reports = new ArrayList<>();
CommandReport cr = new CommandReport();
cr.setTaskId(2);
cr.setActionId(StageUtils.getActionId(requestId, stageId));
@@ -180,7 +180,7 @@ public class TestActionManager {
Assert.assertEquals(stageId, stage.getStageId());
stage.setHostRoleStatus(hostname, "HBASE_MASTER", HostRoleStatus.QUEUED);
db.hostRoleScheduled(stage, hostname, "HBASE_MASTER");
- List<CommandReport> reports = new ArrayList<CommandReport>();
+ List<CommandReport> reports = new ArrayList<>();
CommandReport cr = new CommandReport();
cr.setTaskId(1);
cr.setActionId(StageUtils.getActionId(requestId, stageId));
@@ -219,7 +219,7 @@ public class TestActionManager {
RoleCommand.START,
new ServiceComponentHostStartEvent(Role.HBASE_MASTER.toString(),
hostname, System.currentTimeMillis()), "cluster1", "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);
@@ -236,7 +236,7 @@ public class TestActionManager {
RoleCommand.START,
new ServiceComponentHostStartEvent(Role.HBASE_REGIONSERVER.toString(),
hostname, System.currentTimeMillis()), "cluster1", "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);
@@ -270,7 +270,7 @@ public class TestActionManager {
Clusters clusters = createNiceMock(Clusters.class);
Stage stage1 = createNiceMock(Stage.class);
Stage stage2 = createNiceMock(Stage.class);
- List<Stage> listStages = new ArrayList<Stage>();
+ List<Stage> listStages = new ArrayList<>();
listStages.add(stage1);
listStages.add(stage2);