use of org.edx.mobile.model.db.DownloadEntry in project edx-app-android by edx.
the class DbTests method testaddVideoData.
@Test
public void testaddVideoData() throws Exception {
db.clearDataByUser(username);
DownloadEntry de1 = getDummyVideoModel();
db.addVideoData(de1, new DataCallback<Long>() {
@Override
public void onResult(Long result) {
// assertNotNull(result);
// assertTrue(result >= 0);
assertTrue(result > 0);
print("addVideoData" + 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 testgetVideosDownloadedCount.
@Test
public void testgetVideosDownloadedCount() throws Exception {
db.clearDataByUser(username);
db.getVideosDownloadedCount(new DataCallback<Integer>() {
@Override
public void onResult(Integer result) {
assertNotNull(result);
// assertTrue(result >= 0);
assertTrue(result == 0);
print("Result for get Videos Downloaded Count is= " + result);
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
DownloadEntry de = getDummyVideoModel();
de.downloaded = DownloadedState.DOWNLOADED;
db.addVideoData(de, null);
db.getVideosDownloadedCount(new DataCallback<Integer>() {
@Override
public void onResult(Integer result) {
assertNotNull(result);
// assertTrue(result >= 0);
assertTrue(result == 1);
print("Result for get Videos Downloaded Count is= " + 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 testgetAllDeactivatedVideos.
@Test
public void testgetAllDeactivatedVideos() throws Exception {
db.clearDataByUser(username);
db.getAllDeactivatedVideos(new DataCallback<List<VideoModel>>() {
@Override
public void onResult(List<VideoModel> result) {
// assertNotNull(result);
assertTrue(result.isEmpty());
print("Result for getAllDeactivatedVideos for size 0 is" + result);
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
DownloadEntry de = getDummyVideoModel();
// inactive video
de.isCourseActive = 0;
db.addVideoData(de, null);
db.getAllDeactivatedVideos(new DataCallback<List<VideoModel>>() {
@Override
public void onResult(List<VideoModel> result) {
assertNotNull(result);
assertTrue("result size = " + result.size(), result.size() == 1);
print("Result for getAllDeactivatedVideos for size 1 is" + result.toString());
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 testgetVideoByVideoUrl.
@Test
public void testgetVideoByVideoUrl() throws Exception {
db.clearDataByUser(username);
String videoUrl = "url";
db.getVideoByVideoUrl(videoUrl, new DataCallback<VideoModel>() {
@Override
public void onResult(VideoModel result) {
assertNull("result should be null", 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.getVideoByVideoUrl(de.url, new DataCallback<VideoModel>() {
@Override
public void onResult(VideoModel result) {
assertNotNull(result);
// assertTrue(result == 1);
print("Result for getVideoByVideoUrl for not null:" + 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 testgetDownloadEntryByDmId.
@Test
public void testgetDownloadEntryByDmId() throws Exception {
db.clearDataByUser(username);
long dmId = 1;
db.getDownloadEntryByDmId(dmId, new DataCallback<VideoModel>() {
@Override
public void onResult(VideoModel result) {
assertNull("result should be null", result);
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
DownloadEntry de = getDummyVideoModel();
de.dmId = 1;
db.addVideoData(de, null);
db.getDownloadEntryByDmId(de.dmId, new DataCallback<VideoModel>() {
@Override
public void onResult(VideoModel result) {
assertTrue(result != null);
print("result for getDownloadEntryByDmId for not null is:" + result);
unlock();
}
@Override
public void onFail(Exception ex) {
fail(ex.getMessage());
}
});
lock();
}
Aggregations