Search in sources :

Example 51 with DiscoveryStringId

use of siena.base.test.model.DiscoveryStringId in project siena by mandubian.

the class BaseTestNoAutoInc_DEFAULT method testRelationship.

public void testRelationship() {
    DiscoveryStringId radioactivity = new DiscoveryStringId("Radioactivity", StringID_CURIE);
    DiscoveryStringId relativity = new DiscoveryStringId("Relativity", StringID_EINSTEIN);
    DiscoveryStringId teslaCoil = new DiscoveryStringId("Tesla Coil", StringID_TESLA);
    pm.insert(radioactivity);
    pm.insert(relativity);
    pm.insert(teslaCoil);
    DiscoveryStringId relativity2 = pm.createQuery(DiscoveryStringId.class).filter("discoverer", StringID_EINSTEIN).get();
    assertTrue(relativity.name.equals(relativity2.name));
}
Also used : DiscoveryStringId(siena.base.test.model.DiscoveryStringId)

Example 52 with DiscoveryStringId

use of siena.base.test.model.DiscoveryStringId in project siena by mandubian.

the class BaseTestNoAutoInc_DEFAULT method testJoin.

public void testJoin() {
    DiscoveryStringId radioactivity = new DiscoveryStringId("Radioactivity", StringID_CURIE);
    DiscoveryStringId relativity = new DiscoveryStringId("Relativity", StringID_EINSTEIN);
    DiscoveryStringId foo = new DiscoveryStringId("Foo", StringID_EINSTEIN);
    DiscoveryStringId teslaCoil = new DiscoveryStringId("Tesla Coil", StringID_TESLA);
    pm.insert(radioactivity);
    pm.insert(relativity);
    pm.insert(foo);
    pm.insert(teslaCoil);
    List<DiscoveryStringId> res = pm.createQuery(DiscoveryStringId.class).join("discoverer").order("name").fetch();
    assertEquals(4, res.size());
    assertEquals(foo, res.get(0));
    assertEquals(radioactivity, res.get(1));
    assertEquals(relativity, res.get(2));
    assertEquals(teslaCoil, res.get(3));
    assertEquals(StringID_EINSTEIN, res.get(0).discoverer);
    assertEquals(StringID_CURIE, res.get(1).discoverer);
    assertEquals(StringID_EINSTEIN, res.get(2).discoverer);
    assertEquals(StringID_TESLA, res.get(3).discoverer);
}
Also used : DiscoveryStringId(siena.base.test.model.DiscoveryStringId)

Example 53 with DiscoveryStringId

use of siena.base.test.model.DiscoveryStringId in project siena by mandubian.

the class BaseTestNoAutoInc_DEFAULT method testJoinSortFields.

public void testJoinSortFields() {
    DiscoveryStringId radioactivity = new DiscoveryStringId("Radioactivity", StringID_CURIE);
    DiscoveryStringId relativity = new DiscoveryStringId("Relativity", StringID_EINSTEIN);
    DiscoveryStringId foo = new DiscoveryStringId("Foo", StringID_EINSTEIN);
    DiscoveryStringId teslaCoil = new DiscoveryStringId("Tesla Coil", StringID_TESLA);
    pm.insert(radioactivity);
    pm.insert(relativity);
    pm.insert(foo);
    pm.insert(teslaCoil);
    List<DiscoveryStringId> res = pm.createQuery(DiscoveryStringId.class).join("discoverer", "firstName").order("name").fetch();
    assertEquals(4, res.size());
    assertEquals(foo, res.get(0));
    assertEquals(radioactivity, res.get(1));
    assertEquals(relativity, res.get(2));
    assertEquals(teslaCoil, res.get(3));
    assertEquals(StringID_EINSTEIN, res.get(0).discoverer);
    assertEquals(StringID_CURIE, res.get(1).discoverer);
    assertEquals(StringID_EINSTEIN, res.get(2).discoverer);
    assertEquals(StringID_TESLA, res.get(3).discoverer);
}
Also used : DiscoveryStringId(siena.base.test.model.DiscoveryStringId)

Example 54 with DiscoveryStringId

use of siena.base.test.model.DiscoveryStringId in project siena by mandubian.

the class BaseTestNoAutoInc_DEFAULT method testFetchLimitOffsetReal.

public void testFetchLimitOffsetReal() {
    DiscoveryStringId[] discs = new DiscoveryStringId[10];
    for (int i = 0; i < 10; i++) {
        discs[i] = new DiscoveryStringId("Disc_" + i, StringID_CURIE);
        pm.insert(discs[i]);
    }
    List<DiscoveryStringId> res = pm.createQuery(DiscoveryStringId.class).order("name").fetch(3, 5);
    assertNotNull(res);
    assertEquals(3, res.size());
    assertEquals(discs[5], res.get(0));
    assertEquals(discs[6], res.get(1));
    assertEquals(discs[7], res.get(2));
}
Also used : DiscoveryStringId(siena.base.test.model.DiscoveryStringId)

Example 55 with DiscoveryStringId

use of siena.base.test.model.DiscoveryStringId in project siena by mandubian.

the class BaseTestNoAutoInc_4_SPECIALS method testRelationship.

public void testRelationship() {
    DiscoveryStringId radioactivity = new DiscoveryStringId("Radioactivity", StringID_CURIE);
    DiscoveryStringId relativity = new DiscoveryStringId("Relativity", StringID_EINSTEIN);
    DiscoveryStringId teslaCoil = new DiscoveryStringId("Tesla Coil", StringID_TESLA);
    pm.insert(radioactivity);
    pm.insert(relativity);
    pm.insert(teslaCoil);
    DiscoveryStringId relativity2 = pm.createQuery(DiscoveryStringId.class).filter("discoverer", StringID_EINSTEIN).get();
    assertTrue(relativity.name.equals(relativity2.name));
}
Also used : DiscoveryStringId(siena.base.test.model.DiscoveryStringId)

Aggregations

DiscoveryStringId (siena.base.test.model.DiscoveryStringId)98 SienaException (siena.SienaException)9 ArrayList (java.util.ArrayList)6