Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c116597
Showing
6 changed files
with
190 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
target/ | ||
.classpath | ||
.settings/ | ||
.project | ||
.metadata | ||
ActiveMQ/ | ||
FedoraRepository/ | ||
indexes/ | ||
ObjectStore/ | ||
*/.cache | ||
.cache | ||
.DS_Store | ||
*~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>demo</groupId> | ||
<artifactId>node-goes-from-federated-to-ispn</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.modeshape</groupId> | ||
<artifactId>modeshape-jcr</artifactId> | ||
<version>3.2-SNAPSHOT</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.0</version> | ||
<configuration> | ||
<debug>false</debug> | ||
<source>1.7</source> | ||
<target>1.7</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<mainClass>demo.Main</mainClass> | ||
</manifest> | ||
</archive> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<repositories> | ||
<repository> | ||
<id>fcrepo-snapshot</id> | ||
<name>Fcrepo Repository for Maven</name> | ||
<url>http://maven.fcrepo.org/nexus/content/repositories/snapshots/</url> | ||
<releases> | ||
<enabled>true</enabled> | ||
</releases> | ||
<snapshots> | ||
<enabled>true</enabled> | ||
</snapshots> | ||
</repository> | ||
</repositories> | ||
</project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
|
||
package demo; | ||
|
||
import static java.lang.System.exit; | ||
import static java.lang.System.out; | ||
import static org.modeshape.jcr.RepositoryConfiguration.read; | ||
|
||
import java.util.concurrent.ExecutionException; | ||
|
||
import javax.jcr.RepositoryException; | ||
import javax.jcr.Session; | ||
import javax.jcr.Workspace; | ||
|
||
import org.infinispan.schematic.document.ParsingException; | ||
import org.modeshape.jcr.ConfigurationException; | ||
import org.modeshape.jcr.JcrRepository; | ||
import org.modeshape.jcr.ModeShapeEngine; | ||
import org.modeshape.jcr.NoSuchRepositoryException; | ||
import org.modeshape.jcr.api.JcrTools; | ||
|
||
public class Main { | ||
|
||
static Main me = new Main(); | ||
|
||
ModeShapeEngine engine = new ModeShapeEngine(); | ||
|
||
JcrRepository repo; | ||
|
||
private final String repoName = "repo"; | ||
|
||
private final static String repoConfig = "/repository.json"; | ||
|
||
public static void main(String[] args) { | ||
try { | ||
me.start(); | ||
Session session = me.repo.login(); | ||
|
||
setup: { | ||
session.getRootNode().addNode("nonfederated"); | ||
new JcrTools(true).uploadFileAndBlock(session, Main.class | ||
.getResource("/thing2"), "/nonfederated"); | ||
} | ||
|
||
action: { | ||
final Workspace ws = session.getWorkspace(); | ||
ws.copy("/p1/thing1", "/nonfederated/thing1"); | ||
session.removeItem("/p1/thing1"); | ||
ws.copy("/nonfederated/thing2", "/p1/thing2"); | ||
session.removeItem("/nonfederated/thing2"); | ||
} | ||
|
||
session.save(); | ||
session.logout(); | ||
session = me.repo.login(); | ||
|
||
tests: { | ||
assert !session.nodeExists("/p1/thing1") : "Shouldn't find /p1/thing1!"; | ||
assert session.nodeExists("/nonfederated/thing1") : "Should find /nonfederated/thing1!"; | ||
assert !session.nodeExists("/nonfederated/thing2") : "Shouldn't find /nonfederated/thing2!"; | ||
assert session.nodeExists("/p1/thing2") : "Should find /p1/thing2!"; | ||
} | ||
|
||
session.save(); | ||
session.logout(); | ||
me.stop(); | ||
|
||
} catch (Exception e) { | ||
e.printStackTrace(); | ||
exit(1); | ||
} | ||
exit(0); | ||
|
||
} | ||
|
||
private void start() throws ConfigurationException, ParsingException, | ||
RepositoryException { | ||
engine.start(); | ||
out.println("Engine started..."); | ||
engine.deploy(read(this.getClass().getResource(repoConfig))); | ||
out.println("Repo deployed..."); | ||
engine.startRepository(repoName); | ||
out.println("Repo started..."); | ||
repo = engine.getRepository(repoName); | ||
} | ||
|
||
private void stop() throws NoSuchRepositoryException, InterruptedException, | ||
ExecutionException { | ||
// block waiting for all repos to shutdown | ||
out.println("Engine stopping..."); | ||
engine.shutdown().get(); | ||
out.println("Engine stopped."); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"name": "repo", | ||
"workspaces": { | ||
"predefined": [], | ||
"default": "default", | ||
"allowCreation": false | ||
}, | ||
"externalSources": {"targetDirectory": { | ||
"classname": "org.modeshape.connector.filesystem.FileSystemConnector", | ||
"directoryPath": "target/classes/test-objects", | ||
"readonly": false, | ||
"cacheTtlSeconds": 1, | ||
"projections": ["default:/p1 => /"] | ||
}}, | ||
"security": { | ||
"anonymous": { | ||
"roles": [ | ||
"readonly", | ||
"readwrite", | ||
"admin" | ||
], | ||
"useOnFailedLogin": false | ||
}, | ||
"providers": [{"classname": "servlet"}] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
foo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
flambeau |