Examples of RpcResult


Examples of org.apache.rave.portal.web.api.rpc.model.RpcResult

        final String PAGE_NAME = "My New Page";
        final String PAGE_LAYOUT_CODE = "layout1";

        expect(pageService.addNewPage(PAGE_NAME, PAGE_LAYOUT_CODE)).andThrow(new RuntimeException(INTERNAL_ERROR_MESSAGE));
        replay(pageService);
        RpcResult result = pageApi.addPage(PAGE_NAME, PAGE_LAYOUT_CODE);
        verify(pageService);
        assertThat(result, is(notNullValue()));
        assertThat(result.getResult(), is(nullValue()));
        assertThat(result.isError(), is(true));
        assertThat(result.getErrorCode(), is(RpcResult.ErrorCode.INTERNAL_ERROR));
        assertThat(result.getErrorMessage(), is(equalTo(INTERNAL_ERROR_MESSAGE)));
    }
View Full Code Here

Examples of org.apache.rave.portal.web.api.rpc.model.RpcResult

    @Test
    public void getPage() {
        expect(pageService.getPage(PAGE_ID)).andReturn(page);
        replay(pageService);
       
        RpcResult result = pageApi.getPage(PAGE_ID);
       
        verify(pageService);
        assertThat(result, is(notNullValue()));
        assertThat((Page)result.getResult(), is (page));
        assertThat(result.isError(), is(false));
        assertThat(result.getErrorCode(), is (RpcResult.ErrorCode.NO_ERROR));
        assertThat(result.getErrorMessage(), is(nullValue()));
    }
View Full Code Here

Examples of org.apache.rave.portal.web.api.rpc.model.RpcResult

        String pageName = "name";
        String layoutName = "layout";
        expect(pageService.updatePage(PAGE_ID, pageName, layoutName)).andReturn(page);
        replay(pageService);
       
        RpcResult result = pageApi.updatePageProperties(PAGE_ID, pageName, layoutName);
       
        verify(pageService);
        assertThat(result, is(notNullValue()));
        assertThat((Page)result.getResult(), is (page));
        assertThat(result.isError(), is(false));
        assertThat(result.getErrorCode(), is (RpcResult.ErrorCode.NO_ERROR));
        assertThat(result.getErrorMessage(), is(nullValue()));
    }
View Full Code Here

Examples of org.apache.rave.portal.web.api.rpc.model.RpcResult

    @Test
    public void movePage_nonNullMoveAfterPageId() {
        expect(pageService.movePage(PAGE_ID, PAGE_2_ID)).andReturn(page);
        replay(pageService);
               
        RpcResult result = pageApi.movePage(PAGE_ID, PAGE_2_ID);               
       
        verify(pageService);       
        assertThat(result, is(notNullValue()));
        assertThat((Page)result.getResult(), is(page));
        assertThat(result.isError(), is(false));
        assertThat(result.getErrorCode(), is(RpcResult.ErrorCode.NO_ERROR));
        assertThat(result.getErrorMessage(), is(nullValue()));
    }   
View Full Code Here

Examples of org.erlide.runtime.rpc.RpcResult

        this.backend = backend;
    }

    @Override
    public List<OtpErlangObject> parse(final String s) {
        final RpcResult res = backend.call_noexception("erlide_parse", "consult", "b", s);
        if (res.isOk()) {
            final OtpErlangObject val = res.getValue();
            if (val instanceof OtpErlangList) {
                return Lists.newArrayList(((OtpErlangList) val).elements());
            }
        }
        return Lists.newArrayList();
View Full Code Here

Examples of org.erlide.runtime.rpc.RpcResult

        final WranglerRefactoringBackend backend = WranglerBackendManager
                .getRefactoringBackend();
        final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters
                .getWranglerSelection();

        RpcResult result;
        final String functionName = "sim_code_detection_eclipse";
        if (onlyInFile) {

            final OtpErlangString fp = new OtpErlangString(sel.getFilePath());
            final OtpErlangString[] fpa = new OtpErlangString[1];
            fpa[0] = fp;
            final OtpErlangList fpl = new OtpErlangList(fpa);

            result = backend.callWithoutParser(
                    WranglerRefactoringBackend.UNLIMITED_TIMEOUT, functionName,
                    "xiiiidxi", fpl, minLen, minToks, minFreq, maxNewVars, simScore,
                    sel.getSearchPath(), GlobalParameters.getTabWidth());
        } else {
            result = backend.callWithoutParser(
                    WranglerRefactoringBackend.UNLIMITED_TIMEOUT, functionName,
                    "xiiiidxi", sel.getSearchPath(), minLen, minToks, minFreq,
                    maxNewVars, simScore, sel.getSearchPath(),
                    GlobalParameters.getTabWidth());
        }

        if (!result.isOk()) {
            throw new WranglerRpcParsingException("Rpc error");
        }
        return new DuplicateDetectionParser(result.getValue());

    }
View Full Code Here

Examples of org.erlide.runtime.rpc.RpcResult

        final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters
                .getWranglerSelection();
        final WranglerRefactoringBackend backend = WranglerBackendManager
                .getRefactoringBackend();
        RpcResult result = null;
        String functionName;
        if (onlyInFile) {
            functionName = "simi_expr_search_in_buffer_eclipse";
        } else {
            functionName = "simi_expr_search_in_dirs_eclipse";
        }
        result = backend.callWithoutParser(WranglerRefactoringBackend.UNLIMITED_TIMEOUT,
                functionName, "sxxxxi", sel.getFilePath(), sel.getSelectionRange()
                        .getStartPos(), sel.getSelectionRange().getEndPos(),
                new OtpErlangFloat(simScore), sel.getSearchPath(), GlobalParameters
                        .getTabWidth());

        if (result.isOk()) {
            return new SimilarExpressionSearchParser(result.getValue());
        }
        throw new WranglerRpcParsingException("RPC error");
    }
View Full Code Here

Examples of org.erlide.runtime.rpc.RpcResult

    @SuppressWarnings("boxing")
    @Override
    protected IResultParser callRefactoring() throws WranglerRpcParsingException,
            CoreException, IOException, WranglerWarningException {
        String functionName;
        RpcResult result;

        // getting the path of the fragment

        final String suffixPath = getSuffixPath();
        ErlLogger.debug("Suffix binary at: " + suffixPath);
        final WranglerRefactoringBackend backend = WranglerBackendManager
                .getRefactoringBackend();
        final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters
                .getWranglerSelection();

        if (onlyInfile) {
            functionName = "duplicated_code_eclipse";
            final OtpErlangString fp = new OtpErlangString(sel.getFilePath());
            final OtpErlangString[] fpa = new OtpErlangString[1];
            fpa[0] = fp;
            final OtpErlangList fpl = new OtpErlangList(fpa);

            result = backend.callWithoutParser(
                    WranglerRefactoringBackend.UNLIMITED_TIMEOUT, functionName, "xiiis",
                    fpl, minToks, minClones, GlobalParameters.getTabWidth(), suffixPath);
        } else {
            functionName = "duplicated_code_eclipse";
            result = backend.callWithoutParser(
                    WranglerRefactoringBackend.UNLIMITED_TIMEOUT, functionName, "xiiis",
                    sel.getSearchPath(), minToks, minClones,
                    GlobalParameters.getTabWidth(), suffixPath);
        }

        if (!result.isOk()) {
            throw new WranglerRpcParsingException("Rpc error");
        }
        return new DuplicateDetectionParser(result.getValue());
    }
View Full Code Here

Examples of org.erlide.runtime.rpc.RpcResult

    @Override
    public RpcResult call_noexception(final long timeout, final String m, final String f,
            final String signature, final Object... args) {
        try {
            final OtpErlangObject result = call(timeout, m, f, signature, args);
            return new RpcResult(result);
        } catch (final RpcException e) {
            return RpcResult.error(e.getMessage());
        }
    }
View Full Code Here

Examples of org.erlide.runtime.rpc.RpcResult

    protected IResultParser callRefactoring() throws WranglerRpcParsingException {
        final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters
                .getWranglerSelection();
        final WranglerRefactoringBackend backend = WranglerBackendManager
                .getRefactoringBackend();
        final RpcResult result = backend.callWithoutParser(
                WranglerRefactoringBackend.UNLIMITED_TIMEOUT, "expr_search_eclipse",
                "sxxi", sel.getFilePath(), sel.getSelectionRange().getStartPos(), sel
                        .getSelectionRange().getEndPos(), GlobalParameters.getTabWidth());
        if (result.isOk()) {
            return new ExpressionSearchParser(result.getValue());
        }
        throw new WranglerRpcParsingException("RPC error");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.