Search in sources :

Example 1 with OtpNodeProxy

use of org.erlide.runtime.internal.OtpNodeProxy in project erlide_eclipse by erlang.

the class OtpNodeProxyTest method nonManagedRuntimeWorks.

@Test
public void nonManagedRuntimeWorks() {
    final RuntimeData data = new RuntimeData(info, "run");
    data.setNodeName(runtime.getNodeName());
    data.setLongName(false);
    data.setCookie("c");
    data.setManaged(false);
    final OtpNodeProxy runtime2 = new OtpNodeProxy(data);
    runtime2.ensureRunning();
    final Process process2 = runtime2.getProcess();
    assertThat(runtime2.isRunning()).isEqualTo(true);
    assertThat(process2).isNull();
    final IOtpRpc site = runtime2.getOtpRpc();
    OtpErlangObject r;
    try {
        r = site.call("erlang", "now", "");
    } catch (final RpcException e) {
        r = null;
    }
    assertThat(r).isNotNull();
    try {
        runtime2.dispose();
    } catch (final Throwable t) {
        ErlLogger.error(t);
    }
    try {
        Thread.sleep(100);
    } catch (final InterruptedException e) {
    }
    expect(runtime2, process2, -1, State.TERMINATED);
    assertThat(runtime.state()).isEqualTo(State.RUNNING);
}
Also used : RuntimeData(org.erlide.runtime.api.RuntimeData) OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) OtpNodeProxy(org.erlide.runtime.internal.OtpNodeProxy) RpcException(org.erlide.runtime.rpc.RpcException) IOtpRpc(org.erlide.runtime.rpc.IOtpRpc) Test(org.junit.Test)

Example 2 with OtpNodeProxy

use of org.erlide.runtime.internal.OtpNodeProxy in project erlide_eclipse by erlang.

the class OtpNodeProxyTest method prepareRuntime.

@Before
public void prepareRuntime() {
    final RuntimeInfoCatalog cat = new RuntimeInfoCatalog();
    cat.initializeRuntimesList();
    assertThat(cat.getRuntimes()).isNotEmpty();
    info = cat.getRuntimes().iterator().next();
    assertThat(info).isNotEqualTo(RuntimeInfo.NO_RUNTIME_INFO);
    HostnameChecker.getInstance().detectHostNames(info.getOtpHome());
    final RuntimeData data = new RuntimeData(info, "run");
    data.setNodeName("etest" + System.currentTimeMillis());
    data.setLongName(false);
    data.setCookie("c");
    data.setManaged(true);
    data.setRestartable(false);
    runtime = new OtpNodeProxy(data);
    runtime.ensureRunning();
    process = runtime.getProcess();
    assertThat(process).isNotNull();
}
Also used : RuntimeInfoCatalog(org.erlide.runtime.runtimeinfo.RuntimeInfoCatalog) RuntimeData(org.erlide.runtime.api.RuntimeData) OtpNodeProxy(org.erlide.runtime.internal.OtpNodeProxy) Before(org.junit.Before)

Aggregations

RuntimeData (org.erlide.runtime.api.RuntimeData)2 OtpNodeProxy (org.erlide.runtime.internal.OtpNodeProxy)2 OtpErlangObject (com.ericsson.otp.erlang.OtpErlangObject)1 IOtpRpc (org.erlide.runtime.rpc.IOtpRpc)1 RpcException (org.erlide.runtime.rpc.RpcException)1 RuntimeInfoCatalog (org.erlide.runtime.runtimeinfo.RuntimeInfoCatalog)1 Before (org.junit.Before)1 Test (org.junit.Test)1