Package com.google.api.services.drive.model

Examples of com.google.api.services.drive.model.File


    private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveCommentsApiMethod.class).getName();
   
    @Test
    public void testComment() throws Exception {
        // 1. create test file
        File testFile = uploadTestFile();
        String fileId = testFile.getId();
       
        // 2. comment on that file
        Map<String, Object> headers = new HashMap<String, Object>();
        // parameter type is String
        headers.put("CamelGoogleDrive.fileId", fileId);
View Full Code Here


    private static final Logger LOG = LoggerFactory.getLogger(DriveRevisionsIntegrationTest.class);
    private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveRevisionsApiMethod.class).getName();

    @Test
    public void testList() throws Exception {
        File testFile = uploadTestFile();
        String fileId = testFile.getId();
       
        // using String message body for single parameter "fileId"
        final com.google.api.services.drive.model.RevisionList result = requestBody("direct://LIST", fileId);

        assertNotNull("list result", result);
View Full Code Here

        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(1);

        assertMockEndpointsSatisfied();
        File file = mock.getReceivedExchanges().get(0).getIn().getBody(com.google.api.services.drive.model.File.class);
       
        assertEquals("Hello!", context.getTypeConverter().convertTo(String.class, mock.getReceivedExchanges().get(0), file));

    }
View Full Code Here

    private static final Logger LOG = LoggerFactory.getLogger(DrivePropertiesIntegrationTest.class);
    private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DrivePropertiesApiMethod.class).getName();

    @Test
    public void testList() throws Exception {
        File testFile = uploadTestFile();
        String fileId = testFile.getId()
       
        // using String message body for single parameter "fileId"
        final com.google.api.services.drive.model.PropertyList result = requestBody("direct://LIST", fileId);

        assertNotNull("list result", result);
View Full Code Here

    private static final String TEST_OPTIONS_PROPERTIES = "/test-options.properties";
    private static final String REFRESH_TOKEN_PROPERTY = "refreshToken";
   
   
    protected File uploadTestFile() {
        File fileMetadata = new File();
        fileMetadata.setTitle(UPLOAD_FILE.getName());
        FileContent mediaContent = new FileContent(null, UPLOAD_FILE);
       
        final Map<String, Object> headers = new HashMap<String, Object>();
        // parameter type is com.google.api.services.drive.model.File
        headers.put("CamelGoogleDrive.content", fileMetadata);
        // parameter type is com.google.api.client.http.AbstractInputStreamContent
        headers.put("CamelGoogleDrive.mediaContent", mediaContent);

        File result = requestBodyAndHeaders("google-drive://drive-files/insert", null, headers);
        return result;
    }
View Full Code Here

        File result = requestBodyAndHeaders("google-drive://drive-files/insert", null, headers);
        return result;
    }

    protected File uploadTestFolder() {
        File fileMetadata = new File();
        fileMetadata.setTitle("testfolder");
        fileMetadata.setMimeType("application/vnd.google-apps.folder");

        File result = requestBody("google-drive://drive-files/insert?inBody=content", fileMetadata);
        return result;
    }
View Full Code Here

    @Test
    public void testListConsumer() throws Exception {
        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedMessageCount(1);

        File testFile = uploadTestFile();
        String fileId = testFile.getId();

        assertMockEndpointsSatisfied();
       
        FileList fileList = mock.getReceivedExchanges().get(0).getIn().getBody(com.google.api.services.drive.model.FileList.class);
        assertTrue(fileInList(fileId, fileList));
View Full Code Here

    private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveRepliesApiMethod.class).getName();

    @Test
    public void testReplyToComment() throws Exception {
        // 1. create test file
        File testFile = uploadTestFile();
        String fileId = testFile.getId();
       
        // 2. comment on that file
        Map<String, Object> headers = new HashMap<String, Object>();
        // parameter type is String
        headers.put("CamelGoogleDrive.fileId", fileId);
View Full Code Here

    private static final Logger LOG = LoggerFactory.getLogger(DriveFilesIntegrationTest.class);
    private static final String PATH_PREFIX = GoogleDriveApiCollection.getCollection().getApiName(DriveFilesApiMethod.class).getName();
   
    @Test
    public void testCopy() throws Exception {
        File testFile = uploadTestFile();
        String fromFileId = testFile.getId();
       
        File toFile = new File();
        toFile.setTitle(UPLOAD_FILE.getName() + "_copy");
       
        final Map<String, Object> headers = new HashMap<String, Object>();
        // parameter type is String
        headers.put("CamelGoogleDrive.fileId", fromFileId);
        // parameter type is com.google.api.services.drive.model.File
        headers.put("CamelGoogleDrive.content", toFile);

        final File result = requestBodyAndHeaders("direct://COPY", null, headers);

        assertNotNull("copy result", result);
        assertEquals(toFile.getTitle(), result.getTitle());       
        LOG.debug("copy: " + result);
    }
View Full Code Here

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

    @Test   
    public void testDelete() throws Exception {
        File testFile = uploadTestFile();
        String fileId = testFile.getId();
       
        // using String message body for single parameter "fileId"
        sendBody("direct://DELETE", fileId);

        try {
            // the file should be gone now
            final File result = requestBody("direct://GET", fileId);
            assertTrue("Should have not found deleted file.", false);
        } catch (Exception e) {              
            e.printStackTrace();
        }       
    }
View Full Code Here

TOP

Related Classes of com.google.api.services.drive.model.File

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.