### Eclipse Workspace Patch 1.0
#P dna-connector-federation
Index: src/test/java/org/jboss/dna/connector/federation/contribution/NodeContributionTest.java
===================================================================
--- src/test/java/org/jboss/dna/connector/federation/contribution/NodeContributionTest.java (revision 727)
+++ src/test/java/org/jboss/dna/connector/federation/contribution/NodeContributionTest.java (working copy)
@@ -84,14 +84,14 @@
child2 = mock(Location.class);
child3 = mock(Location.class);
children = Arrays.asList(child1, child2, child3);
- contribution = new NodeContribution(sourceName, workspaceName, new Location(pathInSource), expiration, properties,
+ contribution = new NodeContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, properties,
children);
}
@Test
public void shouldAllowNullExpiration() {
expiration = null;
- contribution = new NodeContribution(sourceName, workspaceName, new Location(pathInSource), expiration, properties,
+ contribution = new NodeContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, properties,
children);
assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
}
@@ -99,35 +99,35 @@
@Test( expected = IllegalArgumentException.class )
public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
expiration = new JodaDateTime(System.currentTimeMillis(), "CST");
- contribution = new NodeContribution(sourceName, workspaceName, new Location(pathInSource), expiration, properties,
+ contribution = new NodeContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, properties,
children);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowNullProperties() {
properties = null;
- contribution = new NodeContribution(sourceName, workspaceName, new Location(pathInSource), expiration, properties,
+ contribution = new NodeContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, properties,
children);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowEmptyProperties() {
properties = Collections.emptyList();
- contribution = new NodeContribution(sourceName, workspaceName, new Location(pathInSource), expiration, properties,
+ contribution = new NodeContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, properties,
children);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowNullChildren() {
children = null;
- contribution = new NodeContribution(sourceName, workspaceName, new Location(pathInSource), expiration, properties,
+ contribution = new NodeContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, properties,
children);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowEmptyChildren() {
children = Collections.emptyList();
- contribution = new NodeContribution(sourceName, workspaceName, new Location(pathInSource), expiration, properties,
+ contribution = new NodeContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, properties,
children);
}
@@ -143,7 +143,7 @@
@Test
public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new NodeContribution(sourceName, workspaceName, new Location(pathInSource), NOW, properties, children);
+ contribution = new NodeContribution(sourceName, workspaceName, Location.create(pathInSource), NOW, properties, children);
assertThat(contribution.isExpired(YESTERDAY), is(false));
assertThat(contribution.isExpired(TOMORROW), is(true));
}
Index: src/test/java/org/jboss/dna/connector/federation/FederatingRequestProcessorTest.java
===================================================================
--- src/test/java/org/jboss/dna/connector/federation/FederatingRequestProcessorTest.java (revision 727)
+++ src/test/java/org/jboss/dna/connector/federation/FederatingRequestProcessorTest.java (working copy)
@@ -263,15 +263,15 @@
Path path = pathFactory.createRootPath();
List contributions = new LinkedList();
- executor.loadContributionsFromSources(new Location(path), defaultWorkspace, null, contributions);
+ executor.loadContributionsFromSources(Location.create(path), defaultWorkspace, null, contributions);
assertThat(contributions.size(), is(3)); // order is based upon order of projections
assertThat(contributions.get(0).getSourceName(), is(source1.getName()));
assertThat(contributions.get(1).getSourceName(), is(source2.getName()));
assertThat(contributions.get(2).getSourceName(), is(source3.getName()));
- Location childA = new Location(pathFactory.create(path, "a"));
- Location childB = new Location(pathFactory.create(path, "b"));
+ Location childA = Location.create(pathFactory.create(path, "a"));
+ Location childB = Location.create(pathFactory.create(path, "b"));
assertThat(contributions.get(0).getChildren(), hasItems(childA, childB));
assertThat(contributions.get(1).getChildren(), hasItems(childA));
assertThat(contributions.get(2).getChildren(), hasItems(nodeX, nodeB));
@@ -283,7 +283,7 @@
Iterator iter = contribution.getChildren();
for (String childName : childNames) {
Path expectedChildPath = context.getValueFactories().getPathFactory().create(location.getPath(), childName);
- Location expectedChild = new Location(expectedChildPath);
+ Location expectedChild = Location.create(expectedChildPath);
Location next = iter.next();
if (!next.isSame(expectedChild)) {
assertThat(next, is(expectedChild));
@@ -311,7 +311,7 @@
Path path = pathFactory.create("/x/y"); // from source 3
List contributions = new LinkedList();
- executor.loadContributionsFromSources(new Location(path), defaultWorkspace, null, contributions);
+ executor.loadContributionsFromSources(Location.create(path), defaultWorkspace, null, contributions);
assertThat(contributions.size(), is(3)); // order is based upon order of projections
assertThat(contributions.get(0).getSourceName(), is(source1.getName()));
@@ -324,7 +324,7 @@
path = pathFactory.create("/x"); // from source 3
contributions.clear();
- executor.loadContributionsFromSources(new Location(path), defaultWorkspace, null, contributions);
+ executor.loadContributionsFromSources(Location.create(path), defaultWorkspace, null, contributions);
assertThat(contributions.size(), is(3)); // order is based upon order of projections
assertThat(contributions.get(0).getSourceName(), is(source1.getName()));
@@ -383,7 +383,7 @@
Path path = pathFactory.create("/b"); // from source 2 and source 3
List contributions = new LinkedList();
- executor.loadContributionsFromSources(new Location(path), defaultWorkspace, null, contributions);
+ executor.loadContributionsFromSources(Location.create(path), defaultWorkspace, null, contributions);
assertThat(contributions.size(), is(3)); // order is based upon order of projections
assertThat(contributions.get(0).getSourceName(), is(source1.getName()));
@@ -396,7 +396,7 @@
path = pathFactory.create("/b/by"); // from source 3
contributions.clear();
- executor.loadContributionsFromSources(new Location(path), defaultWorkspace, null, contributions);
+ executor.loadContributionsFromSources(Location.create(path), defaultWorkspace, null, contributions);
assertThat(contributions.size(), is(2)); // order is based upon order of projections
assertThat(contributions.get(0).getSourceName(), is(source2.getName()));
@@ -457,7 +457,7 @@
Path path = pathFactory.create("/a"); // from sources 1, 2 and 3
List contributions = new LinkedList();
- executor.loadContributionsFromSources(new Location(path), defaultWorkspace, null, contributions);
+ executor.loadContributionsFromSources(Location.create(path), defaultWorkspace, null, contributions);
assertThat(contributions.size(), is(3)); // order is based upon order of projections
assertThat(contributions.get(0).getSourceName(), is(source1.getName()));
@@ -470,7 +470,7 @@
path = pathFactory.create("/a/ay"); // from source 3
contributions.clear();
- executor.loadContributionsFromSources(new Location(path), defaultWorkspace, null, contributions);
+ executor.loadContributionsFromSources(Location.create(path), defaultWorkspace, null, contributions);
assertThat(contributions.size(), is(1)); // order is based upon order of projections
assertThat(contributions.get(0).getSourceName(), is(source3.getName()));
@@ -481,7 +481,7 @@
public void shouldFailToLoadNodeFromSourcesWhenTheNodeDoesNotAppearInAnyOfTheSources() throws Exception {
Path nonExistant = pathFactory.create("/nonExistant/Node/In/AnySource");
List contributions = new LinkedList();
- executor.loadContributionsFromSources(new Location(nonExistant), defaultWorkspace, null, contributions);
+ executor.loadContributionsFromSources(Location.create(nonExistant), defaultWorkspace, null, contributions);
// All of the contributions should be empty ...
for (Contribution contribution : contributions) {
assertThat(contribution.isEmpty(), is(true));
@@ -539,7 +539,7 @@
Path path = pathFactory.create("/a"); // from sources 1, 2 and 3
List contributions = new LinkedList();
- executor.loadContributionsFromSources(new Location(path), defaultWorkspace, null, contributions);
+ executor.loadContributionsFromSources(Location.create(path), defaultWorkspace, null, contributions);
// Check when the contributions expire ...
DateTime nowInUtc = executor.getCurrentTimeInUtc();
Index: src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceIntegrationTest.java
===================================================================
--- src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceIntegrationTest.java (revision 727)
+++ src/test/java/org/jboss/dna/connector/federation/FederatedRepositorySourceIntegrationTest.java (working copy)
@@ -187,7 +187,7 @@
// locations may have more than just paths. So, create a list of actual locations that just have paths ...
List actualPathOnlyChildren = new ArrayList(childLocations.size());
for (Location actualChild : childLocations) {
- actualPathOnlyChildren.add(new Location(actualChild.getPath()));
+ actualPathOnlyChildren.add(Location.create(actualChild.getPath()));
}
// Now create the array of expected locations (that each contain only a path) ...
Location[] expectedChildren = new Location[children.length];
@@ -196,7 +196,7 @@
for (String child : children) {
Path.Segment segment = context.getValueFactories().getPathFactory().createSegment(child);
Path childPath = context.getValueFactories().getPathFactory().create(parentPath, segment);
- expectedChildren[i++] = new Location(childPath);
+ expectedChildren[i++] = Location.create(childPath);
}
assertThat(actualPathOnlyChildren, hasItems(expectedChildren));
}
Index: src/test/java/org/jboss/dna/connector/federation/merge/strategy/OneContributionMergeStrategyTest.java
===================================================================
--- src/test/java/org/jboss/dna/connector/federation/merge/strategy/OneContributionMergeStrategyTest.java (revision 727)
+++ src/test/java/org/jboss/dna/connector/federation/merge/strategy/OneContributionMergeStrategyTest.java (working copy)
@@ -75,12 +75,12 @@
context.getNamespaceRegistry().register(DnaLexicon.Namespace.PREFIX, DnaLexicon.Namespace.URI);
context.getNamespaceRegistry().register(JcrLexicon.Namespace.PREFIX, JcrLexicon.Namespace.URI);
parentPath = context.getValueFactories().getPathFactory().create("/a/b/c");
- node = new FederatedNode(new Location(parentPath), "some workspace");
+ node = new FederatedNode(Location.create(parentPath), "some workspace");
stub(contribution.getSourceName()).toReturn("source name");
children = new LinkedList();
for (int i = 0; i != 10; ++i) {
Path childPath = context.getValueFactories().getPathFactory().create(parentPath, "a" + i);
- children.add(new Location(childPath));
+ children.add(Location.create(childPath));
}
properties = new HashMap();
for (int i = 0; i != 10; ++i) {
Index: src/test/java/org/jboss/dna/connector/federation/merge/strategy/SimpleMergeStrategyTest.java
===================================================================
--- src/test/java/org/jboss/dna/connector/federation/merge/strategy/SimpleMergeStrategyTest.java (revision 727)
+++ src/test/java/org/jboss/dna/connector/federation/merge/strategy/SimpleMergeStrategyTest.java (working copy)
@@ -74,7 +74,7 @@
context.getNamespaceRegistry().register("jcr", "http://www.jcr.org");
parentPath = context.getValueFactories().getPathFactory().create("/a/b/c");
workspaceName = "some workspace";
- node = new FederatedNode(new Location(parentPath), workspaceName);
+ node = new FederatedNode(Location.create(parentPath), workspaceName);
}
@Test
@@ -202,7 +202,7 @@
protected Matcher> hasChildLocations( String... childNames ) {
List locations = new ArrayList();
for (String childName : childNames) {
- locations.add(new Location(context.getValueFactories().getPathFactory().create(parentPath, childName)));
+ locations.add(Location.create(context.getValueFactories().getPathFactory().create(parentPath, childName)));
}
return equalTo(locations);
}
@@ -211,7 +211,7 @@
Location[] locations = new Location[childNames.length];
int index = 0;
for (String childName : childNames) {
- locations[index++] = new Location(context.getValueFactories().getPathFactory().create(parentPath, childName));
+ locations[index++] = Location.create(context.getValueFactories().getPathFactory().create(parentPath, childName));
}
return IsIteratorContaining.hasItems(locations);
}
@@ -242,7 +242,7 @@
List contributions ) {
this.context = context;
this.mockContribution = Mockito.mock(Contribution.class);
- stub(mockContribution.getLocationInSource()).toReturn(new Location(parentPath));
+ stub(mockContribution.getLocationInSource()).toReturn(Location.create(parentPath));
stub(mockContribution.getSourceName()).toReturn(name);
stub(mockContribution.getChildren()).toAnswer(new Answer>() {
public Iterator answer( InvocationOnMock invocation ) throws Throwable {
@@ -273,7 +273,7 @@
public ContributionBuilder addChildren( String... pathsForChildren ) {
for (String childPath : pathsForChildren) {
Path path = context.getValueFactories().getPathFactory().create(parentPath, childPath);
- children.add(new Location(path));
+ children.add(Location.create(path));
}
return this;
}
Index: src/test/java/org/jboss/dna/connector/federation/contribution/ThreePropertyContributionTest.java
===================================================================
--- src/test/java/org/jboss/dna/connector/federation/contribution/ThreePropertyContributionTest.java (revision 727)
+++ src/test/java/org/jboss/dna/connector/federation/contribution/ThreePropertyContributionTest.java (working copy)
@@ -71,14 +71,14 @@
property1 = new BasicSingleValueProperty(new BasicName(nsUri, "property1"), "value1");
property2 = new BasicSingleValueProperty(new BasicName(nsUri, "property2"), "value2");
property3 = new BasicSingleValueProperty(new BasicName(nsUri, "property3"), "value3");
- contribution = new ThreePropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration,
+ contribution = new ThreePropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration,
property1, property2, property3);
}
@Test
public void shouldAllowNullExpiration() {
expiration = null;
- contribution = new ThreePropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration,
+ contribution = new ThreePropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration,
property1, property2, property3);
assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
}
@@ -86,28 +86,28 @@
@Test( expected = IllegalArgumentException.class )
public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
expiration = new JodaDateTime(System.currentTimeMillis(), "CST");
- contribution = new ThreePropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration,
+ contribution = new ThreePropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration,
property1, property2, property3);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowNullFirstProperty() {
property1 = null;
- contribution = new ThreePropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration,
+ contribution = new ThreePropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration,
property1, property2, property3);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowNullSecondProperty() {
property2 = null;
- contribution = new ThreePropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration,
+ contribution = new ThreePropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration,
property1, property2, property3);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowNullThirdProperty() {
property3 = null;
- contribution = new ThreePropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration,
+ contribution = new ThreePropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration,
property1, property2, property3);
}
@@ -123,7 +123,7 @@
@Test
public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new ThreePropertyContribution(sourceName, workspaceName, new Location(pathInSource), NOW, property1,
+ contribution = new ThreePropertyContribution(sourceName, workspaceName, Location.create(pathInSource), NOW, property1,
property2, property3);
assertThat(contribution.isExpired(YESTERDAY), is(false));
assertThat(contribution.isExpired(TOMORROW), is(true));
Index: src/test/java/org/jboss/dna/connector/federation/contribution/OneChildContributionTest.java
===================================================================
--- src/test/java/org/jboss/dna/connector/federation/contribution/OneChildContributionTest.java (revision 727)
+++ src/test/java/org/jboss/dna/connector/federation/contribution/OneChildContributionTest.java (working copy)
@@ -62,26 +62,26 @@
pathInSource = RootPath.INSTANCE;
expiration = TOMORROW;
child1 = mock(Location.class);
- contribution = new OneChildContribution(sourceName, workspaceName, new Location(pathInSource), expiration, child1);
+ contribution = new OneChildContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, child1);
}
@Test
public void shouldAllowNullExpiration() {
expiration = null;
- contribution = new OneChildContribution(sourceName, workspaceName, new Location(pathInSource), expiration, child1);
+ contribution = new OneChildContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, child1);
assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
}
@Test( expected = IllegalArgumentException.class )
public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
expiration = new JodaDateTime(System.currentTimeMillis(), "CST");
- contribution = new OneChildContribution(sourceName, workspaceName, new Location(pathInSource), expiration, child1);
+ contribution = new OneChildContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, child1);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowNullChildren() {
child1 = null;
- contribution = new OneChildContribution(sourceName, workspaceName, new Location(pathInSource), expiration, child1);
+ contribution = new OneChildContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, child1);
}
@Test
@@ -96,7 +96,7 @@
@Test
public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new OneChildContribution(sourceName, workspaceName, new Location(pathInSource), NOW, child1);
+ contribution = new OneChildContribution(sourceName, workspaceName, Location.create(pathInSource), NOW, child1);
assertThat(contribution.isExpired(YESTERDAY), is(false));
assertThat(contribution.isExpired(TOMORROW), is(true));
}
Index: src/test/java/org/jboss/dna/connector/federation/contribution/MultiChildContributionTest.java
===================================================================
--- src/test/java/org/jboss/dna/connector/federation/contribution/MultiChildContributionTest.java (revision 727)
+++ src/test/java/org/jboss/dna/connector/federation/contribution/MultiChildContributionTest.java (working copy)
@@ -71,32 +71,32 @@
child2 = mock(Location.class);
child3 = mock(Location.class);
children = Arrays.asList(child1, child2, child3);
- contribution = new MultiChildContribution(sourceName, workspaceName, new Location(pathInSource), expiration, children);
+ contribution = new MultiChildContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, children);
}
@Test
public void shouldAllowNullExpiration() {
expiration = null;
- contribution = new MultiChildContribution(sourceName, workspaceName, new Location(pathInSource), expiration, children);
+ contribution = new MultiChildContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, children);
assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
}
@Test( expected = IllegalArgumentException.class )
public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
expiration = new JodaDateTime(System.currentTimeMillis(), "CST");
- contribution = new MultiChildContribution(sourceName, workspaceName, new Location(pathInSource), expiration, children);
+ contribution = new MultiChildContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, children);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowNullChildren() {
children = null;
- contribution = new MultiChildContribution(sourceName, workspaceName, new Location(pathInSource), expiration, children);
+ contribution = new MultiChildContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, children);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowEmptyChildren() {
children = Collections.emptyList();
- contribution = new MultiChildContribution(sourceName, workspaceName, new Location(pathInSource), expiration, children);
+ contribution = new MultiChildContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, children);
}
@Test
@@ -111,7 +111,7 @@
@Test
public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new MultiChildContribution(sourceName, workspaceName, new Location(pathInSource), NOW, children);
+ contribution = new MultiChildContribution(sourceName, workspaceName, Location.create(pathInSource), NOW, children);
assertThat(contribution.isExpired(YESTERDAY), is(false));
assertThat(contribution.isExpired(TOMORROW), is(true));
}
Index: src/test/java/org/jboss/dna/connector/federation/merge/FederatedNodeTest.java
===================================================================
--- src/test/java/org/jboss/dna/connector/federation/merge/FederatedNodeTest.java (revision 727)
+++ src/test/java/org/jboss/dna/connector/federation/merge/FederatedNodeTest.java (working copy)
@@ -45,7 +45,7 @@
@Before
public void beforeEach() {
MockitoAnnotations.initMocks(this);
- location = new Location(mock(Path.class));
+ location = Location.create(mock(Path.class));
node = new FederatedNode(location, "workspace");
}
Index: src/test/java/org/jboss/dna/connector/federation/contribution/MultiPropertyContributionTest.java
===================================================================
--- src/test/java/org/jboss/dna/connector/federation/contribution/MultiPropertyContributionTest.java (revision 727)
+++ src/test/java/org/jboss/dna/connector/federation/contribution/MultiPropertyContributionTest.java (working copy)
@@ -75,14 +75,14 @@
property2 = new BasicSingleValueProperty(new BasicName(nsUri, "property2"), "value2");
property3 = new BasicSingleValueProperty(new BasicName(nsUri, "property3"), "value3");
properties = Arrays.asList(property1, property2, property3);
- contribution = new MultiPropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration,
+ contribution = new MultiPropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration,
properties);
}
@Test
public void shouldAllowNullExpiration() {
expiration = null;
- contribution = new MultiPropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration,
+ contribution = new MultiPropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration,
properties);
assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
}
@@ -90,21 +90,21 @@
@Test( expected = IllegalArgumentException.class )
public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
expiration = new JodaDateTime(System.currentTimeMillis(), "CST");
- contribution = new MultiPropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration,
+ contribution = new MultiPropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration,
properties);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowNullProperties() {
properties = null;
- contribution = new MultiPropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration,
+ contribution = new MultiPropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration,
properties);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowEmptyProperties() {
properties = Collections.emptyList();
- contribution = new MultiPropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration,
+ contribution = new MultiPropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration,
properties);
}
@@ -120,7 +120,7 @@
@Test
public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new MultiPropertyContribution(sourceName, workspaceName, new Location(pathInSource), NOW, properties);
+ contribution = new MultiPropertyContribution(sourceName, workspaceName, Location.create(pathInSource), NOW, properties);
assertThat(contribution.isExpired(YESTERDAY), is(false));
assertThat(contribution.isExpired(TOMORROW), is(true));
}
Index: src/main/java/org/jboss/dna/connector/federation/merge/strategy/SimpleMergeStrategy.java
===================================================================
--- src/main/java/org/jboss/dna/connector/federation/merge/strategy/SimpleMergeStrategy.java (revision 727)
+++ src/main/java/org/jboss/dna/connector/federation/merge/strategy/SimpleMergeStrategy.java (working copy)
@@ -110,7 +110,7 @@
if (!childNames.containsKey(childName)) {
childNames.put(childName, 1);
Path pathToChild = pathFactory.create(location.getPath(), childName);
- federatedNode.addChild(new Location(pathToChild));
+ federatedNode.addChild(Location.create(pathToChild));
}
}
} else {
@@ -140,7 +140,7 @@
index = previousValue;
}
Path pathToChild = pathFactory.create(location.getPath(), childName, index);
- federatedNode.addChild(new Location(pathToChild));
+ federatedNode.addChild(Location.create(pathToChild));
}
// Add in the properties ...
Index: src/test/java/org/jboss/dna/connector/federation/contribution/TwoChildContributionTest.java
===================================================================
--- src/test/java/org/jboss/dna/connector/federation/contribution/TwoChildContributionTest.java (revision 727)
+++ src/test/java/org/jboss/dna/connector/federation/contribution/TwoChildContributionTest.java (working copy)
@@ -64,32 +64,32 @@
expiration = TOMORROW;
child1 = mock(Location.class);
child2 = mock(Location.class);
- contribution = new TwoChildContribution(sourceName, workspaceName, new Location(pathInSource), expiration, child1, child2);
+ contribution = new TwoChildContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, child1, child2);
}
@Test
public void shouldAllowNullExpiration() {
expiration = null;
- contribution = new TwoChildContribution(sourceName, workspaceName, new Location(pathInSource), expiration, child1, child2);
+ contribution = new TwoChildContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, child1, child2);
assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
}
@Test( expected = IllegalArgumentException.class )
public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
expiration = new JodaDateTime(System.currentTimeMillis(), "CST");
- contribution = new TwoChildContribution(sourceName, workspaceName, new Location(pathInSource), expiration, child1, child2);
+ contribution = new TwoChildContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, child1, child2);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowNullFirstChild() {
child1 = null;
- contribution = new TwoChildContribution(sourceName, workspaceName, new Location(pathInSource), expiration, child1, child2);
+ contribution = new TwoChildContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, child1, child2);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowNullSecondChild() {
child2 = null;
- contribution = new TwoChildContribution(sourceName, workspaceName, new Location(pathInSource), expiration, child1, child2);
+ contribution = new TwoChildContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, child1, child2);
}
@Test
@@ -104,7 +104,7 @@
@Test
public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new TwoChildContribution(sourceName, workspaceName, new Location(pathInSource), NOW, child1, child2);
+ contribution = new TwoChildContribution(sourceName, workspaceName, Location.create(pathInSource), NOW, child1, child2);
assertThat(contribution.isExpired(YESTERDAY), is(false));
assertThat(contribution.isExpired(TOMORROW), is(true));
}
Index: src/test/java/org/jboss/dna/connector/federation/contribution/OnePropertyContributionTest.java
===================================================================
--- src/test/java/org/jboss/dna/connector/federation/contribution/OnePropertyContributionTest.java (revision 727)
+++ src/test/java/org/jboss/dna/connector/federation/contribution/OnePropertyContributionTest.java (working copy)
@@ -67,26 +67,26 @@
expiration = TOMORROW;
String nsUri = "http://www.jboss.org/default";
property1 = new BasicSingleValueProperty(new BasicName(nsUri, "property1"), "value1");
- contribution = new OnePropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration, property1);
+ contribution = new OnePropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, property1);
}
@Test
public void shouldAllowNullExpiration() {
expiration = null;
- contribution = new OnePropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration, property1);
+ contribution = new OnePropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, property1);
assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
}
@Test( expected = IllegalArgumentException.class )
public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
expiration = new JodaDateTime(System.currentTimeMillis(), "CST");
- contribution = new OnePropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration, property1);
+ contribution = new OnePropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, property1);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowNullFirstProperty() {
property1 = null;
- contribution = new OnePropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration, property1);
+ contribution = new OnePropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, property1);
}
@Test
@@ -101,7 +101,7 @@
@Test
public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new OnePropertyContribution(sourceName, workspaceName, new Location(pathInSource), NOW, property1);
+ contribution = new OnePropertyContribution(sourceName, workspaceName, Location.create(pathInSource), NOW, property1);
assertThat(contribution.isExpired(YESTERDAY), is(false));
assertThat(contribution.isExpired(TOMORROW), is(true));
}
Index: src/main/java/org/jboss/dna/connector/federation/FederatingRequestProcessor.java
===================================================================
--- src/main/java/org/jboss/dna/connector/federation/FederatingRequestProcessor.java (revision 727)
+++ src/main/java/org/jboss/dna/connector/federation/FederatingRequestProcessor.java (working copy)
@@ -299,7 +299,7 @@
FederatedWorkspace workspace = getWorkspace(request, request.workspaceName());
if (workspace != null) {
request.setActualWorkspaceName(workspace.getName());
- Location root = new Location(getExecutionContext().getValueFactories().getPathFactory().createRootPath());
+ Location root = Location.create(getExecutionContext().getValueFactories().getPathFactory().createRootPath());
ReadNodeRequest nodeInfo = getNode(root, workspace);
if (nodeInfo.hasError()) return;
request.setActualRootLocation(nodeInfo.getActualLocationOfNode());
@@ -385,7 +385,7 @@
// Load the nodes along the path below the existing ancestor, down to (but excluding) the desired path
Path pathToLoad = ancestor;
while (!pathToLoad.equals(lowestExistingAncestor)) {
- Location locationToLoad = new Location(pathToLoad);
+ Location locationToLoad = Location.create(pathToLoad);
loadContributionsFromSources(locationToLoad, workspace, null, contributions); // sourceNames may be
// null or empty
FederatedNode mergedNode = createFederatedNode(locationToLoad, workspace, contributions, true);
@@ -584,14 +584,14 @@
// use those to figure out the children of the nodes.
Contribution contribution = null;
List topLevelPaths = projection.getTopLevelPathsInRepository(pathFactory);
- Location input = new Location(path);
+ Location input = Location.create(path);
switch (topLevelPaths.size()) {
case 0:
break;
case 1: {
Path topLevelPath = topLevelPaths.iterator().next();
if (path.isAncestorOf(topLevelPath)) {
- Location child = new Location(topLevelPath);
+ Location child = Location.create(topLevelPath);
contribution = Contribution.createPlaceholder(source, workspace, input, expirationTime, child);
}
break;
@@ -601,7 +601,7 @@
List children = new ArrayList(topLevelPaths.size());
for (Path topLevelPath : topLevelPaths) {
if (path.isAncestorOf(topLevelPath)) {
- children.add(new Location(topLevelPath));
+ children.add(Location.create(topLevelPath));
}
}
if (children.size() > 0) {
@@ -618,7 +618,7 @@
final int numPaths = pathsInSource.size();
if (numPaths == 1) {
Path pathInSource = pathsInSource.iterator().next();
- ReadNodeRequest fromSource = new ReadNodeRequest(new Location(pathInSource), workspace);
+ ReadNodeRequest fromSource = new ReadNodeRequest(Location.create(pathInSource), workspace);
sourceConnection.execute(getExecutionContext(), fromSource);
if (!fromSource.hasError()) {
Collection properties = fromSource.getProperties();
@@ -657,7 +657,7 @@
} else {
List fromSourceCommands = new ArrayList(numPaths);
for (Path pathInSource : pathsInSource) {
- fromSourceCommands.add(new ReadNodeRequest(new Location(pathInSource), workspace));
+ fromSourceCommands.add(new ReadNodeRequest(Location.create(pathInSource), workspace));
}
Request request = CompositeRequest.with(fromSourceCommands);
sourceConnection.execute(context, request);
@@ -720,7 +720,7 @@
Name childName = null;
if (!path.isRoot()) {
// This is not the root node, so we need to create the node ...
- final Location parentLocation = new Location(path.getParent());
+ final Location parentLocation = Location.create(path.getParent());
childName = path.getLastSegment().getName();
requests.add(new CreateNodeRequest(parentLocation, cacheWorkspace, childName, NodeConflictBehavior.REPLACE,
mergedNode.getProperties()));
Index: src/test/java/org/jboss/dna/connector/federation/contribution/TwoPropertyContributionTest.java
===================================================================
--- src/test/java/org/jboss/dna/connector/federation/contribution/TwoPropertyContributionTest.java (revision 727)
+++ src/test/java/org/jboss/dna/connector/federation/contribution/TwoPropertyContributionTest.java (working copy)
@@ -69,14 +69,14 @@
String nsUri = "http://www.jboss.org/default";
property1 = new BasicSingleValueProperty(new BasicName(nsUri, "property1"), "value1");
property2 = new BasicSingleValueProperty(new BasicName(nsUri, "property2"), "value2");
- contribution = new TwoPropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration, property1,
+ contribution = new TwoPropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, property1,
property2);
}
@Test
public void shouldAllowNullExpiration() {
expiration = null;
- contribution = new TwoPropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration, property1,
+ contribution = new TwoPropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, property1,
property2);
assertThat(contribution.getExpirationTimeInUtc(), is(nullValue()));
}
@@ -84,21 +84,21 @@
@Test( expected = IllegalArgumentException.class )
public void shouldNotAllowExpirationTimeIfNotInUtcTime() {
expiration = new JodaDateTime(System.currentTimeMillis(), "CST");
- contribution = new TwoPropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration, property1,
+ contribution = new TwoPropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, property1,
property2);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowNullFirstProperty() {
property1 = null;
- contribution = new TwoPropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration, property1,
+ contribution = new TwoPropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, property1,
property2);
}
@Test( expected = AssertionError.class )
public void shouldNotAllowNullSecondProperty() {
property2 = null;
- contribution = new TwoPropertyContribution(sourceName, workspaceName, new Location(pathInSource), expiration, property1,
+ contribution = new TwoPropertyContribution(sourceName, workspaceName, Location.create(pathInSource), expiration, property1,
property2);
}
@@ -114,7 +114,7 @@
@Test
public void shouldNotBeExpiredIfExpirationIsInTheFuture() {
- contribution = new TwoPropertyContribution(sourceName, workspaceName, new Location(pathInSource), NOW, property1,
+ contribution = new TwoPropertyContribution(sourceName, workspaceName, Location.create(pathInSource), NOW, property1,
property2);
assertThat(contribution.isExpired(YESTERDAY), is(false));
assertThat(contribution.isExpired(TOMORROW), is(true));
#P dna-connector-svn
Index: src/test/java/org/jboss/dna/connector/svn/SVNRepositoryConnectionTest.java
===================================================================
--- src/test/java/org/jboss/dna/connector/svn/SVNRepositoryConnectionTest.java (revision 727)
+++ src/test/java/org/jboss/dna/connector/svn/SVNRepositoryConnectionTest.java (working copy)
@@ -222,7 +222,7 @@
@Test
public void shouldNotHaveProperties() {
// Root location does not need properties.
- Location root = new Location(pathFactory.create("/"));
+ Location root = Location.create(pathFactory.create("/"));
Collection nilProperties = graph.getProperties().on(root);
assertThat(nilProperties, is(notNullValue()));
assertThat(nilProperties.isEmpty(), is(true));
@@ -231,7 +231,7 @@
@Test
public void shouldJustCatchThePropertiesOnLocation() {
// directory nodeA has "jcr:primaryType" with value "nt:folder" and also "jcr:created" with value folder created date
- Location nodeA = new Location(pathFactory.create("/nodeA"));
+ Location nodeA = Location.create(pathFactory.create("/nodeA"));
Collection nodeAProperties = graph.getProperties().on(nodeA);
assertThat(nodeAProperties, is(notNullValue()));
assertThat(nodeAProperties.isEmpty(), is(false));
@@ -239,7 +239,7 @@
// file itemA.txt has "jcr:primaryType" property whose value is "nt:file" and also "jcr:created" with value folder created
// date
- Location itemA1 = new Location(pathFactory.create("/nodeA/itemA1.txt"));
+ Location itemA1 = Location.create(pathFactory.create("/nodeA/itemA1.txt"));
Collection itemA1Properties = graph.getProperties().on(itemA1);
assertThat(itemA1Properties, is(notNullValue()));
assertThat(itemA1Properties.isEmpty(), is(false));
@@ -250,7 +250,7 @@
// "jcr:data" property whose value are the contents of the file
// and a few other properties, like "jcr:encoding", "jcr:mimeType" and "jcr:lastModified" and
// also "jcr:created" property
- Location content = new Location(pathFactory.create("/nodeA/itemA2.txt/jcr:content"));
+ Location content = Location.create(pathFactory.create("/nodeA/itemA2.txt/jcr:content"));
Collection itemA2ContentProperties = graph.getProperties().on(content);
assertThat(itemA2ContentProperties, is(notNullValue()));
assertThat(itemA2ContentProperties.isEmpty(), is(false));
Index: src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java
===================================================================
--- src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java (revision 727)
+++ src/main/java/org/jboss/dna/connector/svn/SVNRepositoryRequestProcessor.java (working copy)
@@ -216,7 +216,7 @@
Name childName = nameFactory().create(defaultNamespaceUri, localName);
String url = entry.getURL().toString();
Property idProperty = propertyFactory().create(childName, url);
- request.addChild(new Location(pathFactory().create(nodePath, JcrLexicon.CONTENT), idProperty));
+ request.addChild(Location.create(pathFactory().create(nodePath, JcrLexicon.CONTENT), idProperty));
}
} else if (kind == SVNNodeKind.DIR) { // the requested node is a directory.
final Collection dirEntries = getRepository().getDir(requestedNodePath,
@@ -231,7 +231,7 @@
Name childName = nameFactory().create(defaultNamespaceUri, localName);
String url = dirEntry.getURL().toString();
Property idProperty = propertyFactory().create(childName, url);
- Location location = new Location(pathFactory().create(newPath, JcrLexicon.CONTENT), idProperty);
+ Location location = Location.create(pathFactory().create(newPath, JcrLexicon.CONTENT), idProperty);
request.addChild(location);
}
} else if (dirEntry.getKind() == SVNNodeKind.DIR) {
@@ -373,7 +373,7 @@
// This does the job of converting a null workspace name to a valid workspace
String workspaceName = request.workspaceName();
if (workspaceName == null) workspaceName = "default";
- request.setActualRootLocation(new Location(pathFactory().createRootPath()));
+ request.setActualRootLocation(Location.create(pathFactory().createRootPath()));
request.setActualWorkspaceName(workspaceName);
}
@@ -531,11 +531,11 @@
kind = getRepository().checkPath(myPath, -1);
if (kind == SVNNodeKind.NONE) {
// node does not exist or requested node is not correct.
- throw new PathNotFoundException(new Location(requestedPath), null,
+ throw new PathNotFoundException(Location.create(requestedPath), null,
SVNRepositoryConnectorI18n.nodeDoesNotExist.text(myPath));
} else if (kind == SVNNodeKind.UNKNOWN) {
// node is unknown
- throw new PathNotFoundException(new Location(requestedPath), null,
+ throw new PathNotFoundException(Location.create(requestedPath), null,
SVNRepositoryConnectorI18n.nodeIsActuallyUnknow.text(myPath));
}
} catch (SVNException e) {
#P dna-jcr
Index: src/test/java/org/jboss/dna/jcr/JackrabbitJcrTckTest.java
===================================================================
--- src/test/java/org/jboss/dna/jcr/JackrabbitJcrTckTest.java (revision 0)
+++ src/test/java/org/jboss/dna/jcr/JackrabbitJcrTckTest.java (revision 0)
@@ -0,0 +1,227 @@
+/*
+ * JBoss DNA (http://www.jboss.org/dna)
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ * See the AUTHORS.txt file in the distribution for a full listing of
+ * individual contributors.
+ *
+ * JBoss DNA is free software. Unless otherwise indicated, all code in JBoss DNA
+ * is licensed to you under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * JBoss DNA is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.dna.jcr;
+
+import java.io.File;
+import java.net.URI;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.util.Collections;
+import java.util.Properties;
+
+import javax.jcr.Credentials;
+import javax.jcr.Repository;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+import org.apache.jackrabbit.test.JCRTestSuite;
+import org.apache.jackrabbit.test.RepositoryStub;
+import org.jboss.dna.graph.DnaLexicon;
+import org.jboss.dna.graph.ExecutionContext;
+import org.jboss.dna.graph.Graph;
+import org.jboss.dna.graph.GraphImporter;
+import org.jboss.dna.graph.Location;
+import org.jboss.dna.graph.connector.RepositoryConnection;
+import org.jboss.dna.graph.connector.RepositoryConnectionFactory;
+import org.jboss.dna.graph.connector.inmemory.InMemoryRepositorySource;
+import org.jboss.dna.graph.property.Path;
+
+/**
+ * Test suite to wrap Apache Jackrabbit JCR technology compatibility kit (TCK) tests.
+ *
+ */
+public class JackrabbitJcrTckTest {
+
+ /** Wrapper so that the Jackrabbit TCK test suite gets picked up by
+ * the DNA Maven test target.
+ * @return a new instance of {@link JCRTestSuite}.
+ */
+ public static Test suite() {
+ // Uncomment this to execute all tests
+ //return new JCRTestSuite();
+
+ // Uncomment this to execute level one tests only
+ return new JcrLevelOneTestSuite();
+ }
+
+ /** Test suite that includes all of the Jackrabbit TCK API tests except the level two tests. */
+ private static class JcrLevelOneTestSuite extends TestSuite {
+ public JcrLevelOneTestSuite() {
+ super("JCR 1.0 Level 1 API tests");
+
+ addTestSuite(org.apache.jackrabbit.test.api.RootNodeTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.NodeReadMethodsTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.PropertyTypeTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.NodeDiscoveringNodeTypesTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.BinaryPropertyTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.BooleanPropertyTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.DatePropertyTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.DoublePropertyTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.LongPropertyTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.NamePropertyTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.PathPropertyTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.ReferencePropertyTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.StringPropertyTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.UndefinedPropertyTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.NamespaceRegistryReadMethodsTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.NamespaceRemappingTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.NodeIteratorTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.PropertyReadMethodsTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.RepositoryDescriptorTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.SessionReadMethodsTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.WorkspaceReadMethodsTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.ReferenceableRootNodesTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.ExportSysViewTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.ExportDocViewTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.RepositoryLoginTest.class);
+
+ // These might not all be level one tests
+ addTestSuite(org.apache.jackrabbit.test.api.query.XPathPosIndexTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.query.XPathDocOrderTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.query.XPathOrderByTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.query.XPathJcrPathTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.query.DerefQueryLevel1Test.class);
+ addTestSuite(org.apache.jackrabbit.test.api.query.GetLanguageTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.query.GetPersistentQueryPathLevel1Test.class);
+ addTestSuite(org.apache.jackrabbit.test.api.query.GetStatementTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.query.GetSupportedQueryLanguagesTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.query.GetPropertyNamesTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.query.PredicatesTest.class);
+ addTestSuite(org.apache.jackrabbit.test.api.query.SimpleSelectionTest.class);
+
+ // The tests in this suite are level one
+ addTest(org.apache.jackrabbit.test.api.nodetype.TestAll.suite());
+ }
+
+
+ }
+
+ /**
+ * Concrete implementation of {@link RepositoryStub} based on DNA-specific configuration.
+ *
+ */
+ public static class InMemoryRepositoryStub extends RepositoryStub {
+ private Repository repository;
+ protected RepositoryConnection connection;
+ protected AccessControlContext accessControlContext = AccessController.getContext();
+
+ private Credentials credentials = new Credentials() {
+ private static final long serialVersionUID = 1L;
+
+ @SuppressWarnings( "unused" )
+ public AccessControlContext getAccessControlContext() {
+ return accessControlContext;
+ }
+ };
+
+ protected ExecutionContext executionContext = new ExecutionContext() {
+
+ @Override
+ public ExecutionContext create(AccessControlContext accessControlContext) {
+ return executionContext;
+ }
+ };
+
+ protected RepositoryConnectionFactory connectionFactory = new RepositoryConnectionFactory() {
+ public RepositoryConnection createConnection( String sourceName ) {
+ return connection;
+ }
+ };
+
+ public InMemoryRepositoryStub(Properties env) {
+ super(env);
+
+ // Create the in-memory (DNA) repository
+ InMemoryRepositorySource source = new InMemoryRepositorySource();
+
+ // Various calls will fail if you do not set a non-null name for the source
+ source.setName("TestRepositorySource");
+
+ // Wrap a connection to the in-memory (DNA) repository in a (JCR) repository
+ connection = source.getConnection();
+ repository = new JcrRepository(Collections.emptyMap(),
+ executionContext.create(accessControlContext), connectionFactory);
+
+ // Set up some sample nodes in the graph to match the expected test configuration
+ try {
+
+ //TODO: Should there be an easier way to define these since they will be needed for all JCR repositories?
+ executionContext.getNamespaceRegistry().register(DnaLexicon.Namespace.PREFIX, DnaLexicon.Namespace.URI);
+ executionContext.getNamespaceRegistry().register("jcr", "http://www.jcp.org/jcr/1.0");
+ executionContext.getNamespaceRegistry().register("nt", "http://www.jcp.org/jcr/nt/1.0");
+ executionContext.getNamespaceRegistry().register("sv", "http://www.jcp.org/jcr/sv/1.0");
+
+ Path destinationPath = executionContext.getValueFactories().getPathFactory().create("/");
+ Graph graph = Graph.create(source.getName(), connectionFactory, executionContext);
+ GraphImporter importer = new GraphImporter(graph);
+
+ URI xmlContent = new File("src/test/resources/repositoryJackrabbitTck.xml").toURI();
+ Graph.Batch batch = importer.importXml(xmlContent, Location.create(destinationPath));
+
+ batch.execute();
+
+ }
+ catch (Exception ex) {
+ // The TCK tries to quash this exception. Print it out to be more obvious.
+ ex.printStackTrace();
+ throw new IllegalStateException("Repository initialization failed.", ex);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.apache.jackrabbit.test.RepositoryStub#getSuperuserCredentials()
+ */
+ @Override
+ public Credentials getSuperuserCredentials() {
+ //TODO: Why must we override this method? The default TCK implementation just returns a particular instance of SimpleCredentials.
+ return credentials;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.apache.jackrabbit.test.RepositoryStub#getReadOnlyCredentials()
+ */
+ @Override
+ public Credentials getReadOnlyCredentials() {
+ //TODO: Why must we override this method? The default TCK implementation just returns a particular instance of SimpleCredentials.
+ return credentials;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.apache.jackrabbit.test.RepositoryStub#getRepository()
+ */
+ @Override
+ public Repository getRepository() {
+ return repository;
+ }
+
+ }
+
+}
#P dna-connector-jbosscache
Index: src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheRequestProcessor.java
===================================================================
--- src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheRequestProcessor.java (revision 727)
+++ src/main/java/org/jboss/dna/connector/jbosscache/JBossCacheRequestProcessor.java (working copy)
@@ -116,10 +116,10 @@
Path.Segment[] childList = (Path.Segment[])node.get(JBossCacheLexicon.CHILD_PATH_SEGMENT_LIST);
if (childList != null) {
for (Path.Segment child : childList) {
- request.addChild(new Location(pathFactory.create(nodePath, child)));
+ request.addChild(Location.create(pathFactory.create(nodePath, child)));
}
}
- request.setActualLocationOfNode(new Location(nodePath));
+ request.setActualLocationOfNode(Location.create(nodePath));
setCacheableInfo(request);
}
@@ -142,7 +142,7 @@
Property property = propertyFactory.create(propertyName, values);
request.addProperty(property);
}
- request.setActualLocationOfNode(new Location(nodePath));
+ request.setActualLocationOfNode(Location.create(nodePath));
setCacheableInfo(request);
}
@@ -177,7 +177,7 @@
node.put(propName, value);
}
Path nodePath = pathFactory.create(parent, newSegment);
- request.setActualLocationOfNode(new Location(nodePath));
+ request.setActualLocationOfNode(Location.create(nodePath));
}
@Override
@@ -206,7 +206,7 @@
}
node.put(propName, value);
}
- request.setActualLocationOfNode(new Location(nodePath));
+ request.setActualLocationOfNode(Location.create(nodePath));
}
@Override
@@ -242,7 +242,7 @@
getExecutionContext());
Path newPath = pathFactory.create(newParentPath, newSegment);
- request.setActualLocations(new Location(nodePath), new Location(newPath));
+ request.setActualLocations(Location.create(nodePath), Location.create(newPath));
}
@Override
@@ -255,7 +255,7 @@
if (node == null) return;
node.getParent().removeChild(node.getFqn().getLastElement());
- request.setActualLocationOfNode(new Location(nodePath));
+ request.setActualLocationOfNode(Location.create(nodePath));
}
@Override
@@ -281,7 +281,7 @@
assert removed;
Path newPath = pathFactory.create(newParentPath, newSegment);
- request.setActualLocations(new Location(nodePath), new Location(newPath));
+ request.setActualLocations(Location.create(nodePath), Location.create(newPath));
}
/**
@@ -305,7 +305,7 @@
uuid = uuidFactory.create();
cache.put(rootName, DnaLexicon.UUID, uuid);
}
- request.setActualRootLocation(new Location(pathFactory.createRootPath()));
+ request.setActualRootLocation(Location.create(pathFactory.createRootPath()));
request.setActualWorkspaceName(workspaceName);
}
}
@@ -347,7 +347,7 @@
uuid = uuidFactory.create();
cache.put(rootName, DnaLexicon.UUID, uuid);
}
- request.setActualRootLocation(new Location(pathFactory.createRootPath()));
+ request.setActualRootLocation(Location.create(pathFactory.createRootPath()));
request.setActualWorkspaceName(workspaceName);
}
@@ -482,7 +482,7 @@
fqn = null;
}
}
- request.setError(new PathNotFoundException(new Location(path), lowestExisting,
+ request.setError(new PathNotFoundException(Location.create(path), lowestExisting,
JBossCacheConnectorI18n.nodeDoesNotExist.text(nodePath)));
node = null;
}
#P dna-graph
Index: src/main/java/org/jboss/dna/graph/Graph.java
===================================================================
--- src/main/java/org/jboss/dna/graph/Graph.java (revision 729)
+++ src/main/java/org/jboss/dna/graph/Graph.java (working copy)
@@ -442,7 +442,7 @@
* be moved
*/
public Move> move( String fromPath ) {
- return new MoveAction>(this.nextGraph, this.requestQueue, new Location(createPath(fromPath)));
+ return new MoveAction>(this.nextGraph, this.requestQueue, Location.create(createPath(fromPath)));
}
/**
@@ -458,7 +458,7 @@
* be moved
*/
public Move> move( Path from ) {
- return new MoveAction>(this.nextGraph, this.requestQueue, new Location(from));
+ return new MoveAction>(this.nextGraph, this.requestQueue, Location.create(from));
}
/**
@@ -474,7 +474,7 @@
* be moved
*/
public Move> move( UUID from ) {
- return new MoveAction>(this.nextGraph, this.requestQueue, new Location(from));
+ return new MoveAction>(this.nextGraph, this.requestQueue, Location.create(from));
}
/**
@@ -491,7 +491,7 @@
* be moved
*/
public Move> move( Property idProperty ) {
- return new MoveAction>(this.nextGraph, this.requestQueue, new Location(idProperty));
+ return new MoveAction>(this.nextGraph, this.requestQueue, Location.create(idProperty));
}
/**
@@ -510,7 +510,7 @@
*/
public Move> move( Property firstIdProperty,
Property... additionalIdProperties ) {
- return new MoveAction>(this.nextGraph, this.requestQueue, new Location(firstIdProperty,
+ return new MoveAction>(this.nextGraph, this.requestQueue, Location.create(firstIdProperty,
additionalIdProperties));
}
@@ -559,7 +559,7 @@
* be copied
*/
public Copy copy( String fromPath ) {
- return new CopyAction(this, this.requestQueue, new Location(createPath(fromPath)));
+ return new CopyAction(this, this.requestQueue, Location.create(createPath(fromPath)));
}
/**
@@ -575,7 +575,7 @@
* be copied
*/
public Copy copy( Path from ) {
- return new CopyAction(this, this.requestQueue, new Location(from));
+ return new CopyAction(this, this.requestQueue, Location.create(from));
}
/**
@@ -591,7 +591,7 @@
* be copied
*/
public Copy copy( UUID from ) {
- return new CopyAction(this, this.requestQueue, new Location(from));
+ return new CopyAction(this, this.requestQueue, Location.create(from));
}
/**
@@ -608,7 +608,7 @@
* be copied
*/
public Copy copy( Property idProperty ) {
- return new CopyAction(this, this.requestQueue, new Location(idProperty));
+ return new CopyAction(this, this.requestQueue, Location.create(idProperty));
}
/**
@@ -627,7 +627,7 @@
*/
public Copy copy( Property firstIdProperty,
Property... additionalIdProperties ) {
- return new CopyAction(this, this.requestQueue, new Location(firstIdProperty, additionalIdProperties));
+ return new CopyAction(this, this.requestQueue, Location.create(firstIdProperty, additionalIdProperties));
}
/**
@@ -659,7 +659,7 @@
* @return an object that may be used to start another request
*/
public Conjunction delete( String atPath ) {
- this.requestQueue.submit(new DeleteBranchRequest(new Location(createPath(atPath)), getCurrentWorkspaceName()));
+ this.requestQueue.submit(new DeleteBranchRequest(Location.create(createPath(atPath)), getCurrentWorkspaceName()));
return nextGraph;
}
@@ -670,7 +670,7 @@
* @return an object that may be used to start another request
*/
public Conjunction delete( Path at ) {
- this.requestQueue.submit(new DeleteBranchRequest(new Location(at), getCurrentWorkspaceName()));
+ this.requestQueue.submit(new DeleteBranchRequest(Location.create(at), getCurrentWorkspaceName()));
return nextGraph;
}
@@ -681,7 +681,7 @@
* @return an object that may be used to start another request
*/
public Conjunction delete( UUID at ) {
- this.requestQueue.submit(new DeleteBranchRequest(new Location(at), getCurrentWorkspaceName()));
+ this.requestQueue.submit(new DeleteBranchRequest(Location.create(at), getCurrentWorkspaceName()));
return nextGraph;
}
@@ -693,7 +693,7 @@
* @return an object that may be used to start another request
*/
public Conjunction delete( Property idProperty ) {
- this.requestQueue.submit(new DeleteBranchRequest(new Location(idProperty), getCurrentWorkspaceName()));
+ this.requestQueue.submit(new DeleteBranchRequest(Location.create(idProperty), getCurrentWorkspaceName()));
return nextGraph;
}
@@ -707,7 +707,7 @@
*/
public Conjunction delete( Property firstIdProperty,
Property... additionalIdProperties ) {
- this.requestQueue.submit(new DeleteBranchRequest(new Location(firstIdProperty, additionalIdProperties),
+ this.requestQueue.submit(new DeleteBranchRequest(Location.create(firstIdProperty, additionalIdProperties),
getCurrentWorkspaceName()));
return nextGraph;
}
@@ -727,7 +727,7 @@
Path at = createPath(atPath);
Path parent = at.getParent();
Name child = at.getLastSegment().getName();
- this.requestQueue.submit(new CreateNodeRequest(new Location(parent), getCurrentWorkspaceName(), child));
+ this.requestQueue.submit(new CreateNodeRequest(Location.create(parent), getCurrentWorkspaceName(), child));
return nextGraph;
}
@@ -748,7 +748,7 @@
Path at = createPath(atPath);
Path parent = at.getParent();
Name child = at.getLastSegment().getName();
- this.requestQueue.submit(new CreateNodeRequest(new Location(parent), getCurrentWorkspaceName(), child, properties));
+ this.requestQueue.submit(new CreateNodeRequest(Location.create(parent), getCurrentWorkspaceName(), child, properties));
return nextGraph;
}
@@ -767,7 +767,7 @@
CheckArg.isNotNull(at, "at");
Path parent = at.getParent();
Name child = at.getLastSegment().getName();
- this.requestQueue.submit(new CreateNodeRequest(new Location(parent), getCurrentWorkspaceName(), child));
+ this.requestQueue.submit(new CreateNodeRequest(Location.create(parent), getCurrentWorkspaceName(), child));
return nextGraph;
}
@@ -788,7 +788,7 @@
CheckArg.isNotNull(at, "at");
Path parent = at.getParent();
Name child = at.getLastSegment().getName();
- this.requestQueue.submit(new CreateNodeRequest(new Location(parent), getCurrentWorkspaceName(), child, properties));
+ this.requestQueue.submit(new CreateNodeRequest(Location.create(parent), getCurrentWorkspaceName(), child, properties));
return nextGraph;
}
@@ -809,7 +809,7 @@
CheckArg.isNotNull(at, "at");
Path parent = at.getParent();
Name child = at.getLastSegment().getName();
- this.requestQueue.submit(new CreateNodeRequest(new Location(parent), getCurrentWorkspaceName(), child, properties));
+ this.requestQueue.submit(new CreateNodeRequest(Location.create(parent), getCurrentWorkspaceName(), child, properties));
return nextGraph;
}
@@ -870,28 +870,28 @@
}
public Conjunction on( String path ) {
- return on(new Location(createPath(path)));
+ return on(Location.create(createPath(path)));
}
public Conjunction on( Path path ) {
- return on(new Location(path));
+ return on(Location.create(path));
}
public Conjunction on( Property idProperty ) {
- return on(new Location(idProperty));
+ return on(Location.create(idProperty));
}
public Conjunction on( Property firstIdProperty,
Property... additionalIdProperties ) {
- return on(new Location(firstIdProperty, additionalIdProperties));
+ return on(Location.create(firstIdProperty, additionalIdProperties));
}
public Conjunction on( Iterable idProperties ) {
- return on(new Location(idProperties));
+ return on(Location.create(idProperties));
}
public Conjunction on( UUID uuid ) {
- return on(new Location(uuid));
+ return on(Location.create(uuid));
}
};
}
@@ -1072,28 +1072,28 @@
}
public SetValuesTo> on( String path ) {
- return on(new Location(createPath(path)));
+ return on(Location.create(createPath(path)));
}
public SetValuesTo> on( Path path ) {
- return on(new Location(path));
+ return on(Location.create(path));
}
public SetValuesTo> on( Property idProperty ) {
- return on(new Location(idProperty));
+ return on(Location.create(idProperty));
}
public SetValuesTo> on( Property firstIdProperty,
Property... additionalIdProperties ) {
- return on(new Location(firstIdProperty, additionalIdProperties));
+ return on(Location.create(firstIdProperty, additionalIdProperties));
}
public SetValuesTo> on( Iterable idProperties ) {
- return on(new Location(idProperties));
+ return on(Location.create(idProperties));
}
public SetValuesTo> on( UUID uuid ) {
- return on(new Location(uuid));
+ return on(Location.create(uuid));
}
public On> to( Node node ) {
@@ -1240,28 +1240,28 @@
}
public Conjunction on( String path ) {
- return on(new Location(createPath(path)));
+ return on(Location.create(createPath(path)));
}
public Conjunction on( Path path ) {
- return on(new Location(path));
+ return on(Location.create(path));
}
public Conjunction on( Property idProperty ) {
- return on(new Location(idProperty));
+ return on(Location.create(idProperty));
}
public Conjunction on( Property firstIdProperty,
Property... additionalIdProperties ) {
- return on(new Location(firstIdProperty, additionalIdProperties));
+ return on(Location.create(firstIdProperty, additionalIdProperties));
}
public Conjunction on( Iterable idProperties ) {
- return on(new Location(idProperties));
+ return on(Location.create(idProperties));
}
public Conjunction on( UUID uuid ) {
- return on(new Location(uuid));
+ return on(Location.create(uuid));
}
};
}
@@ -1287,28 +1287,28 @@
}
public Conjunction on( String path ) {
- return on(new Location(createPath(path)));
+ return on(Location.create(createPath(path)));
}
public Conjunction on( Path path ) {
- return on(new Location(path));
+ return on(Location.create(path));
}
public Conjunction on( Property idProperty ) {
- return on(new Location(idProperty));
+ return on(Location.create(idProperty));
}
public Conjunction on( Property firstIdProperty,
Property... additionalIdProperties ) {
- return on(new Location(firstIdProperty, additionalIdProperties));
+ return on(Location.create(firstIdProperty, additionalIdProperties));
}
public Conjunction on( Iterable idProperties ) {
- return on(new Location(idProperties));
+ return on(Location.create(idProperties));
}
public Conjunction on( UUID uuid ) {
- return on(new Location(uuid));
+ return on(Location.create(uuid));
}
};
}
@@ -1328,28 +1328,28 @@
}
public Collection on( String path ) {
- return on(new Location(createPath(path)));
+ return on(Location.create(createPath(path)));
}
public Collection on( Path path ) {
- return on(new Location(path));
+ return on(Location.create(path));
}
public Collection on( Property idProperty ) {
- return on(new Location(idProperty));
+ return on(Location.create(idProperty));
}
public Collection on( Property firstIdProperty,
Property... additionalIdProperties ) {
- return on(new Location(firstIdProperty, additionalIdProperties));
+ return on(Location.create(firstIdProperty, additionalIdProperties));
}
public Collection on( Iterable idProperties ) {
- return on(new Location(idProperties));
+ return on(Location.create(idProperties));
}
public Collection on( UUID uuid ) {
- return on(new Location(uuid));
+ return on(Location.create(uuid));
}
};
}
@@ -1370,28 +1370,28 @@
}
public Map on( String path ) {
- return on(new Location(createPath(path)));
+ return on(Location.create(createPath(path)));
}
public Map on( Path path ) {
- return on(new Location(path));
+ return on(Location.create(path));
}
public Map on( Property idProperty ) {
- return on(new Location(idProperty));
+ return on(Location.create(idProperty));
}
public Map on( Property firstIdProperty,
Property... additionalIdProperties ) {
- return on(new Location(firstIdProperty, additionalIdProperties));
+ return on(Location.create(firstIdProperty, additionalIdProperties));
}
public Map on( Iterable idProperties ) {
- return on(new Location(idProperties));
+ return on(Location.create(idProperties));
}
public Map on( UUID uuid ) {
- return on(new Location(uuid));
+ return on(Location.create(uuid));
}
};
}
@@ -1406,28 +1406,28 @@
public Children> getChildren() {
return new Children>() {
public List of( String path ) {
- return of(new Location(createPath(path)));
+ return of(Location.create(createPath(path)));
}
public List of( Path path ) {
- return of(new Location(path));
+ return of(Location.create(path));
}
public List of( Property idProperty ) {
- return of(new Location(idProperty));
+ return of(Location.create(idProperty));
}
public List of( Property firstIdProperty,
Property... additionalIdProperties ) {
- return of(new Location(firstIdProperty, additionalIdProperties));
+ return of(Location.create(firstIdProperty, additionalIdProperties));
}
public List of( Iterable idProperties ) {
- return of(new Location(idProperties));
+ return of(Location.create(idProperties));
}
public List of( UUID uuid ) {
- return of(new Location(uuid));
+ return of(Location.create(uuid));
}
public List of( Location at ) {
@@ -1441,24 +1441,24 @@
public Under> startingAt( final int startingIndex ) {
return new Under>() {
public List under( String path ) {
- return under(new Location(createPath(path)));
+ return under(Location.create(createPath(path)));
}
public List under( Path path ) {
- return under(new Location(path));
+ return under(Location.create(path));
}
public List under( Property idProperty ) {
- return under(new Location(idProperty));
+ return under(Location.create(idProperty));
}
public List under( Property firstIdProperty,
Property... additionalIdProperties ) {
- return under(new Location(firstIdProperty, additionalIdProperties));
+ return under(Location.create(firstIdProperty, additionalIdProperties));
}
public List under( UUID uuid ) {
- return under(new Location(uuid));
+ return under(Location.create(uuid));
}
public List under( Location at ) {
@@ -1480,24 +1480,24 @@
}
public List startingAfter( String pathOfPreviousSibling ) {
- return startingAfter(new Location(createPath(pathOfPreviousSibling)));
+ return startingAfter(Location.create(createPath(pathOfPreviousSibling)));
}
public List startingAfter( Path pathOfPreviousSibling ) {
- return startingAfter(new Location(pathOfPreviousSibling));
+ return startingAfter(Location.create(pathOfPreviousSibling));
}
public List startingAfter( UUID uuidOfPreviousSibling ) {
- return startingAfter(new Location(uuidOfPreviousSibling));
+ return startingAfter(Location.create(uuidOfPreviousSibling));
}
public List startingAfter( Property idPropertyOfPreviousSibling ) {
- return startingAfter(new Location(idPropertyOfPreviousSibling));
+ return startingAfter(Location.create(idPropertyOfPreviousSibling));
}
public List startingAfter( Property firstIdProperyOfPreviousSibling,
Property... additionalIdPropertiesOfPreviousSibling ) {
- return startingAfter(new Location(firstIdProperyOfPreviousSibling,
+ return startingAfter(Location.create(firstIdProperyOfPreviousSibling,
additionalIdPropertiesOfPreviousSibling));
}
};
@@ -1527,28 +1527,28 @@
public On getProperty( final Name name ) {
return new On() {
public Property on( String path ) {
- return on(new Location(createPath(path)));
+ return on(Location.create(createPath(path)));
}
public Property on( Path path ) {
- return on(new Location(path));
+ return on(Location.create(path));
}
public Property on( Property idProperty ) {
- return on(new Location(idProperty));
+ return on(Location.create(idProperty));
}
public Property on( Property firstIdProperty,
Property... additionalIdProperties ) {
- return on(new Location(firstIdProperty, additionalIdProperties));
+ return on(Location.create(firstIdProperty, additionalIdProperties));
}
public Property on( Iterable idProperties ) {
- return on(new Location(idProperties));
+ return on(Location.create(idProperties));
}
public Property on( UUID uuid ) {
- return on(new Location(uuid));
+ return on(Location.create(uuid));
}
public Property on( Location at ) {
@@ -1566,7 +1566,7 @@
* @return the node that is read from the repository
*/
public Node getNodeAt( UUID uuid ) {
- return getNodeAt(new Location(uuid));
+ return getNodeAt(Location.create(uuid));
}
/**
@@ -1588,7 +1588,7 @@
* @return the node that is read from the repository
*/
public Node getNodeAt( String path ) {
- return getNodeAt(new Location(createPath(path)));
+ return getNodeAt(Location.create(createPath(path)));
}
/**
@@ -1598,7 +1598,7 @@
* @return the node that is read from the repository
*/
public Node getNodeAt( Path path ) {
- return getNodeAt(new Location(path));
+ return getNodeAt(Location.create(path));
}
/**
@@ -1608,7 +1608,7 @@
* @return the node that is read from the repository
*/
public Node getNodeAt( Property idProperty ) {
- return getNodeAt(new Location(idProperty));
+ return getNodeAt(Location.create(idProperty));
}
/**
@@ -1620,7 +1620,7 @@
*/
public Node getNodeAt( Property firstIdProperty,
Property... additionalIdProperties ) {
- return getNodeAt(new Location(firstIdProperty, additionalIdProperties));
+ return getNodeAt(Location.create(firstIdProperty, additionalIdProperties));
}
/**
@@ -1630,7 +1630,7 @@
* @return the node that is read from the repository
*/
public Node getNodeAt( Iterable idProperties ) {
- return getNodeAt(new Location(idProperties));
+ return getNodeAt(Location.create(idProperties));
}
/**
@@ -1664,28 +1664,28 @@
}
public Subgraph at( String path ) {
- return at(new Location(createPath(path)));
+ return at(Location.create(createPath(path)));
}
public Subgraph at( Path path ) {
- return at(new Location(path));
+ return at(Location.create(path));
}
public Subgraph at( UUID uuid ) {
- return at(new Location(uuid));
+ return at(Location.create(uuid));
}
public Subgraph at( Property idProperty ) {
- return at(new Location(idProperty));
+ return at(Location.create(idProperty));
}
public Subgraph at( Property firstIdProperty,
Property... additionalIdProperties ) {
- return at(new Location(firstIdProperty, additionalIdProperties));
+ return at(Location.create(firstIdProperty, additionalIdProperties));
}
public Subgraph at( Iterable idProperties ) {
- return at(new Location(idProperties));
+ return at(Location.create(idProperties));
}
};
}
@@ -1708,28 +1708,28 @@
}
public Conjunction into( String path ) throws IOException, SAXException {
- return into(new Location(createPath(path)));
+ return into(Location.create(createPath(path)));
}
public Conjunction into( Path path ) throws IOException, SAXException {
- return into(new Location(path));
+ return into(Location.create(path));
}
public Conjunction into( Property idProperty ) throws IOException, SAXException {
- return into(new Location(idProperty));
+ return into(Location.create(idProperty));
}
public Conjunction into( Property firstIdProperty,
Property... additionalIdProperties ) throws IOException, SAXException {
- return into(new Location(firstIdProperty, additionalIdProperties));
+ return into(Location.create(firstIdProperty, additionalIdProperties));
}
public Conjunction into( Iterable idProperties ) throws IOException, SAXException {
- return into(new Location(idProperties));
+ return into(Location.create(idProperties));
}
public Conjunction into( UUID uuid ) throws IOException, SAXException {
- return into(new Location(uuid));
+ return into(Location.create(uuid));
}
@SuppressWarnings( "synthetic-access" )
@@ -1892,7 +1892,7 @@
*/
public Move move( String fromPath ) {
assertNotExecuted();
- return new MoveAction(this.nextRequests, this.requestQueue, new Location(createPath(fromPath)));
+ return new MoveAction(this.nextRequests, this.requestQueue, Location.create(createPath(fromPath)));
}
/**
@@ -1909,7 +1909,7 @@
*/
public Move move( Path from ) {
assertNotExecuted();
- return new MoveAction(this.nextRequests, this.requestQueue, new Location(from));
+ return new MoveAction(this.nextRequests, this.requestQueue, Location.create(from));
}
/**
@@ -1926,7 +1926,7 @@
*/
public Move move( UUID from ) {
assertNotExecuted();
- return new MoveAction(this.nextRequests, this.requestQueue, new Location(from));
+ return new MoveAction(this.nextRequests, this.requestQueue, Location.create(from));
}
/**
@@ -1944,7 +1944,7 @@
*/
public Move move( Property idProperty ) {
assertNotExecuted();
- return new MoveAction(this.nextRequests, this.requestQueue, new Location(idProperty));
+ return new MoveAction(this.nextRequests, this.requestQueue, Location.create(idProperty));
}
/**
@@ -1964,7 +1964,7 @@
public Move move( Property firstIdProperty,
Property... additionalIdProperties ) {
assertNotExecuted();
- return new MoveAction(this.nextRequests, this.requestQueue, new Location(firstIdProperty,
+ return new MoveAction(this.nextRequests, this.requestQueue, Location.create(firstIdProperty,
additionalIdProperties));
}
@@ -1983,7 +1983,7 @@
*/
public Move move( Iterable idProperties ) {
assertNotExecuted();
- return new MoveAction(this.nextRequests, this.requestQueue, new Location(idProperties));
+ return new MoveAction(this.nextRequests, this.requestQueue, Location.create(idProperties));
}
/**
@@ -2034,7 +2034,7 @@
*/
public Copy copy( String fromPath ) {
assertNotExecuted();
- return new CopyAction(nextRequests, this.requestQueue, new Location(createPath(fromPath)));
+ return new CopyAction(nextRequests, this.requestQueue, Location.create(createPath(fromPath)));
}
/**
@@ -2051,7 +2051,7 @@
*/
public Copy copy( Path from ) {
assertNotExecuted();
- return new CopyAction(nextRequests, this.requestQueue, new Location(from));
+ return new CopyAction(nextRequests, this.requestQueue, Location.create(from));
}
/**
@@ -2068,7 +2068,7 @@
*/
public Copy copy( UUID from ) {
assertNotExecuted();
- return new CopyAction(nextRequests, this.requestQueue, new Location(from));
+ return new CopyAction(nextRequests, this.requestQueue, Location.create(from));
}
/**
@@ -2086,7 +2086,7 @@
*/
public Copy copy( Property idProperty ) {
assertNotExecuted();
- return new CopyAction(nextRequests, this.requestQueue, new Location(idProperty));
+ return new CopyAction(nextRequests, this.requestQueue, Location.create(idProperty));
}
/**
@@ -2106,7 +2106,7 @@
public Copy copy( Property firstIdProperty,
Property... additionalIdProperties ) {
assertNotExecuted();
- return new CopyAction(nextRequests, this.requestQueue, new Location(firstIdProperty,
+ return new CopyAction(nextRequests, this.requestQueue, Location.create(firstIdProperty,
additionalIdProperties));
}
@@ -2125,7 +2125,7 @@
*/
public Copy copy( Iterable idProperties ) {
assertNotExecuted();
- return new CopyAction(nextRequests, this.requestQueue, new Location(idProperties));
+ return new CopyAction(nextRequests, this.requestQueue, Location.create(idProperties));
}
/**
@@ -2172,7 +2172,7 @@
*/
public BatchConjunction delete( String atPath ) {
assertNotExecuted();
- this.requestQueue.submit(new DeleteBranchRequest(new Location(createPath(atPath)), getCurrentWorkspaceName()));
+ this.requestQueue.submit(new DeleteBranchRequest(Location.create(createPath(atPath)), getCurrentWorkspaceName()));
return nextRequests;
}
@@ -2188,7 +2188,7 @@
*/
public BatchConjunction delete( Path at ) {
assertNotExecuted();
- this.requestQueue.submit(new DeleteBranchRequest(new Location(at), getCurrentWorkspaceName()));
+ this.requestQueue.submit(new DeleteBranchRequest(Location.create(at), getCurrentWorkspaceName()));
return nextRequests;
}
@@ -2204,7 +2204,7 @@
*/
public BatchConjunction delete( UUID at ) {
assertNotExecuted();
- this.requestQueue.submit(new DeleteBranchRequest(new Location(at), getCurrentWorkspaceName()));
+ this.requestQueue.submit(new DeleteBranchRequest(Location.create(at), getCurrentWorkspaceName()));
return nextRequests;
}
@@ -2220,7 +2220,7 @@
*/
public BatchConjunction delete( Property idProperty ) {
assertNotExecuted();
- this.requestQueue.submit(new DeleteBranchRequest(new Location(idProperty), getCurrentWorkspaceName()));
+ this.requestQueue.submit(new DeleteBranchRequest(Location.create(idProperty), getCurrentWorkspaceName()));
return nextRequests;
}
@@ -2239,7 +2239,7 @@
public BatchConjunction delete( Property firstIdProperty,
Property... additionalIdProperties ) {
assertNotExecuted();
- this.requestQueue.submit(new DeleteBranchRequest(new Location(firstIdProperty, additionalIdProperties),
+ this.requestQueue.submit(new DeleteBranchRequest(Location.create(firstIdProperty, additionalIdProperties),
getCurrentWorkspaceName()));
return nextRequests;
}
@@ -2257,7 +2257,7 @@
*/
public BatchConjunction delete( Iterable idProperties ) {
assertNotExecuted();
- this.requestQueue.submit(new DeleteBranchRequest(new Location(idProperties), getCurrentWorkspaceName()));
+ this.requestQueue.submit(new DeleteBranchRequest(Location.create(idProperties), getCurrentWorkspaceName()));
return nextRequests;
}
@@ -2277,7 +2277,7 @@
Path at = createPath(atPath);
Path parent = at.getParent();
Name name = at.getLastSegment().getName();
- return new CreateAction(this, requestQueue, new Location(parent), getCurrentWorkspaceName(), name);
+ return new CreateAction(this, requestQueue, Location.create(parent), getCurrentWorkspaceName(), name);
}
/**
@@ -2298,7 +2298,7 @@
Path at = createPath(atPath);
Path parent = at.getParent();
Name name = at.getLastSegment().getName();
- return new CreateAction(this, requestQueue, new Location(parent), getCurrentWorkspaceName(), name).with(property);
+ return new CreateAction(this, requestQueue, Location.create(parent), getCurrentWorkspaceName(), name).with(property);
}
/**
@@ -2321,7 +2321,7 @@
Path at = createPath(atPath);
Path parent = at.getParent();
Name name = at.getLastSegment().getName();
- return new CreateAction(this, requestQueue, new Location(parent), getCurrentWorkspaceName(), name).with(firstProperty,
+ return new CreateAction(this, requestQueue, Location.create(parent), getCurrentWorkspaceName(), name).with(firstProperty,
additionalProperties);
}
@@ -2341,7 +2341,7 @@
CheckArg.isNotNull(at, "at");
Path parent = at.getParent();
Name name = at.getLastSegment().getName();
- return new CreateAction(this, requestQueue, new Location(parent), getCurrentWorkspaceName(), name);
+ return new CreateAction(this, requestQueue, Location.create(parent), getCurrentWorkspaceName(), name);
}
/**
@@ -2362,7 +2362,7 @@
CheckArg.isNotNull(at, "at");
Path parent = at.getParent();
Name name = at.getLastSegment().getName();
- CreateAction action = new CreateAction(this, requestQueue, new Location(parent),
+ CreateAction action = new CreateAction(this, requestQueue, Location.create(parent),
getCurrentWorkspaceName(), name);
for (Property property : properties) {
action.and(property);
@@ -2388,7 +2388,7 @@
CheckArg.isNotNull(at, "at");
Path parent = at.getParent();
Name name = at.getLastSegment().getName();
- return new CreateAction(this, requestQueue, new Location(parent), getCurrentWorkspaceName(), name).with(property);
+ return new CreateAction(this, requestQueue, Location.create(parent), getCurrentWorkspaceName(), name).with(property);
}
/**
@@ -2411,7 +2411,7 @@
CheckArg.isNotNull(at, "at");
Path parent = at.getParent();
Name name = at.getLastSegment().getName();
- return new CreateAction(this, requestQueue, new Location(parent), getCurrentWorkspaceName(), name).with(firstProperty,
+ return new CreateAction(this, requestQueue, Location.create(parent), getCurrentWorkspaceName(), name).with(firstProperty,
additionalProperties);
}
@@ -2442,28 +2442,28 @@
}
public BatchConjunction on( String path ) {
- return on(new Location(createPath(path)));
+ return on(Location.create(createPath(path)));
}
public BatchConjunction on( Path path ) {
- return on(new Location(path));
+ return on(Location.create(path));
}
public BatchConjunction on( Property idProperty ) {
- return on(new Location(idProperty));
+ return on(Location.create(idProperty));
}
public BatchConjunction on( Property firstIdProperty,
Property... additionalIdProperties ) {
- return on(new Location(firstIdProperty, additionalIdProperties));
+ return on(Location.create(firstIdProperty, additionalIdProperties));
}
public BatchConjunction on( Iterable idProperties ) {
- return on(new Location(idProperties));
+ return on(Location.create(idProperties));
}
public BatchConjunction on( UUID uuid ) {
- return on(new Location(uuid));
+ return on(Location.create(uuid));
}
};
}
@@ -2644,28 +2644,28 @@
}
public SetValuesTo on( String path ) {
- return on(new Location(createPath(path)));
+ return on(Location.create(createPath(path)));
}
public SetValuesTo on( Path path ) {
- return on(new Location(path));
+ return on(Location.create(path));
}
public SetValuesTo on( Property idProperty ) {
- return on(new Location(idProperty));
+ return on(Location.create(idProperty));
}
public SetValuesTo on( Property firstIdProperty,
Property... additionalIdProperties ) {
- return on(new Location(firstIdProperty, additionalIdProperties));
+ return on(Location.create(firstIdProperty, additionalIdProperties));
}
public SetValuesTo on( Iterable idProperties ) {
- return on(new Location(idProperties));
+ return on(Location.create(idProperties));
}
public SetValuesTo on( UUID uuid ) {
- return on(new Location(uuid));
+ return on(Location.create(uuid));
}
public On to( Node value ) {
@@ -2812,28 +2812,28 @@
}
public BatchConjunction on( String path ) {
- return on(new Location(createPath(path)));
+ return on(Location.create(createPath(path)));
}
public BatchConjunction on( Path path ) {
- return on(new Location(path));
+ return on(Location.create(path));
}
public BatchConjunction on( Property idProperty ) {
- return on(new Location(idProperty));
+ return on(Location.create(idProperty));
}
public BatchConjunction on( Property firstIdProperty,
Property... additionalIdProperties ) {
- return on(new Location(firstIdProperty, additionalIdProperties));
+ return on(Location.create(firstIdProperty, additionalIdProperties));
}
public BatchConjunction on( Iterable idProperties ) {
- return on(new Location(idProperties));
+ return on(Location.create(idProperties));
}
public BatchConjunction on( UUID uuid ) {
- return on(new Location(uuid));
+ return on(Location.create(uuid));
}
};
}
@@ -2858,28 +2858,28 @@
}
public BatchConjunction on( String path ) {
- return on(new Location(createPath(path)));
+ return on(Location.create(createPath(path)));
}
public BatchConjunction on( Path path ) {
- return on(new Location(path));
+ return on(Location.create(path));
}
public BatchConjunction on( Property idProperty ) {
- return on(new Location(idProperty));
+ return on(Location.create(idProperty));
}
public BatchConjunction on( Property firstIdProperty,
Property... additionalIdProperties ) {
- return on(new Location(firstIdProperty, additionalIdProperties));
+ return on(Location.create(firstIdProperty, additionalIdProperties));
}
public BatchConjunction on( Iterable idProperties ) {
- return on(new Location(idProperties));
+ return on(Location.create(idProperties));
}
public BatchConjunction on( UUID uuid ) {
- return on(new Location(uuid));
+ return on(Location.create(uuid));
}
};
}
@@ -2895,7 +2895,7 @@
* @return the interface that can either execute the batched requests or continue to add additional requests to the batch
*/
public BatchConjunction read( UUID uuid ) {
- return read(new Location(uuid));
+ return read(Location.create(uuid));
}
/**
@@ -2926,7 +2926,7 @@
* @return the interface that can either execute the batched requests or continue to add additional requests to the batch
*/
public BatchConjunction read( String path ) {
- return read(new Location(createPath(path)));
+ return read(Location.create(createPath(path)));
}
/**
@@ -2940,7 +2940,7 @@
* @return the interface that can either execute the batched requests or continue to add additional requests to the batch
*/
public BatchConjunction read( Path path ) {
- return read(new Location(path));
+ return read(Location.create(path));
}
/**
@@ -2954,7 +2954,7 @@
* @return the interface that can either execute the batched requests or continue to add additional requests to the batch
*/
public BatchConjunction read( Property idProperty ) {
- return read(new Location(idProperty));
+ return read(Location.create(idProperty));
}
/**
@@ -2971,7 +2971,7 @@
*/
public BatchConjunction read( Property firstIdProperty,
Property... additionalIdProperties ) {
- return read(new Location(firstIdProperty, additionalIdProperties));
+ return read(Location.create(firstIdProperty, additionalIdProperties));
}
/**
@@ -2985,7 +2985,7 @@
* @return the interface that can either execute the batched requests or continue to add additional requests to the batch
*/
public BatchConjunction read( Iterable idProperties ) {
- return read(new Location(idProperties));
+ return read(Location.create(idProperties));
}
/**
@@ -3020,28 +3020,28 @@
assertNotExecuted();
return new On() {
public BatchConjunction on( String path ) {
- return on(new Location(createPath(path)));
+ return on(Location.create(createPath(path)));
}
public BatchConjunction on( Path path ) {
- return on(new Location(path));
+ return on(Location.create(path));
}
public BatchConjunction on( Property idProperty ) {
- return on(new Location(idProperty));
+ return on(Location.create(idProperty));
}
public BatchConjunction on( Property firstIdProperty,
Property... additionalIdProperties ) {
- return on(new Location(firstIdProperty, additionalIdProperties));
+ return on(Location.create(firstIdProperty, additionalIdProperties));
}
public BatchConjunction on( Iterable idProperties ) {
- return on(new Location(idProperties));
+ return on(Location.create(idProperties));
}
public BatchConjunction on( UUID uuid ) {
- return on(new Location(uuid));
+ return on(Location.create(uuid));
}
public BatchConjunction on( Location at ) {
@@ -3072,28 +3072,28 @@
}
public BatchConjunction on( String path ) {
- return on(new Location(createPath(path)));
+ return on(Location.create(createPath(path)));
}
public BatchConjunction on( Path path ) {
- return on(new Location(path));
+ return on(Location.create(path));
}
public BatchConjunction on( Property idProperty ) {
- return on(new Location(idProperty));
+ return on(Location.create(idProperty));
}
public BatchConjunction on( Property firstIdProperty,
Property... additionalIdProperties ) {
- return on(new Location(firstIdProperty, additionalIdProperties));
+ return on(Location.create(firstIdProperty, additionalIdProperties));
}
public BatchConjunction on( Iterable idProperties ) {
- return on(new Location(idProperties));
+ return on(Location.create(idProperties));
}
public BatchConjunction on( UUID uuid ) {
- return on(new Location(uuid));
+ return on(Location.create(uuid));
}
};
}
@@ -3112,28 +3112,28 @@
assertNotExecuted();
return new Of() {
public BatchConjunction of( String path ) {
- return of(new Location(createPath(path)));
+ return of(Location.create(createPath(path)));
}
public BatchConjunction of( Path path ) {
- return of(new Location(path));
+ return of(Location.create(path));
}
public BatchConjunction of( Property idProperty ) {
- return of(new Location(idProperty));
+ return of(Location.create(idProperty));
}
public BatchConjunction of( Property firstIdProperty,
Property... additionalIdProperties ) {
- return of(new Location(firstIdProperty, additionalIdProperties));
+ return of(Location.create(firstIdProperty, additionalIdProperties));
}
public BatchConjunction of( Iterable idProperties ) {
- return of(new Location(idProperties));
+ return of(Location.create(idProperties));
}
public BatchConjunction of( UUID uuid ) {
- return of(new Location(uuid));
+ return of(Location.create(uuid));
}
public BatchConjunction of( Location at ) {
@@ -3165,28 +3165,28 @@
}
public BatchConjunction at( String path ) {
- return at(new Location(createPath(path)));
+ return at(Location.create(createPath(path)));
}
public BatchConjunction at( Path path ) {
- return at(new Location(path));
+ return at(Location.create(path));
}
public BatchConjunction at( UUID uuid ) {
- return at(new Location(uuid));
+ return at(Location.create(uuid));
}
public BatchConjunction at( Property idProperty ) {
- return at(new Location(idProperty));
+ return at(Location.create(idProperty));
}
public BatchConjunction at( Property firstIdProperty,
Property... additionalIdProperties ) {
- return at(new Location(firstIdProperty, additionalIdProperties));
+ return at(Location.create(firstIdProperty, additionalIdProperties));
}
public BatchConjunction at( Iterable idProperties ) {
- return at(new Location(idProperties));
+ return at(Location.create(idProperties));
}
};
}
@@ -3384,7 +3384,7 @@
*/
public interface To {
/**
- * Finish the request by specifying the new location where the node should be copied/moved. Unlike
+ * Finish the request by specifying the Location.create where the node should be copied/moved. Unlike
* {@link Into#into(Location)}, which specifies the location of the parent and which assumes the new node should have the
* same name as the original, this method allows the caller to specify a new name for the new node.
*
@@ -3395,7 +3395,7 @@
Next to( Location desiredLocation );
/**
- * Finish the request by specifying the new location where the node should be copied/moved. Unlike
+ * Finish the request by specifying the Location.create where the node should be copied/moved. Unlike
* {@link Into#into(String)}, which specifies the location of the parent and which assumes the new node should have the
* same name as the original, this method allows the caller to specify a new name for the new node.
*
@@ -3406,7 +3406,7 @@
Next to( String desiredPath );
/**
- * Finish the request by specifying the new location where the node should be copied/moved. Unlike {@link Into#into(Path)}
+ * Finish the request by specifying the Location.create where the node should be copied/moved. Unlike {@link Into#into(Path)}
* , which specifies the location of the parent and which assumes the new node should have the same name as the original,
* this method allows the caller to specify a new name for the new node.
*
@@ -4284,7 +4284,7 @@
ImportInto skippingRootElement( boolean skip );
/**
- * Finish the import by specifying the new location into which the node should be copied/moved.
+ * Finish the import by specifying the Location.create into which the node should be copied/moved.
*
* @param to the location of the new parent
* @return the interface for additional requests or actions
@@ -4294,7 +4294,7 @@
Next into( Location to ) throws IOException, SAXException;
/**
- * Finish the import by specifying the new location into which the node should be copied/moved.
+ * Finish the import by specifying the Location.create into which the node should be copied/moved.
*
* @param toPath the path of the new parent
* @return the interface for additional requests or actions
@@ -4304,7 +4304,7 @@
Next into( String toPath ) throws IOException, SAXException;
/**
- * Finish the import by specifying the new location into which the node should be copied/moved.
+ * Finish the import by specifying the Location.create into which the node should be copied/moved.
*
* @param to the path of the new parent
* @return the interface for additional requests or actions
@@ -4314,7 +4314,7 @@
Next into( Path to ) throws IOException, SAXException;
/**
- * Finish the import by specifying the new location into which the node should be copied/moved.
+ * Finish the import by specifying the Location.create into which the node should be copied/moved.
*
* @param to the UUID of the new parent
* @return the interface for additional requests or actions
@@ -4324,7 +4324,7 @@
Next into( UUID to ) throws IOException, SAXException;
/**
- * Finish the import by specifying the new location into which the node should be copied/moved.
+ * Finish the import by specifying the Location.create into which the node should be copied/moved.
*
* @param idProperty the property that uniquely identifies the new parent
* @return the interface for additional requests or actions
@@ -4334,7 +4334,7 @@
Next into( Property idProperty ) throws IOException, SAXException;
/**
- * Finish the import by specifying the new location into which the node should be copied/moved.
+ * Finish the import by specifying the Location.create into which the node should be copied/moved.
*
* @param firstIdProperty the first property that, with the additionalIdProperties
, uniquely identifies the
* new parent
@@ -4348,7 +4348,7 @@
Property... additionalIdProperties ) throws IOException, SAXException;
/**
- * Finish the import by specifying the new location into which the node should be copied/moved.
+ * Finish the import by specifying the Location.create into which the node should be copied/moved.
*
* @param idProperties the properties that uniquely identifies the new parent
* @return the interface for additional requests or actions
@@ -4985,33 +4985,33 @@
}
public Move and( String from ) {
- this.from.add(new Location(createPath(from)));
+ this.from.add(Location.create(createPath(from)));
return this;
}
public Move and( Path from ) {
- this.from.add(new Location(from));
+ this.from.add(Location.create(from));
return this;
}
public Move and( Property firstFrom,
Property... additionalFroms ) {
- this.from.add(new Location(firstFrom, additionalFroms));
+ this.from.add(Location.create(firstFrom, additionalFroms));
return this;
}
public Move and( Iterable idPropertiesFrom ) {
- this.from.add(new Location(idPropertiesFrom));
+ this.from.add(Location.create(idPropertiesFrom));
return this;
}
public Move and( Property from ) {
- this.from.add(new Location(from));
+ this.from.add(Location.create(from));
return this;
}
public Move and( UUID from ) {
- this.from.add(new Location(from));
+ this.from.add(Location.create(from));
return this;
}
@@ -5043,24 +5043,24 @@
}
public T into( Path into ) {
- return submit(new Location(into));
+ return submit(Location.create(into));
}
public T into( UUID into ) {
- return submit(new Location(into));
+ return submit(Location.create(into));
}
public T into( Property firstIdProperty,
Property... additionalIdProperties ) {
- return submit(new Location(firstIdProperty, additionalIdProperties));
+ return submit(Location.create(firstIdProperty, additionalIdProperties));
}
public T into( Property into ) {
- return submit(new Location(into));
+ return submit(Location.create(into));
}
public T into( String into ) {
- return submit(new Location(createPath(into)));
+ return submit(Location.create(createPath(into)));
}
@Override
@@ -5086,33 +5086,33 @@
}
public Copy and( String from ) {
- this.from.add(new Location(createPath(from)));
+ this.from.add(Location.create(createPath(from)));
return this;
}
public Copy and( Path from ) {
- this.from.add(new Location(from));
+ this.from.add(Location.create(from));
return this;
}
public Copy and( Property firstFrom,
Property... additionalFroms ) {
- this.from.add(new Location(firstFrom, additionalFroms));
+ this.from.add(Location.create(firstFrom, additionalFroms));
return this;
}
public Copy and( Iterable idProperties ) {
- this.from.add(new Location(idProperties));
+ this.from.add(Location.create(idProperties));
return this;
}
public Copy and( Property from ) {
- this.from.add(new Location(from));
+ this.from.add(Location.create(from));
return this;
}
public Copy and( UUID from ) {
- this.from.add(new Location(from));
+ this.from.add(Location.create(from));
return this;
}
@@ -5146,24 +5146,24 @@
}
public T into( Path into ) {
- return submit(new Location(into), null);
+ return submit(Location.create(into), null);
}
public T into( UUID into ) {
- return submit(new Location(into), null);
+ return submit(Location.create(into), null);
}
public T into( Property firstIdProperty,
Property... additionalIdProperties ) {
- return submit(new Location(firstIdProperty, additionalIdProperties), null);
+ return submit(Location.create(firstIdProperty, additionalIdProperties), null);
}
public T into( Property into ) {
- return submit(new Location(into), null);
+ return submit(Location.create(into), null);
}
public T into( String into ) {
- return submit(new Location(createPath(into)), null);
+ return submit(Location.create(createPath(into)), null);
}
public T to( Location desiredLocation ) {
@@ -5175,7 +5175,7 @@
throw new IllegalArgumentException(GraphI18n.unableToCopyToTheRoot.text(this.from, desiredLocation));
}
Path parent = desiredPath.getParent();
- return submit(new Location(parent), desiredPath.getLastSegment().getName());
+ return submit(Location.create(parent), desiredPath.getLastSegment().getName());
}
public T to( Path desiredPath ) {
@@ -5183,7 +5183,7 @@
throw new IllegalArgumentException(GraphI18n.unableToCopyToTheRoot.text(this.from, desiredPath));
}
Path parent = desiredPath.getParent();
- return submit(new Location(parent), desiredPath.getLastSegment().getName());
+ return submit(Location.create(parent), desiredPath.getLastSegment().getName());
}
public T to( String desiredPath ) {
Index: src/main/java/org/jboss/dna/graph/connector/inmemory/InMemoryRequestProcessor.java
===================================================================
--- src/main/java/org/jboss/dna/graph/connector/inmemory/InMemoryRequestProcessor.java (revision 729)
+++ src/main/java/org/jboss/dna/graph/connector/inmemory/InMemoryRequestProcessor.java (working copy)
@@ -130,7 +130,7 @@
copyMap);
Path newPath = getExecutionContext().getValueFactories().getPathFactory().create(newParentPath, newNode.getName());
Location oldLocation = getActualLocation(request.from().getPath(), node);
- Location newLocation = new Location(newPath, newNode.getUuid());
+ Location newLocation = Location.create(newPath, newNode.getUuid());
request.setActualLocations(oldLocation, newLocation);
}
@@ -198,7 +198,7 @@
node.setParent(newParent);
newPath = getExecutionContext().getValueFactories().getPathFactory().create(newParentPath, node.getName());
Location oldLocation = getActualLocation(request.from().getPath(), node);
- Location newLocation = new Location(newPath, node.getUuid());
+ Location newLocation = Location.create(newPath, node.getUuid());
request.setActualLocations(oldLocation, newLocation);
}
@@ -238,7 +238,7 @@
request.setError(new InvalidWorkspaceException(msg));
} else {
InMemoryNode root = workspace.getRoot();
- request.setActualRootLocation(new Location(pathFactory.createRootPath(), root.getUuid()));
+ request.setActualRootLocation(Location.create(pathFactory.createRootPath(), root.getUuid()));
request.setActualWorkspaceName(workspace.getName());
}
}
@@ -278,7 +278,7 @@
InMemoryRepository.Workspace original = getWorkspace(request, request.workspaceName());
if (original != null) {
Path path = getExecutionContext().getValueFactories().getPathFactory().createRootPath();
- request.setActualRootLocation(new Location(path, original.getRoot().getUuid()));
+ request.setActualRootLocation(Location.create(path, original.getRoot().getUuid()));
request.setActualWorkspaceName(original.getName());
}
}
@@ -310,7 +310,7 @@
request.setError(new InvalidWorkspaceException(msg));
} else {
InMemoryNode root = target.getRoot();
- request.setActualRootLocation(new Location(pathFactory.createRootPath(), root.getUuid()));
+ request.setActualRootLocation(Location.create(pathFactory.createRootPath(), root.getUuid()));
request.setActualWorkspaceName(target.getName());
}
return;
@@ -328,7 +328,7 @@
request.setError(new InvalidWorkspaceException(msg));
} else {
InMemoryNode root = target.getRoot();
- request.setActualRootLocation(new Location(pathFactory.createRootPath(), root.getUuid()));
+ request.setActualRootLocation(Location.create(pathFactory.createRootPath(), root.getUuid()));
request.setActualWorkspaceName(target.getName());
}
}
@@ -346,7 +346,7 @@
}
path = pathFactory.createAbsolutePath(segments);
}
- return new Location(path, node.getUuid());
+ return Location.create(path, node.getUuid());
}
protected InMemoryRepository.Workspace getWorkspace( Request request,
Index: src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java
===================================================================
--- src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java (revision 729)
+++ src/main/java/org/jboss/dna/graph/request/processor/RequestProcessor.java (working copy)
@@ -433,7 +433,7 @@
assert parentPath != null;
// Convert the request to a ReadAllChildrenRequest and execute it ...
- ReadAllChildrenRequest readAll = new ReadAllChildrenRequest(new Location(parentPath), request.inWorkspace());
+ ReadAllChildrenRequest readAll = new ReadAllChildrenRequest(Location.create(parentPath), request.inWorkspace());
process(readAll);
if (readAll.hasError()) {
request.setError(readAll.getError());
@@ -649,7 +649,7 @@
* This method does nothing if the request is null. Unless overridden, this method converts the rename into a
* {@link MoveBranchRequest move}. However, this only works if the request
has a {@link Location#hasPath() path}
* for its {@link RenameNodeRequest#at() location}. (If not, this method throws an {@link UnsupportedOperationException} and
- * must be overriddent.)
+ * must be overridden.)
*
*
* @param request the rename request
@@ -661,7 +661,7 @@
throw new UnsupportedOperationException();
}
Path newPath = getExecutionContext().getValueFactories().getPathFactory().create(from.getPath(), request.toName());
- Location to = new Location(newPath);
+ Location to = Location.create(newPath);
MoveBranchRequest move = new MoveBranchRequest(from, to, request.inWorkspace());
process(move);
// Set the actual locations ...
Index: src/test/java/org/jboss/dna/graph/xml/XmlHandlerTest.java
===================================================================
--- src/test/java/org/jboss/dna/graph/xml/XmlHandlerTest.java (revision 729)
+++ src/test/java/org/jboss/dna/graph/xml/XmlHandlerTest.java (working copy)
@@ -441,7 +441,7 @@
assert path != null;
Path parent = path.getParent();
Name child = path.getLastSegment().getName();
- requests.add(new CreateNodeRequest(new Location(parent), workspace, child, properties));
+ requests.add(new CreateNodeRequest(Location.create(parent), workspace, child, properties));
}
public void create( final Path path,
@@ -449,7 +449,7 @@
final Property... additionalProperties ) {
Path parent = path.getParent();
Name child = path.getLastSegment().getName();
- Location location = new Location(parent);
+ Location location = Location.create(parent);
if (firstProperty == null) {
requests.add(new CreateNodeRequest(location, workspace, child));
} else {
Index: src/main/java/org/jboss/dna/graph/request/ReadAllChildrenRequest.java
===================================================================
--- src/main/java/org/jboss/dna/graph/request/ReadAllChildrenRequest.java (revision 729)
+++ src/main/java/org/jboss/dna/graph/request/ReadAllChildrenRequest.java (working copy)
@@ -137,7 +137,7 @@
public void addChild( Path pathToChild,
Property firstIdProperty,
Property... remainingIdProperties ) {
- Location child = new Location(pathToChild, firstIdProperty, remainingIdProperties);
+ Location child = Location.create(pathToChild, firstIdProperty, remainingIdProperties);
this.children.add(child);
}
@@ -153,7 +153,7 @@
*/
public void addChild( Path pathToChild,
Property idProperty ) {
- Location child = new Location(pathToChild, idProperty);
+ Location child = Location.create(pathToChild, idProperty);
this.children.add(child);
}
Index: src/test/java/org/jboss/dna/graph/connector/RepositorySourceLoadHarness.java
===================================================================
--- src/test/java/org/jboss/dna/graph/connector/RepositorySourceLoadHarness.java (revision 729)
+++ src/test/java/org/jboss/dna/graph/connector/RepositorySourceLoadHarness.java (working copy)
@@ -217,7 +217,7 @@
if (i % 2 == 0) {
Thread.yield();
}
- connection.execute(context, new ReadNodeRequest(new Location(RootPath.INSTANCE), "workspace1"));
+ connection.execute(context, new ReadNodeRequest(Location.create(RootPath.INSTANCE), "workspace1"));
int int2 = random(this.hashCode() ^ (int)System.nanoTime() + i);
total += Math.min(Math.abs(Math.max(int1, int2) + int1 * int2 / 3), count);
}
Index: src/main/java/org/jboss/dna/graph/request/ReadBlockOfChildrenRequest.java
===================================================================
--- src/main/java/org/jboss/dna/graph/request/ReadBlockOfChildrenRequest.java (revision 729)
+++ src/main/java/org/jboss/dna/graph/request/ReadBlockOfChildrenRequest.java (working copy)
@@ -184,7 +184,7 @@
public void addChild( Path pathToChild,
Property firstIdProperty,
Property... remainingIdProperties ) {
- Location child = new Location(pathToChild, firstIdProperty, remainingIdProperties);
+ Location child = Location.create(pathToChild, firstIdProperty, remainingIdProperties);
this.children.add(child);
}
@@ -200,7 +200,7 @@
*/
public void addChild( Path pathToChild,
Property idProperty ) {
- Location child = new Location(pathToChild, idProperty);
+ Location child = Location.create(pathToChild, idProperty);
this.children.add(child);
}
Index: src/main/java/org/jboss/dna/graph/Location.java
===================================================================
--- src/main/java/org/jboss/dna/graph/Location.java (revision 729)
+++ src/main/java/org/jboss/dna/graph/Location.java (working copy)
@@ -64,29 +64,34 @@
private final Path path;
private final List idProperties;
+
/**
* Create a location defined by a path.
*
* @param path the path
+ * @return a new Location
with the given path and no identification properties
* @throws IllegalArgumentException if path
is null
*/
- public Location( Path path ) {
+ public static Location create( Path path ) {
CheckArg.isNotNull(path, "path");
- this.path = path;
- this.idProperties = null;
+
+ return new Location(path, null);
}
/**
* Create a location defined by a UUID.
*
* @param uuid the UUID
+ * @return a new Location
with no path and a single identification property
+ * with the name {@link DnaLexicon#UUID} and the given uuid
for a value.
* @throws IllegalArgumentException if uuid
is null
*/
- public Location( UUID uuid ) {
+ public static Location create( UUID uuid ) {
CheckArg.isNotNull(uuid, "uuid");
- this.path = null;
+
Property idProperty = new BasicSingleValueProperty(DnaLexicon.UUID, uuid);
- this.idProperties = Collections.singletonList(idProperty);
+
+ return new Location(null, Collections.singletonList(idProperty));
}
/**
@@ -94,18 +99,22 @@
*
* @param path the path
* @param uuid the UUID, or null if there is no UUID
+ * @return a new Location
with the given path (if any) and a single identification property
+ * with the name {@link DnaLexicon#UUID} and the given uuid
(if it is present) for a value.
* @throws IllegalArgumentException if path
is null
*/
- public Location( Path path,
+ public static Location create( Path path,
UUID uuid ) {
CheckArg.isNotNull(uuid, "uuid");
- this.path = path;
+
+ List idProperties = null;
+
if (uuid != null) {
Property idProperty = new BasicSingleValueProperty(DnaLexicon.UUID, uuid);
- this.idProperties = Collections.singletonList(idProperty);
- } else {
- this.idProperties = null;
+ idProperties = Collections.singletonList(idProperty);
}
+
+ return new Location(path, idProperties);
}
/**
@@ -113,14 +122,16 @@
*
* @param path the path
* @param idProperty the identification property
+ * @return a new Location
with the given path and identification property
+ * (if it is present).
* @throws IllegalArgumentException if path
or idProperty
is null
*/
- public Location( Path path,
+ public static Location create( Path path,
Property idProperty ) {
CheckArg.isNotNull(path, "path");
CheckArg.isNotNull(idProperty, "idProperty");
- this.path = path;
- this.idProperties = idProperty != null ? Collections.singletonList(idProperty) : null;
+
+ return new Location(path, idProperty != null ? Collections.singletonList(idProperty) : null);
}
/**
@@ -129,21 +140,23 @@
* @param path the path
* @param firstIdProperty the first identification property
* @param remainingIdProperties the remaining identification property
+ * @return a new Location
with the given path and identification properties.
* @throws IllegalArgumentException if any of the arguments are null
*/
- public Location( Path path,
+ public static Location create( Path path,
Property firstIdProperty,
Property... remainingIdProperties ) {
CheckArg.isNotNull(path, "path");
CheckArg.isNotNull(firstIdProperty, "firstIdProperty");
CheckArg.isNotNull(remainingIdProperties, "remainingIdProperties");
- this.path = path;
+
List idProperties = new ArrayList(1 + remainingIdProperties.length);
idProperties.add(firstIdProperty);
for (Property property : remainingIdProperties) {
idProperties.add(property);
}
- this.idProperties = Collections.unmodifiableList(idProperties);
+
+ return new Location(path, Collections.unmodifiableList(idProperties));
}
/**
@@ -151,30 +164,32 @@
*
* @param path the path
* @param idProperties the iterator over the identification properties
+ * @return a new Location
with the given path and identification properties
* @throws IllegalArgumentException if any of the arguments are null
*/
- public Location( Path path,
+ public static Location create( Path path,
Iterable idProperties ) {
CheckArg.isNotNull(path, "path");
CheckArg.isNotNull(idProperties, "idProperties");
- this.path = path;
+
List idPropertiesList = new ArrayList();
for (Property property : idProperties) {
idPropertiesList.add(property);
}
- this.idProperties = Collections.unmodifiableList(idPropertiesList);
+ return new Location(path, Collections.unmodifiableList(idPropertiesList));
}
/**
* Create a location defined by a single identification property.
*
* @param idProperty the identification property
+ * @return a new Location
with no path and the given identification property.
* @throws IllegalArgumentException if idProperty
is null
*/
- public Location( Property idProperty ) {
+ public static Location create( Property idProperty ) {
CheckArg.isNotNull(idProperty, "idProperty");
- this.path = null;
- this.idProperties = Collections.singletonList(idProperty);
+
+ return new Location(null, Collections.singletonList(idProperty));
}
/**
@@ -182,47 +197,50 @@
*
* @param firstIdProperty the first identification property
* @param remainingIdProperties the remaining identification property
+ * @return a new Location
with no path and the given and identification properties.
* @throws IllegalArgumentException if any of the arguments are null
*/
- public Location( Property firstIdProperty,
+ public static Location create( Property firstIdProperty,
Property... remainingIdProperties ) {
CheckArg.isNotNull(firstIdProperty, "firstIdProperty");
CheckArg.isNotNull(remainingIdProperties, "remainingIdProperties");
- this.path = null;
+
List idProperties = new ArrayList(1 + remainingIdProperties.length);
idProperties.add(firstIdProperty);
for (Property property : remainingIdProperties) {
idProperties.add(property);
}
- this.idProperties = Collections.unmodifiableList(idProperties);
+ return new Location(null, Collections.unmodifiableList(idProperties));
}
/**
* Create a location defined by a path and an iterator over identification properties.
*
* @param idProperties the iterator over the identification properties
+ * @return a new Location
with no path and the given identification properties.
* @throws IllegalArgumentException if any of the arguments are null
*/
- public Location( Iterable idProperties ) {
+ public static Location create( Iterable idProperties ) {
CheckArg.isNotNull(idProperties, "idProperties");
- this.path = null;
+
List idPropertiesList = new ArrayList();
for (Property property : idProperties) {
idPropertiesList.add(property);
}
- this.idProperties = Collections.unmodifiableList(idPropertiesList);
+ return new Location(null, Collections.unmodifiableList(idPropertiesList));
}
/**
* Create a location defined by multiple identification properties.
*
* @param idProperties the identification properties
+ * @return a new Location
with no path and the given identification properties.
* @throws IllegalArgumentException if idProperties
is null or empty
*/
- public Location( List idProperties ) {
+ public static Location create( List idProperties ) {
CheckArg.isNotEmpty(idProperties, "idProperties");
- this.path = null;
- this.idProperties = idProperties;
+
+ return new Location(null, idProperties);
}
/**
@@ -230,17 +248,31 @@
*
* @param path the path
* @param idProperties the identification properties
+ * @return a new Location
with the given path and identification properties
* @throws IllegalArgumentException if path
is null, or if idProperties
is empty
*/
- protected Location( Path path,
+ protected static Location create( Path path,
List idProperties ) {
CheckArg.isNotNull(path, "path");
CheckArg.isNotEmpty(idProperties, "idProperties");
- this.path = path;
- this.idProperties = idProperties;
+
+ return new Location(path, idProperties);
}
/**
+ * Create a new location with a given path and set of identification properties.
+ *
+ * @param path the path
+ * @param idProperties the identification properties
+ */
+ protected Location( Path path,
+ List idProperties ) {
+
+ this.path = path;
+ this.idProperties = idProperties;
+ }
+
+ /**
* Create a location from another but adding the supplied identification property. The new identification property will
* replace any existing identification property with the same name on the original.
*
Index: src/main/java/org/jboss/dna/graph/request/ReadNextBlockOfChildrenRequest.java
===================================================================
--- src/main/java/org/jboss/dna/graph/request/ReadNextBlockOfChildrenRequest.java (revision 729)
+++ src/main/java/org/jboss/dna/graph/request/ReadNextBlockOfChildrenRequest.java (working copy)
@@ -152,7 +152,7 @@
public void addChild( Path pathToChild,
Property firstIdProperty,
Property... remainingIdProperties ) {
- Location child = new Location(pathToChild, firstIdProperty, remainingIdProperties);
+ Location child = Location.create(pathToChild, firstIdProperty, remainingIdProperties);
this.children.add(child);
}
@@ -168,7 +168,7 @@
*/
public void addChild( Path pathToChild,
Property idProperty ) {
- Location child = new Location(pathToChild, idProperty);
+ Location child = Location.create(pathToChild, idProperty);
this.children.add(child);
}
Index: src/test/java/org/jboss/dna/graph/GraphImporterTest.java
===================================================================
--- src/test/java/org/jboss/dna/graph/GraphImporterTest.java (revision 729)
+++ src/test/java/org/jboss/dna/graph/GraphImporterTest.java (working copy)
@@ -88,7 +88,7 @@
@Test
public void shouldImportXmlContentAndGenerateTheCorrectCommands() throws Exception {
System.out.println(xmlContent);
- Graph.Batch batch = importer.importXml(xmlContent, new Location(destinationPath));
+ Graph.Batch batch = importer.importXml(xmlContent, Location.create(destinationPath));
batch.execute();
// 'lastExecutedCommand'
assertThat(lastExecutedRequest, is(instanceOf(CompositeRequest.class)));
@@ -156,7 +156,7 @@
lastExecutedRequest = request;
if (request instanceof VerifyWorkspaceRequest) {
VerifyWorkspaceRequest workspaceRequest = (VerifyWorkspaceRequest)request;
- workspaceRequest.setActualRootLocation(new Location(context.getValueFactories().getPathFactory().createRootPath()));
+ workspaceRequest.setActualRootLocation(Location.create(context.getValueFactories().getPathFactory().createRootPath()));
workspaceRequest.setActualWorkspaceName("default");
}
}
Index: src/test/java/org/jboss/dna/graph/request/AbstractRequestTest.java
===================================================================
--- src/test/java/org/jboss/dna/graph/request/AbstractRequestTest.java (revision 729)
+++ src/test/java/org/jboss/dna/graph/request/AbstractRequestTest.java (working copy)
@@ -65,21 +65,21 @@
Name idProperty2Name = createName("id2");
Property idProperty1 = context.getPropertyFactory().create(idProperty1Name, "1");
Property idProperty2 = context.getPropertyFactory().create(idProperty2Name, "2");
- validPathLocation = new Location(validPath);
- validUuidLocation = new Location(validUuid);
- validPropsLocation = new Location(idProperty1, idProperty2);
+ validPathLocation = Location.create(validPath);
+ validUuidLocation = Location.create(validUuid);
+ validPropsLocation = Location.create(idProperty1, idProperty2);
- validPathLocation1 = new Location(validPath);
- validUuidLocation1 = new Location(validUuid);
- validPropsLocation1 = new Location(idProperty1, idProperty2);
+ validPathLocation1 = Location.create(validPath);
+ validUuidLocation1 = Location.create(validUuid);
+ validPropsLocation1 = Location.create(idProperty1, idProperty2);
validPath = createPath("/a/c/d");
validUuid = UUID.randomUUID();
idProperty1 = context.getPropertyFactory().create(idProperty1Name, "3");
idProperty2 = context.getPropertyFactory().create(idProperty2Name, "4");
- validPathLocation2 = new Location(validPath);
- validUuidLocation2 = new Location(validUuid);
- validPropsLocation2 = new Location(idProperty1, idProperty2);
+ validPathLocation2 = Location.create(validPath);
+ validUuidLocation2 = Location.create(validUuid);
+ validPropsLocation2 = Location.create(idProperty1, idProperty2);
validProperty1 = context.getPropertyFactory().create(createName("fooProperty"), "foo");
validProperty2 = context.getPropertyFactory().create(createName("barProperty"), "bar");
Index: src/test/java/org/jboss/dna/graph/connector/test/AbstractConnectorTest.java
===================================================================
--- src/test/java/org/jboss/dna/graph/connector/test/AbstractConnectorTest.java (revision 729)
+++ src/test/java/org/jboss/dna/graph/connector/test/AbstractConnectorTest.java (working copy)
@@ -278,7 +278,7 @@
* @return the location
*/
protected Location location( String path ) {
- return new Location(path(path));
+ return Location.create(path(path));
}
/**
@@ -288,7 +288,7 @@
* @return the location
*/
protected Location location( UUID uuid ) {
- return new Location(uuid);
+ return Location.create(uuid);
}
protected UUID getRootNodeUuid() {
Index: src/test/java/org/jboss/dna/graph/GraphTest.java
===================================================================
--- src/test/java/org/jboss/dna/graph/GraphTest.java (revision 729)
+++ src/test/java/org/jboss/dna/graph/GraphTest.java (working copy)
@@ -123,7 +123,7 @@
Name idProperty2Name = createName("id2");
validIdProperty1 = context.getPropertyFactory().create(idProperty1Name, "1");
validIdProperty2 = context.getPropertyFactory().create(idProperty2Name, "2");
- validLocation = new Location(validPath);
+ validLocation = Location.create(validPath);
properties = new HashMap>();
children = new HashMap>();
@@ -330,17 +330,17 @@
public void shouldMoveNode() {
graph.move(validPath).into(validIdProperty1, validIdProperty2);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsMove(new Location(validPath), new Location(validIdProperty1, validIdProperty2));
+ assertNextRequestIsMove(Location.create(validPath), Location.create(validIdProperty1, validIdProperty2));
assertNoMoreRequests();
graph.move(validPathString).into(validIdProperty1, validIdProperty2);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsMove(new Location(validPath), new Location(validIdProperty1, validIdProperty2));
+ assertNextRequestIsMove(Location.create(validPath), Location.create(validIdProperty1, validIdProperty2));
assertNoMoreRequests();
graph.move(validUuid).into(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsMove(new Location(validUuid), new Location(validPath));
+ assertNextRequestIsMove(Location.create(validUuid), Location.create(validPath));
assertNoMoreRequests();
}
@@ -348,17 +348,17 @@
public void shouldCopyNode() {
graph.copy(validPath).into(validIdProperty1, validIdProperty2);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsCopy(new Location(validPath), new Location(validIdProperty1, validIdProperty2));
+ assertNextRequestIsCopy(Location.create(validPath), Location.create(validIdProperty1, validIdProperty2));
assertNoMoreRequests();
graph.copy(validPathString).into(validIdProperty1, validIdProperty2);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsCopy(new Location(validPath), new Location(validIdProperty1, validIdProperty2));
+ assertNextRequestIsCopy(Location.create(validPath), Location.create(validIdProperty1, validIdProperty2));
assertNoMoreRequests();
graph.copy(validUuid).into(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsCopy(new Location(validUuid), new Location(validPath));
+ assertNextRequestIsCopy(Location.create(validUuid), Location.create(validPath));
assertNoMoreRequests();
}
@@ -366,27 +366,27 @@
public void shouldDeleteNode() {
graph.delete(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsDelete(new Location(validPath));
+ assertNextRequestIsDelete(Location.create(validPath));
assertNoMoreRequests();
graph.delete(validPathString);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsDelete(new Location(validPath));
+ assertNextRequestIsDelete(Location.create(validPath));
assertNoMoreRequests();
graph.delete(validUuid);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsDelete(new Location(validUuid));
+ assertNextRequestIsDelete(Location.create(validUuid));
assertNoMoreRequests();
graph.delete(validIdProperty1);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsDelete(new Location(validIdProperty1));
+ assertNextRequestIsDelete(Location.create(validIdProperty1));
assertNoMoreRequests();
graph.delete(validIdProperty1, validIdProperty2);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsDelete(new Location(validIdProperty1, validIdProperty2));
+ assertNextRequestIsDelete(Location.create(validIdProperty1, validIdProperty2));
assertNoMoreRequests();
}
@@ -394,32 +394,32 @@
public void shouldCreateNode() {
graph.create(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsCreate(new Location(validPath.getParent()), "c");
+ assertNextRequestIsCreate(Location.create(validPath.getParent()), "c");
assertNoMoreRequests();
graph.create(validPath, validIdProperty1);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsCreate(new Location(validPath.getParent()), "c", validIdProperty1);
+ assertNextRequestIsCreate(Location.create(validPath.getParent()), "c", validIdProperty1);
assertNoMoreRequests();
graph.create(validPath, validIdProperty1, validIdProperty2);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsCreate(new Location(validPath.getParent()), "c", validIdProperty1, validIdProperty2);
+ assertNextRequestIsCreate(Location.create(validPath.getParent()), "c", validIdProperty1, validIdProperty2);
assertNoMoreRequests();
graph.create(validPathString);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsCreate(new Location(validPath.getParent()), "c");
+ assertNextRequestIsCreate(Location.create(validPath.getParent()), "c");
assertNoMoreRequests();
graph.create(validPathString, validIdProperty1);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsCreate(new Location(validPath.getParent()), "c", validIdProperty1);
+ assertNextRequestIsCreate(Location.create(validPath.getParent()), "c", validIdProperty1);
assertNoMoreRequests();
graph.create(validPathString, validIdProperty1, validIdProperty2);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsCreate(new Location(validPath.getParent()), "c", validIdProperty1, validIdProperty2);
+ assertNextRequestIsCreate(Location.create(validPath.getParent()), "c", validIdProperty1, validIdProperty2);
assertNoMoreRequests();
}
@@ -432,107 +432,107 @@
@Test
public void shouldGetPropertiesOnNode() {
- setPropertiesToReadOn(new Location(validPath), validIdProperty1, validIdProperty2);
+ setPropertiesToReadOn(Location.create(validPath), validIdProperty1, validIdProperty2);
Collection props = graph.getProperties().on(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadProperties(new Location(validPath), validIdProperty1, validIdProperty2);
+ assertNextRequestReadProperties(Location.create(validPath), validIdProperty1, validIdProperty2);
assertNoMoreRequests();
assertThat(props, hasItems(validIdProperty1, validIdProperty2));
- setPropertiesToReadOn(new Location(validPath));
+ setPropertiesToReadOn(Location.create(validPath));
props = graph.getProperties().on(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadProperties(new Location(validPath));
+ assertNextRequestReadProperties(Location.create(validPath));
assertNoMoreRequests();
assertThat(props.size(), is(0));
}
@Test
public void shouldGetPropertiesByNameOnNode() {
- setPropertiesToReadOn(new Location(validPath), validIdProperty1, validIdProperty2);
+ setPropertiesToReadOn(Location.create(validPath), validIdProperty1, validIdProperty2);
Map propsByName = graph.getPropertiesByName().on(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadProperties(new Location(validPath), validIdProperty1, validIdProperty2);
+ assertNextRequestReadProperties(Location.create(validPath), validIdProperty1, validIdProperty2);
assertNoMoreRequests();
assertThat(propsByName.get(validIdProperty1.getName()), is(validIdProperty1));
assertThat(propsByName.get(validIdProperty2.getName()), is(validIdProperty2));
- setPropertiesToReadOn(new Location(validPath));
+ setPropertiesToReadOn(Location.create(validPath));
propsByName = graph.getPropertiesByName().on(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadProperties(new Location(validPath));
+ assertNextRequestReadProperties(Location.create(validPath));
assertNoMoreRequests();
assertThat(propsByName.isEmpty(), is(true));
}
@Test
public void shouldGetPropertyOnNode() {
- setPropertiesToReadOn(new Location(validPath), validIdProperty1, validIdProperty2);
+ setPropertiesToReadOn(Location.create(validPath), validIdProperty1, validIdProperty2);
graph.getProperty(validIdProperty2.getName()).on(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadProperty(new Location(validPath), validIdProperty2);
+ assertNextRequestReadProperty(Location.create(validPath), validIdProperty2);
assertNoMoreRequests();
- setPropertiesToReadOn(new Location(validPath), validIdProperty1, validIdProperty2);
+ setPropertiesToReadOn(Location.create(validPath), validIdProperty1, validIdProperty2);
graph.getProperty(validIdProperty2.getName().getString(context.getNamespaceRegistry())).on(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadProperty(new Location(validPath), validIdProperty2);
+ assertNextRequestReadProperty(Location.create(validPath), validIdProperty2);
assertNoMoreRequests();
}
@Test
public void shouldGetChildrenOnNode() {
- Location child1 = new Location(createPath(validPath, "x"));
- Location child2 = new Location(createPath(validPath, "y"));
- Location child3 = new Location(createPath(validPath, "z"));
- setChildrenToReadOn(new Location(validPath), child1, child2, child3);
+ Location child1 = Location.create(createPath(validPath, "x"));
+ Location child2 = Location.create(createPath(validPath, "y"));
+ Location child3 = Location.create(createPath(validPath, "z"));
+ setChildrenToReadOn(Location.create(validPath), child1, child2, child3);
List children = graph.getChildren().of(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadChildren(new Location(validPath), child1, child2, child3);
+ assertNextRequestReadChildren(Location.create(validPath), child1, child2, child3);
assertNoMoreRequests();
assertThat(children, hasItems(child1, child2, child3));
- setChildrenToReadOn(new Location(validPath));
+ setChildrenToReadOn(Location.create(validPath));
children = graph.getChildren().of(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadChildren(new Location(validPath));
+ assertNextRequestReadChildren(Location.create(validPath));
assertNoMoreRequests();
assertThat(children.isEmpty(), is(true));
}
@Test
public void shouldGetChildrenInBlockAtStartingIndex() {
- Location child1 = new Location(createPath(validPath, "x"));
- Location child2 = new Location(createPath(validPath, "y"));
- Location child3 = new Location(createPath(validPath, "z"));
- setChildrenToReadOn(new Location(validPath), child1, child2, child3);
+ Location child1 = Location.create(createPath(validPath, "x"));
+ Location child2 = Location.create(createPath(validPath, "y"));
+ Location child3 = Location.create(createPath(validPath, "z"));
+ setChildrenToReadOn(Location.create(validPath), child1, child2, child3);
List children = graph.getChildren().inBlockOf(2).startingAt(0).under(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadBlockOfChildren(new Location(validPath), 0, 2, child1, child2);
+ assertNextRequestReadBlockOfChildren(Location.create(validPath), 0, 2, child1, child2);
assertNoMoreRequests();
assertThat(children, hasItems(child1, child2));
children = graph.getChildren().inBlockOf(2).startingAt(1).under(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadBlockOfChildren(new Location(validPath), 1, 2, child2, child3);
+ assertNextRequestReadBlockOfChildren(Location.create(validPath), 1, 2, child2, child3);
assertNoMoreRequests();
assertThat(children, hasItems(child2, child3));
children = graph.getChildren().inBlockOf(2).startingAt(2).under(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadBlockOfChildren(new Location(validPath), 2, 2, child3);
+ assertNextRequestReadBlockOfChildren(Location.create(validPath), 2, 2, child3);
assertNoMoreRequests();
assertThat(children, hasItems(child3));
children = graph.getChildren().inBlockOf(2).startingAt(20).under(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadBlockOfChildren(new Location(validPath), 20, 2);
+ assertNextRequestReadBlockOfChildren(Location.create(validPath), 20, 2);
assertNoMoreRequests();
assertThat(children.isEmpty(), is(true));
children = graph.getChildren().inBlockOf(20).startingAt(0).under(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadBlockOfChildren(new Location(validPath), 0, 20, child1, child2, child3);
+ assertNextRequestReadBlockOfChildren(Location.create(validPath), 0, 20, child1, child2, child3);
assertNoMoreRequests();
assertThat(children, hasItems(child1, child2, child3));
}
@@ -542,26 +542,26 @@
Path pathX = createPath(validPath, "x");
Path pathY = createPath(validPath, "y");
Path pathZ = createPath(validPath, "z");
- Location child1 = new Location(pathX);
- Location child2 = new Location(pathY);
- Location child3 = new Location(pathZ);
- setChildrenToReadOn(new Location(validPath), child1, child2, child3);
+ Location child1 = Location.create(pathX);
+ Location child2 = Location.create(pathY);
+ Location child3 = Location.create(pathZ);
+ setChildrenToReadOn(Location.create(validPath), child1, child2, child3);
List children = graph.getChildren().inBlockOf(2).startingAfter(pathX);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadNextBlockOfChildren(new Location(pathX), 2, child2, child3);
+ assertNextRequestReadNextBlockOfChildren(Location.create(pathX), 2, child2, child3);
assertNoMoreRequests();
assertThat(children, hasItems(child2, child3));
children = graph.getChildren().inBlockOf(3).startingAfter(pathX);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadNextBlockOfChildren(new Location(pathX), 3, child2, child3);
+ assertNextRequestReadNextBlockOfChildren(Location.create(pathX), 3, child2, child3);
assertNoMoreRequests();
assertThat(children, hasItems(child2, child3));
children = graph.getChildren().inBlockOf(2).startingAfter(pathY);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadNextBlockOfChildren(new Location(pathY), 2, child3);
+ assertNextRequestReadNextBlockOfChildren(Location.create(pathY), 2, child3);
assertNoMoreRequests();
assertThat(children, hasItems(child3));
}
@@ -569,86 +569,86 @@
@Test
public void shouldSetPropertiesWithEitherOnOrToMethodsCalledFirst() {
graph.set("propName").on(validPath).to(3.0f);
- assertNextRequestUpdateProperties(new Location(validPath), createProperty("propName", 3.0f));
+ assertNextRequestUpdateProperties(Location.create(validPath), createProperty("propName", 3.0f));
graph.set("propName").to(3.0f).on(validPath);
- assertNextRequestUpdateProperties(new Location(validPath), createProperty("propName", 3.0f));
+ assertNextRequestUpdateProperties(Location.create(validPath), createProperty("propName", 3.0f));
}
@Test
public void shouldSetPropertyValueToPrimitiveTypes() {
graph.set("propName").on(validPath).to(3.0F);
- assertNextRequestUpdateProperties(new Location(validPath), createProperty("propName", new Float(3.0f)));
+ assertNextRequestUpdateProperties(Location.create(validPath), createProperty("propName", new Float(3.0f)));
graph.set("propName").on(validPath).to(1.0D);
- assertNextRequestUpdateProperties(new Location(validPath), createProperty("propName", new Double(1.0)));
+ assertNextRequestUpdateProperties(Location.create(validPath), createProperty("propName", new Double(1.0)));
graph.set("propName").on(validPath).to(false);
- assertNextRequestUpdateProperties(new Location(validPath), createProperty("propName", Boolean.FALSE));
+ assertNextRequestUpdateProperties(Location.create(validPath), createProperty("propName", Boolean.FALSE));
graph.set("propName").on(validPath).to(3);
- assertNextRequestUpdateProperties(new Location(validPath), createProperty("propName", new Integer(3)));
+ assertNextRequestUpdateProperties(Location.create(validPath), createProperty("propName", new Integer(3)));
graph.set("propName").on(validPath).to(5L);
- assertNextRequestUpdateProperties(new Location(validPath), createProperty("propName", new Long(5)));
+ assertNextRequestUpdateProperties(Location.create(validPath), createProperty("propName", new Long(5)));
graph.set("propName").on(validPath).to(validPath);
- assertNextRequestUpdateProperties(new Location(validPath), createProperty("propName", validPath));
+ assertNextRequestUpdateProperties(Location.create(validPath), createProperty("propName", validPath));
graph.set("propName").on(validPath).to(validPath.getLastSegment().getName());
- assertNextRequestUpdateProperties(new Location(validPath), createProperty("propName",
+ assertNextRequestUpdateProperties(Location.create(validPath), createProperty("propName",
validPath.getLastSegment().getName()));
Date now = new Date();
graph.set("propName").on(validPath).to(now);
- assertNextRequestUpdateProperties(new Location(validPath), createProperty("propName", now));
+ assertNextRequestUpdateProperties(Location.create(validPath), createProperty("propName", now));
DateTime dtNow = context.getValueFactories().getDateFactory().create(now);
graph.set("propName").on(validPath).to(dtNow);
- assertNextRequestUpdateProperties(new Location(validPath), createProperty("propName", dtNow));
+ assertNextRequestUpdateProperties(Location.create(validPath), createProperty("propName", dtNow));
Calendar calNow = Calendar.getInstance();
calNow.setTime(now);
graph.set("propName").on(validPath).to(calNow);
- assertNextRequestUpdateProperties(new Location(validPath), createProperty("propName", dtNow));
+ assertNextRequestUpdateProperties(Location.create(validPath), createProperty("propName", dtNow));
}
@Test
public void shouldReadNode() {
- Location child1 = new Location(createPath(validPath, "x"));
- Location child2 = new Location(createPath(validPath, "y"));
- Location child3 = new Location(createPath(validPath, "z"));
- setChildrenToReadOn(new Location(validPath), child1, child2, child3);
- setPropertiesToReadOn(new Location(validPath), validIdProperty1, validIdProperty2);
+ Location child1 = Location.create(createPath(validPath, "x"));
+ Location child2 = Location.create(createPath(validPath, "y"));
+ Location child3 = Location.create(createPath(validPath, "z"));
+ setChildrenToReadOn(Location.create(validPath), child1, child2, child3);
+ setPropertiesToReadOn(Location.create(validPath), validIdProperty1, validIdProperty2);
Node node = graph.getNodeAt(validPath);
assertThat(node, is(notNullValue()));
assertThat(node.getChildren(), hasItems(child1, child2));
assertThat(node.getProperties(), hasItems(validIdProperty1, validIdProperty2));
- assertThat(node.getLocation(), is(new Location(validPath)));
+ assertThat(node.getLocation(), is(Location.create(validPath)));
assertThat(node.getGraph(), is(sameInstance(graph)));
assertThat(node.getPropertiesByName().get(validIdProperty1.getName()), is(validIdProperty1));
assertThat(node.getPropertiesByName().get(validIdProperty2.getName()), is(validIdProperty2));
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadNode(new Location(validPath));
+ assertNextRequestReadNode(Location.create(validPath));
assertNoMoreRequests();
}
@Test
public void shouldReadSubgraph() {
- Location child1 = new Location(createPath(validPath, "x"));
- Location child2 = new Location(createPath(validPath, "y"));
- Location child3 = new Location(createPath(validPath, "z"));
- setChildrenToReadOn(new Location(validPath), child1, child2, child3);
- Location child11 = new Location(createPath(child1.getPath(), "h"));
- Location child12 = new Location(createPath(child1.getPath(), "i"));
- Location child13 = new Location(createPath(child1.getPath(), "j"));
+ Location child1 = Location.create(createPath(validPath, "x"));
+ Location child2 = Location.create(createPath(validPath, "y"));
+ Location child3 = Location.create(createPath(validPath, "z"));
+ setChildrenToReadOn(Location.create(validPath), child1, child2, child3);
+ Location child11 = Location.create(createPath(child1.getPath(), "h"));
+ Location child12 = Location.create(createPath(child1.getPath(), "i"));
+ Location child13 = Location.create(createPath(child1.getPath(), "j"));
setChildrenToReadOn(child1, child11, child12, child13);
- Location child121 = new Location(createPath(child12.getPath(), "m"));
- Location child122 = new Location(createPath(child12.getPath(), "n"));
- Location child123 = new Location(createPath(child12.getPath(), "o"));
+ Location child121 = Location.create(createPath(child12.getPath(), "m"));
+ Location child122 = Location.create(createPath(child12.getPath(), "n"));
+ Location child123 = Location.create(createPath(child12.getPath(), "o"));
setChildrenToReadOn(child12, child121, child122, child123);
- setPropertiesToReadOn(new Location(validPath), validIdProperty1, validIdProperty2);
+ setPropertiesToReadOn(Location.create(validPath), validIdProperty1, validIdProperty2);
setPropertiesToReadOn(child1, validIdProperty1);
setPropertiesToReadOn(child2, validIdProperty2);
setPropertiesToReadOn(child11, validIdProperty1);
@@ -659,10 +659,10 @@
Subgraph subgraph = graph.getSubgraphOfDepth(2).at(validPath);
assertThat(subgraph, is(notNullValue()));
assertThat(subgraph.getMaximumDepth(), is(2));
- assertThat(subgraph.getLocation(), is(new Location(validPath)));
+ assertThat(subgraph.getLocation(), is(Location.create(validPath)));
// Get nodes by absolute path
- Node root = subgraph.getNode(new Location(validPath));
+ Node root = subgraph.getNode(Location.create(validPath));
assertThat(root.getChildren(), hasItems(child1, child2, child3));
assertThat(root.getProperties(), hasItems(validIdProperty1, validIdProperty2));
@@ -707,26 +707,26 @@
public void shouldMoveNodeInBatches() {
graph.batch().move(validPath).into(validIdProperty1, validIdProperty2).execute();
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsMove(new Location(validPath), new Location(validIdProperty1, validIdProperty2));
+ assertNextRequestIsMove(Location.create(validPath), Location.create(validIdProperty1, validIdProperty2));
assertNoMoreRequests();
graph.batch().move(validPathString).into(validIdProperty1, validIdProperty2).execute();
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsMove(new Location(validPath), new Location(validIdProperty1, validIdProperty2));
+ assertNextRequestIsMove(Location.create(validPath), Location.create(validIdProperty1, validIdProperty2));
assertNoMoreRequests();
graph.batch().move(validUuid).into(validPath).execute();
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsMove(new Location(validUuid), new Location(validPath));
+ assertNextRequestIsMove(Location.create(validUuid), Location.create(validPath));
assertNoMoreRequests();
graph.batch().move(validPath).into(validIdProperty1, validIdProperty2).and().move(validPathString).into(validIdProperty1,
validIdProperty2).and().move(validUuid).into(validPath).execute();
assertThat(numberOfExecutions, is(1));
extractRequestsFromComposite();
- assertNextRequestIsMove(new Location(validPath), new Location(validIdProperty1, validIdProperty2));
- assertNextRequestIsMove(new Location(validPath), new Location(validIdProperty1, validIdProperty2));
- assertNextRequestIsMove(new Location(validUuid), new Location(validPath));
+ assertNextRequestIsMove(Location.create(validPath), Location.create(validIdProperty1, validIdProperty2));
+ assertNextRequestIsMove(Location.create(validPath), Location.create(validIdProperty1, validIdProperty2));
+ assertNextRequestIsMove(Location.create(validUuid), Location.create(validPath));
assertNoMoreRequests();
}
@@ -734,45 +734,45 @@
public void shouldCopyNodeInBatches() {
graph.batch().copy(validPath).into(validIdProperty1, validIdProperty2).execute();
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsCopy(new Location(validPath), new Location(validIdProperty1, validIdProperty2));
+ assertNextRequestIsCopy(Location.create(validPath), Location.create(validIdProperty1, validIdProperty2));
assertNoMoreRequests();
graph.batch().copy(validPathString).into(validIdProperty1, validIdProperty2).execute();
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsCopy(new Location(validPath), new Location(validIdProperty1, validIdProperty2));
+ assertNextRequestIsCopy(Location.create(validPath), Location.create(validIdProperty1, validIdProperty2));
assertNoMoreRequests();
graph.batch().copy(validUuid).into(validPath).execute();
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsCopy(new Location(validUuid), new Location(validPath));
+ assertNextRequestIsCopy(Location.create(validUuid), Location.create(validPath));
assertNoMoreRequests();
graph.batch().copy(validPath).into(validIdProperty1, validIdProperty2).and().copy(validPathString).into(validIdProperty1,
validIdProperty2).and().copy(validUuid).into(validPath).execute();
assertThat(numberOfExecutions, is(1));
extractRequestsFromComposite();
- assertNextRequestIsCopy(new Location(validPath), new Location(validIdProperty1, validIdProperty2));
- assertNextRequestIsCopy(new Location(validPath), new Location(validIdProperty1, validIdProperty2));
- assertNextRequestIsCopy(new Location(validUuid), new Location(validPath));
+ assertNextRequestIsCopy(Location.create(validPath), Location.create(validIdProperty1, validIdProperty2));
+ assertNextRequestIsCopy(Location.create(validPath), Location.create(validIdProperty1, validIdProperty2));
+ assertNextRequestIsCopy(Location.create(validUuid), Location.create(validPath));
assertNoMoreRequests();
}
@Test
public void shouldReadNodesInBatches() {
- Location child1 = new Location(createPath(validPath, "x"));
- Location child2 = new Location(createPath(validPath, "y"));
- Location child3 = new Location(createPath(validPath, "z"));
- setChildrenToReadOn(new Location(validPath), child1, child2, child3);
- Location child11 = new Location(createPath(child1.getPath(), "h"));
- Location child12 = new Location(createPath(child1.getPath(), "i"));
- Location child13 = new Location(createPath(child1.getPath(), "j"));
+ Location child1 = Location.create(createPath(validPath, "x"));
+ Location child2 = Location.create(createPath(validPath, "y"));
+ Location child3 = Location.create(createPath(validPath, "z"));
+ setChildrenToReadOn(Location.create(validPath), child1, child2, child3);
+ Location child11 = Location.create(createPath(child1.getPath(), "h"));
+ Location child12 = Location.create(createPath(child1.getPath(), "i"));
+ Location child13 = Location.create(createPath(child1.getPath(), "j"));
setChildrenToReadOn(child1, child11, child12, child13);
- Location child121 = new Location(createPath(child12.getPath(), "m"));
- Location child122 = new Location(createPath(child12.getPath(), "n"));
- Location child123 = new Location(createPath(child12.getPath(), "o"));
+ Location child121 = Location.create(createPath(child12.getPath(), "m"));
+ Location child122 = Location.create(createPath(child12.getPath(), "n"));
+ Location child123 = Location.create(createPath(child12.getPath(), "o"));
setChildrenToReadOn(child12, child121, child122, child123);
- setPropertiesToReadOn(new Location(validPath), validIdProperty1, validIdProperty2);
+ setPropertiesToReadOn(Location.create(validPath), validIdProperty1, validIdProperty2);
setPropertiesToReadOn(child1, validIdProperty1);
setPropertiesToReadOn(child2, validIdProperty2);
setPropertiesToReadOn(child11, validIdProperty1);
@@ -783,7 +783,7 @@
results = graph.batch().read(validPath).and().read(child11).and().read(child12).execute();
assertThat(numberOfExecutions, is(1));
extractRequestsFromComposite();
- assertNextRequestReadNode(new Location(validPath));
+ assertNextRequestReadNode(Location.create(validPath));
assertNextRequestReadNode(child11);
assertNextRequestReadNode(child12);
assertNoMoreRequests();
@@ -793,7 +793,7 @@
assertThat(node, is(notNullValue()));
assertThat(node.getChildren(), hasItems(child1, child2, child3));
assertThat(node.getProperties(), hasItems(validIdProperty1, validIdProperty2));
- assertThat(node.getLocation(), is(new Location(validPath)));
+ assertThat(node.getLocation(), is(Location.create(validPath)));
assertThat(node.getGraph(), is(sameInstance(graph)));
assertThat(node.getPropertiesByName().get(validIdProperty1.getName()), is(validIdProperty1));
assertThat(node.getPropertiesByName().get(validIdProperty2.getName()), is(validIdProperty2));
@@ -820,17 +820,17 @@
// ----------------------------------------------------------------------------------------------------------------
@Test( expected = AssertionError.class )
public void shouldPropertyCheckReadPropertiesUsingTestHarness1() {
- setPropertiesToReadOn(new Location(validPath), validIdProperty1);
+ setPropertiesToReadOn(Location.create(validPath), validIdProperty1);
graph.getProperties().on(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadProperties(new Location(validPath), validIdProperty1, validIdProperty2); // wrong!
+ assertNextRequestReadProperties(Location.create(validPath), validIdProperty1, validIdProperty2); // wrong!
}
@Test( expected = AssertionError.class )
public void shouldPropertyCheckReadPropertiesUsingTestHarness2() {
graph.getProperties().on(validPath);
assertThat(numberOfExecutions, is(1));
- assertNextRequestReadProperties(new Location(validPath), validIdProperty1, validIdProperty2); // wrong!
+ assertNextRequestReadProperties(Location.create(validPath), validIdProperty1, validIdProperty2); // wrong!
}
// ----------------------------------------------------------------------------------------------------------------
@@ -863,8 +863,8 @@
public void shouldMoveNodesThroughMultipleMoveRequests() {
graph.move(validPath).into(validIdProperty1, validIdProperty2).and().move(validUuid).into(validPathString);
assertThat(numberOfExecutions, is(2));
- assertNextRequestIsMove(new Location(validPath), new Location(validIdProperty1, validIdProperty2));
- assertNextRequestIsMove(new Location(validUuid), new Location(createPath(validPathString)));
+ assertNextRequestIsMove(Location.create(validPath), Location.create(validIdProperty1, validIdProperty2));
+ assertNextRequestIsMove(Location.create(validUuid), Location.create(createPath(validPathString)));
assertNoMoreRequests();
}
@@ -875,7 +875,7 @@
graph.move(validPath).into(validUuid);
assertThat(numberOfExecutions, is(1));
- assertNextRequestIsMove(new Location(validPath), new Location(validUuid));
+ assertNextRequestIsMove(Location.create(validPath), Location.create(validUuid));
assertNoMoreRequests();
}
@@ -946,7 +946,7 @@
Name childName = request.desiredName();
if (childName == null) childName = createName("child");
Path childPath = context.getValueFactories().getPathFactory().create(request.into().getPath(), childName);
- Location newChild = actualLocationOf(new Location(childPath));
+ Location newChild = actualLocationOf(Location.create(childPath));
// Just update the actual location
request.setActualLocations(actualLocationOf(request.from()), newChild);
} else {
@@ -961,7 +961,7 @@
Location parent = actualLocationOf(request.under()); // just make sure it has a path ...
Name name = request.named();
Path childPath = context.getValueFactories().getPathFactory().create(parent.getPath(), name);
- request.setActualLocationOfNode(new Location(childPath));
+ request.setActualLocationOfNode(Location.create(childPath));
}
@Override
@@ -1012,7 +1012,7 @@
String workspaceName = request.workspaceName();
if (workspaceName == null) workspaceName = "default";
request.setActualWorkspaceName(workspaceName);
- request.setActualRootLocation(new Location(context.getValueFactories().getPathFactory().createRootPath()));
+ request.setActualRootLocation(Location.create(context.getValueFactories().getPathFactory().createRootPath()));
}
@Override
@@ -1021,7 +1021,7 @@
String workspaceName = request.desiredNameOfNewWorkspace();
if (workspaceName == null) workspaceName = "default";
request.setActualWorkspaceName(workspaceName);
- request.setActualRootLocation(new Location(context.getValueFactories().getPathFactory().createRootPath()));
+ request.setActualRootLocation(Location.create(context.getValueFactories().getPathFactory().createRootPath()));
}
@Override
@@ -1039,7 +1039,7 @@
String workspaceName = request.desiredNameOfTargetWorkspace();
assert workspaceName != null;
request.setActualWorkspaceName(workspaceName);
- request.setActualRootLocation(new Location(context.getValueFactories().getPathFactory().createRootPath()));
+ request.setActualRootLocation(Location.create(context.getValueFactories().getPathFactory().createRootPath()));
}
private Location actualLocationOf( Location location ) {
@@ -1047,7 +1047,7 @@
if (location.hasPath()) return location;
// Otherwise, create a new location with an artificial path ...
Path path = context.getValueFactories().getPathFactory().create("/a/b/c/d");
- return new Location(path, location.getIdProperties());
+ return Location.create(path, location.getIdProperties());
}
}
Index: src/main/java/org/jboss/dna/graph/request/ReadNodeRequest.java
===================================================================
--- src/main/java/org/jboss/dna/graph/request/ReadNodeRequest.java (revision 729)
+++ src/main/java/org/jboss/dna/graph/request/ReadNodeRequest.java (working copy)
@@ -184,7 +184,7 @@
public void addChild( Path pathToChild,
Property firstIdProperty,
Property... remainingIdProperties ) {
- Location child = new Location(pathToChild, firstIdProperty, remainingIdProperties);
+ Location child = Location.create(pathToChild, firstIdProperty, remainingIdProperties);
this.children.add(child);
}
@@ -200,7 +200,7 @@
*/
public void addChild( Path pathToChild,
Property idProperty ) {
- Location child = new Location(pathToChild, idProperty);
+ Location child = Location.create(pathToChild, idProperty);
this.children.add(child);
}
#P dna-connector-filesystem
Index: src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java
===================================================================
--- src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java (revision 729)
+++ src/main/java/org/jboss/dna/connector/filesystem/FileSystemRequestProcessor.java (working copy)
@@ -148,7 +148,7 @@
for (String localName : parent.list(filenameFilter)) {
Name childName = nameFactory.create(defaultNamespaceUri, localName);
Path childPath = pathFactory.create(parentPath, childName);
- request.addChild(new Location(childPath));
+ request.addChild(Location.create(childPath));
}
} else {
// The parent is a java.io.File, and the path may refer to the node that is either the "nt:file" parent
@@ -156,7 +156,7 @@
if (!parentPath.getLastSegment().getName().equals(JcrLexicon.CONTENT)) {
// This node represents the "nt:file" parent node, so the only child is the "jcr:content" node ...
Path contentPath = pathFactory().create(parentPath, JcrLexicon.CONTENT);
- Location content = new Location(contentPath);
+ Location content = Location.create(contentPath);
request.addChild(content);
}
// otherwise, the path ends in "jcr:content", and there are no children
@@ -357,7 +357,7 @@
File directory = new File(workspaceName);
if (directory.exists() && directory.isDirectory() && directory.canRead()) {
request.setActualWorkspaceName(getCanonicalWorkspaceName(directory));
- request.setActualRootLocation(new Location(pathFactory().createRootPath()));
+ request.setActualRootLocation(Location.create(pathFactory().createRootPath()));
} else {
request.setError(new InvalidWorkspaceException(FileSystemI18n.workspaceDoesNotExist.text(workspaceName)));
}
@@ -425,7 +425,7 @@
File directory = new File(workspaceName);
if (directory.exists() && directory.isDirectory() && directory.canRead()) {
request.setActualWorkspaceName(getCanonicalWorkspaceName(directory));
- request.setActualRootLocation(new Location(pathFactory().createRootPath()));
+ request.setActualRootLocation(Location.create(pathFactory().createRootPath()));
availableWorkspaceNames.add(workspaceName);
} else {
request.setError(new InvalidWorkspaceException(FileSystemI18n.workspaceDoesNotExist.text(workspaceName)));
#P dna-connector-store-jpa
Index: src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java
===================================================================
--- src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java (revision 727)
+++ src/main/java/org/jboss/dna/connector/store/jpa/model/basic/BasicRequestProcessor.java (working copy)
@@ -265,7 +265,7 @@
String parentUuid = null;
ChildEntity parentEntity = null;
if (parent == null) {
- return new Location(pathFactory.createRootPath(), UUID.fromString(childUuid));
+ return Location.create(pathFactory.createRootPath(), UUID.fromString(childUuid));
}
parentPath = parent.location.getPath();
parentUuid = parent.uuid;
@@ -357,7 +357,7 @@
// Set the actual path, regardless of the supplied path...
Path path = pathFactory.create(parentPath, childName, nextSnsIndex);
- Location actualLocation = new Location(path, UUID.fromString(childUuid));
+ Location actualLocation = Location.create(path, UUID.fromString(childUuid));
// Finally, update the cache with the information we know ...
if (childrenOfParent != null) {
@@ -515,7 +515,7 @@
int sns = child.getSameNameSiblingIndex();
Path childPath = pathFactory.create(parentPath, childName, sns);
String childUuidString = child.getId().getChildUuidString();
- Location childLocation = new Location(childPath, UUID.fromString(childUuidString));
+ Location childLocation = Location.create(childPath, UUID.fromString(childUuidString));
childLocations.add(childLocation);
}
// Update the cache ...
@@ -572,7 +572,7 @@
int sns = child.getSameNameSiblingIndex();
Path childPath = pathFactory.create(parentPath, childName, sns);
String childUuidString = child.getId().getChildUuidString();
- Location childLocation = new Location(childPath, UUID.fromString(childUuidString));
+ Location childLocation = Location.create(childPath, UUID.fromString(childUuidString));
request.addChild(childLocation);
}
// Do not update the cache, since we don't know all of the children.
@@ -668,7 +668,7 @@
int sns = child.getSameNameSiblingIndex();
Path childPath = pathFactory.create(parentPath, childName, sns);
String childUuidString = child.getId().getChildUuidString();
- Location childLocation = new Location(childPath, UUID.fromString(childUuidString));
+ Location childLocation = Location.create(childPath, UUID.fromString(childUuidString));
request.addChild(childLocation);
if (allChildren != null) {
// We're going to cache the results, so add this child ...
@@ -1015,7 +1015,7 @@
assert children != null;
Path childPath = pathFactory.create(parent, childName, sns);
String childUuidString = child.getId().getChildUuidString();
- Location childLocation = new Location(childPath, UUID.fromString(childUuidString));
+ Location childLocation = Location.create(childPath, UUID.fromString(childUuidString));
locationsByUuid.put(childUuidString, childLocation);
children.add(childLocation);
}
@@ -1285,7 +1285,7 @@
Map> invalidRefs = new HashMap>();
for (ReferenceEntity entity : invalidReferences) {
UUID fromUuid = UUID.fromString(entity.getId().getFromUuidString());
- ActualLocation actualFromLocation = getActualLocation(workspaceId, new Location(fromUuid));
+ ActualLocation actualFromLocation = getActualLocation(workspaceId, Location.create(fromUuid));
Location fromLocation = actualFromLocation.location;
List refs = invalidRefs.get(fromLocation);
if (refs == null) {
@@ -1441,7 +1441,7 @@
if (workspace != null) {
Long workspaceId = workspace.getId();
assert workspaceId != null;
- ActualLocation actual = getActualLocation(workspaceId, new Location(pathFactory.createRootPath()));
+ ActualLocation actual = getActualLocation(workspaceId, Location.create(pathFactory.createRootPath()));
request.setActualRootLocation(actual.location);
request.setActualWorkspaceName(workspace.getName());
}
@@ -1494,7 +1494,7 @@
WorkspaceEntity entity = workspaces.create(name);
request.setActualWorkspaceName(entity.getName());
// Create the root node ...
- Location root = new Location(pathFactory.createRootPath());
+ Location root = Location.create(pathFactory.createRootPath());
request.setActualRootLocation(getActualLocation(entity.getId(), root).location);
}
@@ -1592,7 +1592,7 @@
}
// Finish up the request ...
- Location root = new Location(pathFactory.createRootPath(), rootNodeUuid);
+ Location root = Location.create(pathFactory.createRootPath(), rootNodeUuid);
request.setActualRootLocation(getActualLocation(intoWorkspace.getId(), root).location);
}
@@ -1688,7 +1688,7 @@
for (ReferenceEntity entity : references) {
ReferenceId id = entity.getId();
UUID fromUuid = UUID.fromString(id.getFromUuidString());
- Location location = new Location(fromUuid);
+ Location location = Location.create(fromUuid);
location = getActualLocation(id.getWorkspaceId(), location).location;
List refs = invalidRefs.get(location);
if (refs == null) {
@@ -1778,7 +1778,7 @@
// See if the reference is by UUID ...
try {
UUID uuid = uuidFactory.create(reference);
- ActualLocation actualLocation = getActualLocation(workspaceId, new Location(uuid));
+ ActualLocation actualLocation = getActualLocation(workspaceId, Location.create(uuid));
return actualLocation.uuid;
} catch (ValueFormatException e) {
// Unknown kind of reference, which we don't track
@@ -1860,7 +1860,7 @@
}
}
Path fullPath = pathFactory.createAbsolutePath(segments);
- Location newLocation = new Location(fullPath, uuidProperty);
+ Location newLocation = Location.create(fullPath, uuidProperty);
cache.addNewNode(workspaceId, newLocation);
return new ActualLocation(newLocation, nodeUuidString, originalEntity);
}
Index: src/test/java/org/jboss/dna/connector/store/jpa/util/RequestProcessorCacheTest.java
===================================================================
--- src/test/java/org/jboss/dna/connector/store/jpa/util/RequestProcessorCacheTest.java (revision 727)
+++ src/test/java/org/jboss/dna/connector/store/jpa/util/RequestProcessorCacheTest.java (working copy)
@@ -68,30 +68,30 @@
workspaceId = 10L;
Path parent = pathFactory.create("/a/b/c");
- location = new Location(parent, UUID.randomUUID());
- children = new Location[] {new Location(pathFactory.create(parent, "d1"), UUID.randomUUID()),
- new Location(pathFactory.create(parent, "d2"), UUID.randomUUID()),
- new Location(pathFactory.create(parent, "d3"), UUID.randomUUID()),
- new Location(pathFactory.create(parent, "d4"), UUID.randomUUID()),
- new Location(pathFactory.create(parent, name("e"), 1), UUID.randomUUID()),
- new Location(pathFactory.create(parent, name("e"), 2), UUID.randomUUID()),
- new Location(pathFactory.create(parent, name("e"), 3), UUID.randomUUID()),
- new Location(pathFactory.create(parent, name("e"), 4), UUID.randomUUID())};
+ location = Location.create(parent, UUID.randomUUID());
+ children = new Location[] {Location.create(pathFactory.create(parent, "d1"), UUID.randomUUID()),
+ Location.create(pathFactory.create(parent, "d2"), UUID.randomUUID()),
+ Location.create(pathFactory.create(parent, "d3"), UUID.randomUUID()),
+ Location.create(pathFactory.create(parent, "d4"), UUID.randomUUID()),
+ Location.create(pathFactory.create(parent, name("e"), 1), UUID.randomUUID()),
+ Location.create(pathFactory.create(parent, name("e"), 2), UUID.randomUUID()),
+ Location.create(pathFactory.create(parent, name("e"), 3), UUID.randomUUID()),
+ Location.create(pathFactory.create(parent, name("e"), 4), UUID.randomUUID())};
childrenList = new LinkedList();
for (Location loc : children) {
childrenList.add(loc);
}
parent = pathFactory.create("/a/b/c/e[2]");
- location2 = new Location(parent, children[5].getUuid());
- children2 = new Location[] {new Location(pathFactory.create(parent, "f1"), UUID.randomUUID()),
- new Location(pathFactory.create(parent, "f2"), UUID.randomUUID()),
- new Location(pathFactory.create(parent, "f3"), UUID.randomUUID()),
- new Location(pathFactory.create(parent, "f4"), UUID.randomUUID()),
- new Location(pathFactory.create(parent, name("g"), 1), UUID.randomUUID()),
- new Location(pathFactory.create(parent, name("g"), 2), UUID.randomUUID()),
- new Location(pathFactory.create(parent, name("g"), 3), UUID.randomUUID()),
- new Location(pathFactory.create(parent, name("g"), 4), UUID.randomUUID())};
+ location2 = Location.create(parent, children[5].getUuid());
+ children2 = new Location[] {Location.create(pathFactory.create(parent, "f1"), UUID.randomUUID()),
+ Location.create(pathFactory.create(parent, "f2"), UUID.randomUUID()),
+ Location.create(pathFactory.create(parent, "f3"), UUID.randomUUID()),
+ Location.create(pathFactory.create(parent, "f4"), UUID.randomUUID()),
+ Location.create(pathFactory.create(parent, name("g"), 1), UUID.randomUUID()),
+ Location.create(pathFactory.create(parent, name("g"), 2), UUID.randomUUID()),
+ Location.create(pathFactory.create(parent, name("g"), 3), UUID.randomUUID()),
+ Location.create(pathFactory.create(parent, name("g"), 4), UUID.randomUUID())};
childrenList2 = new LinkedList();
for (Location loc : children2) {
childrenList2.add(loc);
@@ -169,7 +169,7 @@
// The cache knows about the children of "/a/b/c" and "/a/b/c/e[2]".
// This test moves "/a/b/c/e[2]" into "/a/b/c/d3"
Location oldLocation = location2;
- Location newLocation = new Location(pathFactory.create("/a/b/c/d3/e[1]"));
+ Location newLocation = Location.create(pathFactory.create("/a/b/c/d3/e[1]"));
assertThat(oldLocation.getPath().getString(namespaces), is("/a/b/c/e[2]"));
assertThat(newLocation.getPath().getString(namespaces), is("/a/b/c/d3/e[1]"));
cache.addNewNode(workspaceId, location);
@@ -294,7 +294,7 @@
// The cache knows about the children of "/a/b/c" and "/a/b/c/e[2]".
// This test removes "/a/b/c/e[2]"
Location oldLocation = location2;
- Location newLocation = new Location(pathFactory.create("/a/b/c/d3/e[1]"));
+ Location newLocation = Location.create(pathFactory.create("/a/b/c/d3/e[1]"));
assertThat(oldLocation.getPath().getString(namespaces), is("/a/b/c/e[2]"));
assertThat(newLocation.getPath().getString(namespaces), is("/a/b/c/d3/e[1]"));
cache.addNewNode(workspaceId, location);
@@ -359,9 +359,9 @@
for (Location childLocation : children2) {
locationsToRemove.add(childLocation);
}
- locationsToRemove.add(new Location(pathFactory.create(children2[6].getPath(), "m1")));
- locationsToRemove.add(new Location(pathFactory.create(children2[6].getPath(), "m2")));
- locationsToRemove.add(new Location(pathFactory.create(children2[6].getPath(), "m3")));
+ locationsToRemove.add(Location.create(pathFactory.create(children2[6].getPath(), "m1")));
+ locationsToRemove.add(Location.create(pathFactory.create(children2[6].getPath(), "m2")));
+ locationsToRemove.add(Location.create(pathFactory.create(children2[6].getPath(), "m3")));
// Remove the branch ...
assertThat(cache.removeBranch(workspaceId, locationsToRemove), is(true));
Index: src/main/java/org/jboss/dna/connector/store/jpa/model/basic/SubgraphQuery.java
===================================================================
--- src/main/java/org/jboss/dna/connector/store/jpa/model/basic/SubgraphQuery.java (revision 727)
+++ src/main/java/org/jboss/dna/connector/store/jpa/model/basic/SubgraphQuery.java (working copy)
@@ -272,7 +272,7 @@
pathByUuid.put(subgraphRootUuid, subgraphRootPath);
UUID uuid = UUID.fromString(subgraphRootUuid);
if (includeRoot) {
- locations.add(new Location(subgraphRootPath, uuid));
+ locations.add(Location.create(subgraphRootPath, uuid));
}
// Now iterate over the child nodes in the subgraph (we've already included the root) ...
@@ -290,7 +290,7 @@
String childUuid = entity.getId().getChildUuidString();
pathByUuid.put(childUuid, childPath);
uuid = UUID.fromString(childUuid);
- locations.add(new Location(childPath, uuid));
+ locations.add(Location.create(childPath, uuid));
}
return locations;