[testng] 184/355: Remove usage of deprecated methods

Eugene Zhukov eugene-guest at moszumanska.debian.org
Tue Aug 18 10:20:03 UTC 2015


This is an automated email from the git hooks/post-receive script.

eugene-guest pushed a commit to annotated tag OpenBSD
in repository testng.

commit 686e86e3395453eb841bce402bd8116a64b51655
Author: Julien Herr <julien.herr at alcatel-lucent.com>
Date:   Mon Apr 13 14:19:05 2015 +0200

    Remove usage of deprecated methods
---
 src/main/java/org/testng/DependencyMap.java                    | 3 +--
 src/main/java/org/testng/TestRunner.java                       | 8 ++++----
 src/main/java/org/testng/collections/ListMultiMap.java         | 3 ++-
 src/main/java/org/testng/internal/DynamicGraph.java            | 4 ++--
 src/main/java/org/testng/reporters/JqReporter.java             | 2 +-
 src/main/java/org/testng/reporters/jq/IgnoredMethodsPanel.java | 2 +-
 src/main/java/org/testng/reporters/jq/ResultsByClass.java      | 1 +
 src/main/java/org/testng/xml/Parameters.java                   | 5 +++--
 src/main/java/org/testng/xml/dom/XDom.java                     | 3 ++-
 9 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/src/main/java/org/testng/DependencyMap.java b/src/main/java/org/testng/DependencyMap.java
index 5318306..ae4f9ed 100644
--- a/src/main/java/org/testng/DependencyMap.java
+++ b/src/main/java/org/testng/DependencyMap.java
@@ -29,8 +29,7 @@ public class DependencyMap {
   }
 
   public List<ITestNGMethod> getMethodsThatBelongTo(String group, ITestNGMethod fromMethod) {
-    List<String> keys = m_groups.getKeys();
-    Set<String> uniqueKeys = Sets.newHashSet(keys);
+    Set<String> uniqueKeys = m_groups.keySet();
 
     List<ITestNGMethod> result = Lists.newArrayList();
 
diff --git a/src/main/java/org/testng/TestRunner.java b/src/main/java/org/testng/TestRunner.java
index 0a5bd36..2772445 100644
--- a/src/main/java/org/testng/TestRunner.java
+++ b/src/main/java/org/testng/TestRunner.java
@@ -894,7 +894,7 @@ public class TestRunner
     for (ITestNGMethod m : methods) {
       lmm.put(m.getInstance(), m);
     }
-    for (Map.Entry<Object, List<ITestNGMethod>> es : lmm.getEntrySet()) {
+    for (Map.Entry<Object, List<ITestNGMethod>> es : lmm.entrySet()) {
       List<IMethodInstance> methodInstances = Lists.newArrayList();
       for (ITestNGMethod m : es.getValue()) {
         methodInstances.add(new MethodInstance(m));
@@ -1102,7 +1102,7 @@ public class TestRunner
       ListMultiMap<ITestNGMethod, ITestNGMethod> classDependencies
           = createClassDependencies(methods, getCurrentXmlTest());
 
-      for (Map.Entry<ITestNGMethod, List<ITestNGMethod>> es : classDependencies.getEntrySet()) {
+      for (Map.Entry<ITestNGMethod, List<ITestNGMethod>> es : classDependencies.entrySet()) {
         for (ITestNGMethod dm : es.getValue()) {
           result.addEdge(dm, es.getKey());
         }
@@ -1114,7 +1114,7 @@ public class TestRunner
       ListMultiMap<ITestNGMethod, ITestNGMethod> instanceDependencies
           = createInstanceDependencies(methods, getCurrentXmlTest());
 
-      for (Map.Entry<ITestNGMethod, List<ITestNGMethod>> es : instanceDependencies.getEntrySet()) {
+      for (Map.Entry<ITestNGMethod, List<ITestNGMethod>> es : instanceDependencies.entrySet()) {
         for (ITestNGMethod dm : es.getValue()) {
           result.addEdge(dm, es.getKey());
         }
@@ -1135,7 +1135,7 @@ public class TestRunner
 
     ListMultiMap<ITestNGMethod, ITestNGMethod> result = Maps.newListMultiMap();
     Object previousInstance = null;
-    for (Map.Entry<Object, List<ITestNGMethod>> es : instanceMap.getEntrySet()) {
+    for (Map.Entry<Object, List<ITestNGMethod>> es : instanceMap.entrySet()) {
       if (previousInstance == null) {
         previousInstance = es.getKey();
       } else {
diff --git a/src/main/java/org/testng/collections/ListMultiMap.java b/src/main/java/org/testng/collections/ListMultiMap.java
index 1c7a8b2..88d27e6 100644
--- a/src/main/java/org/testng/collections/ListMultiMap.java
+++ b/src/main/java/org/testng/collections/ListMultiMap.java
@@ -112,7 +112,8 @@ public class ListMultiMap<K, V> {
     return result;
   }
 
+  @Deprecated
   public static <K, V> ListMultiMap<K, V> create() {
-    return new ListMultiMap<>();
+    return Maps.newListMultiMap();
   }
 }
diff --git a/src/main/java/org/testng/internal/DynamicGraph.java b/src/main/java/org/testng/internal/DynamicGraph.java
index 3cfaad6..26ef57e 100644
--- a/src/main/java/org/testng/internal/DynamicGraph.java
+++ b/src/main/java/org/testng/internal/DynamicGraph.java
@@ -159,7 +159,7 @@ public class DynamicGraph<T> {
     result.append("\n  Running:" + m_nodesRunning);
     result.append("\n  Finished:" + m_nodesFinished);
     result.append("\n  Edges:\n");
-    for (Map.Entry<T, List<T>> es : m_dependingOn.getEntrySet()) {
+    for (Map.Entry<T, List<T>> es : m_dependingOn.entrySet()) {
       result.append("     " + es.getKey() + "\n");
       for (T t : es.getValue()) {
         result.append("        " + t + "\n");
@@ -199,7 +199,7 @@ public class DynamicGraph<T> {
     }
     result.append("\n");
 
-    for (T k : m_dependingOn.getKeys()) {
+    for (T k : m_dependingOn.keySet()) {
       List<T> nodes = m_dependingOn.get(k);
       for (T n : nodes) {
         String dotted = m_nodesFinished.contains(k) ? "style=dotted" : "";
diff --git a/src/main/java/org/testng/reporters/JqReporter.java b/src/main/java/org/testng/reporters/JqReporter.java
index a1de95a..6e0cb15 100644
--- a/src/main/java/org/testng/reporters/JqReporter.java
+++ b/src/main/java/org/testng/reporters/JqReporter.java
@@ -152,7 +152,7 @@ public class JqReporter implements IReporter {
     xsb.pop(D);
 
     xsb.push(D, C, "test-content");
-    for (Class<?> c : map.getKeys()) {
+    for (Class<?> c : map.keySet()) {
       xsb.push(D, C, C);
       xsb.push(D, C, "class-header");
 
diff --git a/src/main/java/org/testng/reporters/jq/IgnoredMethodsPanel.java b/src/main/java/org/testng/reporters/jq/IgnoredMethodsPanel.java
index 767099c..41f35e3 100644
--- a/src/main/java/org/testng/reporters/jq/IgnoredMethodsPanel.java
+++ b/src/main/java/org/testng/reporters/jq/IgnoredMethodsPanel.java
@@ -32,7 +32,7 @@ public class IgnoredMethodsPanel extends BaseMultiSuitePanel {
       map.put(method.getTestClass().getRealClass(), method);
     }
 
-    for (Class<?> c : map.getKeys()) {
+    for (Class<?> c : map.keySet()) {
       xsb.push(D, C, "ignored-class-div");
       xsb.addRequired(S, c.getName(), C, "ignored-class-name");
       xsb.push(D, C, "ignored-methods-div");
diff --git a/src/main/java/org/testng/reporters/jq/ResultsByClass.java b/src/main/java/org/testng/reporters/jq/ResultsByClass.java
index a1536b7..6864b05 100644
--- a/src/main/java/org/testng/reporters/jq/ResultsByClass.java
+++ b/src/main/java/org/testng/reporters/jq/ResultsByClass.java
@@ -33,6 +33,7 @@ public class ResultsByClass {
   }
 
   public List<Class<?>> getClasses() {
+    // TODO do not use deprecated method
     return m_results.getKeys();
   }
 }
diff --git a/src/main/java/org/testng/xml/Parameters.java b/src/main/java/org/testng/xml/Parameters.java
index 2d87421..3c79901 100644
--- a/src/main/java/org/testng/xml/Parameters.java
+++ b/src/main/java/org/testng/xml/Parameters.java
@@ -1,6 +1,7 @@
 package org.testng.xml;
 
 import org.testng.collections.ListMultiMap;
+import org.testng.collections.Maps;
 
 import java.util.List;
 
@@ -10,8 +11,8 @@ import java.util.List;
  */
 public class Parameters {
 
-  private ListMultiMap<String, String> m_localParameters = ListMultiMap.create();
-  private ListMultiMap<String, String> m_allParameters = ListMultiMap.create();
+  private ListMultiMap<String, String> m_localParameters = Maps.newListMultiMap();
+  private ListMultiMap<String, String> m_allParameters = Maps.newListMultiMap();
 
   public List<String> getLocalParameter(String name) {
     return m_localParameters.get(name);
diff --git a/src/main/java/org/testng/xml/dom/XDom.java b/src/main/java/org/testng/xml/dom/XDom.java
index 0bc2d76..3bffb89 100644
--- a/src/main/java/org/testng/xml/dom/XDom.java
+++ b/src/main/java/org/testng/xml/dom/XDom.java
@@ -8,6 +8,7 @@ import javax.xml.xpath.XPathExpressionException;
 import org.testng.Assert;
 import org.testng.collections.ListMultiMap;
 import org.testng.collections.Lists;
+import org.testng.collections.Maps;
 import org.testng.internal.collections.Pair;
 import org.testng.xml.XmlDefine;
 import org.testng.xml.XmlGroups;
@@ -76,7 +77,7 @@ public class XDom {
       IllegalAccessException, XPathExpressionException, SecurityException, IllegalArgumentException, NoSuchMethodException, InvocationTargetException {
     p("populateChildren: " + root.getLocalName());
     NodeList childNodes = root.getChildNodes();
-    ListMultiMap<String, Object> children = ListMultiMap.create();
+    ListMultiMap<String, Object> children = Maps.newListMultiMap();
     for (int i = 0; i < childNodes.getLength(); i++) {
       Node item = childNodes.item(i);
       if (item.getAttributes() != null) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/testng.git



More information about the pkg-java-commits mailing list