Package org.springframework.social.dropbox.api

Examples of org.springframework.social.dropbox.api.Metadata


        break;
      }
      bytes.write(b);
    }
   
    Metadata metadata = dropbox.putFile("file.json", bytes.toByteArray());
    assertEquals("7702a9405f", metadata.getRev());
    assertEquals(false, metadata.isThumbExists());
    assertEquals(12265, metadata.getBytes());
    assertEquals(fromDropboxDate("Fri, 02 Dec 2011 11:27:27 +0000"), metadata.getModified());
    assertEquals("/file.json", metadata.getPath());
    assertEquals(false, metadata.isDir());
    assertEquals("page_white", metadata.getIcon());
    assertEquals("dropbox", metadata.getRoot());
    assertEquals("application/octet-stream", metadata.getMimeType());
    assertEquals("12KB", metadata.getSize());
  }
View Full Code Here


      mockServer
        .expect(requestTo(DropboxTemplate.COPY_URL))
        .andExpect(method(POST))
        .andRespond(withResponse(jsonResource("/copy"), responseHeaders));
   
    Metadata metadata = dropbox.copy("file.json", "file3.json");
    assertEquals("8e02a9405f", metadata.getRev());
    assertEquals(false, metadata.isThumbExists());
    assertEquals(12265, metadata.getBytes());
    assertEquals(fromDropboxDate("Fri, 16 Dec 2011 12:24:07 +0000"), metadata.getModified());
    assertEquals("/file3.json", metadata.getPath());
    assertEquals(false, metadata.isDir());
    assertEquals("page_white", metadata.getIcon());
    assertEquals("dropbox", metadata.getRoot());
    assertEquals("application/octet-stream", metadata.getMimeType());
    assertEquals("12KB", metadata.getSize());
  }
View Full Code Here

      mockServer
        .expect(requestTo(DropboxTemplate.MOVE_URL))
        .andExpect(method(POST))
        .andRespond(withResponse(jsonResource("/file_moved"), responseHeaders));
   
    Metadata metadata = dropbox.move("file.json", "file_moved.json");
    assertEquals("9202a9405f", metadata.getRev());
    assertEquals(false, metadata.isThumbExists());
    assertEquals(12265, metadata.getBytes());
    assertEquals(fromDropboxDate("Fri, 16 Dec 2011 14:39:42 +0000"), metadata.getModified());
    assertEquals("/file_moved.json", metadata.getPath());
    assertEquals(false, metadata.isDir());
    assertEquals("page_white", metadata.getIcon());
    assertEquals("dropbox", metadata.getRoot());
    assertEquals("application/octet-stream", metadata.getMimeType());
    assertEquals("12KB", metadata.getSize());
  }
View Full Code Here

            .replaceFirst("\\{path\\}", "file3.json")
            + "?rev=8e02a9405f"))
        .andExpect(method(GET))
        .andRespond(withResponse(jsonResource("/restored"), responseHeaders));
   
    Metadata metadata = dropbox.restore("file3.json", "8e02a9405f");
    assertEquals("9302a9405f", metadata.getRev());
    assertEquals(false, metadata.isThumbExists());
    assertEquals(12265, metadata.getBytes());
    assertEquals(fromDropboxDate("Fri, 16 Dec 2011 14:48:58 +0000"), metadata.getModified());
    assertEquals("/file3.json", metadata.getPath());
    assertEquals(false, metadata.isDir());
    assertEquals("page_white", metadata.getIcon());
    assertEquals("dropbox", metadata.getRoot());
    assertEquals("application/octet-stream", metadata.getMimeType());
    assertEquals("12KB", metadata.getSize());
  }
View Full Code Here

        .andExpect(method(GET))
        .andRespond(withResponse(jsonResource("/search"), responseHeaders));
   
    List<Metadata> list = dropbox.search("", "json");
    assertEquals(3, list.size());
    Metadata metadata = list.get(0);
   
    assertEquals("8d02a9405f", metadata.getRev());
    assertEquals(false, metadata.isThumbExists());
    assertEquals(12265, metadata.getBytes());
    assertEquals(fromDropboxDate("Fri, 16 Dec 2011 12:23:30 +0000"), metadata.getModified());
    assertEquals("/file2.json", metadata.getPath());
    assertEquals(false, metadata.isDir());
    assertEquals("page_white", metadata.getIcon());
    assertEquals("dropbox", metadata.getRoot());
    assertEquals("application/octet-stream", metadata.getMimeType());
    assertEquals("12KB", metadata.getSize());
  }
View Full Code Here

      mockServer
        .expect(requestTo(DropboxTemplate.CREATE_FOLDER_URL))
        .andExpect(method(POST))
        .andRespond(withResponse(jsonResource("/create_folder"), responseHeaders));
   
    Metadata metadata = dropbox.createFolder("test");
    assertEquals("8f02a9405f", metadata.getRev());
    assertEquals(false, metadata.isThumbExists());
    assertEquals(0, metadata.getBytes());
    assertEquals(fromDropboxDate("Fri, 16 Dec 2011 12:35:37 +0000"), metadata.getModified());
    assertEquals("/test", metadata.getPath());
    assertEquals(true, metadata.isDir());
    assertEquals("folder", metadata.getIcon());
    assertEquals("dropbox", metadata.getRoot());
    assertEquals("0 bytes", metadata.getSize());
  }
View Full Code Here

         mockServer
           .expect(requestTo(DropboxTemplate.DELETE_URL))
           .andExpect(method(POST))
           .andRespond(withResponse(jsonResource("/delete"), responseHeaders));
      
       Metadata metadata = dropbox.delete("file3.json");
       assertEquals("9002a9405f", metadata.getRev());
       assertEquals(false, metadata.isThumbExists());
       assertEquals(0, metadata.getBytes());
       assertEquals(fromDropboxDate("Fri, 16 Dec 2011 12:57:00 +0000"), metadata.getModified());
       assertEquals("/file3.json", metadata.getPath());
       assertEquals(false, metadata.isDir());
       assertEquals("page_white", metadata.getIcon());
       assertEquals("dropbox", metadata.getRoot());
       assertEquals("0 bytes", metadata.getSize());
       assertEquals(true, metadata.isDeleted());
    assertEquals("application/octet-stream", metadata.getMimeType());
     }
View Full Code Here

    public void getRevisions() throws Exception {
      mockServer.expect(requestTo(DropboxTemplate.REVISIONS_URL.replaceFirst("\\{appFolderUrl\\}", "dropbox").replaceFirst("\\{path\\}", "file.json"))).andExpect(method(GET))
    .andRespond(withResponse(jsonResource("/revisions"), responseHeaders));
    List<Metadata> revisions = dropbox.getRevisions("file.json");
   
    Metadata file = revisions.get(0);
    assertEquals("7702a9405f", file.getRev());
    assertEquals(false, file.isThumbExists());
    assertEquals(12265, file.getBytes());
    assertEquals(fromDropboxDate("Fri, 02 Dec 2011 11:27:27 +0000"), file.getModified());
    assertEquals("/file.json", file.getPath());
    assertEquals(false, file.isDir());
    assertEquals("12KB", file.getSize());
    assertEquals("dropbox", file.getRoot());
    assertEquals("page_white", file.getIcon());
    assertEquals("application/octet-stream", file.getMimeType());
   
    file = revisions.get(1);
    assertEquals("7602a9405f", file.getRev());
    assertEquals(false, file.isThumbExists());
    assertEquals(556035, file.getBytes());
    assertEquals(fromDropboxDate("Fri, 02 Dec 2011 11:24:16 +0000"), file.getModified());
    assertEquals("/file.json", file.getPath());
    assertEquals(false, file.isDir());
    assertEquals("543KB", file.getSize());
    assertEquals("dropbox", file.getRoot());
    assertEquals("page_white", file.getIcon());
    assertEquals("application/octet-stream", file.getMimeType());
    }
View Full Code Here

   
    @Test
  public void getMetadata() throws Exception {
    mockServer.expect(requestTo(DropboxTemplate.METADATA_URL.replaceFirst("\\{appFolderUrl\\}", "dropbox").replaceFirst("\\{path\\}", ""))).andExpect(method(GET))
    .andRespond(withResponse(jsonResource("/metadata"), responseHeaders));
    Metadata metadata = dropbox.getItemMetadata("");
   
    assertEquals("0881bfe7f09e0fe856cf9a27000ac00c", metadata.getHash());
    assertEquals(false, metadata.isThumbExists());
    assertEquals(0, metadata.getBytes());
    assertEquals("/", metadata.getPath());
    assertEquals(true, metadata.isDir());
    assertEquals("0 bytes", metadata.getSize());
    assertEquals("dropbox", metadata.getRoot());
    assertEquals("folder", metadata.getIcon());
   
    List<Metadata> contents = metadata.getContents();
    assertEquals(9, contents.size());
   
    Metadata folder = contents.get(0);
    assertEquals("1202a9405f", folder.getRev());
    assertEquals(false, folder.isThumbExists());
    assertEquals(0, folder.getBytes());
    assertEquals(fromDropboxDate("Wed, 08 Jun 2011 20:58:29 +0000"), folder.getModified());
    assertEquals("/cv", folder.getPath());
    assertEquals(true, folder.isDir());
    assertEquals("0 bytes", folder.getSize());
    assertEquals("dropbox", folder.getRoot());
    assertEquals("folder", folder.getIcon());
   
    Metadata file = contents.get(1);
    assertEquals("702a9405f", file.getRev());
    assertEquals(false, file.isThumbExists());
    assertEquals(230783, file.getBytes());
    assertEquals(fromDropboxDate("Thu, 05 May 2011 14:28:24 +0000"), file.getModified());
    assertEquals("/Getting Started.pdf", file.getPath());
    assertEquals(false, file.isDir());
    assertEquals("225.4KB", file.getSize());
    assertEquals("dropbox", file.getRoot());
    assertEquals("page_white_acrobat", file.getIcon());
    assertEquals("application/pdf", file.getMimeType());
  }
View Full Code Here

TOP

Related Classes of org.springframework.social.dropbox.api.Metadata

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.