Search in sources :

Example 1 with JudgmentRepository

use of ch.hsr.sa.radiotour.dataaccess.repositories.JudgmentRepository in project app by TourLive.

the class JudgmentRepositoryInstrumentedTest method initTestData.

@Before
public void initTestData() {
    this.judgmentRepository = new JudgmentRepository();
    this.rewardRepository = new RewardRepository();
    realm = Realm.getInstance(RadioTourApplication.getInstance());
    initCallbacks();
    realm.executeTransaction(new Realm.Transaction() {

        @Override
        public void execute(Realm realm) {
            realm.where(Judgement.class).findAll().deleteAllFromRealm();
            realm.where(Reward.class).findAll().deleteAllFromRealm();
        }
    });
}
Also used : Judgement(ch.hsr.sa.radiotour.dataaccess.models.Judgement) IJudgmentRepository(ch.hsr.sa.radiotour.dataaccess.interfaces.IJudgmentRepository) JudgmentRepository(ch.hsr.sa.radiotour.dataaccess.repositories.JudgmentRepository) IRewardRepository(ch.hsr.sa.radiotour.dataaccess.interfaces.IRewardRepository) RewardRepository(ch.hsr.sa.radiotour.dataaccess.repositories.RewardRepository) Reward(ch.hsr.sa.radiotour.dataaccess.models.Reward) Realm(io.realm.Realm) Before(org.junit.Before)

Example 2 with JudgmentRepository

use of ch.hsr.sa.radiotour.dataaccess.repositories.JudgmentRepository in project app by TourLive.

the class JudgmentRiderConnectionInstrumentedTest method initTestData.

@Before
public void initTestData() {
    this.judgmentRiderConnectionRepository = new JudgmentRiderConnectionRepository();
    this.riderRepository = new RiderRepository();
    this.judgmentRepository = new JudgmentRepository();
    realm = Realm.getInstance(RadioTourApplication.getInstance());
    initCallbacks();
    realm.executeTransaction((Realm db) -> {
        db.where(JudgmentRiderConnection.class).findAll().deleteAllFromRealm();
        db.where(Rider.class).findAll().deleteAllFromRealm();
        db.where(Judgement.class).findAll().deleteAllFromRealm();
    });
}
Also used : RiderRepository(ch.hsr.sa.radiotour.dataaccess.repositories.RiderRepository) IRiderRepository(ch.hsr.sa.radiotour.dataaccess.interfaces.IRiderRepository) JudgmentRiderConnectionRepository(ch.hsr.sa.radiotour.dataaccess.repositories.JudgmentRiderConnectionRepository) IJudgmentRiderConnectionRepository(ch.hsr.sa.radiotour.dataaccess.interfaces.IJudgmentRiderConnectionRepository) IJudgmentRepository(ch.hsr.sa.radiotour.dataaccess.interfaces.IJudgmentRepository) JudgmentRepository(ch.hsr.sa.radiotour.dataaccess.repositories.JudgmentRepository) Realm(io.realm.Realm) Before(org.junit.Before)

Example 3 with JudgmentRepository

use of ch.hsr.sa.radiotour.dataaccess.repositories.JudgmentRepository in project app by TourLive.

the class RewardRepositoryInstrumentedTest method initTestData.

@Before
public void initTestData() {
    this.judgmentRepository = new JudgmentRepository();
    this.rewardRepository = new RewardRepository();
    realm = Realm.getInstance(RadioTourApplication.getInstance());
    initCallbacks();
    realm.executeTransaction(new Realm.Transaction() {

        @Override
        public void execute(Realm realm) {
            realm.where(Judgement.class).findAll().deleteAllFromRealm();
            realm.where(Reward.class).findAll().deleteAllFromRealm();
        }
    });
    Judgement judgement = new Judgement();
    judgement.setDistance(100);
    judgement.setName("judgment");
    judgement.setRewardId(93);
    synchronized (this) {
        judgmentRepository.addJudgment(judgement, onSaveJudgmentCallback);
        judgement.setName("judgment2");
        judgmentRepository.addJudgment(judgement, onSaveJudgmentCallback);
    }
}
Also used : Judgement(ch.hsr.sa.radiotour.dataaccess.models.Judgement) IJudgmentRepository(ch.hsr.sa.radiotour.dataaccess.interfaces.IJudgmentRepository) JudgmentRepository(ch.hsr.sa.radiotour.dataaccess.repositories.JudgmentRepository) IRewardRepository(ch.hsr.sa.radiotour.dataaccess.interfaces.IRewardRepository) RewardRepository(ch.hsr.sa.radiotour.dataaccess.repositories.RewardRepository) Reward(ch.hsr.sa.radiotour.dataaccess.models.Reward) Realm(io.realm.Realm) Before(org.junit.Before)

Aggregations

IJudgmentRepository (ch.hsr.sa.radiotour.dataaccess.interfaces.IJudgmentRepository)3 JudgmentRepository (ch.hsr.sa.radiotour.dataaccess.repositories.JudgmentRepository)3 Realm (io.realm.Realm)3 Before (org.junit.Before)3 IRewardRepository (ch.hsr.sa.radiotour.dataaccess.interfaces.IRewardRepository)2 Judgement (ch.hsr.sa.radiotour.dataaccess.models.Judgement)2 Reward (ch.hsr.sa.radiotour.dataaccess.models.Reward)2 RewardRepository (ch.hsr.sa.radiotour.dataaccess.repositories.RewardRepository)2 IJudgmentRiderConnectionRepository (ch.hsr.sa.radiotour.dataaccess.interfaces.IJudgmentRiderConnectionRepository)1 IRiderRepository (ch.hsr.sa.radiotour.dataaccess.interfaces.IRiderRepository)1 JudgmentRiderConnectionRepository (ch.hsr.sa.radiotour.dataaccess.repositories.JudgmentRiderConnectionRepository)1 RiderRepository (ch.hsr.sa.radiotour.dataaccess.repositories.RiderRepository)1