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 24e36c535b7d2b03c32562162d8b7d8e4fe5f354
Author: Vladislav Rassokhin <[email protected]>
Date:   Sun Nov 23 00:22:52 2014 +0300

    Simplifications in MethodInvocationHelper
---
 .../testng/internal/MethodInvocationHelper.java    | 28 ++++++++++------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/src/main/java/org/testng/internal/MethodInvocationHelper.java 
b/src/main/java/org/testng/internal/MethodInvocationHelper.java
index 79b92e5..f5821f8 100644
--- a/src/main/java/org/testng/internal/MethodInvocationHelper.java
+++ b/src/main/java/org/testng/internal/MethodInvocationHelper.java
@@ -1,7 +1,9 @@
 package org.testng.internal;
 
+import org.testng.IConfigurable;
 import org.testng.IConfigureCallBack;
 import org.testng.IHookCallBack;
+import org.testng.IHookable;
 import org.testng.ITestContext;
 import org.testng.ITestNGMethod;
 import org.testng.ITestResult;
@@ -36,7 +38,6 @@ public class MethodInvocationHelper {
 
   protected static Object invokeMethod(Method thisMethod, Object instance, 
Object[] parameters)
       throws InvocationTargetException, IllegalAccessException {
-    Object result = null;
     Utils.checkInstanceOrStatic(instance, thisMethod);
 
     // TESTNG-326, allow IObjectFactory to load from non-standard classloader
@@ -87,7 +88,7 @@ public class MethodInvocationHelper {
   protected static Iterator<Object[]> invokeDataProvider(Object instance, 
Method dataProvider,
       ITestNGMethod method, ITestContext testContext, Object fedInstance,
       IAnnotationFinder annotationFinder) {
-    Iterator<Object[]> result = null;
+    Iterator<Object[]> result;
     final ConstructorOrMethod com = method.getConstructorOrMethod();
 
     // If it returns an Object[][], convert it to an Iterable<Object[]>
@@ -149,7 +150,7 @@ public class MethodInvocationHelper {
         method.setParameterInvocationCount(oResult.length);
         result = MethodHelper.createArrayIterator(oResult);
       } else if (Iterator.class.isAssignableFrom(returnType)) {
-        // Already an Iterable<Object[]>, assign it directly
+        // Already an Iterator<Object[]>, assign it directly
         result = (Iterator<Object[]>) invokeMethod(dataProvider, instance, 
parameters);
       } else {
         throw new TestNGException("Data Provider " + dataProvider + " must 
return"
@@ -188,9 +189,8 @@ public class MethodInvocationHelper {
    *           <tt>thisMethod</code> results in an exception
    */
   protected static void invokeHookable(final Object testInstance, final 
Object[] parameters,
-      Object hookableInstance, final Method thisMethod, TestResult testResult) 
throws Throwable {
-    Method runMethod = hookableInstance.getClass().getMethod("run",
-        new Class[] { IHookCallBack.class, ITestResult.class });
+                                       final IHookable hookable, final Method 
thisMethod,
+                                       final TestResult testResult) throws 
Throwable {
     final Throwable[] error = new Throwable[1];
 
     IHookCallBack callback = new IHookCallBack() {
@@ -209,7 +209,7 @@ public class MethodInvocationHelper {
         return parameters;
       }
     };
-    runMethod.invoke(hookableInstance, new Object[] { callback, testResult });
+    hookable.run(callback, testResult);
     if (error[0] != null) {
       throw error[0];
     }
@@ -248,7 +248,7 @@ public class MethodInvocationHelper {
   private static void invokeWithTimeoutWithNewExecutor(ITestNGMethod tm, 
Object instance,
       Object[] parameterValues, ITestResult testResult)
       throws InterruptedException, ThreadExecutionException {
-    IExecutor exec = ThreadUtil.createExecutor(1, tm.getMethod().getName());
+    IExecutor exec = ThreadUtil.createExecutor(1, tm.getMethodName());
 
     InvokeMethodRunnable imr = new InvokeMethodRunnable(tm, instance, 
parameterValues);
     IFutureResult future = exec.submitRunnable(imr);
@@ -265,7 +265,7 @@ public class MethodInvocationHelper {
       testResult.setThrowable(exception);
       testResult.setStatus(ITestResult.FAILURE);
     } else {
-      Utils.log("Invoker " + Thread.currentThread().hashCode(), 3, "Method " + 
tm.getMethod()
+      Utils.log("Invoker " + Thread.currentThread().hashCode(), 3, "Method " + 
tm.getMethodName()
           + " completed within the time-out " + tm.getTimeOut());
 
       // We don't need the result from the future but invoking get() on it
@@ -279,10 +279,8 @@ public class MethodInvocationHelper {
   }
 
   protected static void invokeConfigurable(final Object instance, final 
Object[] parameters,
-      Object configurableInstance, final Method thisMethod, ITestResult 
testResult)
-      throws NoSuchMethodException, IllegalAccessException, 
InvocationTargetException, Throwable {
-    Method runMethod = configurableInstance.getClass().getMethod("run",
-        new Class[] { IConfigureCallBack.class, ITestResult.class });
+                                           final IConfigurable 
configurableInstance, final Method thisMethod,
+                                           final ITestResult testResult) 
throws Throwable {
     final Throwable[] error = new Throwable[1];
 
     IConfigureCallBack callback = new IConfigureCallBack() {
@@ -301,10 +299,10 @@ public class MethodInvocationHelper {
         return parameters;
       }
     };
-    runMethod.invoke(configurableInstance, new Object[] { callback, testResult 
});
+    configurableInstance.run(callback, testResult);
     if (error[0] != null) {
       throw error[0];
     }
   }
 
-}
\ No newline at end of file
+}

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

_______________________________________________
pkg-java-commits mailing list
[email protected]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

Reply via email to