use of org.erlide.runtime.rpc.RpcException 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);
}
use of org.erlide.runtime.rpc.RpcException in project erlide_eclipse by erlang.
the class OtpNodeProxyTest method exitCodeIsDetected.
@Test
public void exitCodeIsDetected() {
final IOtpRpc site = runtime.getOtpRpc();
try {
site.cast("erlang", "halt", "i", 3);
} catch (final RpcException e1) {
}
expect(runtime, process, 3, State.FAILED);
}
use of org.erlide.runtime.rpc.RpcException in project erlide_eclipse by erlang.
the class OtpNodeProxyTest method runtimeProcessStartsAndIsAvailableForRpc.
@Test
public void runtimeProcessStartsAndIsAvailableForRpc() {
int val;
try {
val = process.exitValue();
} catch (final IllegalThreadStateException e) {
val = -1;
}
assertThat(val).isEqualTo(-1);
assertThat(runtime.isRunning()).isEqualTo(true);
final IOtpRpc site = runtime.getOtpRpc();
OtpErlangObject r;
try {
r = site.call("erlang", "now", "");
} catch (final RpcException e) {
r = null;
}
assertThat(r).isNotNull();
try {
site.cast("erlang", "halt", "i", 0);
} catch (final RpcException e1) {
}
expect(runtime, process, 0, State.TERMINATED);
}
use of org.erlide.runtime.rpc.RpcException in project erlide_eclipse by erlang.
the class ErlangSearchPage method tryErlangTextSelection.
public SearchPatternData tryErlangTextSelection(final SearchPatternData initData0, final IEditorPart activePart) throws ErlModelException {
final AbstractErlangEditor erlangEditor = (AbstractErlangEditor) activePart;
final IErlModule module = erlangEditor.getModule();
SearchPatternData initData = initData0;
if (module != null) {
final ISelection ssel = erlangEditor.getSite().getSelectionProvider().getSelection();
final ITextSelection textSel = (ITextSelection) ssel;
final int offset = textSel.getOffset();
OpenResult res;
try {
res = ErlangEngine.getInstance().getOpenService().open(module.getScannerName(), offset, ErlangEngine.getInstance().getModelUtilService().getImportsAsList(module), "", ErlangEngine.getInstance().getModel().getPathVars());
} catch (final RpcException e) {
res = null;
}
ErlLogger.debug("searchPage(open) " + res);
initData = determineInitValuesFrom(module, offset, res);
}
return initData;
}
use of org.erlide.runtime.rpc.RpcException in project erlide_eclipse by erlang.
the class CoveragePerformer method analyse.
/**
* Perform coverage analysis
*/
@Override
public synchronized void analyse() throws CoverException {
final List<OtpErlangObject> modules = new ArrayList<>(config.getModules().size());
for (final IErlModule module : config.getModules()) {
log.info(module.getModuleName());
modules.add(new OtpErlangList(module.getModuleName()));
}
try {
CoverBackend.getInstance().getBackend().getOtpRpc().call(CoverConstants.COVER_ERL_BACKEND, CoverConstants.FUN_ANALYSE, "x", modules);
} catch (final RpcException e) {
ErlLogger.error(e);
throw new CoverException(e.getMessage());
}
}
Aggregations