Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add content search type
Signed-off-by: tobiasKaminsky <[email protected]>
  • Loading branch information
tobiasKaminsky committed Jul 15, 2019
commit f9fdd66c88c890e519e8b432a29d3438e9f4ecd4
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,25 @@ public void oneFavorite() {
assertEquals(path, remoteFile.getRemotePath());
}

@Test
public void testContentTypeSearch() throws IOException {
String imagePath = createFile("image");
assertTrue(new UploadFileRemoteOperation(imagePath, "/image.jpg", "image/jpg", "123")
.execute(client).isSuccess());

String filePath = createFile("pdf");
assertTrue(new UploadFileRemoteOperation(filePath, "/pdf.pdf", "application/pdf", "123")
.execute(client).isSuccess());

SearchRemoteOperation sut = new SearchRemoteOperation("application/pdf",
SearchRemoteOperation.SearchType.CONTENT_TYPE_SEARCH,
false);

RemoteOperationResult result = sut.execute(client);
assertTrue(result.isSuccess());
assertEquals(1, result.getData().size());
}

/**
* shows just all files, but sorted by date
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ private Document createQuery(String searchQuery) {
propElement = query.createElementNS(DAV_NAMESPACE, "d:prop");

switch (searchType) {
case CONTENT_TYPE_SEARCH:
case PHOTO_SEARCH:
queryElement = query.createElementNS(DAV_NAMESPACE, "d:getcontenttype");
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public class SearchRemoteOperation extends RemoteOperation {
public enum SearchType {
FILE_SEARCH, // search by name
FAVORITE_SEARCH, // get all favorited files/folder
CONTENT_TYPE_SEARCH, // search by mimetype
RECENTLY_MODIFIED_SEARCH, // get files/folders that were modified within last 7 days, ordered descending by time
PHOTO_SEARCH, // gets all files with mimetype "image/%"
GALLERY_SEARCH, // combined photo and video
Expand Down