Package org.apache.rave.portal.web.api.rpc.model

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


        final int PAGE_ID = 1;
        final long 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


        final int PAGE_ID = 1;
        final long WIDGET_ID = 2;

        expect(pageService.addWidgetToPage(PAGE_ID, WIDGET_ID)).andReturn(new RegionWidget());
        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

        final int PAGE_ID = 1;
        final long 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

        final int PAGE_ID = 1;
        final long 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

    public void deleteWidget_invalidParams() {
        final long 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

    public void deleteWidget_internalError() {
        final long 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

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

        expect(pageService.addNewUserPage(PAGE_NAME, PAGE_LAYOUT_CODE)).andReturn(new Page());
        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

        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

        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

    @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

Related Classes of org.apache.rave.portal.web.api.rpc.model.RpcResult

Copyright © 2018 www.massapicom. 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.