public Map<Name, Property> getPropertiesByName() { return request.getPropertiesByName(); }
@Test public void shouldAllowAddingProperties() { request = new ReadNodeRequest(validPathLocation, workspace1); request.addProperty(validProperty1); request.addProperty(validProperty2); assertThat(request.getProperties().size(), is(2)); assertThat(request.getProperties(), hasItems(validProperty1, validProperty2)); assertThat(request.getPropertiesByName().get(validProperty1.getName()), is(validProperty1)); assertThat(request.getPropertiesByName().get(validProperty2.getName()), is(validProperty2)); } }
request.setProperties(actualLocation, readNode.getProperties()); if (includeChildrenInSubgraph(actualLocation, readNode.getPropertiesByName(), first)) {
assertThat(projectedRequest.getPropertiesByName(), is(properties)); assertThat(fedRequest.getFirstProjectedRequest().hasNext(), is(false));
/** * {@inheritDoc} * * @see org.modeshape.graph.request.processor.RequestProcessor#process(org.modeshape.graph.request.ReadBranchRequest) */ @Override public void process( ReadBranchRequest request ) { CacheableRequest source = (CacheableRequest)federatedRequest.getFirstProjectedRequest().getRequest(); if (checkErrorOrCancel(request, source)) return; if (RequestType.READ_BRANCH == source.getType()) { ReadBranchRequest readSource = (ReadBranchRequest)source; request.setActualLocationOfNode(readSource.getActualLocationOfNode()); for (Location node : readSource) { List<Location> children = readSource.getChildren(node); if (children != null) request.setChildren(node, children); Map<Name, Property> props = readSource.getPropertiesFor(node); if (props != null) request.setProperties(node, props.values()); } } else if (RequestType.READ_NODE == source.getType()) { ReadNodeRequest readSource = (ReadNodeRequest)source; request.setActualLocationOfNode(readSource.getActualLocationOfNode()); Location parent = readSource.getActualLocationOfNode(); request.setChildren(parent, readSource.getChildren()); request.setProperties(parent, readSource.getPropertiesByName().values()); } request.setCachePolicy(getDefaultCachePolicy()); setCacheableInfo(request, source.getCachePolicy()); }
expires = computeExpirationTime(readNode); node = getOrCreateNode(readNode.getActualLocationOfNode(), expires); node.setProperties(readNode.getPropertiesByName()); node.setChildren(readNode.getChildren()); break;
expires = computeExpirationTime(readNode); node = getOrCreateNode(readNode.getActualLocationOfNode(), expires); node.setProperties(readNode.getPropertiesByName()); node.setChildren(readNode.getChildren()); break;
@Test public void shouldJoinSingleMirroredReadNodeRequest() { // Create the original read node request ... final ReadNodeRequest original = new ReadNodeRequest(location("/a/b/c"), "workspaceM"); // Create a single federated request... final FederatedRequest request = new FederatedRequest(original); // And "fork" the original request ... final ReadNodeRequest projected = new ReadNodeRequest(location("/a/b/c"), "workspaceM"); projected.setActualLocationOfNode(Location.create(projected.at().getPath(), UUID.randomUUID())); projected.addProperty(property("propA", "valueA")); projected.addProperty(property("propB", "valueB")); projected.addChild(child(projected.getActualLocationOfNode(), "child1")); projected.addChild(child(projected.getActualLocationOfNode(), "child2")); request.add(projected, true, false, mirrorProjection); request.freeze(); request.getLatch().countDown(); joinQueue.add(request); // Add a terminating request and join the request... joinQueue.add(new NoMoreFederatedRequests()); joinProcessor.process(joinQueue); // Check the results of the original has the same results of the projected... assertThat(original.getChildren(), is(projected.getChildren())); assertThat(original.getPropertiesByName(), is(projected.getPropertiesByName())); assertThat(original.getActualLocationOfNode(), is(projected.getActualLocationOfNode())); }
@Test public void shouldJoinSingleOffsetReadNodeRequest() { // Create the original read node request ... final ReadNodeRequest original = new ReadNodeRequest(location("/a/b/c"), "workspaceM"); // Create a single federated request using the mirror projection... final FederatedRequest request = new FederatedRequest(original); // And "fork" the original request by creating a mirror final ReadNodeRequest projected = new ReadNodeRequest(location("/b/c"), "workspaceM"); projected.setActualLocationOfNode(Location.create(projected.at().getPath(), UUID.randomUUID())); projected.addProperty(property("propA", "valueA")); projected.addProperty(property("propB", "valueB")); projected.addChild(child(projected.getActualLocationOfNode(), "child1")); projected.addChild(child(projected.getActualLocationOfNode(), "child2")); request.add(projected, false, false, projectionA); request.freeze(); request.getLatch().countDown(); joinQueue.add(request); // Add a terminating request and join the request... joinQueue.add(new NoMoreFederatedRequests()); joinProcessor.process(joinQueue); // Check the results of the original has the same results of the projected... assertThat(original.getPropertiesByName(), is(projected.getPropertiesByName())); assertThat(original.getActualLocationOfNode().getPath(), is(path("/a/b/c"))); assertThat(original.getChildren().get(0).getPath(), is(path("/a/b/c/child1"))); assertThat(original.getChildren().get(1).getPath(), is(path("/a/b/c/child2"))); }
Map<Name, Property> properties = readFromSource.getPropertiesByName(); projectToFederated(actualLocation, projection, request, parent, children, properties);
public void process( ReadNodeRequest request ) { Path federatedPath = request.at().getPath(); Map<Name, Property> properties = request.getPropertiesByName(); Map<Name, Integer> childSnsIndexes = new HashMap<Name, Integer>(); ProjectedRequest projectedRequest = federatedRequest.getFirstProjectedRequest();