use of org.edx.mobile.model.db.DownloadEntry in project edx-app-android by edx.
the class DbTests method testisVideoFilePresentByUrl.
@Test
public void testisVideoFilePresentByUrl() throws Exception {
db.clearDataByUser(username);
final String url = "fakeURL";
db.isVideoFilePresentByUrl(url, new DataCallback<Boolean>() {
@Override
public void onResult(Boolean result) {
assertNotNull(result);
assertFalse("Video should not be present for " + url, result);
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
DownloadEntry de = getDummyVideoModel();
de.url = "http://fake/url";
db.addVideoData(de, null);
db.isVideoFilePresentByUrl(url, new DataCallback<Boolean>() {
@Override
public void onResult(Boolean result) {
assertNotNull(result);
assertTrue(result != null);
// assertFalse("Video should not be present for " + url, result);
print("Result for is VideoFilePresentByUrl in AssertTrue= " + result);
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
}
use of org.edx.mobile.model.db.DownloadEntry in project edx-app-android by edx.
the class DbTests method testgetDownloadingVideoDmIdsForChapter.
@Test
public void testgetDownloadingVideoDmIdsForChapter() throws Exception {
db.clearDataByUser(username);
String enrollmentId = "enrollmentId";
String chapter = "chapter";
db.getDownloadingVideoDmIdsForChapter(enrollmentId, chapter, new DataCallback<List<Long>>() {
@Override
public void onResult(List<Long> result) {
assertNotNull(result);
// assertTrue(result.length >= 0);
assertTrue(result.size() == 0);
// assertFalse("something is downloading", result);
print("get All Downloading Videos DmidList :" + result.size());
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
DownloadEntry de = getDummyVideoModel();
de.chapter = "chapter";
de.eid = "enrollmentId";
db.addVideoData(de, null);
db.getDownloadingVideoDmIdsForChapter(enrollmentId, chapter, new DataCallback<List<Long>>() {
@Override
public void onResult(List<Long> result) {
assertNotNull(result);
assertTrue(result.size() == 1);
// assertFalse("something is downloading", result);
print("get All Downloading Videos DmidList :" + result.size());
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
}
use of org.edx.mobile.model.db.DownloadEntry in project edx-app-android by edx.
the class DbTests method testgetListOfOngoingDownloads.
@Test
public void testgetListOfOngoingDownloads() throws Exception {
db.clearDataByUser(username);
db.getListOfOngoingDownloads(new DataCallback<List<VideoModel>>() {
@Override
public void onResult(List<VideoModel> result) {
assertNotNull(result);
assertTrue(result.size() == 0);
for (VideoModel model : result) {
print(model.getChapterName());
print("ID : " + model.getVideoId());
print("result for get ListOfOngoingDownloads is:" + result.size());
}
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
DownloadEntry de = getDummyVideoModel();
db.addVideoData(de, null);
db.getListOfOngoingDownloads(new DataCallback<List<VideoModel>>() {
@Override
public void onResult(List<VideoModel> result) {
assertNotNull(result);
assertTrue(result.size() == 1);
for (VideoModel model : result) {
print(model.getChapterName());
print("ID : " + model.getVideoId());
print("result for get ListOfOngoingDownloads is:" + result.size());
}
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
}
use of org.edx.mobile.model.db.DownloadEntry in project edx-app-android by edx.
the class DbTests method testgetAllDownloadingVideosDmidList.
@Test
public void testgetAllDownloadingVideosDmidList() throws Exception {
db.clearDataByUser(username);
db.getAllDownloadingVideosDmidList(new DataCallback<List<Long>>() {
@Override
public void onResult(List<Long> result) {
assertNotNull(result);
assertTrue(result.size() == 0);
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
DownloadEntry de = getDummyVideoModel();
de.downloaded = DownloadedState.DOWNLOADING;
db.addVideoData(de, null);
db.getAllDownloadingVideosDmidList(new DataCallback<List<Long>>() {
@Override
public void onResult(List<Long> result) {
assertNotNull(result);
assertTrue(result.size() == 1);
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
}
use of org.edx.mobile.model.db.DownloadEntry in project edx-app-android by edx.
the class DbTests method testgetDownloadingVideoDmIdsForSection.
@Test
public void testgetDownloadingVideoDmIdsForSection() throws Exception {
db.clearDataByUser(username);
String enrollmentId = "enrollmentId";
String chapter = "chapter";
String section = "section";
db.getDownloadingVideoDmIdsForSection(enrollmentId, chapter, section, new DataCallback<List<Long>>() {
@Override
public void onResult(List<Long> result) {
assertNotNull(result);
// assertTrue(result.length >= 0);
assertTrue(result.size() == 0);
print("get DownloadingVideo DmIds For Section :" + result.size());
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
DownloadEntry de = getDummyVideoModel();
de.chapter = "chapter";
de.section = "section";
de.eid = "enrollmentId";
db.addVideoData(de, null);
db.getDownloadingVideoDmIdsForSection(enrollmentId, chapter, section, new DataCallback<List<Long>>() {
@Override
public void onResult(List<Long> result) {
assertNotNull(result);
// assertTrue(result.length >= 0);
assertTrue(result.size() == 1);
// assertFalse("something is downloading", result);
print("get DownloadingVideo DmIds For Section :" + result.size());
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
}
Aggregations