// Path: hibernate4-memcached-core/src/main/java/kr/pe/kwonnam/hibernate4memcached/strategies/NonstrictReadWriteEntityRegionAccessStrategy.java
// public class NonstrictReadWriteEntityRegionAccessStrategy extends BaseEntityMemcachedRegionAccessStrategy {
//     private Logger log = LoggerFactory.getLogger(NonstrictReadWriteEntityRegionAccessStrategy.class);
// 
//     public NonstrictReadWriteEntityRegionAccessStrategy(EntityMemcachedRegion entityMemcachedRegion) {
//         super(entityMemcachedRegion);
//     }
// 
//     @Override
//     public boolean insert(Object key, Object value, Object version) throws CacheException {
//         log.debug("region access strategy nonstrict-read-write entity insert() {} {}", getInternalRegion().getCacheNamespace(), key);
//         // On nonstrict-read-write, Hibernate never calls this method.
//         return false;
//     }
// 
//     @Override
//     public boolean afterInsert(Object key, Object value, Object version) throws CacheException {
//         log.debug("region access strategy nonstrict-read-write entity afterInsert() {} {}", getInternalRegion().getCacheNamespace(), key);
//         // On nonstrict-read-write, Hibernate never calls this method.
//         return false;
//     }
// 
//     /**
//      * not necessary in nostrict-read-write
//      *
//      * @see org.hibernate.cache.spi.access.EntityRegionAccessStrategy
//      */
//     @Override
//     public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException {
//         log.debug("region access strategy nonstrict-read-write entity update() {} {}", getInternalRegion().getCacheNamespace(), key);
//         return false;
//     }
// 
//     /**
//      * need evict the key, after update.
//      *
//      * @see org.hibernate.cache.spi.access.EntityRegionAccessStrategy
//      */
//     @Override
//     public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws CacheException {
//         log.debug("region access strategy nonstrict-read-write entity afterUpdate() {} {}", getInternalRegion().getCacheNamespace(), key);
//         getInternalRegion().evict(key);
//         return false;
//     }
// }
// 
// Path: hibernate4-memcached-core/src/main/java/kr/pe/kwonnam/hibernate4memcached/strategies/ReadOnlyEntityRegionAccessStrategy.java
// public class ReadOnlyEntityRegionAccessStrategy extends BaseEntityMemcachedRegionAccessStrategy {
//     private Logger log = LoggerFactory.getLogger(ReadOnlyEntityRegionAccessStrategy.class);
// 
//     public ReadOnlyEntityRegionAccessStrategy(EntityMemcachedRegion entityMemcachedRegion) {
//         super(entityMemcachedRegion);
//     }
// 
//     @Override
//     public boolean insert(Object key, Object value, Object version) throws CacheException {
//         log.debug("region access strategy readonly entity insert() {} {}", getInternalRegion().getCacheNamespace(), key);
//         // On read-only, Hibernate never calls this method.
//         return false;
//     }
// 
//     @Override
//     public boolean afterInsert(Object key, Object value, Object version) throws CacheException {
//         log.debug("region access strategy readonly entity afterInsert() {} {}", getInternalRegion().getCacheNamespace(), key);
//         // On read-only, Hibernate never calls this method.
//         return false;
//     }
// 
//     /**
//      * read-onluy does not support update.
//      */
//     @Override
//     public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException {
//         log.debug("region access strategy readonly entity update() {} {}", getInternalRegion().getCacheNamespace(), key);
//         throw new UnsupportedOperationException("ReadOnly strategy does not support update.");
//     }
// 
//     /**
//      * read-only does not support update.
//      */
//     @Override
//     public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws CacheException {
//         log.debug("region access strategy readonly entity afterUpdate() {} {}", getInternalRegion().getCacheNamespace(), key);
//         throw new UnsupportedOperationException("ReadOnly strategy does not support update.");
//     }
// }


import kr.pe.kwonnam.hibernate4memcached.strategies.NonstrictReadWriteEntityRegionAccessStrategy;
import kr.pe.kwonnam.hibernate4memcached.strategies.ReadOnlyEntityRegionAccessStrategy;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.access.AccessType;
import org.junit.Test;
import static org.fest.assertions.api.Assertions.assertThat;
import static org.hamcrest.CoreMatchers.containsString;
package kr.pe.kwonnam.hibernate4memcached.regions;



public class EntityMemcachedRegionTest extends AbstractFinalMemcachedRegionTest {

    private EntityMemcachedRegion entityMemcachedRegion;

    @Override
    protected void afterSetUp() throws Exception {
        entityMemcachedRegion = new EntityMemcachedRegion("Books", properties, metadata, settings, memcachedAdapter, hibernateCacheTimestamper);
    }

    @Test
    public void buildAccessStrategy_AccessType_READ_ONLY() throws Exception {
        assertThat(entityMemcachedRegion.buildAccessStrategy(AccessType.READ_ONLY))
// Path: hibernate4-memcached-core/src/main/java/kr/pe/kwonnam/hibernate4memcached/strategies/NonstrictReadWriteEntityRegionAccessStrategy.java
// public class NonstrictReadWriteEntityRegionAccessStrategy extends BaseEntityMemcachedRegionAccessStrategy {
//     private Logger log = LoggerFactory.getLogger(NonstrictReadWriteEntityRegionAccessStrategy.class);
// 
//     public NonstrictReadWriteEntityRegionAccessStrategy(EntityMemcachedRegion entityMemcachedRegion) {
//         super(entityMemcachedRegion);
//     }
// 
//     @Override
//     public boolean insert(Object key, Object value, Object version) throws CacheException {
//         log.debug("region access strategy nonstrict-read-write entity insert() {} {}", getInternalRegion().getCacheNamespace(), key);
//         // On nonstrict-read-write, Hibernate never calls this method.
//         return false;
//     }
// 
//     @Override
//     public boolean afterInsert(Object key, Object value, Object version) throws CacheException {
//         log.debug("region access strategy nonstrict-read-write entity afterInsert() {} {}", getInternalRegion().getCacheNamespace(), key);
//         // On nonstrict-read-write, Hibernate never calls this method.
//         return false;
//     }
// 
//     /**
//      * not necessary in nostrict-read-write
//      *
//      * @see org.hibernate.cache.spi.access.EntityRegionAccessStrategy
//      */
//     @Override
//     public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException {
//         log.debug("region access strategy nonstrict-read-write entity update() {} {}", getInternalRegion().getCacheNamespace(), key);
//         return false;
//     }
// 
//     /**
//      * need evict the key, after update.
//      *
//      * @see org.hibernate.cache.spi.access.EntityRegionAccessStrategy
//      */
//     @Override
//     public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws CacheException {
//         log.debug("region access strategy nonstrict-read-write entity afterUpdate() {} {}", getInternalRegion().getCacheNamespace(), key);
//         getInternalRegion().evict(key);
//         return false;
//     }
// }
// 
// Path: hibernate4-memcached-core/src/main/java/kr/pe/kwonnam/hibernate4memcached/strategies/ReadOnlyEntityRegionAccessStrategy.java
// public class ReadOnlyEntityRegionAccessStrategy extends BaseEntityMemcachedRegionAccessStrategy {
//     private Logger log = LoggerFactory.getLogger(ReadOnlyEntityRegionAccessStrategy.class);
// 
//     public ReadOnlyEntityRegionAccessStrategy(EntityMemcachedRegion entityMemcachedRegion) {
//         super(entityMemcachedRegion);
//     }
// 
//     @Override
//     public boolean insert(Object key, Object value, Object version) throws CacheException {
//         log.debug("region access strategy readonly entity insert() {} {}", getInternalRegion().getCacheNamespace(), key);
//         // On read-only, Hibernate never calls this method.
//         return false;
//     }
// 
//     @Override
//     public boolean afterInsert(Object key, Object value, Object version) throws CacheException {
//         log.debug("region access strategy readonly entity afterInsert() {} {}", getInternalRegion().getCacheNamespace(), key);
//         // On read-only, Hibernate never calls this method.
//         return false;
//     }
// 
//     /**
//      * read-onluy does not support update.
//      */
//     @Override
//     public boolean update(Object key, Object value, Object currentVersion, Object previousVersion) throws CacheException {
//         log.debug("region access strategy readonly entity update() {} {}", getInternalRegion().getCacheNamespace(), key);
//         throw new UnsupportedOperationException("ReadOnly strategy does not support update.");
//     }
// 
//     /**
//      * read-only does not support update.
//      */
//     @Override
//     public boolean afterUpdate(Object key, Object value, Object currentVersion, Object previousVersion, SoftLock lock) throws CacheException {
//         log.debug("region access strategy readonly entity afterUpdate() {} {}", getInternalRegion().getCacheNamespace(), key);
//         throw new UnsupportedOperationException("ReadOnly strategy does not support update.");
//     }
// }


// Path: hibernate4-memcached-core/src/test/java/kr/pe/kwonnam/hibernate4memcached/regions/EntityMemcachedRegionTest.java
import kr.pe.kwonnam.hibernate4memcached.strategies.NonstrictReadWriteEntityRegionAccessStrategy;
import kr.pe.kwonnam.hibernate4memcached.strategies.ReadOnlyEntityRegionAccessStrategy;
import org.hibernate.cache.CacheException;
import org.hibernate.cache.spi.access.AccessType;
import org.junit.Test;
import static org.fest.assertions.api.Assertions.assertThat;
import static org.hamcrest.CoreMatchers.containsString;

package kr.pe.kwonnam.hibernate4memcached.regions;



public class EntityMemcachedRegionTest extends AbstractFinalMemcachedRegionTest {

    private EntityMemcachedRegion entityMemcachedRegion;

    @Override
    protected void afterSetUp() throws Exception {
        entityMemcachedRegion = new EntityMemcachedRegion("Books", properties, metadata, settings, memcachedAdapter, hibernateCacheTimestamper);
    }

    @Test
    public void buildAccessStrategy_AccessType_READ_ONLY() throws Exception {
        assertThat(entityMemcachedRegion.buildAccessStrategy(AccessType.READ_ONLY))
                .isExactlyInstanceOf(ReadOnlyEntityRegionAccessStrategy.class);