Examples of BoxPreview


Examples of com.box.boxjavalibv2.dao.BoxPreview

            boolean ignore = false;
            if (e.getCause().getCause() instanceof BoxServerException) {
                BoxServerException exception = (BoxServerException) e.getCause().getCause();
                if (PREVIEW_UNAVAILABLE.equals(exception.getMessage())) {
                    // ignore unavailable preview errors
                    result = new BoxPreview();
                    ignore = true;
                }
            }
            if (!ignore) {
                throw e;
View Full Code Here

Examples of com.box.boxjavalibv2.dao.BoxPreview

    private static final String REL = "rel";
    private static final String PAGE = "page";

    @Override
    public BoxPreview parse(IBoxResponse response) throws BoxRestException {
        BoxPreview preview = new BoxPreview();
        preview.setContent((InputStream) super.parse(response));
        extraParses(preview, (DefaultBoxResponse) response);
        return preview;
    }
View Full Code Here

Examples of com.box.boxjavalibv2.dao.BoxPreview

    private InputStream inputStream;
    private Header header;

    @Before
    public void setUp() {
        preview = new BoxPreview();
        preview.setFirstPage(firstPage);
        preview.setLastPage(lastPage);
        boxResponse = EasyMock.createMock(DefaultBoxResponse.class);
        response = EasyMock.createMock(BasicHttpResponse.class);
        entity = EasyMock.createMock(StringEntity.class);
View Full Code Here

Examples of com.box.boxjavalibv2.dao.BoxPreview

        EasyMock.replay(boxResponse, response, entity);
        PreviewResponseParser parser = new PreviewResponseParser();
        Object object = parser.parse(boxResponse);
        Assert.assertEquals(BoxPreview.class, object.getClass());

        BoxPreview parsed = (BoxPreview) object;
        Assert.assertEquals(length, parsed.getContentLength(), 0.001);
        Assert.assertEquals(firstPage, parsed.getFirstPage().intValue());
        Assert.assertEquals(lastPage, parsed.getLastPage().intValue());
        Assert.assertEquals(PREVIEW_MOCK_CONTENT, IOUtils.toString(parsed.getContent()));
        EasyMock.verify(boxResponse, response, entity);

    }
View Full Code Here

Examples of com.box.boxjavalibv2.dao.BoxPreview

    private static final String PAGE = "page";

    @Override
    public BoxPreview parse(IBoxResponse response) throws BoxRestException {
        InputStream is = (InputStream) super.parse(response);
        BoxPreview preview = new BoxPreview();
        preview.setContent(is);
        preview.setContentLength(response.getContentLength());
        parseLinks(preview, (DefaultBoxResponse) response);
        return preview;
    }
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.