Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
low-level cache store tests
  • Loading branch information
cbeer committed Mar 15, 2013
1 parent bbcff84 commit bcb3081
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Expand Up @@ -38,7 +38,7 @@ public boolean equals(final Object other) {
if(other instanceof LowLevelCacheStore) {
final LowLevelCacheStore that = (LowLevelCacheStore)other;

return this.store.equals(that.store) && this.low_level_store.equals(that.low_level_store);
return this.store.equals(that.store) && ((this.low_level_store == null && that.low_level_store == null) || this.low_level_store.equals(that.low_level_store));
} else {
return false;
}
Expand Down
Expand Up @@ -44,6 +44,36 @@ public void testGetExternalIdentifier() throws Exception {
assertEquals("org.modeshape.jcr.value.binary.TransientBinaryStore", cs.getExternalIdentifier().split("@")[0]);
}

@Test
public void testEquals() throws Exception {

BinaryStore store = ((JcrRepository)repo).getConfiguration()
.getBinaryStorage().getBinaryStore();

LowLevelCacheStore cs1 = new LowLevelCacheStore(store);
LowLevelCacheStore cs2 = new LowLevelCacheStore(store);

assertEquals(cs1, cs2);
}


@Test
public void testEqualsIspn() throws Exception {

EmbeddedCacheManager cm = new DefaultCacheManager("test_infinispan_configuration.xml");
BinaryStore store = new InfinispanBinaryStore(cm, false, "FedoraRepository", "FedoraRepository");

CacheStore ispn = cm.getCache("FedoraRepository").getAdvancedCache().getComponentRegistry()
.getComponent(CacheLoaderManager.class)
.getCacheStore();

LowLevelCacheStore cs1 = new LowLevelCacheStore(store, ispn);
LowLevelCacheStore cs2 = new LowLevelCacheStore(store, ispn);

assertEquals(cs1, cs2);

}

@Test
public void testGetExternalIdentifierWithInfinispan() throws Exception {

Expand Down

0 comments on commit bcb3081

Please sign in to comment.