Skip to content

Commit

Permalink
MODE-1526 - Added test case which indicates a problem with ISPN and S…
Browse files Browse the repository at this point in the history
…chematic entries
  • Loading branch information
Horia Chiorean authored and rhauch committed Jun 21, 2012
1 parent f0710b0 commit f82ecaf
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@
import static org.hamcrest.core.Is.is;
import static org.hamcrest.core.IsNull.notNullValue;
import static org.hamcrest.core.IsNull.nullValue;
import org.infinispan.Cache;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
import java.io.File;
import java.io.InputStream;
import java.net.URL;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.Set;
Expand All @@ -44,6 +49,7 @@
import javax.jcr.query.QueryResult;
import javax.transaction.TransactionManager;
import org.junit.After;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
Expand Down Expand Up @@ -717,6 +723,45 @@ public void shouldWorkWithUserDefinedTransactionsThatUseRollback() throws Except
}
}

@Test
@FixFor("MODE-1526")
@Ignore("Ignored because it crashes")
public void shouldKeepPersistentDataAcrossRestart() throws Exception {
File contentFolder = new File("target/persistent_repository/store/persistentRepository");
boolean testNodeShouldExist = contentFolder.exists() && contentFolder.isDirectory();

URL config = getClass().getClassLoader().getResource("config/repo-config-persistent-cache.json");
JcrRepository repository = new JcrRepository(RepositoryConfiguration.read(config));
repository.start();


try {
Session session = repository.login();
if (testNodeShouldExist) {
assertNotNull(session.getNode("/testNode"));
}
else {
session.getRootNode().addNode("testNode");
session.save();
}

for (Cache cache : repository.caches()) {
cache.stop();
}
repository.shutdown();

repository.start();
for (Cache cache : repository.caches()) {
cache.start();
}

session = repository.login();
assertNotNull(session.getNode("/testNode"));
} finally {
TestingUtil.killRepository(repository);
}
}

protected void nodeExists( Session session,
String parentPath,
String childName,
Expand Down
28 changes: 28 additions & 0 deletions modeshape-jcr/src/test/resources/config/infinispan-persistent.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<infinispan
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd"
xmlns="urn:infinispan:config:5.1">

<global/>

<namedCache name="persistentRepository">
<transaction
transactionManagerLookupClass="org.infinispan.transaction.lookup.GenericTransactionManagerLookup"
transactionMode="TRANSACTIONAL"
lockingMode="OPTIMISTIC"/>
<loaders
passivation="false"
shared="false"
preload="false">
<loader
class="org.infinispan.loaders.file.FileCacheStore"
fetchPersistentState="false"
purgeOnStartup="false">
<properties>
<property name="location" value="target/persistent_repository/store"/>
</properties>
</loader>
</loaders>
</namedCache>
</infinispan>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name" : "Persistent Repository",
"jndiName" : "java:jcr/local/PersistentRepository",
"monitoring" : {
"enabled" : true
},
"storage" : {
"cacheName" : "persistentRepository",
"cacheConfiguration" : "config/infinispan-persistent.xml"
},
"workspaces" : {
"default" : "default",
"allowCreation" : true
},
"security" : {
"anonymous" : {
"roles" : ["readonly","readwrite","admin"],
"useOnFailedLogin" : false
}
},
"query" : {
"enabled" : true,
"indexStorage" : {
"type" : "filesystem",
"location" : "target/persistent_repository/index"
},
"rebuildUponStartup" : "if_missing"
}
}

0 comments on commit f82ecaf

Please sign in to comment.