Example usage for org.apache.ibatis.cache CacheKey CacheKey

List of usage examples for org.apache.ibatis.cache CacheKey CacheKey

Introduction

In this page you can find the example usage for org.apache.ibatis.cache CacheKey CacheKey.

Prototype

public CacheKey() 

Source Link

Usage

From source file:com.ibatis.sqlmap.CacheStatementTest.java

License:Apache License

public void testCacheKeyWithSameHashcode() {
    CacheKey key1 = new CacheKey();
    CacheKey key2 = new CacheKey();

    key1.update("HS1CS001");
    key2.update("HS1D4001");

    assertEquals("Expect same hashcode.", key1.hashCode(), key2.hashCode());
    assertFalse("Expect not equal", key1.equals(key2));
}

From source file:com.ibatis.sqlmap.CacheStatementTest.java

License:Apache License

public void testCacheKeyWithTwoParamsSameHashcode() {
    CacheKey key1 = new CacheKey();
    CacheKey key2 = new CacheKey();

    key1.update("HS1CS001");
    key1.update("HS1D4001");

    key2.update("HS1D4001");
    key2.update("HS1CS001");

    assertEquals("Expect same hashcode.", key1.hashCode(), key2.hashCode());
    assertFalse("Expect not equal", key1.equals(key2));
}

From source file:com.ibatis.sqlmap.engine.cache.CacheKeyTest.java

License:Apache License

public void testUpdate() {
    CacheKey key3 = new CacheKey();

    CacheKey key4 = new CacheKey();

    key3.update("AV");

    key4.update("B7");

    assertTrue(!key3.equals(key4));// www .  jav  a  2s  .co m
    assertTrue(!key3.toString().equals(key4.toString()));

}

From source file:org.cacheonix.impl.plugin.mybatis.v300.MyBatisCacheKeyTest.java

License:LGPL

public void testEquals() throws Exception {

    final CacheKey cacheKey = new CacheKey();
    cacheKey.update("Object 1");
    cacheKey.update("Object 2");
    assertEquals(myBatisCacheKey, new MyBatisCacheKey(cacheKey));
}

From source file:org.cacheonix.impl.plugin.mybatis.v300.MyBatisCacheKeyTest.java

License:LGPL

public void setUp() throws Exception {

    super.setUp();

    final CacheKey cacheKey = new CacheKey();
    cacheKey.update("Object 1");
    cacheKey.update("Object 2");

    myBatisCacheKey = new MyBatisCacheKey(cacheKey);
}

From source file:org.cacheonix.plugin.mybatis.v300.MyBatisCacheTestDriver.java

License:LGPL

private static CacheKey createKey() {

    final CacheKey cacheKey = new CacheKey();
    cacheKey.update("org.mybatis.example.AccountMapper.getAccountByUsername");
    cacheKey.update("Key Object 1");
    cacheKey.update("Key Object 2");
    return cacheKey;
}