Package com.box.boxjavalibv2.dao

Examples of com.box.boxjavalibv2.dao.BoxFile


        return result;
    }

    @Test
    public void testUploadNewVersion() throws Exception {
        final BoxFile boxFile = uploadFile();

        try {
            final Map<String, Object> headers = new HashMap<String, Object>();
            // parameter type is String
            headers.put("CamelBox.fileId", boxFile.getId());
            // parameter type is com.box.restclientv2.requestsbase.BoxFileUploadRequestObject
            final BoxFileUploadRequestObject requestObject =
                    BoxFileUploadRequestObject.uploadNewVersionRequestObject(CAMEL_TEST_FILE,
                            getClass().getResourceAsStream(TEST_UPLOAD_FILE));
            final FileTransferListener fileTransferListener = new FileTransferListener();
            requestObject.setListener(fileTransferListener);

            headers.put("CamelBox.fileUploadRequest", requestObject);
            BoxFile result = requestBodyAndHeaders("direct://UPLOADNEWVERSION", null, headers);

            assertTransferSuccess(fileTransferListener);
            assertNotNull("uploadNewVersion result", result);
            LOG.debug("uploadNewVersion: " + result);
        } finally {
View Full Code Here


    private HttpEntity entity;
    private InputStream inputStream;

    @Before
    public void setUp() {
        file = new BoxFile();
        boxResponse = EasyMock.createMock(DefaultBoxResponse.class);
        response = EasyMock.createMock(BasicHttpResponse.class);
        entity = EasyMock.createMock(StringEntity.class);
    }
View Full Code Here

        // parameter type is com.box.boxjavalibv2.requests.requestobjects.BoxSimpleUserRequestObject
        final BoxSimpleUserRequestObject requestObject =
                BoxSimpleUserRequestObject.moveFolderToAnotherUserRequestEntity(toUserId, false);
        headers.put("CamelBox.simpleUserRequest", requestObject);

        BoxFolder result = requestBodyAndHeaders("direct://MOVEFOLDERTOANOTHERUSER", null, headers);

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

    @Test
    // also tests create folder, and delete folder
    public void testCopyFolder() throws Exception {
        // create a test folder to copy
        final BoxFolder testFolder = createFolder();

        try {
            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.BoxItemCopyRequestObject
            final BoxItemCopyRequestObject requestObject = BoxItemCopyRequestObject.copyItemRequestObject("0");
            requestObject.setName(CAMEL_TEST_COPY_FOLDER);
            headers.put("CamelBox.itemCopyRequest", requestObject);

            BoxFolder result = requestBodyAndHeaders("direct://COPYFOLDER", null, headers);
            assertNotNull("copyFolder result", result);
            assertEquals("copyFolder folder name", CAMEL_TEST_COPY_FOLDER, result.getName());
            LOG.debug("copyFolder: " + result);

            // delete the copy
            deleteFolder(result.getId());
        } finally {
            deleteFolder(testFolder.getId());
        }
    }
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

        return result;
    }

    @Test
    public void testCreateSharedLink() throws Exception {
        final BoxFolder testFolder = createFolder();

        try {
            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.BoxSharedLinkRequestObject
            final BoxSharedLinkRequestEntity sharedLink = new BoxSharedLinkRequestEntity(
                    BoxSharedLinkAccess.COLLABORATORS);
            headers.put("CamelBox.sharedLinkRequest",
                    BoxSharedLinkRequestObject.createSharedLinkRequestObject(sharedLink));

            BoxFolder result = requestBodyAndHeaders("direct://CREATESHAREDLINK", null, headers);
            assertNotNull("createSharedLink result", result);
            assertNotNull("createSharedLink result", result.getSharedLink());
            LOG.debug("createSharedLink: " + result);
        } finally {
            deleteFolder(testFolder.getId());
        }
    }
View Full Code Here

        // parameter type is String
        headers.put("CamelBox.folderId", "0");
        // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject
//        headers.put("CamelBox.defaultRequest", null);

        final BoxFolder result = (BoxFolder) requestBodyAndHeaders("direct://GETFOLDER", null, headers);
        assertNotNull("getFolder result", result);
        assertEquals("getFolder folder id", "0", result.getId());
        LOG.debug("getFolder: " + result);
    }
View Full Code Here

        LOG.debug("getFolder: " + result);
    }

    @Test
    public void testGetFolderCollaborations() throws Exception {
        final BoxFolder testFolder = createFolder();

        try {
            final Map<String, Object> headers = new HashMap<String, Object>();
            // parameter type is String
            headers.put("CamelBox.folderId", testFolder.getId());
            // parameter type is com.box.restclientv2.requestsbase.BoxDefaultRequestObject
//            headers.put("CamelBox.defaultRequest", null);

            List result = requestBodyAndHeaders("direct://GETFOLDERCOLLABORATIONS", null, headers);
            assertNotNull("getFolderCollaborations result", result);
            LOG.debug("getFolderCollaborations: " + result);
        } finally {
            deleteFolder(testFolder.getId());
        }
    }
View Full Code Here

    }

    @Test
    public void testUpdateFolderInfo() throws Exception {
        // create test folder
        final BoxFolder testFolder = createFolder();

        try {

            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());
//            assertEquals("updateFolderInfo result", "["+ CAMEL_TEST_TAG + "]", Arrays.toString(result.getTags()));
            LOG.debug("updateFolderInfo: " + result);
        } finally {
            deleteFolder(testFolder.getId());
        }
View Full Code Here

    private static final String CAMEL_TEST_GROUP = "CamelTestGroup";

    public BoxGroup createGroup() throws Exception {
        // using com.box.boxjavalibv2.requests.requestobjects.BoxGroupRequestObject message body for single parameter "groupRequest"
        final BoxGroupRequestObject requestObject = BoxGroupRequestObject.createGroupRequestObject(CAMEL_TEST_GROUP);
        BoxGroup result = requestBody("direct://CREATEGROUP", requestObject);

        assertNotNull("createGroup result", result);
        return result;
    }
View Full Code Here

TOP

Related Classes of com.box.boxjavalibv2.dao.BoxFile

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.