Search in sources :

Example 1 with MethExecutorResult

use of hydra.MethExecutorResult in project geode by apache.

the class RemoteDUnitVM method executeMethodOnClass.

/**
   * Called remotely by the master controller to cause the client to execute the method on the
   * class. Does this synchronously (does not spawn a thread). This method is used by the unit test
   * framework, dunit.
   *
   * @param className the name of the class execute
   * @param methodName the name of the method to execute
   * @return the result of method execution
   */
public MethExecutorResult executeMethodOnClass(String className, String methodName) {
    String name = className + '.' + methodName;
    long start = start(name);
    MethExecutorResult result = MethExecutor.execute(className, methodName);
    logDelta(name, start, result);
    return result;
}
Also used : MethExecutorResult(hydra.MethExecutorResult)

Example 2 with MethExecutorResult

use of hydra.MethExecutorResult in project geode by apache.

the class RemoteDUnitVM method executeMethodOnObject.

/**
   * Called remotely by the master controller to cause the client to execute the instance method on
   * the object. Does this synchronously (does not spawn a thread). This method is used by the unit
   * test framework, dunit.
   *
   * @param target the object to execute the method on
   * @param methodName the name of the method to execute
   * @return the result of method execution
   */
@Override
public MethExecutorResult executeMethodOnObject(Object target, String methodName) {
    String name = target.getClass().getName() + '.' + methodName + " on object: " + target;
    long start = start(name);
    MethExecutorResult result = MethExecutor.executeObject(target, methodName);
    logDelta(name, start, result);
    return result;
}
Also used : MethExecutorResult(hydra.MethExecutorResult)

Example 3 with MethExecutorResult

use of hydra.MethExecutorResult in project geode by apache.

the class RemoteDUnitVM method executeMethodOnClass.

/**
   * Executes a given static method in a given class with the given arguments.
   */
@Override
public MethExecutorResult executeMethodOnClass(String className, String methodName, Object[] args) {
    String name = className + '.' + methodName + (args != null ? " with " + args.length + " args" : "");
    long start = start(name);
    MethExecutorResult result = MethExecutor.execute(className, methodName, args);
    logDelta(name, start, result);
    return result;
}
Also used : MethExecutorResult(hydra.MethExecutorResult)

Example 4 with MethExecutorResult

use of hydra.MethExecutorResult in project geode by apache.

the class RemoteDUnitVM method executeMethodOnObject.

/**
   * Executes a given instance method on a given object with the given arguments.
   */
@Override
public MethExecutorResult executeMethodOnObject(Object target, String methodName, Object[] args) {
    String name = target.getClass().getName() + '.' + methodName + (args != null ? " with " + args.length + " args" : "") + " on object: " + target;
    long start = start(name);
    MethExecutorResult result = MethExecutor.executeObject(target, methodName, args);
    logDelta(name, start, result);
    return result;
}
Also used : MethExecutorResult(hydra.MethExecutorResult)

Example 5 with MethExecutorResult

use of hydra.MethExecutorResult in project geode by apache.

the class DUnitLauncher method startLocator.

private static int startLocator(Registry registry) throws IOException, NotBoundException {
    RemoteDUnitVMIF remote = (RemoteDUnitVMIF) registry.lookup("vm" + LOCATOR_VM_NUM);
    final File locatorLogFile = LOCATOR_LOG_TO_DISK ? new File("locator-" + locatorPort + ".log") : new File("");
    MethExecutorResult result = remote.executeMethodOnObject(new SerializableCallable() {

        public Object call() throws IOException {
            Properties p = getDistributedSystemProperties();
            // I never want this locator to end up starting a jmx manager
            // since it is part of the unit test framework
            p.setProperty(JMX_MANAGER, "false");
            // Disable the shared configuration on this locator.
            // Shared configuration tests create their own locator
            p.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
            // Tell the locator it's the first in the system for
            // faster boot-up
            System.setProperty(GMSJoinLeave.BYPASS_DISCOVERY_PROPERTY, "true");
            // disable auto-reconnect - tests fly by so fast that it will never be
            // able to do so successfully anyway
            p.setProperty(DISABLE_AUTO_RECONNECT, "true");
            try {
                Locator.startLocatorAndDS(0, locatorLogFile, p);
                InternalLocator internalLocator = (InternalLocator) Locator.getLocator();
                locatorPort = internalLocator.getPort();
                internalLocator.resetInternalLocatorFileNamesWithCorrectPortNumber(locatorPort);
            } finally {
                System.getProperties().remove(GMSJoinLeave.BYPASS_DISCOVERY_PROPERTY);
            }
            return locatorPort;
        }
    }, "call");
    if (result.getException() != null) {
        RuntimeException ex = new RuntimeException("Failed to start locator", result.getException());
        ex.printStackTrace();
        throw ex;
    }
    return (Integer) result.getResult();
}
Also used : InternalLocator(org.apache.geode.distributed.internal.InternalLocator) MethExecutorResult(hydra.MethExecutorResult) SerializableCallable(org.apache.geode.test.dunit.SerializableCallable) UnicastRemoteObject(java.rmi.server.UnicastRemoteObject) IOException(java.io.IOException) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) File(java.io.File)

Aggregations

MethExecutorResult (hydra.MethExecutorResult)5 File (java.io.File)1 IOException (java.io.IOException)1 UnicastRemoteObject (java.rmi.server.UnicastRemoteObject)1 Properties (java.util.Properties)1 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)1 InternalLocator (org.apache.geode.distributed.internal.InternalLocator)1 SerializableCallable (org.apache.geode.test.dunit.SerializableCallable)1