Search in sources :

Example 21 with FileFolder

use of com.instructure.canvasapi2.models.FileFolder in project instructure-android by instructure.

the class FileFolderTest method compareTo_FolderAndFile.

@Test
public void compareTo_FolderAndFile() {
    FileFolder folder = new FileFolder();
    folder.setFullName("fileFolder");
    FileFolder file = new FileFolder();
    file.setDisplayName("fileFolder");
    assertEquals(-1, folder.compareTo(file));
}
Also used : FileFolder(com.instructure.canvasapi2.models.FileFolder) Test(org.junit.Test)

Example 22 with FileFolder

use of com.instructure.canvasapi2.models.FileFolder in project instructure-android by instructure.

the class FileListRecyclerAdapterTest method testAreContentsTheSame_DifferentObjectNames.

@Test
public void testAreContentsTheSame_DifferentObjectNames() {
    FileFolder fileFolder1 = new FileFolder();
    fileFolder1.setDisplayName("fileFolder1");
    fileFolder1.setSize(100);
    FileFolder fileFolder2 = new FileFolder();
    fileFolder2.setDisplayName("fileFolder2");
    fileFolder2.setSize(100);
    assertFalse(mAdapter.getItemCallback().areContentsTheSame(fileFolder1, fileFolder2));
}
Also used : FileFolder(com.instructure.canvasapi2.models.FileFolder) Test(org.junit.Test)

Example 23 with FileFolder

use of com.instructure.canvasapi2.models.FileFolder in project instructure-android by instructure.

the class FileListRecyclerAdapterTest method testAreContentsTheSame_DifferentFolderNames.

@Test
public void testAreContentsTheSame_DifferentFolderNames() {
    FileFolder fileFolder1 = new FileFolder();
    fileFolder1.setName("fileFolder1");
    fileFolder1.setSize(100);
    FileFolder fileFolder2 = new FileFolder();
    fileFolder2.setName("fileFolder2");
    fileFolder2.setSize(100);
    assertFalse(mAdapter.getItemCallback().areContentsTheSame(fileFolder1, fileFolder2));
}
Also used : FileFolder(com.instructure.canvasapi2.models.FileFolder) Test(org.junit.Test)

Example 24 with FileFolder

use of com.instructure.canvasapi2.models.FileFolder in project instructure-android by instructure.

the class FileListRecyclerAdapterTest method testAreContentsTheSame_SameObjects.

@Test
public void testAreContentsTheSame_SameObjects() {
    FileFolder fileFolder = new FileFolder();
    fileFolder.setDisplayName("fileFolder");
    fileFolder.setSize(0);
    assertTrue(mAdapter.getItemCallback().areContentsTheSame(fileFolder, fileFolder));
}
Also used : FileFolder(com.instructure.canvasapi2.models.FileFolder) Test(org.junit.Test)

Example 25 with FileFolder

use of com.instructure.canvasapi2.models.FileFolder in project instructure-android by instructure.

the class FileFolderManager method getFirstPageFoldersRoot.

public static void getFirstPageFoldersRoot(CanvasContext canvasContext, boolean forceNetwork, final StatusCallback<List<FileFolder>> callback) {
    if (isTesting() || mTesting) {
    // TODO
    } else {
        final RestBuilder adapter = new RestBuilder(callback);
        RestParams params = new RestParams.Builder().withCanvasContext(canvasContext).withForceReadFromNetwork(forceNetwork).withPerPageQueryParam(true).build();
        final RestParams folderParams = new RestParams.Builder().withForceReadFromNetwork(forceNetwork).build();
        FileFolderAPI.getRootFolderForContext(adapter, canvasContext, new StatusCallback<FileFolder>() {

            @Override
            public void onResponse(@NonNull Response<FileFolder> response, @NonNull LinkHeaders linkHeaders, @NonNull ApiType type) {
                FileFolderAPI.getFirstPageFolders(adapter, response.body().getId(), callback, folderParams);
            }
        }, params);
    }
}
Also used : RestParams(com.instructure.canvasapi2.builders.RestParams) LinkHeaders(com.instructure.canvasapi2.utils.LinkHeaders) FileFolder(com.instructure.canvasapi2.models.FileFolder) UpdateFileFolder(com.instructure.canvasapi2.models.UpdateFileFolder) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder) ApiType(com.instructure.canvasapi2.utils.ApiType) RestBuilder(com.instructure.canvasapi2.builders.RestBuilder)

Aggregations

RestBuilder (com.instructure.canvasapi2.builders.RestBuilder)21 RestParams (com.instructure.canvasapi2.builders.RestParams)21 FileFolder (com.instructure.canvasapi2.models.FileFolder)21 Test (org.junit.Test)12 UpdateFileFolder (com.instructure.canvasapi2.models.UpdateFileFolder)7 ApiType (com.instructure.canvasapi2.utils.ApiType)6 LinkHeaders (com.instructure.canvasapi2.utils.LinkHeaders)6 StatusCallback (com.instructure.canvasapi2.StatusCallback)3 NonNull (android.support.annotation.NonNull)2 ExhaustiveListCallback (com.instructure.canvasapi2.utils.ExhaustiveListCallback)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 WorkerThread (android.support.annotation.WorkerThread)1 CanvasContext (com.instructure.canvasapi2.models.CanvasContext)1 RemoteFile (com.instructure.canvasapi2.models.RemoteFile)1 Date (java.util.Date)1 Headers (okhttp3.Headers)1 RequestBody (okhttp3.RequestBody)1 ResponseBody (okhttp3.ResponseBody)1 Response (retrofit2.Response)1