Exemplo 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);
  }
Exemplo n.º 2
0
  @Test
  public void testGetOwnedDevices() {
    Transaction tx = schema.connect(null);
    Person owner;
    Iterable<Device> devQuery;

    owner = tx.retrieve("Person", "1");
    devQuery = tx.query("Device", new IQuery("owner", owner));

    Device d1, d2;
    d1 = devQuery.iterator().next();
    d2 = Persons.getOwnedDevices(tx, owner).iterator().next();
    Assert.assertSame(d1, d2);
  }