Package com.box.boxjavalibv2

Examples of com.box.boxjavalibv2.BoxConfigBuilder


        // parameter type is com.box.boxjavalibv2.dao.IBoxType
        headers.put("CamelBox.commentedItemType", BoxResourceType.FILE);
        // parameter type is String
        headers.put("CamelBox.message", "Camel was here!");

        BoxComment result = requestBodyAndHeaders("direct://ADDCOMMENT_1", null, headers);
        assertNotNull("addComment result", result);
        LOG.debug("addComment: " + result);

        deleteComment(result.getId());
    }
View Full Code Here


        requestBodyAndHeaders("direct://DELETECOMMENT", null, headers);
    }

    @Test
    public void testGetComment() throws Exception {
        final BoxComment comment = addComment();
        try {
            final Map<String, Object> headers = new HashMap<String, Object>();
            // parameter type is String
            headers.put("CamelBox.commentId", comment.getId());
            // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject
//            headers.put("CamelBox.defaultRequest", null);
            BoxComment result = requestBodyAndHeaders("direct://GETCOMMENT", null, headers);

            LOG.debug("getComment: " + result);
        } finally {
            deleteComment(comment.getId());
        }
View Full Code Here

        }
    }

    @Test
    public void testUpdateComment() throws Exception {
        final BoxComment comment = addComment();
        try {
            final Map<String, Object> headers = new HashMap<String, Object>();
            // parameter type is String
            headers.put("CamelBox.commentId", comment.getId());
            // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxCommentRequestObject
            final BoxCommentRequestObject requestObject =
                    BoxCommentRequestObject.updateCommentRequestObject("Camel was here, again!");
            headers.put("CamelBox.commentRequest", requestObject);
            BoxComment result = requestBodyAndHeaders("direct://UPDATECOMMENT", null, headers);

            LOG.debug("updateComment: " + result);
        } finally {
            deleteComment(comment.getId());
        }
View Full Code Here

        // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxEmailAliasRequestObject
        final BoxEmailAliasRequestObject requestObject =
                BoxEmailAliasRequestObject.addEmailAliasRequestObject(CAMEL_EMAIL_ALIAS);
        headers.put("CamelBox.emailAliasRequest", requestObject);

        BoxEmailAlias result = requestBodyAndHeaders("direct://ADDEMAILALIAS", null, headers);

        assertNotNull("addEmailAlias result", result);
        LOG.debug("addEmailAlias: " + result);

        deleteEmailAlias();
View Full Code Here

    @Test
    public void testGetEvents() throws Exception {
        // using com.box.boxjavalibv2.requests.requestobjects.BoxEventRequestObject message body for single parameter "eventRequest"
        final BoxEventRequestObject requestObject =
                BoxEventRequestObject.getEventsRequestObject(BoxEventRequestObject.STREAM_POSITION_NOW);
        BoxEventCollection result = requestBody("direct://GETEVENTS", requestObject);

        assertNotNull("getEvents result", result);
        LOG.debug("getEvents: " + result);
    }
View Full Code Here

                                    // get events
                                    final BoxEventRequestObject requestObject =
                                        BoxEventRequestObject.getEventsRequestObject(currentStreamPosition);
                                    requestObject.setStreamType(streamType);
                                    requestObject.setLimit(limit);
                                    final BoxEventCollection events = eventsManager.getEvents(requestObject);

                                    // notify callback
                                    callback.onEvent(events);

                                    // update stream position
                                    currentStreamPosition = events.getNextStreamPosition();

                                } else if (RECONNECT.equals(message) || MAX_RETRIES.equals(message)) {
                                    LOG.debug("Long poll reconnect for " + cachedBoxClient);
                                    realTimeServer = null;
                                } else if (OUT_OF_DATE.equals(message)) {
View Full Code Here

    private long getCurrentStreamPosition(IBoxEventsManager eventsManager, long streamPosition)
        throws BoxRestException, BoxServerException, AuthFatalFailureException {

        final BoxEventRequestObject requestObject =
            BoxEventRequestObject.getEventsRequestObject(streamPosition);
        final BoxEventCollection events = eventsManager.getEvents(requestObject);
        streamPosition = events.getNextStreamPosition();
        return streamPosition;
    }
View Full Code Here

    }

    @Override
    public Object splitResult(Object result) {
        if (result instanceof BoxEventCollection && splitResult) {
            BoxEventCollection eventCollection = (BoxEventCollection) result;
            final ArrayList<BoxTypedObject> entries = eventCollection.getEntries();
            return entries.toArray(new BoxTypedObject[entries.size()]);
        }
        return result;
    }
View Full Code Here

    }

    @Override
    public void interceptResult(Object result, Exchange resultExchange) {
        if (result instanceof BoxEventCollection) {
            BoxEventCollection boxEventCollection = (BoxEventCollection) result;
            resultExchange.getIn().setHeader(BoxConstants.CHUNK_SIZE_PROPERTY,
                boxEventCollection.getChunkSize());
            resultExchange.getIn().setHeader(BoxConstants.NEXT_STREAM_POSITION_PROPERTY,
                boxEventCollection.getNextStreamPosition());
        }
    }
View Full Code Here

        headers.put("CamelBox.fileId", testFileId);
        final BoxItemCopyRequestObject requestObject = BoxItemCopyRequestObject.copyItemRequestObject("0");
        requestObject.setName(CAMEL_TEST_FILE);
        headers.put("CamelBox.itemCopyRequest", requestObject);

        BoxFile result = requestBodyAndHeaders("direct://COPYFILE", null, headers);

        assertNotNull("copyFile result", result);
        LOG.debug("copyFile: " + result);

        // generate file delete event
        headers.clear();
        headers.put("CamelBox.fileId", result.getId());
        headers.put("CamelBox.defaultRequest", null);
        requestBodyAndHeaders("direct://DELETEFILE", null, headers);

        MockEndpoint mockEndpoint = getMockEndpoint("mock:boxEvents");
        mockEndpoint.expectedMinimumMessageCount(2);
View Full Code Here

TOP

Related Classes of com.box.boxjavalibv2.BoxConfigBuilder

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.