Package com.box.boxjavalibv2.javafxoauth.sample

Examples of com.box.boxjavalibv2.javafxoauth.sample.SampleOAuthCaller


    private static final Logger LOG = LoggerFactory.getLogger(IBoxCommentsManagerIntegrationTest.class);
    private static final String PATH_PREFIX = BoxApiName.COMMENTS.getName();

    private BoxComment addComment() throws InterruptedException {
        final BoxCommentRequestObject requestObject =
                BoxCommentRequestObject.addCommentRequestObject(BoxResourceType.FILE, testFileId, "Camel was here!");

        BoxComment result = requestBody("direct://ADDCOMMENT", requestObject);
        assertNotNull("addComment result", result);
        Thread.sleep(2000);
View Full Code Here


        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);
View Full Code Here

    public void testAddEmailAlias() throws Exception {
        final Map<String, Object> headers = new HashMap<String, Object>();
        // parameter type is String
        headers.put("CamelBox.userId", testUserId);
        // 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);
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

                                final String message = rtsResponse.get(MESSAGE);
                                if (NEW_CHANGE.equals(message)) {

                                    // 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);
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

    }

    private BoxRealTimeServer getBoxRealTimeServer(long currentStreamPosition, IBoxEventsManager eventsManager)
        throws BoxRestException, BoxServerException, AuthFatalFailureException {

        final BoxEventRequestObject optionsRequest =
            BoxEventRequestObject.getEventsRequestObject(currentStreamPosition);

        final BoxCollection eventOptions = eventsManager.getEventOptions(optionsRequest);
        final ArrayList<BoxTypedObject> entries = eventOptions.getEntries();
View Full Code Here

        }
    }

    private BoxFolder createFolder() {
        // using com.box.boxjavalibv2.requests.requestobjects.BoxFolderRequestObject message body for single parameter "folderRequest"
        final BoxFolderRequestObject camelTestFolder = BoxFolderRequestObject.createFolderRequestObject(CAMEL_TEST_FOLDER, "0");

        BoxFolder result = requestBody("direct://CREATEFOLDER", camelTestFolder);
        assertNotNull("createFolder result", result);
        assertNotNull("createFolder folder id", result.getId());
        return result;
View Full Code Here

            final Map<String, Object> headers = new HashMap<String, Object>();
            // parameter type is String
            headers.put("CamelBox.folderId", testFolder.getId());
            // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxFolderRequestObject
            final BoxFolderRequestObject folderRequestObject = BoxFolderRequestObject.getRequestObject();
            folderRequestObject.setTags(new String[]{CAMEL_TEST_TAG});
            folderRequestObject.setName(CAMEL_TEST_COPY_FOLDER);
            headers.put("CamelBox.folderRequest", folderRequestObject);

            BoxFolder result = requestBodyAndHeaders("direct://UPDATEFOLDERINFO", null, headers);
            assertNotNull("updateFolderInfo result", result);
            assertEquals("updateFolderInfo folder name", CAMEL_TEST_COPY_FOLDER, result.getName());
View Full Code Here

    }

    @Test
    public void testGetAllCollaborations() throws Exception {
        // using com.box.boxjavalibv2.requests.requestobjects.BoxGetAllCollabsRequestObject message body for single parameter "getAllCollabsRequest"
        final BoxGetAllCollabsRequestObject collabRequest =
                BoxGetAllCollabsRequestObject.getAllCollaborationsRequestObject(BoxCollaboration.STATUS_PENDING);

        List result = requestBody("direct://GETALLCOLLABORATIONS", collabRequest);
        assertNotNull("getAllCollaborations: " + result);
        LOG.debug("getAllCollaborations: " + result);
View Full Code Here

TOP

Related Classes of com.box.boxjavalibv2.javafxoauth.sample.SampleOAuthCaller

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.