Search in sources :

Example 1 with BeforeExperiment

use of dk.ilios.spanner.BeforeExperiment in project realm-java by realm.

the class RealmBenchmarks method before.

@BeforeExperiment
public void before() {
    Realm.init(InstrumentationRegistry.getTargetContext());
    coldConfig = new RealmConfiguration.Builder().name("cold").build();
    RealmConfiguration config = new RealmConfiguration.Builder().build();
    Realm.deleteRealm(coldConfig);
    Realm.deleteRealm(config);
    realm = Realm.getInstance(config);
    realm.executeTransaction(new Realm.Transaction() {

        @Override
        public void execute(Realm realm) {
            readObject = realm.createObject(AllTypes.class);
            readObject.setColumnString("Foo");
            readObject.setColumnLong(42);
            readObject.setColumnDouble(1.234D);
        }
    });
}
Also used : RealmConfiguration(io.realm.RealmConfiguration) Realm(io.realm.Realm) BeforeExperiment(dk.ilios.spanner.BeforeExperiment)

Example 2 with BeforeExperiment

use of dk.ilios.spanner.BeforeExperiment in project realm-java by realm.

the class RealmObjectWriteBenchmarks method before.

@BeforeExperiment
public void before() {
    RealmConfiguration config = new RealmConfiguration.Builder().build();
    Realm.deleteRealm(config);
    realm = Realm.getInstance(config);
    realm.beginTransaction();
    writeObject = realm.createObject(AllTypes.class);
}
Also used : RealmConfiguration(io.realm.RealmConfiguration) AllTypes(io.realm.entities.AllTypes) BeforeExperiment(dk.ilios.spanner.BeforeExperiment)

Example 3 with BeforeExperiment

use of dk.ilios.spanner.BeforeExperiment in project realm-java by realm.

the class RealmQueryBenchmarks method before.

@BeforeExperiment
public void before() {
    RealmConfiguration config = new RealmConfiguration.Builder().build();
    Realm.deleteRealm(config);
    realm = Realm.getInstance(config);
    realm.beginTransaction();
    for (int i = 0; i < DATA_SIZE; i++) {
        AllTypes obj = realm.createObject(AllTypes.class);
        obj.setColumnLong(i);
        obj.setColumnBoolean(i % 2 == 0);
        obj.setColumnString("Foo " + i);
        obj.setColumnDouble(i + 1.234D);
    }
    realm.commitTransaction();
}
Also used : RealmConfiguration(io.realm.RealmConfiguration) AllTypes(io.realm.entities.AllTypes) BeforeExperiment(dk.ilios.spanner.BeforeExperiment)

Example 4 with BeforeExperiment

use of dk.ilios.spanner.BeforeExperiment in project realm-java by realm.

the class RealmResultsBenchmarks method before.

@BeforeExperiment
public void before() {
    Realm.init(InstrumentationRegistry.getTargetContext());
    RealmConfiguration config = new RealmConfiguration.Builder().build();
    Realm.deleteRealm(config);
    realm = Realm.getInstance(config);
    realm.beginTransaction();
    for (int i = 0; i < DATA_SIZE; i++) {
        AllTypes obj = realm.createObject(AllTypes.class);
        obj.setColumnLong(i);
        obj.setColumnBoolean(i % 2 == 0);
        obj.setColumnString("Foo " + i);
        obj.setColumnDouble(i + 1.234D);
    }
    realm.commitTransaction();
    results = realm.where(AllTypes.class).findAll();
}
Also used : RealmConfiguration(io.realm.RealmConfiguration) AllTypes(io.realm.entities.AllTypes) BeforeExperiment(dk.ilios.spanner.BeforeExperiment)

Example 5 with BeforeExperiment

use of dk.ilios.spanner.BeforeExperiment in project realm-java by realm.

the class RealmAllocBenchmarks method before.

@BeforeExperiment
public void before() {
    Realm.init(InstrumentationRegistry.getTargetContext());
    RealmConfiguration config = new RealmConfiguration.Builder().build();
    Realm.deleteRealm(config);
    realm = Realm.getInstance(config);
    realm.beginTransaction();
    realm.createObject(AllTypes.class).getColumnRealmList().add(realm.createObject(Dog.class));
    realm.commitTransaction();
}
Also used : RealmConfiguration(io.realm.RealmConfiguration) Dog(io.realm.entities.Dog) BeforeExperiment(dk.ilios.spanner.BeforeExperiment)

Aggregations

BeforeExperiment (dk.ilios.spanner.BeforeExperiment)6 RealmConfiguration (io.realm.RealmConfiguration)6 AllTypes (io.realm.entities.AllTypes)3 Realm (io.realm.Realm)2 Dog (io.realm.entities.Dog)1