コード例 #1
0
  @Ignore
  @Test
  public void testWithHazelcastConfiguration() throws Exception {
    // wrong use!!

    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    URI uri = classLoader.getResource("hazelcast-jcache.xml").toURI();

    try (CachingProvider provider = Caching.getCachingProvider();
        CacheManager manager = provider.getCacheManager(uri, classLoader);
        Cache<String, String> cache = manager.getCache("testCache")) {
      cache.put("key1", "value1");
      cache.put("key2", "value2");

      TimeUnit.SECONDS.sleep(1);

      cache.get("key2");

      TimeUnit.SECONDS.sleep(2);

      assertThat(cache.get("key1")).isNull();
      assertThat(cache.get("key2")).isEqualTo("value2");
    }
  }
コード例 #2
0
  @Before
  public void init() {

    InputStream stream = ClassLoader.getSystemResourceAsStream("testLuceneIndex.sql");
    db.command(new OCommandScript("sql", getScriptFromStream(stream))).execute();
  }