Examples of RpcResult


Examples of com.alibaba.dubbo.rpc.RpcResult

            public boolean isAvailable() {
                return true;
            }

            public Result invoke(Invocation invocation) throws RpcException {
                RpcResult result = new RpcResult();
                try {
                    RemoteInvocation i = new RemoteInvocation();
                    i.setMethodName(invocation.getMethodName());
                    i.setParameterTypes(invocation.getParameterTypes());
                    i.setArguments(invocation.getArguments());
                    result.setValue(((RmiInvocationHandler) remote).invoke(i));
                } catch (InvocationTargetException e) {
                    result.setException(e.getTargetException());
                } catch (Exception e) {
                    throw new RpcException(StringUtils.toString(e), e);
                }
                return result;
            }
View Full Code Here

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

        final String PAGE_ID = "1";
        final String WIDGET_ID = "2";

        expect(pageService.addWidgetToPage(PAGE_ID, WIDGET_ID)).andReturn(new RegionWidgetImpl());
        replay(pageService);
        RpcResult result = pageApi.addWidgetToPage(PAGE_ID, WIDGET_ID);
        verify(pageService);
        assertThat(result, is(notNullValue()));
        assertThat(result.getResult(), is(notNullValue()));
        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

        final String PAGE_ID = "1";
        final String WIDGET_ID = "2";

        expect(pageService.addWidgetToPage(PAGE_ID, WIDGET_ID)).andThrow(new IllegalArgumentException(PARAM_ERROR_MESSAGE));
        replay(pageService);
        RpcResult result = pageApi.addWidgetToPage(PAGE_ID, WIDGET_ID);
        verify(pageService);
        assertThat(result, is(notNullValue()));
        assertThat(result.getResult(), is(nullValue()));
        assertThat(result.isError(), is(true));
        assertThat(result.getErrorCode(), is(RpcResult.ErrorCode.INVALID_PARAMS));
        assertThat(result.getErrorMessage(), is(equalTo(PARAM_ERROR_MESSAGE)));
    }
View Full Code Here

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

        final String PAGE_ID = "1";
        final String WIDGET_ID = "2";

        expect(pageService.addWidgetToPage(PAGE_ID, WIDGET_ID)).andThrow(new RuntimeException(INTERNAL_ERROR_MESSAGE));
        replay(pageService);
        RpcResult result = pageApi.addWidgetToPage(PAGE_ID, WIDGET_ID);
        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

    public void deleteWidget_invalidParams() {
        final String WIDGET_ID = "2";

        expect(pageService.removeWidgetFromPage(WIDGET_ID)).andThrow(new IllegalArgumentException(PARAM_ERROR_MESSAGE));
        replay(pageService);
        RpcResult result = pageApi.removeWidgetFromPage(WIDGET_ID);
        verify(pageService);
        assertThat(result, is(notNullValue()));
        assertThat(result.getResult(), is(nullValue()));
        assertThat(result.isError(), is(true));
        assertThat(result.getErrorCode(), is(RpcResult.ErrorCode.INVALID_PARAMS));
        assertThat(result.getErrorMessage(), is(equalTo(PARAM_ERROR_MESSAGE)));
    }
View Full Code Here

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

    public void deleteWidget_internalError() {
        final String WIDGET_ID = "2";

        expect(pageService.removeWidgetFromPage(WIDGET_ID)).andThrow(new RuntimeException(INTERNAL_ERROR_MESSAGE));
        replay(pageService);
        RpcResult result = pageApi.removeWidgetFromPage(WIDGET_ID);
        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

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

        expect(pageService.addNewUserPage(PAGE_NAME, PAGE_LAYOUT_CODE)).andReturn(new PageImpl());
        replay(pageService);
        RpcResult result = pageApi.addPage(PAGE_NAME, PAGE_LAYOUT_CODE);
        verify(pageService);
        assertThat(result, is(notNullValue()));
        assertThat(result.getResult(), is(notNullValue()));
        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

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

        expect(pageService.addNewUserPage(PAGE_NAME, PAGE_LAYOUT_CODE)).andThrow(new IllegalArgumentException(PARAM_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.INVALID_PARAMS));
        assertThat(result.getErrorMessage(), is(equalTo(PARAM_ERROR_MESSAGE)));
    }
View Full Code Here

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.addNewUserPage(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
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.