Package com.avaje.tests.model.basic

Examples of com.avaje.tests.model.basic.Country


    Assert.assertTrue(countryCache.size() > 0);

    // reset the statistics
    countryCache.getStatistics(true);

    Country c0 = Ebean.getReference(Country.class, "NZ");
    ServerCacheStatistics statistics = countryCache.getStatistics(false);
    int hc = statistics.getHitCount();
    Assert.assertEquals(1, hc);
    Assert.assertNotNull(c0);
View Full Code Here


    ServerCacheStatistics statistics = cache.getStatistics(false);
    Assert.assertEquals(1, statistics.getSize());
    Assert.assertEquals(1, statistics.getHitCount());
    Assert.assertSame(countryList1, countryList0);
   
    Country nz = Ebean.find(Country.class, "NZ");
    nz.setName("New Zealandia");
    Ebean.save(nz);
   
    statistics = cache.getStatistics(false);
    Assert.assertEquals(0, statistics.getSize());
   
View Full Code Here

      .setUseQueryCache(true)
      .setReadOnly(true)
      .order("name")
      .findMap();
   
    Country loadedNz = map.get("NZ");
   
    // this will hit the cache
    Country nz = Ebean.find(Country.class, "NZ");
   
    Assert.assertTrue(loadedNz == nz);
  }
View Full Code Here

    serverCacheManager.clear(Country.class);

    ServerCache beanCache = serverCacheManager.getBeanCache(Country.class);
    Assert.assertEquals(0, beanCache.size());

    Country nz1 = Ebean.getReference(Country.class, "NZ");
    Assert.assertEquals(0, beanCache.size());

    // has the effect of loading the cache via lazy loading
    nz1.getName();
    Assert.assertEquals(1, beanCache.size());

    Country nz2 = Ebean.getReference(Country.class, "NZ");
    Country nz2b = Ebean.getReference(Country.class, "NZ");

    Country nz3 = Ebean.find(Country.class, "NZ");

    Country nz4 = Ebean.find(Country.class).setId("NZ").setAutofetch(false).setUseCache(false)
        .findUnique();

    Assert.assertTrue(nz2 == nz2b);
    Assert.assertTrue(nz2 == nz3);
    Assert.assertTrue(nz3 != nz4);
View Full Code Here

TOP

Related Classes of com.avaje.tests.model.basic.Country

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.