Esempio n. 1
0
  @Test
  public void testGetActiveSessions() {
    Transaction tx = schema.connect(null);
    Person p, person;
    Iterable<Session> s;
    Boolean expected, actual;

    expected = true;
    p = tx.retrieve("Person", "1");
    person = tx.retrieve("Person", "1");
    s = person.getSessions().stream().filter(Sessions::isLive).collect(Collectors.toList());

    if (Persons.getActiveSessions(p).equals(s)) {
      actual = true;
    } else {
      actual = false;
    }

    Assert.assertEquals(expected, actual);
  }
Esempio n. 2
0
  {
    try {
      schema = TempSQLiteRepo.forSchema(RealmSchema.get());
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

    Transaction tx;
    Person p;

    tx = schema.connect("testing");
    p = tx.create("Person");
    p.setName("personA");
    p.setSessions(tx.create("Person.sessions"));
    // p.setSessions(new IListing<Session>(Session.class));

    Device dev = tx.create("Device");
    dev.setOwner(p);

    tx.post();
  }