Clover coverage report - CRISPY - 1.1.1
Coverage timestamp: Mi Nov 15 2006 13:09:46 CET
file stats: LOC: 67   Methods: 3
NCLOC: 46   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
JBossRemotingExecutor.java 90% 95% 100% 93,9%
coverage coverage
 1    package net.sf.crispy.impl;
 2   
 3    import java.lang.reflect.Method;
 4    import java.util.Map;
 5    import java.util.Vector;
 6   
 7    import net.sf.crispy.Executor;
 8    import net.sf.crispy.InvocationException;
 9    import net.sf.crispy.InvocationStrategy;
 10    import net.sf.crispy.strategy.ClassMethodMapInvocationStrategy;
 11    import net.sf.crispy.util.Util;
 12   
 13    import org.jboss.remoting.Client;
 14    import org.jboss.remoting.InvokerLocator;
 15   
 16    /**
 17    * Remote-Call for JBoss remoting.
 18    *
 19    * @author Linke
 20    *
 21    */
 22    public class JBossRemotingExecutor extends Executor {
 23   
 24    public final static String DEFAULT_URL_AND_PORT = "socket://localhost:5411";
 25   
 26    private Client client = null;
 27   
 28  88 public String getDefaultUrlAndPort() { return DEFAULT_URL_AND_PORT; }
 29  55 public InvocationStrategy getDefaultInvocationStrategy() { return new ClassMethodMapInvocationStrategy(); }
 30   
 31  55 public Object execute(Class pvProxyClass, Object pvProxy, Method pvMethod, Object[] pvArgs) throws Exception {
 32  55 if (client == null) {
 33  33 InvokerLocator locator = new InvokerLocator(getUrlAndPort());
 34  33 client = new org.jboss.remoting.Client(locator);
 35    }
 36   
 37  55 Vector params = new Vector();
 38  55 if (pvArgs != null) {
 39  52 for (int i = 0; i < pvArgs.length; i++) {
 40  72 params.add(pvArgs[i]);
 41    }
 42    }
 43   
 44   
 45  55 Object lvInvocationStrategy = getInvocationStrategy();
 46    if (log.isDebugEnabled()) { log.debug("InvocationStrategy from JBossRemoting client: " + lvInvocationStrategy); }
 47   
 48  55 Object lvResult = null;
 49  55 try {
 50  55 lvResult = client.invoke(params, (Map) lvInvocationStrategy);
 51    } catch (Throwable e) {
 52  1 lvResult = new InvocationException("Problem by invoke JBossRemoting client: " + lvInvocationStrategy, e);
 53    }
 54   
 55  55 if (lvResult instanceof Exception) {
 56  3 Throwable lvThrowable = Util.findDeepestThrowable((Exception) lvResult);
 57  3 if (lvThrowable instanceof Exception) {
 58  3 throw (Exception) lvThrowable;
 59    } else {
 60  0 throw new InvocationException("Exception in " + this.getClass().getName() + ": ", lvThrowable);
 61    }
 62    }
 63   
 64  52 return lvResult;
 65    }
 66   
 67    }