[dna-commits] DNA SVN: r1071 - in trunk: dna-graph/src/main/java/org/jboss/dna/graph and 10 other directories.
dna-commits at lists.jboss.org
dna-commits at lists.jboss.org
Sat Jul 4 16:01:18 EDT 2009
Author: bcarothers
Date: 2009-07-04 16:01:17 -0400 (Sat, 04 Jul 2009)
New Revision: 1071
Modified:
trunk/dna-cnd/src/test/java/org/jboss/dna/cnd/CndImporterTest.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRequestProcessor.java
trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/GraphNamespaceRegistry.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/GraphTest.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/federation/AbstractFederatedRepositorySourceIntegrationTest.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/NotWritableConnectorTest.java
trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/WritableConnectorTest.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrWorkspace.java
trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryNodeTypeManager.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/AbstractJcrAccessTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/ImportExportTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrSessionTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrWorkspaceTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/MixinTest.java
trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/RepositoryNodeTypeManagerTest.java
trunk/dna-repository/src/test/java/org/jboss/dna/repository/RepositoryServiceTest.java
trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapterTest.java
trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/JpaConnectorWritingTest.java
Log:
DNA-448 The 'createIfMissing()' methods should be removed from the Graph API
Commited the DNA-448.patch patch to replace the existing Graph create and createIfMissing methods with a copy of the Graph.Batch create methods (modified to do direct writes, of course). This improves consistency between the direct and batched create methods, but forces the use of and() as a terminator to indicate that a set of create settings is complete and the request should be submitted.
The patch also removes the GetNodeConjunction class, which was only used by the now-deleted createIfMissing methods. It turns out that there was nowhere in the codebase that needed this functionality. As the previous implementation wasn't atomic anyway, the functionality can be replaced with an equivalent create call followed by a getNodeAt in non-batched mode.
Modified: trunk/dna-cnd/src/test/java/org/jboss/dna/cnd/CndImporterTest.java
===================================================================
--- trunk/dna-cnd/src/test/java/org/jboss/dna/cnd/CndImporterTest.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-cnd/src/test/java/org/jboss/dna/cnd/CndImporterTest.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -82,7 +82,7 @@
// Set up the path where the content will go, and make sure that path exists in the repository ...
rootPath = context.getValueFactories().getPathFactory().create("/a");
- graph.create(rootPath);
+ graph.create(rootPath).and();
// Now set up the destination ...
destination = new GraphBatchDestination(graph.batch());
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/Graph.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -1037,229 +1037,145 @@
}
/**
- * Begin the request to create a node located at the supplied path. This request is submitted to the repository immediately.
+ * Begin the request to create a node located at the supplied path.
* <p>
- * If you have the {@link Location} of the parent (for the new node) from a previous request, it is better and more efficient
- * to use {@link #createUnder(Location)}. However, this method work just as well if all you have is the {@link Path} to the
- * parent or new node.
+ * Like all other methods on the {@link Graph}, the request will be performed when the no-argument {@link Create#and()} method
+ * is called.
* </p>
*
* @param atPath the path to the node that is to be created.
- * @return an object that may be used to start another request
+ * @return the object that can be used to specify addition properties for the new node to be copied or the location of the
+ * node where the node is to be created
*/
- public Conjunction<Graph> create( String atPath ) {
- Path at = createPath(atPath);
- Path parent = at.getParent();
- Name child = at.getLastSegment().getName();
- requests.createNode(Location.create(parent), getCurrentWorkspaceName(), child, EMPTY_PROPERTIES);
- return nextGraph;
+ public Create<Graph> create( String atPath ) {
+ return create(createPath(atPath));
}
/**
- * Begin the request to create a node located at the supplied path. This request is submitted to the repository immediately.
+ * Begin the request to create a node located at the supplied path.
* <p>
- * If you have the {@link Location} of the parent (for the new node) from a previous request, it is better and more efficient
- * to use {@link #createUnder(Location)}. However, this method work just as well if all you have is the {@link Path} to the
- * parent or new node.
+ * Like all other methods on the {@link Graph}, the request will be performed when the no-argument {@link Create#and()} method
+ * is called.
* </p>
*
- * @param at the path to the node that is to be created.
- * @return an object that may be used to start another request
+ * @param atPath the path to the node that is to be created.
+ * @param property a property for the new node
+ * @return the object that can be used to specify addition properties for the new node to be copied or the location of the
+ * node where the node is to be created
*/
- public Conjunction<Graph> create( final Path at ) {
- Path parent = at.getParent();
- Name child = at.getLastSegment().getName();
- requests.createNode(Location.create(parent), getCurrentWorkspaceName(), child, EMPTY_PROPERTIES);
- return nextGraph;
+ public Create<Graph> create( String atPath,
+ Property property ) {
+ return create(createPath(atPath)).with(property);
}
/**
- * Begin the request to create a node located at the supplied path. This request is submitted to the repository immediately.
+ * Begin the request to create a node located at the supplied path.
* <p>
- * If you have the {@link Location} of the parent (for the new node) from a previous request, it is better and more efficient
- * to use {@link #createUnder(Location)}. However, this method work just as well if all you have is the {@link Path} to the
- * parent or new node.
+ * Like all other methods on the {@link Graph}, the request will be performed when the no-argument {@link Create#and()} method
+ * is called.
* </p>
*
* @param atPath the path to the node that is to be created.
- * @param properties the properties for the new node
- * @return an object that may be used to start another request
+ * @param firstProperty a property for the new node
+ * @param additionalProperties additional properties for the new node
+ * @return the object that can be used to specify addition properties for the new node to be copied or the location of the
+ * node where the node is to be created
*/
- public Conjunction<Graph> create( String atPath,
- Property... properties ) {
- Path at = createPath(atPath);
- Path parent = at.getParent();
- Name child = at.getLastSegment().getName();
- requests.createNode(Location.create(parent), getCurrentWorkspaceName(), child, properties);
- return nextGraph;
+ public Create<Graph> create( String atPath,
+ Property firstProperty,
+ Property... additionalProperties ) {
+ return create(createPath(atPath)).with(firstProperty, additionalProperties);
}
/**
- * Begin the request to create a node located at the supplied path. This request is submitted to the repository immediately.
+ * Begin the request to create a node located at the supplied path.
* <p>
- * If you have the {@link Location} of the parent (for the new node) from a previous request, it is better and more efficient
- * to use {@link #createUnder(Location)}. However, this method work just as well if all you have is the {@link Path} to the
- * parent or new node.
+ * Like all other methods on the {@link Graph}, the request will be performed when the no-argument {@link Create#and()} method
+ * is called.
* </p>
*
* @param at the path to the node that is to be created.
- * @param properties the properties for the new node
- * @return an object that may be used to start another request
+ * @return the object that can be used to specify addition properties for the new node to be copied or the location of the
+ * node where the node is to be created
*/
- public Conjunction<Graph> create( Path at,
- Property... properties ) {
+ public final Create<Graph> create( Path at ) {
CheckArg.isNotNull(at, "at");
Path parent = at.getParent();
- Name child = at.getLastSegment().getName();
- requests.createNode(Location.create(parent), getCurrentWorkspaceName(), child, properties);
- return nextGraph;
+ Name name = at.getLastSegment().getName();
+ return create(Location.create(parent), name);
}
- /**
- * Begin the request to create a node located at the supplied path, if the node does not exist. This request is submitted to
- * the repository immediately.
- * <p>
- * If you have the {@link Location} of the parent (for the new node) from a previous request, it is better and more efficient
- * to use {@link #createUnder(Location)}. However, this method work just as well if all you have is the {@link Path} to the
- * parent or new node.
- * </p>
- *
- * @param at the path to the node that is to be created.
- * @param properties the properties for the new node
- * @return an object that may be used to start another request
- */
- public Conjunction<Graph> create( Path at,
- Iterable<Property> properties ) {
- CheckArg.isNotNull(at, "at");
- Path parent = at.getParent();
- Name child = at.getLastSegment().getName();
- requests.createNode(Location.create(parent), getCurrentWorkspaceName(), child, properties.iterator());
- return nextGraph;
- }
+ protected final CreateAction<Graph> create( Location parent,
+ Name child ) {
+ return new CreateAction<Graph>(this, parent, getCurrentWorkspaceName(), child) {
+ @Override
+ protected Graph submit( Location parent,
+ String workspaceName,
+ Name childName,
+ Collection<Property> properties,
+ NodeConflictBehavior behavior ) {
+ requests.createNode(parent, workspaceName, childName, properties.iterator(), behavior);
+ return Graph.this;
+ }
- /**
- * Begin the request to create a node located at the supplied path, if the node does not exist. This request is submitted to
- * the repository immediately.
- * <p>
- * If you have the {@link Location} of the parent (for the new node) from a previous request, it is better and more efficient
- * to use {@link #createUnder(Location)}. However, this method work just as well if all you have is the {@link Path} to the
- * parent or new node.
- * </p>
- *
- * @param atPath the path to the node that is to be created.
- * @return an object that may be used to start another request
- */
- public GetNodeConjunction<Graph> createIfMissing( String atPath ) {
- Path at = createPath(atPath);
- Path parent = at.getParent();
- Name child = at.getLastSegment().getName();
- Location location = requests.createNode(Location.create(parent),
- getCurrentWorkspaceName(),
- child,
- EMPTY_PROPERTIES,
- NodeConflictBehavior.UPDATE).getActualLocationOfNode();
- return new GetNodeOrReturnGraph(location);
+ };
}
/**
- * Begin the request to create a node located at the supplied path, if the node does not exist. This request is submitted to
- * the repository immediately.
+ * Begin the request to create a node located at the supplied path.
* <p>
- * If you have the {@link Location} of the parent (for the new node) from a previous request, it is better and more efficient
- * to use {@link #createUnder(Location)}. However, this method work just as well if all you have is the {@link Path} to the
- * parent or new node.
+ * Like all other methods on the {@link Graph}, the request will be performed when the no-argument {@link Create#and()} method
+ * is called.
* </p>
*
* @param at the path to the node that is to be created.
- * @return an object that may be used to start another request
+ * @param properties the iterator over the properties for the new node
+ * @return the object that can be used to specify addition properties for the new node to be copied or the location of the
+ * node where the node is to be created
*/
- public GetNodeConjunction<Graph> createIfMissing( final Path at ) {
- Path parent = at.getParent();
- Name child = at.getLastSegment().getName();
- Location location = requests.createNode(Location.create(parent),
- getCurrentWorkspaceName(),
- child,
- EMPTY_PROPERTIES,
- NodeConflictBehavior.UPDATE).getActualLocationOfNode();
- return new GetNodeOrReturnGraph(location);
+ public Create<Graph> create( Path at,
+ Iterable<Property> properties ) {
+ Create<Graph> action = create(at);
+ for (Property property : properties) {
+ action.and(property);
+ }
+ return action;
}
/**
- * Begin the request to create a node located at the supplied path, if the node does not exist. This request is submitted to
- * the repository immediately.
+ * Begin the request to create a node located at the supplied path.
* <p>
- * If you have the {@link Location} of the parent (for the new node) from a previous request, it is better and more efficient
- * to use {@link #createUnder(Location)}. However, this method work just as well if all you have is the {@link Path} to the
- * parent or new node.
+ * Like all other methods on the {@link Graph}, the request will be performed when the no-argument {@link Create#and()} method
+ * is called.
* </p>
*
- * @param atPath the path to the node that is to be created.
- * @param properties the properties for the new node
- * @return an object that may be used to start another request
- */
- public GetNodeConjunction<Graph> createIfMissing( String atPath,
- Property... properties ) {
- Path at = createPath(atPath);
- Path parent = at.getParent();
- Name child = at.getLastSegment().getName();
- Location location = requests.createNode(Location.create(parent),
- getCurrentWorkspaceName(),
- child,
- properties,
- NodeConflictBehavior.UPDATE).getActualLocationOfNode();
- return new GetNodeOrReturnGraph(location);
- }
-
- /**
- * Begin the request to create a node located at the supplied path, if the node does not exist. This request is submitted to
- * the repository immediately.
- * <p>
- * If you have the {@link Location} of the parent (for the new node) from a previous request, it is better and more efficient
- * to use {@link #createUnder(Location)}. However, this method work just as well if all you have is the {@link Path} to the
- * parent or new node.
- * </p>
- *
* @param at the path to the node that is to be created.
- * @param properties the properties for the new node
- * @return an object that may be used to start another request
+ * @param property a property for the new node
+ * @return the object that can be used to specify addition properties for the new node to be copied or the location of the
+ * node where the node is to be created
*/
- public GetNodeConjunction<Graph> createIfMissing( Path at,
- Property... properties ) {
- CheckArg.isNotNull(at, "at");
- Path parent = at.getParent();
- Name child = at.getLastSegment().getName();
- Location location = requests.createNode(Location.create(parent),
- getCurrentWorkspaceName(),
- child,
- properties,
- NodeConflictBehavior.UPDATE).getActualLocationOfNode();
- return new GetNodeOrReturnGraph(location);
+ public Create<Graph> create( Path at,
+ Property property ) {
+ return create(at).with(property);
}
/**
- * Begin the request to create a node located at the supplied path, if the node does not exist. This request is submitted to
- * the repository immediately.
+ * Begin the request to create a node located at the supplied path.
* <p>
- * If you have the {@link Location} of the parent (for the new node) from a previous request, it is better and more efficient
- * to use {@link #createUnder(Location)}. However, this method work just as well if all you have is the {@link Path} to the
- * parent or new node.
+ * Like all other methods on the {@link Graph}, the request will be performed when the no-argument {@link Create#and()} method
+ * is called.
* </p>
*
* @param at the path to the node that is to be created.
- * @param properties the properties for the new node
- * @return an object that may be used to start another request
+ * @param firstProperty a property for the new node
+ * @param additionalProperties additional properties for the new node
+ * @return the object that can be used to specify addition properties for the new node to be copied or the location of the
+ * node where the node is to be created
*/
- public GetNodeConjunction<Graph> createIfMissing( Path at,
- Iterable<Property> properties ) {
- CheckArg.isNotNull(at, "at");
- Path parent = at.getParent();
- Name child = at.getLastSegment().getName();
- Location location = requests.createNode(Location.create(parent),
- getCurrentWorkspaceName(),
- child,
- properties.iterator(),
- NodeConflictBehavior.UPDATE).getActualLocationOfNode();
- return new GetNodeOrReturnGraph(location);
+ public Create<Graph> create( Path at,
+ Property firstProperty,
+ Property... additionalProperties ) {
+ return create(at).with(firstProperty, additionalProperties);
}
/**
@@ -3001,23 +2917,13 @@
requestQueue.createNode(parent, workspaceName, childName, properties.iterator(), behavior);
return Batch.this;
}
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.graph.Graph.Executable#execute()
- */
- public Results execute() {
- and();
- return Batch.this.execute();
- }
};
}
/**
* Begin the request to create a node located at the supplied path.
* <p>
- * Like all other methods on the {@link Batch}, the request will be performed when the {@link #execute()} method is
+ * Like all other methods on the {@link Batch}, the request will be performed when the {@link Batch#execute()} method is
* called.
* </p>
*
@@ -4389,7 +4295,7 @@
* @param <Next> The interface that is to be returned when this create request is completed
* @author Randall Hauch
*/
- public interface Create<Next> extends Conjunction<Next>, Executable<Node> {
+ public interface Create<Next> extends Conjunction<Next> {
/**
* Create the node only if there is no existing node with the same {@link Path.Segment#getName() name} (ignoring
* {@link Path.Segment#getIndex() same-name-sibling indexes}).
@@ -5442,33 +5348,6 @@
Node andReturn();
}
- protected class GetNodeOrReturnGraph implements GetNodeConjunction<Graph> {
- private final Location location;
-
- GetNodeOrReturnGraph( Location location ) {
- assert location != null;
- this.location = location;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.graph.Graph.Conjunction#and()
- */
- public Graph and() {
- return Graph.this;
- }
-
- /**
- * {@inheritDoc}
- *
- * @see org.jboss.dna.graph.Graph.GetNodeConjunction#andReturn()
- */
- public Node andReturn() {
- return and().getNodeAt(location);
- }
- }
-
// ----------------------------------------------------------------------------------------------------------------
// Node Implementation
// ----------------------------------------------------------------------------------------------------------------
@@ -6383,7 +6262,7 @@
*
* @see org.jboss.dna.graph.Graph.Create#ifAbsent()
*/
- public Create<T> ifAbsent() {
+ public CreateAction<T> ifAbsent() {
conflictBehavior = NodeConflictBehavior.DO_NOT_REPLACE;
return this;
}
@@ -6393,7 +6272,7 @@
*
* @see org.jboss.dna.graph.Graph.Create#orReplace()
*/
- public Create<T> orReplace() {
+ public CreateAction<T> orReplace() {
conflictBehavior = NodeConflictBehavior.REPLACE;
return this;
}
@@ -6403,7 +6282,7 @@
*
* @see org.jboss.dna.graph.Graph.Create#orUpdate()
*/
- public Create<T> orUpdate() {
+ public CreateAction<T> orUpdate() {
conflictBehavior = NodeConflictBehavior.UPDATE;
return this;
}
@@ -6413,7 +6292,7 @@
*
* @see org.jboss.dna.graph.Graph.Create#byAppending()
*/
- public Create<T> byAppending() {
+ public CreateAction<T> byAppending() {
conflictBehavior = NodeConflictBehavior.APPEND;
return this;
}
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRequestProcessor.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRequestProcessor.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/connector/map/MapRequestProcessor.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -201,9 +201,19 @@
}
switch (request.conflictBehavior()) {
case APPEND:
- case DO_NOT_REPLACE:
node = workspace.createNode(getExecutionContext(), parentNode, request.named(), uuid);
break;
+ case DO_NOT_REPLACE:
+ for (MapNode child : parentNode.getChildren()) {
+ if (request.named().equals(child.getName().getName())) {
+ node = child;
+ break;
+ }
+ }
+ if (node == null) {
+ node = workspace.createNode(getExecutionContext(), parentNode, request.named(), uuid);
+ }
+ break;
case REPLACE:
// See if the node already exists (this doesn't record an error on the request) ...
node = getTargetNode(workspace, null, Location.create(pathFactory.create(parent, request.named()), uuid));
Modified: trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/GraphNamespaceRegistry.java
===================================================================
--- trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/GraphNamespaceRegistry.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-graph/src/main/java/org/jboss/dna/graph/property/basic/GraphNamespaceRegistry.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -88,7 +88,7 @@
this.store.getNodeAt(this.parentOfNamespaceNodes);
} catch (PathNotFoundException pnfe) {
// The node did not already exist - create it!
- this.store.create(parentOfNamespaceNodes);
+ this.store.create(parentOfNamespaceNodes).and();
this.store.set(JcrLexicon.PRIMARY_TYPE).on(parentOfNamespaceNodes).to(DnaLexicon.NAMESPACES);
}
}
@@ -314,9 +314,10 @@
Property uriProperty = store.getContext().getPropertyFactory().create(uriPropertyName, namespaceUri);
List<Property> props = new ArrayList<Property>(namespaceProperties);
props.add(uriProperty);
- Location actualLocation = store.createIfMissing(pathToNamespaceNode, props).andReturn().getLocation();
+ // Location actualLocation = store.createIfMissing(pathToNamespaceNode, props).andReturn().getLocation();
+ store.create(pathToNamespaceNode, props).ifAbsent().and();
- return getPrefixFor(actualLocation.getPath());
+ return getPrefixFor(pathToNamespaceNode);
}
} catch (PathNotFoundException e) {
Modified: trunk/dna-graph/src/test/java/org/jboss/dna/graph/GraphTest.java
===================================================================
--- trunk/dna-graph/src/test/java/org/jboss/dna/graph/GraphTest.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-graph/src/test/java/org/jboss/dna/graph/GraphTest.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -432,32 +432,32 @@
@Test
public void shouldCreateNode() {
- graph.create(validPath);
+ graph.create(validPath).and();
assertThat(numberOfExecutions, is(1));
assertNextRequestIsCreate(Location.create(validPath.getParent()), "c");
assertNoMoreRequests();
- graph.create(validPath, validIdProperty1);
+ graph.create(validPath, validIdProperty1).and();
assertThat(numberOfExecutions, is(1));
assertNextRequestIsCreate(Location.create(validPath.getParent()), "c", validIdProperty1);
assertNoMoreRequests();
- graph.create(validPath, validIdProperty1, validIdProperty2);
+ graph.create(validPath, validIdProperty1, validIdProperty2).and();
assertThat(numberOfExecutions, is(1));
assertNextRequestIsCreate(Location.create(validPath.getParent()), "c", validIdProperty1, validIdProperty2);
assertNoMoreRequests();
- graph.create(validPathString);
+ graph.create(validPathString).and();
assertThat(numberOfExecutions, is(1));
assertNextRequestIsCreate(Location.create(validPath.getParent()), "c");
assertNoMoreRequests();
- graph.create(validPathString, validIdProperty1);
+ graph.create(validPathString, validIdProperty1).and();
assertThat(numberOfExecutions, is(1));
assertNextRequestIsCreate(Location.create(validPath.getParent()), "c", validIdProperty1);
assertNoMoreRequests();
- graph.create(validPathString, validIdProperty1, validIdProperty2);
+ graph.create(validPathString, validIdProperty1, validIdProperty2).and();
assertThat(numberOfExecutions, is(1));
assertNextRequestIsCreate(Location.create(validPath.getParent()), "c", validIdProperty1, validIdProperty2);
assertNoMoreRequests();
@@ -522,7 +522,7 @@
@Test
public void shouldCreateNodesWithBatch() {
graph.batch().create(validPath, validIdProperty1).and().remove("prop").on(validPathString).execute();
- graph.batch().move(validPath).and(validPath).into(validPathString).and().create(validPath).execute();
+ graph.batch().move(validPath).and(validPath).into(validPathString).and().create(validPath).and().execute();
graph.batch().createUnder(validLocation).nodeNamed("someName").and().delete(validLocation).execute();
}
Modified: trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/federation/AbstractFederatedRepositorySourceIntegrationTest.java
===================================================================
--- trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/federation/AbstractFederatedRepositorySourceIntegrationTest.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/federation/AbstractFederatedRepositorySourceIntegrationTest.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -94,10 +94,10 @@
configRepositorySource.setName("Configuration Repository");
configRepositorySource.setDefaultWorkspaceName(configurationWorkspaceName);
Graph config = Graph.create(configRepositorySource, context);
- config.create("/a");
- config.create("/a/b");
- config.create("/a/b/Test Repository");
- config.create("/a/b/Test Repository/dna:workspaces");
+ config.create("/a").and();
+ config.create("/a/b").and();
+ config.create("/a/b/Test Repository").and();
+ config.create("/a/b/Test Repository/dna:workspaces").and();
repositoryContext = new RepositoryContext() {
public ExecutionContext getExecutionContext() {
@@ -178,8 +178,8 @@
String projectionPath = wsPath + "/dna:projections/" + projectionName;
Graph config = Graph.create(configRepositorySource, context);
config.useWorkspace(configurationWorkspaceName);
- config.createIfMissing(wsPath);
- config.createIfMissing(wsPath + "/dna:projections");
+ config.create(wsPath).ifAbsent().and();
+ config.create(wsPath + "/dna:projections").ifAbsent().and();
config.createAt(projectionPath)
.with(DnaLexicon.PROJECTION_RULES, (Object[])projectionRules)
.with(DnaLexicon.SOURCE_NAME, sourceName)
Modified: trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/NotWritableConnectorTest.java
===================================================================
--- trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/NotWritableConnectorTest.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/NotWritableConnectorTest.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -75,7 +75,7 @@
@Test( expected = InvalidRequestException.class )
public void shouldNowAllowAddChildUnderRootNode() {
- graph.batch().create("/a").with("propB", "valueB").and("propC", "valueC").execute();
+ graph.batch().create("/a").with("propB", "valueB").and("propC", "valueC").and().execute();
}
@Test( expected = InvalidRequestException.class )
@@ -84,7 +84,7 @@
for (int i = 0; i != 100; ++i) {
create = create.with("property" + i, "value" + i);
}
- create.execute();
+ create.and().execute();
}
@Test( expected = InvalidRequestException.class )
Modified: trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/WritableConnectorTest.java
===================================================================
--- trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/WritableConnectorTest.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-graph/src/test/java/org/jboss/dna/graph/connector/test/WritableConnectorTest.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -96,7 +96,7 @@
@Test
public void shouldAddChildUnderRootNode() {
- graph.batch().create("/a").with("propB", "valueB").and("propC", "valueC").execute();
+ graph.batch().create("/a").with("propB", "valueB").and("propC", "valueC").and().execute();
// Now look up the root node ...
Node root = graph.getNodeAt("/");
assertThat(root, is(notNullValue()));
@@ -115,7 +115,7 @@
public void shouldAddChildrenAndSettingProperties() {
graph.batch().set("propA").to("valueA").on("/").and().create("/a").with("propB", "valueB").and("propC", "valueC").and().create("/b").with("propD",
"valueD").and("propE",
- "valueE").execute();
+ "valueE").and().execute();
// Now look up the root node ...
Node root = graph.getNodeAt("/");
assertThat(root, is(notNullValue()));
@@ -159,7 +159,7 @@
for (int i = 0; i != 100; ++i) {
create = create.with("property" + i, "value" + i);
}
- create.execute();
+ create.and().execute();
// Now look up all the properties ...
Node nodeA = graph.getNodeAt("/a");
assertThat(nodeA, is(notNullValue()));
@@ -176,7 +176,7 @@
for (int i = 0; i != 10; ++i) {
create = create.with("property" + i, "value" + i);
}
- create.execute();
+ create.and().execute();
// Now look up all the properties ...
Node nodeA = graph.getNodeAt("/a");
@@ -217,7 +217,7 @@
}
create = create.with("largeProperty1", validLargeValues[0]);
create = create.with("largeProperty2", validLargeValues[1]);
- create.execute();
+ create.and().execute();
// Now look up all the properties ...
Node nodeA = graph.getNodeAt("/a");
@@ -828,7 +828,7 @@
graph.useWorkspace(defaultWorkspaceName);
- graph.create("/newUuids");
+ graph.create("/newUuids").and();
graph.copy("/node1").fromWorkspace(workspaceName).to("/newUuids/node1");
/*
@@ -865,7 +865,7 @@
graph.useWorkspace(defaultWorkspaceName);
- graph.create("/newUuids");
+ graph.create("/newUuids").and();
// Copy once to get the UUID into the default workspace
//graph.copy("/node1/node1/node1").failingIfUuidsMatch().fromWorkspace(workspaceName).to("/newUuids/node1");
graph.clone("/node1/node1/node1").fromWorkspace(workspaceName).as(name("node1")).into("/newUuids").failingIfAnyUuidsMatch();
@@ -902,7 +902,7 @@
graph.useWorkspace(defaultWorkspaceName);
- graph.create("/newUuids");
+ graph.create("/newUuids").and();
// Copy once to get the UUID into the default workspace
// graph.copy("/node1").replacingExistingNodesWithSameUuids().fromWorkspace(workspaceName).to("/newUuids/node1");
graph.clone("/node1").fromWorkspace(workspaceName).as(name("node1")).into("/newUuids").replacingExistingNodesWithSameUuids();
@@ -966,13 +966,13 @@
graph.useWorkspace(defaultWorkspaceName);
- graph.create("/segmentTestUuids");
+ graph.create("/segmentTestUuids").and();
// Copy once to get the UUID into the default workspace
graph.clone("/node1").fromWorkspace(workspaceName).as(name("node1")).into("/segmentTestUuids").failingIfAnyUuidsMatch();
// Create a new child node that in the target workspace that has no corresponding node in the source workspace
PropertyFactory propFactory = context.getPropertyFactory();
- graph.create("/segmentTestUuids/node1", propFactory.create(name("identifier"), "backup copy"));
+ graph.create("/segmentTestUuids/node1", propFactory.create(name("identifier"), "backup copy")).and();
// Copy again to test the behavior now that the UUIDs are already in the default workspace
// This should remove /newUuids/node1/shouldBeRemoved
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrWorkspace.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrWorkspace.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/JcrWorkspace.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -159,7 +159,7 @@
Path root = pathFactory.createRootPath();
Path systemPath = pathFactory.create(root, JcrLexicon.SYSTEM);
Property systemPrimaryType = context.getPropertyFactory().create(JcrLexicon.PRIMARY_TYPE, DnaLexicon.SYSTEM);
- namespaceGraph.createIfMissing(systemPath, systemPrimaryType);
+ namespaceGraph.create(systemPath, systemPrimaryType).ifAbsent().and();
Name uriProperty = DnaLexicon.NAMESPACE_URI;
Path namespacesPath = pathFactory.create(systemPath, DnaLexicon.NAMESPACES);
Modified: trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryNodeTypeManager.java
===================================================================
--- trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryNodeTypeManager.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-jcr/src/main/java/org/jboss/dna/jcr/RepositoryNodeTypeManager.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -927,7 +927,7 @@
PropertyFactory propertyFactory = context.getPropertyFactory();
graph.create(parentOfTypeNodes,
propertyFactory.create(JcrLexicon.PRIMARY_TYPE,
- DnaLexicon.NODE_TYPES.getString(context.getNamespaceRegistry())));
+ DnaLexicon.NODE_TYPES.getString(context.getNamespaceRegistry()))).and();
}
Graph.Batch batch = graph.batch();
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/AbstractJcrAccessTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/AbstractJcrAccessTest.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/AbstractJcrAccessTest.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -74,7 +74,7 @@
Graph graph = Graph.create(source, context);
// Make sure the path to the namespaces exists ...
- graph.create("/jcr:system"); // .and().create("/jcr:system/dna:namespaces");
+ graph.create("/jcr:system").and(); // .and().create("/jcr:system/dna:namespaces");
graph.set("jcr:primaryType").on("/jcr:system").to(DnaLexicon.SYSTEM);
// Stub out the connection factory ...
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/ImportExportTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/ImportExportTest.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/ImportExportTest.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -82,7 +82,7 @@
Graph graph = Graph.create(source, context);
// Make sure the path to the namespaces exists ...
- graph.create("/jcr:system"); // .and().create("/jcr:system/dna:namespaces");
+ graph.create("/jcr:system").and(); // .and().create("/jcr:system/dna:namespaces");
graph.set("jcr:primaryType").on("/jcr:system").to(DnaLexicon.SYSTEM);
// Stub out the connection factory ...
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrSessionTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrSessionTest.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrSessionTest.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -79,7 +79,7 @@
@Override
protected void initializeContent() {
- graph.create("/a").and().create("/a/b").and().create("/a/b/c");
+ graph.create("/a").and().create("/a/b").and().create("/a/b/c").and();
graph.set("booleanProperty").on("/a/b").to(true);
graph.set("stringProperty").on("/a/b/c").to("value");
graph.set("jcr:mixinTypes").on("/a").to("mix:lockable");
@@ -87,7 +87,7 @@
graph.set("multiLineProperty").on("/a/b/c").to(MULTI_LINE_VALUE);
// Make sure the path to the namespaces exists ...
- graph.create("/jcr:system").and().create("/jcr:system/dna:namespaces");
+ graph.create("/jcr:system").and().create("/jcr:system/dna:namespaces").and();
}
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrWorkspaceTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrWorkspaceTest.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/JcrWorkspaceTest.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -64,13 +64,13 @@
@Override
protected void initializeContent() {
- graph.create("/a").and().create("/a/b").and().create("/a/b/c").and().create("/b");
+ graph.create("/a").and().create("/a/b").and().create("/a/b/c").and().create("/b").and();
graph.set("booleanProperty").on("/a/b").to(true);
graph.set("jcr:primaryType").on("/a/b").to("nt:unstructured");
graph.set("stringProperty").on("/a/b/c").to("value");
// Make sure the path to the namespaces exists ...
- graph.create("/jcr:system").and().create("/jcr:system/dna:namespaces");
+ graph.create("/jcr:system").and().create("/jcr:system/dna:namespaces").ifAbsent().and();
}
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/MixinTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/MixinTest.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/MixinTest.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -84,7 +84,7 @@
@Test( expected = IllegalArgumentException.class )
public void shouldNotAllowNullMixinTypeName() throws Exception {
- graph.create("/a");
+ graph.create("/a").and();
graph.set("jcr:primaryType").on("/a").to(PRIMARY_TYPE_A);
Node rootNode = session.getRootNode();
@@ -95,7 +95,7 @@
@Test( expected = IllegalArgumentException.class )
public void shouldNotAllowEmptyMixinTypeName() throws Exception {
- graph.create("/a");
+ graph.create("/a").and();
graph.set("jcr:primaryType").on("/a").to(PRIMARY_TYPE_A);
Node rootNode = session.getRootNode();
@@ -106,7 +106,7 @@
@Test( expected = NoSuchNodeTypeException.class )
public void shouldNotAllowInvalidMixinTypeName() throws Exception {
- graph.create("/a");
+ graph.create("/a").and();
graph.set(JcrLexicon.PRIMARY_TYPE.getString(registry)).on("/a").to(PRIMARY_TYPE_A);
Node rootNode = session.getRootNode();
@@ -126,7 +126,7 @@
@Test
public void shouldAllowAddingMixinIfNoConflict() throws Exception {
- graph.create("/a");
+ graph.create("/a").and();
graph.set(JcrLexicon.PRIMARY_TYPE.getString(registry)).on("/a").to(PRIMARY_TYPE_A);
graph.set(JcrLexicon.MIXIN_TYPES.getString(registry)).on("/a").to(JcrMixLexicon.REFERENCEABLE.getString(registry));
@@ -138,7 +138,7 @@
@Test
public void shouldNotAllowAddingMixinIfPrimaryTypeConflicts() throws Exception {
- graph.create("/a");
+ graph.create("/a").and();
graph.set(JcrLexicon.PRIMARY_TYPE.getString(registry)).on("/a").to(PRIMARY_TYPE_A);
graph.set(JcrLexicon.MIXIN_TYPES.getString(registry)).on("/a").to(JcrMixLexicon.REFERENCEABLE.getString(registry));
@@ -150,7 +150,7 @@
@Test
public void shouldNotAllowAddingMixinIfMixinTypeConflicts() throws Exception {
- graph.create("/a");
+ graph.create("/a").and();
graph.set(JcrLexicon.PRIMARY_TYPE.getString(registry)).on("/a").to(JcrNtLexicon.BASE.getString(registry));
graph.set(JcrLexicon.MIXIN_TYPES.getString(registry)).on("/a").to(MIXIN_TYPE_B);
@@ -162,7 +162,7 @@
@Test
public void shouldAutoCreateAutoCreatedPropertiesOnAddition() throws Exception {
- graph.create("/a");
+ graph.create("/a").and();
graph.set(JcrLexicon.PRIMARY_TYPE.getString(registry)).on("/a").to(JcrNtLexicon.BASE.getString(registry));
Node rootNode = session.getRootNode();
@@ -178,7 +178,7 @@
@Test
public void shouldAutoCreateAutoCreatedChildNodesOnAddition() throws Exception {
- graph.create("/a");
+ graph.create("/a").and();
graph.set(JcrLexicon.PRIMARY_TYPE.getString(registry)).on("/a").to(JcrNtLexicon.BASE.getString(registry));
Node rootNode = session.getRootNode();
@@ -194,7 +194,7 @@
@Test( expected = ConstraintViolationException.class )
public void shouldNotAllowAdditionIfResidualPropertyConflicts() throws Exception {
- graph.create("/a");
+ graph.create("/a").and();
graph.set(JcrLexicon.PRIMARY_TYPE.getString(registry)).on("/a").to(JcrNtLexicon.UNSTRUCTURED.getString(registry));
Node rootNode = session.getRootNode();
@@ -207,7 +207,7 @@
@Test
public void shouldAllowAdditionIfResidualPropertyDoesNotConflict() throws Exception {
- graph.create("/a");
+ graph.create("/a").and();
graph.set(JcrLexicon.PRIMARY_TYPE.getString(registry)).on("/a").to(JcrNtLexicon.UNSTRUCTURED.getString(registry));
Node rootNode = session.getRootNode();
@@ -220,7 +220,7 @@
@Test( expected = ConstraintViolationException.class )
public void shouldNotAllowAdditionIfResidualChildNodeConflicts() throws Exception {
- graph.create("/a").and().create("/a/" + CHILD_NODE_B);
+ graph.create("/a").and().create("/a/" + CHILD_NODE_B).and();
graph.set(JcrLexicon.PRIMARY_TYPE.getString(registry)).on("/a").to(JcrNtLexicon.UNSTRUCTURED.getString(registry));
graph.set(JcrLexicon.PRIMARY_TYPE.getString(registry)).on("/a/" + CHILD_NODE_B).to(JcrNtLexicon.BASE.getString(registry));
@@ -233,7 +233,7 @@
@Test
public void shouldAllowAdditionIfResidualChildNodeDoesNotConflict() throws Exception {
- graph.create("/a").and().create("/a/" + CHILD_NODE_B);
+ graph.create("/a").and().create("/a/" + CHILD_NODE_B).and();
graph.set(JcrLexicon.PRIMARY_TYPE.getString(registry)).on("/a").to(JcrNtLexicon.UNSTRUCTURED.getString(registry));
graph.set(JcrLexicon.PRIMARY_TYPE.getString(registry)).on("/a/" + CHILD_NODE_B).to(JcrNtLexicon.UNSTRUCTURED.getString(registry));
@@ -260,7 +260,7 @@
@Test
public void shouldAllowSettingNewPropertyAfterAddingMixin() throws Exception {
- graph.create("/a");
+ graph.create("/a").and();
graph.set(JcrLexicon.PRIMARY_TYPE.getString(registry)).on("/a").to(PRIMARY_TYPE_A);
graph.set(JcrLexicon.MIXIN_TYPES.getString(registry)).on("/a").to(JcrMixLexicon.REFERENCEABLE.getString(registry));
@@ -283,7 +283,7 @@
@Test
public void shouldAllowAddingNewChildNodeAfterAddingMixin() throws Exception {
- graph.create("/a");
+ graph.create("/a").and();
graph.set(JcrLexicon.PRIMARY_TYPE.getString(registry)).on("/a").to(PRIMARY_TYPE_A);
graph.set(JcrLexicon.MIXIN_TYPES.getString(registry)).on("/a").to(JcrMixLexicon.REFERENCEABLE.getString(registry));
@@ -370,7 +370,7 @@
@Test( expected = ConstraintViolationException.class )
public void shouldNotAllowRemovalIfExistingChildNodeWouldHaveNoDefinition() throws Exception {
- graph.create("/a").and().create("/a/nodeB");
+ graph.create("/a").and().create("/a/nodeB").and();
graph.set(JcrLexicon.PRIMARY_TYPE.getString(registry)).on("/a").to(PRIMARY_TYPE_A);
graph.set(JcrLexicon.MIXIN_TYPES.getString(registry)).on("/a").to(MIXIN_TYPE_B);
Modified: trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/RepositoryNodeTypeManagerTest.java
===================================================================
--- trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/RepositoryNodeTypeManagerTest.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-jcr/src/test/java/org/jboss/dna/jcr/RepositoryNodeTypeManagerTest.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -65,10 +65,10 @@
@Override
protected void initializeContent() {
// Make sure the path to the namespaces exists ...
- graph.create("/jcr:system"); // .and().create("/jcr:system/dna:namespaces");
+ graph.create("/jcr:system").and(); // .and().create("/jcr:system/dna:namespaces");
graph.set("jcr:primaryType").on("/jcr:system").to(DnaLexicon.SYSTEM);
- graph.create("/a").and().create("/a/b").and().create("/a/b/c");
+ graph.create("/a").and().create("/a/b").and().create("/a/b/c").and();
graph.set("jcr:mixinTypes").on("/a").to(JcrMixLexicon.REFERENCEABLE);
}
Modified: trunk/dna-repository/src/test/java/org/jboss/dna/repository/RepositoryServiceTest.java
===================================================================
--- trunk/dna-repository/src/test/java/org/jboss/dna/repository/RepositoryServiceTest.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-repository/src/test/java/org/jboss/dna/repository/RepositoryServiceTest.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -119,7 +119,7 @@
@Test
public void shouldStartUpUsingConfigurationRepositoryThatContainsNoSources() throws Exception {
// Set up the configuration repository to contain NO sources ...
- configRepository.create("/dna:sources");
+ configRepository.create("/dna:sources").and();
// Now, start up the service ...
service.getAdministrator().start();
@@ -132,8 +132,8 @@
public void shouldStartUpAndCreateRepositoryUsingConfigurationRepositoryThatContainsNoSources() {
// Set up the configuration repository ...
configRepository.useWorkspace("default");
- configRepository.create("/dna:sources");
- configRepository.create("/dna:sources/source A");
+ configRepository.create("/dna:sources").and();
+ configRepository.create("/dna:sources/source A").and();
final String className = InMemoryRepositorySource.class.getName();
configRepository.set(DnaLexicon.CLASSNAME).on("/dna:sources/source A").to(className);
@@ -141,13 +141,13 @@
configRepository.set("retryLimit").on("/dna:sources/source A").to(3);
String fedReposPath = "/dna:repositories/fed repos/";
- configRepository.create("/dna:repositories");
- configRepository.create("/dna:repositories/fed repos");
- configRepository.create("/dna:repositories/fed repos/dna:regions");
- configRepository.create("/dna:repositories/fed repos/dna:regions/source A");
- configRepository.create("/dna:repositories/fed repos/dna:regions/source B");
- configRepository.create("/dna:repositories/fed repos/dna:regions/source C");
- configRepository.create("/dna:repositories/fed repos/dna:regions/source D");
+ configRepository.create("/dna:repositories").and();
+ configRepository.create("/dna:repositories/fed repos").and();
+ configRepository.create("/dna:repositories/fed repos/dna:regions").and();
+ configRepository.create("/dna:repositories/fed repos/dna:regions/source A").and();
+ configRepository.create("/dna:repositories/fed repos/dna:regions/source B").and();
+ configRepository.create("/dna:repositories/fed repos/dna:regions/source C").and();
+ configRepository.create("/dna:repositories/fed repos/dna:regions/source D").and();
configRepository.set(DnaLexicon.TIME_TO_EXPIRE).on(fedReposPath).to(20000);
configRepository.set(DnaLexicon.PROJECTION_RULES).on(fedReposPath + "dna:regions/source A").to("/a/b/c => /sx/sy");
configRepository.set(DnaLexicon.PROJECTION_RULES).on(fedReposPath + "dna:regions/source B").to("/ => /");
@@ -193,9 +193,9 @@
// Set up the configuration repository ...
configRepository.useWorkspace("default");
- configRepository.create("/dna:system");
- configRepository.create("/dna:system/dna:sources");
- configRepository.create("/dna:system/dna:sources/source A");
+ configRepository.create("/dna:system").and();
+ configRepository.create("/dna:system/dna:sources").and();
+ configRepository.create("/dna:system/dna:sources/source A").and();
final String className = FakeRepositorySource.class.getName();
configRepository.set(DnaLexicon.CLASSNAME).on("/dna:system/dna:sources/source A").to(className);
Modified: trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapterTest.java
===================================================================
--- trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapterTest.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/dna-repository/src/test/java/org/jboss/dna/repository/sequencer/StreamSequencerAdapterTest.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -68,15 +68,15 @@
private StreamSequencer streamSequencer;
private StreamSequencerAdapter sequencer;
- private String[] validExpressions = {"/a/* => /output"};
- private SequencerConfig validConfig = new SequencerConfig("name", "desc", Collections.<String, Object>emptyMap(),
+ private final String[] validExpressions = {"/a/* => /output"};
+ private final SequencerConfig validConfig = new SequencerConfig("name", "desc", Collections.<String, Object>emptyMap(),
"something.class", null, validExpressions);
private SequencerOutputMap sequencerOutput;
- private String sampleData = "The little brown fox didn't something bad.";
+ private final String sampleData = "The little brown fox didn't something bad.";
private ExecutionContext context;
private SequencerContext seqContext;
- private String repositorySourceName = "repository";
- private String repositoryWorkspaceName = "";
+ private final String repositorySourceName = "repository";
+ private final String repositoryWorkspaceName = "";
private Problems problems;
private Graph graph;
private Property sequencedProperty;
@@ -124,8 +124,8 @@
};
StreamSequencerAdapter adapter = new StreamSequencerAdapter(streamSequencer);
- graph.create("/a").and().create("/a/b").and().create("/a/b/c");
- graph.create("/d").and().create("/d/e");
+ graph.create("/a").and().create("/a/b").and().create("/a/b/c").and();
+ graph.create("/d").and().create("/d/e").and();
graph.set("sequencedProperty").on("/a/b/c").to(new ByteArrayInputStream(sampleData.getBytes()));
Node inputNode = graph.getNodeAt("/a/b/c");
@@ -174,8 +174,8 @@
public void shouldExecuteSequencerOnExistingNodeAndOutputToExistingNode() throws Exception {
// Set up the repository for the test ...
- graph.create("/a").and().create("/a/b").and().create("/a/b/c");
- graph.create("/d").and().create("/d/e");
+ graph.create("/a").and().create("/a/b").and().create("/a/b/c").and();
+ graph.create("/d").and().create("/d/e").and();
graph.set("sequencedProperty").on("/a/b/c").to(new ByteArrayInputStream(sampleData.getBytes()));
Node nodeC = graph.getNodeAt("/a/b/c");
Node nodeE = graph.getNodeAt("/d/e");
@@ -209,8 +209,8 @@
public void shouldExecuteSequencerOnExistingNodeWithMissingSequencedPropertyAndOutputToExistingNode() throws Exception {
// Set up the repository for the test ...
- graph.create("/a").and().create("/a/b").and().create("/a/b/c");
- graph.create("/d").and().create("/d/e");
+ graph.create("/a").and().create("/a/b").and().create("/a/b/c").and();
+ graph.create("/d").and().create("/d/e").and();
Node nodeC = graph.getNodeAt("/a/b/c");
Node nodeE = graph.getNodeAt("/d/e");
assertThat(nodeC, is(notNullValue()));
@@ -245,8 +245,8 @@
public void shouldExecuteSequencerOnExistingNodeAndOutputToMultipleExistingNodes() throws Exception {
// Set up the repository for the test ...
- graph.create("/a").and().create("/a/b").and().create("/a/b/c");
- graph.create("/d").and().create("/d/e");
+ graph.create("/a").and().create("/a/b").and().create("/a/b/c").and();
+ graph.create("/d").and().create("/d/e").and();
// Set the property that will be sequenced ...
graph.set("sequencedProperty").on("/a/b/c").to(new ByteArrayInputStream(sampleData.getBytes()));
@@ -286,7 +286,7 @@
public void shouldExecuteSequencerOnExistingNodeAndOutputToNonExistingNode() throws Exception {
// Set up the repository for the test ...
- graph.create("/a").and().create("/a/b").and().create("/a/b/c");
+ graph.create("/a").and().create("/a/b").and().create("/a/b/c").and();
// Set the property that will be sequenced ...
graph.set("sequencedProperty").on("/a/b/c").to(new ByteArrayInputStream(sampleData.getBytes()));
@@ -325,7 +325,7 @@
public void shouldExecuteSequencerOnExistingNodeAndOutputToMultipleNonExistingNodes() throws Exception {
// Set up the repository for the test ...
- graph.create("/a").and().create("/a/b").and().create("/a/b/c");
+ graph.create("/a").and().create("/a/b").and().create("/a/b/c").and();
// Set the property that will be sequenced ...
graph.set("sequencedProperty").on("/a/b/c").to(new ByteArrayInputStream(sampleData.getBytes()));
@@ -430,7 +430,7 @@
@Test( expected = java.lang.AssertionError.class )
public void shouldNotAllowNullSequencedProperty() throws Exception {
- graph.create("/a");
+ graph.create("/a").and();
Node input = graph.getNodeAt("/a");
sequencer.createStreamSequencerContext(input, null, seqContext, problems);
}
@@ -439,7 +439,7 @@
public void shouldNotAllowNullExecutionContext() throws Exception {
this.sequencedProperty = mock(Property.class);
- graph.create("/a");
+ graph.create("/a").and();
Node input = graph.getNodeAt("/a");
sequencer.createStreamSequencerContext(input, sequencedProperty, null, problems);
}
@@ -448,7 +448,7 @@
public void shouldProvideNamespaceRegistry() throws Exception {
this.sequencedProperty = mock(Property.class);
- graph.create("/a").and().create("/a/b").and().create("/a/b/c");
+ graph.create("/a").and().create("/a/b").and().create("/a/b/c").and();
Node input = graph.getNodeAt("/a/b/c");
StreamSequencerContext sequencerContext = sequencer.createStreamSequencerContext(input,
sequencedProperty,
@@ -461,7 +461,7 @@
public void shouldProvideValueFactories() throws Exception {
this.sequencedProperty = mock(Property.class);
- graph.create("/a").and().create("/a/b").and().create("/a/b/c");
+ graph.create("/a").and().create("/a/b").and().create("/a/b/c").and();
Node input = graph.getNodeAt("/a/b/c");
StreamSequencerContext sequencerContext = sequencer.createStreamSequencerContext(input,
sequencedProperty,
@@ -474,7 +474,7 @@
public void shouldProvidePathToInput() throws Exception {
this.sequencedProperty = mock(Property.class);
- graph.create("/a").and().create("/a/b").and().create("/a/b/c");
+ graph.create("/a").and().create("/a/b").and().create("/a/b/c").and();
Node input = graph.getNodeAt("/a/b/c");
StreamSequencerContext sequencerContext = sequencer.createStreamSequencerContext(input,
sequencedProperty,
@@ -487,7 +487,7 @@
public void shouldNeverReturnNullInputProperties() throws Exception {
this.sequencedProperty = mock(Property.class);
- graph.create("/a").and().create("/a/b").and().create("/a/b/c");
+ graph.create("/a").and().create("/a/b").and().create("/a/b/c").and();
Node input = graph.getNodeAt("/a/b/c");
StreamSequencerContext sequencerContext = sequencer.createStreamSequencerContext(input,
sequencedProperty,
@@ -501,7 +501,7 @@
public void shouldProvideInputProperties() throws Exception {
this.sequencedProperty = mock(Property.class);
- graph.create("/a").and().create("/a/b").and().create("/a/b/c");
+ graph.create("/a").and().create("/a/b").and().create("/a/b/c").and();
graph.set("x").on("/a/b/c").to(true);
graph.set("y").on("/a/b/c").to(Arrays.asList(new String[] {"asdf", "xyzzy"}));
Node input = graph.getNodeAt("/a/b/c");
@@ -521,7 +521,7 @@
public void shouldCreateSequencerContextThatProvidesMimeType() throws Exception {
this.sequencedProperty = mock(Property.class);
- graph.create("/a").and().create("/a/b").and().create("/a/b/c");
+ graph.create("/a").and().create("/a/b").and().create("/a/b/c").and();
Node input = graph.getNodeAt("/a/b/c");
StreamSequencerContext sequencerContext = sequencer.createStreamSequencerContext(input,
sequencedProperty,
Modified: trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/JpaConnectorWritingTest.java
===================================================================
--- trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/JpaConnectorWritingTest.java 2009-07-04 13:16:05 UTC (rev 1070)
+++ trunk/extensions/dna-connector-store-jpa/src/test/java/org/jboss/dna/connector/store/jpa/JpaConnectorWritingTest.java 2009-07-04 20:01:17 UTC (rev 1071)
@@ -90,14 +90,14 @@
graph.useWorkspace(defaultWorkspaceName);
- graph.create("/newUuids");
+ graph.create("/newUuids").and();
// Copy once to get the UUID into the default workspace
//graph.copy("/node1").replacingExistingNodesWithSameUuids().fromWorkspace(workspaceName).to("/newUuids/node1");
graph.clone("/node1").fromWorkspace(workspaceName).as(name("node1")).into("/newUuids").replacingExistingNodesWithSameUuids();
// Create a new child node that in the target workspace that has no corresponding node in the source workspace
- graph.create("/newUuids/node1/shouldBeRemoved");
- graph.create("/refererringNode");
+ graph.create("/newUuids/node1/shouldBeRemoved").and();
+ graph.create("/refererringNode").and();
graph.set("refProp").on("/refererringNode").to(graph.getNodeAt("/newUuids/node1/shouldBeRemoved"));
// Now create a reference to this new node
More information about the dna-commits
mailing list