Index: modeshape-graph/src/main/java/org/modeshape/graph/session/GraphSession.java =================================================================== --- modeshape-graph/src/main/java/org/modeshape/graph/session/GraphSession.java (revision 2647) +++ modeshape-graph/src/main/java/org/modeshape/graph/session/GraphSession.java (working copy) @@ -105,9 +105,15 @@ public class GraphSession { protected int loadDepth = 1; /** - * A map of the nodes keyed by their identifier. + * A map of the nodes keyed by their identifier. This map contains all of the nodes and is the normative */ protected final Map> nodes = new HashMap>(); + + /** + * A utility map of the nodes keyed by their UUID. This map will not contain nodes that have no UUIDs. + */ + protected final Map> nodesByUuid = new HashMap>(); + /** * A map that records how the changes to a node are dependent upon other nodes. */ @@ -183,6 +189,36 @@ public class GraphSession { this.operations = this.store.batch(this.requestBuilder); } + protected void put( Node node ) { + this.nodes.put(node.getNodeId(), node); + // The UUID of the node should never change once its assigned ... + UUID uuid = node.getLocation().getUuid(); + if (uuid != null) this.nodesByUuid.put(uuid, node); + } + + protected Node node( NodeId id ) { + return this.nodes.get(id); + } + + protected Node node( UUID uuid ) { + // The UUID of the node should never change once its assigned ... + return this.nodesByUuid.get(uuid); + } + + protected void removeNode( NodeId id ) { + Node removed = this.nodes.remove(id); + if (removed != null) { + UUID uuid = removed.getLocation().getUuid(); + if (uuid != null) this.nodesByUuid.remove(uuid); + } + this.changeDependencies.remove(id); + } + + protected void clearNodes() { + nodes.clear(); + nodes.put(root.getNodeId(), root); + } + ExecutionContext context() { return context; } @@ -261,14 +297,9 @@ public class GraphSession { UUID uuid = location.getUuid(); if (uuid != null) { - // Try to find the node in the cache - for (Node node : nodes.values()) { - UUID nodeUuid = uuidFor(node.getLocation()); - - if (uuid.equals(nodeUuid)) { - return node; - } - } + // Try to find the node in the cache ... + Node node = node(uuid); + if (node != null) return node; // Has this node already been deleted by this session (but not yet committed)? if (this.deletedNodes.contains(uuid)) { @@ -277,19 +308,30 @@ public class GraphSession { } // Query for the actual location ... - location = store.getNodeAt(location).getLocation(); + org.modeshape.graph.Node persistentNode = store.getNodeAt(location); + location = persistentNode.getLocation(); + Path path = location.getPath(); + + // If the node is the root, we already have it ... + if (path.isRoot()) return root; + + // Make sure the user has access ... + authorizer.checkPermissions(path, Action.READ); + + // Now find the nodes down to (but not including) this node ... + Path relativePathFromRootToParent = path.getParent().relativeToRoot(); + Node parent = findNodeRelativeTo(root, relativePathFromRootToParent, true); + + // Now materialize the child at our location ... + if (!parent.isLoaded()) parent.load(); + node = parent.getChild(path.getLastSegment()); + nodeOperations.materialize(persistentNode, node); + return node; } + + // There was no UUID, so there has to be a path ... assert location.hasPath(); - Node result = findNodeWith(null, location.getPath()); - if (uuid != null) { - // Check that the input UUID matches that of the result ... - UUID actualUuid = result.getLocation().getUuid(); - if (!uuid.equals(actualUuid)) { - String msg = GraphI18n.nodeDoesNotExistWithUuid.text(uuid, workspaceName); - throw new PathNotFoundException(location, this.root.getPath(), msg); - } - } - return result; + return findNodeWith(null, location.getPath()); } private UUID uuidFor( Location location ) { @@ -311,7 +353,7 @@ public class GraphSession { */ public Node findNodeWith( NodeId id ) { CheckArg.isNotNull(id, "id"); - return nodes.get(id); + return node(id); } /** @@ -331,7 +373,7 @@ public class GraphSession { CheckArg.isNotNull(id, "id"); CheckArg.isNotNull(path, "path"); } - Node result = id != null ? nodes.get(id) : null; // if found, the user should have read + Node result = id != null ? node(id) : null; // if found, the user should have read // privilege since it was // already in the cache if (result == null || result.isStale()) { @@ -820,8 +862,7 @@ public class GraphSession { refresh(root, keepChanges); } else { // Clear out all state ... - nodes.clear(); - nodes.put(root.getNodeId(), root); + clearNodes(); // Clear out all changes ... requests.clear(); changeDependencies.clear(); @@ -1134,8 +1175,7 @@ public class GraphSession { deletedNodes.add(nodeUuid); } // Fix the cache's state ... - nodes.remove(node.getNodeId()); - changeDependencies.remove(node.getNodeId()); + removeNode(node.getNodeId()); recordUnloaded(node); } @@ -1153,8 +1193,7 @@ public class GraphSession { @Override public boolean visit( Node unloaded ) { if (unloaded != node) { // info for 'node' should not be removed - nodes.remove(unloaded.getNodeId()); - changeDependencies.remove(unloaded.getNodeId()); + removeNode(unloaded.getNodeId()); unloaded.parent = null; } return true; @@ -1798,8 +1837,7 @@ public class GraphSession { childrenToKeep.put(existing.getLocation(), existing); } else { // Otherwise, remove the child from the cache since we won't be needing it anymore ... - cache.nodes.remove(existing.getNodeId()); - assert !cache.changeDependencies.containsKey(existing.getNodeId()); + cache.removeNode(existing.getNodeId()); existing.parent = null; } } @@ -1827,7 +1865,7 @@ public class GraphSession { // The existing child (if there was one) is to be refreshed ... NodeId nodeId = cache.idFactory.create(); Node replacementChild = cache.createNode(this, nodeId, location); - cache.nodes.put(replacementChild.getNodeId(), replacementChild); + cache.put(replacementChild); assert replacementChild.getName().equals(childName); assert replacementChild.parent == this; // Add it to the parent node ... @@ -1868,7 +1906,7 @@ public class GraphSession { NodeId id = cache.idFactory.create(); Name childName = location.getPath().getLastSegment().getName(); Node child = cache.createNode(this, id, location); - cache.nodes.put(child.getNodeId(), child); + cache.put(child); List> currentChildren = childrenByName.get(childName); currentChildren.add(child); child.parent = this; @@ -2032,19 +2070,19 @@ public class GraphSession { for (Map.Entry entry : cache.changeDependencies.entrySet()) { Dependencies dependency = entry.getValue(); NodeId nodeId = entry.getKey(); - Node changedNode = cache.nodes.get(nodeId); + Node changedNode = cache.node(nodeId); // First, check whether the changed node is within the branch ... if (!changedNode.isAtOrBelow(this)) { // The node is not within this branch, so the original parent must not be at or below this node ... - if (cache.nodes.get(dependency.getMovedFrom()).isAtOrBelow(this)) { + if (cache.node(dependency.getMovedFrom()).isAtOrBelow(this)) { // The original parent is below 'this' but the changed node is not ... return true; } // None of the other dependencies can be within this branch ... for (NodeId dependentId : dependency.getRequireChangesTo()) { // The dependent node must not be at or below this node ... - if (cache.nodes.get(dependentId).isAtOrBelow(this)) { + if (cache.node(dependentId).isAtOrBelow(this)) { // The other node that must change is at or below 'this' return true; } @@ -2056,7 +2094,7 @@ public class GraphSession { // Second, check whether this node was moved from outside this branch ... if (dependency.getMovedFrom() != null) { - Node originalParent = cache.nodes.get(dependency.getMovedFrom()); + Node originalParent = cache.node(dependency.getMovedFrom()); // If the original parent cannot be found ... if (originalParent == null) { continue; @@ -2069,7 +2107,7 @@ public class GraphSession { // All of the other dependencies must be within this branch ... for (NodeId dependentId : dependency.getRequireChangesTo()) { // The dependent node must not be at or below this node ... - if (!cache.nodes.get(dependentId).isAtOrBelow(this)) { + if (!cache.node(dependentId).isAtOrBelow(this)) { // Another dependent node is not at or below this branch either ... return true; } @@ -2682,7 +2720,7 @@ public class GraphSession { throw e; } - cache.nodes.put(child.getNodeId(), child); + cache.put(child); return child; } Index: modeshape-jcr/src/main/java/org/modeshape/jcr/JcrQueryManager.java =================================================================== --- modeshape-jcr/src/main/java/org/modeshape/jcr/JcrQueryManager.java (revision 2647) +++ modeshape-jcr/src/main/java/org/modeshape/jcr/JcrQueryManager.java (working copy) @@ -30,6 +30,7 @@ import java.util.Set; import javax.jcr.AccessDeniedException; import javax.jcr.Node; import javax.jcr.NodeIterator; +import javax.jcr.PathNotFoundException; import javax.jcr.RepositoryException; import javax.jcr.Value; import javax.jcr.ValueFactory; @@ -1441,9 +1442,15 @@ class JcrQueryManager implements QueryManager { * @see org.modeshape.jcr.query.JcrQueryContext#getNode(Location) */ @Override - public Node getNode( Location location ) throws AccessDeniedException, RepositoryException { + public Node getNode( Location location ) throws RepositoryException { if (!session.wasRemovedInSession(location)) { - return session.getNode(location.getPath()); + try { + return session.getNode(location.getPath()); + } catch (PathNotFoundException e) { + // Must have been deleted from storage but not yet from the indexes ... + } catch (AccessDeniedException e) { + // No access to this node ... + } } return null; } Index: modeshape-jcr/src/main/java/org/modeshape/jcr/query/JcrQueryContext.java =================================================================== --- modeshape-jcr/src/main/java/org/modeshape/jcr/query/JcrQueryContext.java (revision 2647) +++ modeshape-jcr/src/main/java/org/modeshape/jcr/query/JcrQueryContext.java (working copy) @@ -24,7 +24,6 @@ package org.modeshape.jcr.query; import java.util.Map; -import javax.jcr.AccessDeniedException; import javax.jcr.Node; import javax.jcr.NodeIterator; import javax.jcr.RepositoryException; @@ -53,7 +52,7 @@ public interface JcrQueryContext { String language, String statement ) throws RepositoryException; - Node getNode( Location location ) throws AccessDeniedException, RepositoryException; + Node getNode( Location location ) throws RepositoryException; Value createValue( int propertyType, Object value ); Index: modeshape-jcr/src/main/java/org/modeshape/jcr/query/JcrQueryResult.java =================================================================== --- modeshape-jcr/src/main/java/org/modeshape/jcr/query/JcrQueryResult.java (revision 2647) +++ modeshape-jcr/src/main/java/org/modeshape/jcr/query/JcrQueryResult.java (working copy) @@ -29,7 +29,6 @@ import java.util.Iterator; import java.util.List; import java.util.NoSuchElementException; import java.util.Set; -import javax.jcr.AccessDeniedException; import javax.jcr.ItemNotFoundException; import javax.jcr.Node; import javax.jcr.NodeIterator; @@ -406,17 +405,12 @@ public class JcrQueryResult implements QueryResult, org.modeshape.jcr.api.query. int index = 0; for (int locationIndex : locationIndexes) { Location location = (Location)tuple[locationIndex]; - try { - Node node = context.getNode(location); - if (node == null) { - // Skip this record because one of the nodes no longer exists ... - return null; - } - nodes[index++] = node; - } catch (AccessDeniedException e) { - // No access to this node, so skip the record ... + Node node = context.getNode(location); + if (node == null) { + // Skip this record because one of the nodes no longer exists ... return null; } + nodes[index++] = node; } return new MultiSelectorQueryResultRow(this, nodes, locationIndexes, tuple); } Index: utils/modeshape-jdbc/src/test/java/org/modeshape/jdbc/JcrConnectionTest.java =================================================================== --- utils/modeshape-jdbc/src/test/java/org/modeshape/jdbc/JcrConnectionTest.java (revision 2647) +++ utils/modeshape-jdbc/src/test/java/org/modeshape/jdbc/JcrConnectionTest.java (working copy) @@ -33,17 +33,14 @@ import static org.junit.Assert.assertThat; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.when; - import java.sql.Connection; import java.sql.SQLException; import java.sql.SQLFeatureNotSupportedException; import java.sql.Statement; import java.util.HashMap; import java.util.Properties; - import javax.jcr.Repository; import javax.jcr.Session; - import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -69,222 +66,214 @@ public class JcrConnectionTest { @Mock private Session session; - - @Mock - private RepositoryDelegate jcrDelegate; - - @Mock - private JcrMetaData jcrmetadata; + @Mock + private RepositoryDelegate jcrDelegate; @Before public void beforeEach() throws Exception { - MockitoAnnotations.initMocks(this); + MockitoAnnotations.initMocks(this); + + conn = new JcrConnection(jcrDelegate); - conn = new JcrConnection(jcrDelegate); + // Set up the connection information ... + when(connInfo.getWorkspaceName()).thenReturn("workspaceName"); + when(connInfo.getRepositoryName()).thenReturn(REPOSITORY_NAME); - // Set up the connection information ... - when(connInfo.getWorkspaceName()).thenReturn("workspaceName"); - when(connInfo.getRepositoryName()).thenReturn(REPOSITORY_NAME); - - when(jcrDelegate.isValid(anyInt())).thenReturn(Boolean.TRUE); - when(jcrDelegate.getConnectionInfo()).thenReturn(connInfo); + when(jcrDelegate.isValid(anyInt())).thenReturn(Boolean.TRUE); + when(jcrDelegate.getConnectionInfo()).thenReturn(connInfo); - when(repository.login(anyString())).thenReturn(session); - when(repository.getDescriptor(anyString())).thenReturn("modeshape"); + when(repository.login(anyString())).thenReturn(session); + when(repository.getDescriptor(anyString())).thenReturn("modeshape"); + + when(session.getRepository()).thenReturn(repository); - when(session.getRepository()).thenReturn(repository); - } @After public void afterEach() throws Exception { - try { - conn.close(); - } catch (Exception e) { + try { + conn.close(); + } catch (Exception e) { - } + } } @Test public void shouldCallClearWarnings() throws SQLException { - conn.clearWarnings(); + conn.clearWarnings(); } @Test public void shouldCallClose() throws SQLException { - conn.close(); + conn.close(); } @Test public void shouldCallCommit() throws SQLException { - conn.commit(); + conn.commit(); } @Test public void shouldCallGetCatalog() throws SQLException { - assertThat(conn.getCatalog(), is(REPOSITORY_NAME)); + assertThat(conn.getCatalog(), is(REPOSITORY_NAME)); } @Test public void shouldCallCreateStatement() throws SQLException { - Statement stmt = conn.createStatement(); - assertThat(stmt, is(notNullValue())); - assertThat(stmt, is(instanceOf(JcrStatement.class))); + Statement stmt = conn.createStatement(); + assertThat(stmt, is(notNullValue())); + assertThat(stmt, is(instanceOf(JcrStatement.class))); } @Test public void shouldCallGetAutoCommit() throws SQLException { - assertThat(conn.getAutoCommit(), is(true)); + assertThat(conn.getAutoCommit(), is(true)); } @Test public void shouldCallGetClientInfo() throws SQLException { - assertThat(conn.getClientInfo(), is(new Properties())); + assertThat(conn.getClientInfo(), is(new Properties())); } @Test public void shouldCallGetClientInfoByName() throws SQLException { - conn.setClientInfo("prop1", "prop1Value"); - matchClientInfoByName("prop1", "prop1Value"); + conn.setClientInfo("prop1", "prop1Value"); + matchClientInfoByName("prop1", "prop1Value"); } - private void matchClientInfoByName(String name, String match) - throws SQLException { - assertThat(conn.getClientInfo(name), is(match)); + private void matchClientInfoByName( String name, + String match ) throws SQLException { + assertThat(conn.getClientInfo(name), is(match)); } @Test public void shouldCallGetMetaData() throws SQLException { - assertNotNull(conn.getMetaData()); + assertNotNull(conn.getMetaData()); } @Test public void shouldCallGetTransactionIsolation() throws SQLException { - assertThat(conn.getTransactionIsolation(), - is(Connection.TRANSACTION_READ_COMMITTED)); + assertThat(conn.getTransactionIsolation(), is(Connection.TRANSACTION_READ_COMMITTED)); } @Test public void shouldCallGetTypeMap() throws SQLException { - assertEquals(conn.getTypeMap(), new HashMap()); + assertEquals(conn.getTypeMap(), new HashMap()); } @Test public void ShouldCallGetWarnings() throws SQLException { - assertNull(conn.getWarnings()); + assertNull(conn.getWarnings()); } @Test public void shouldCallIsClosed() throws SQLException { - assertThat(conn.isClosed(), is(false)); - conn.close(); - assertThat(conn.isClosed(), is(true)); + assertThat(conn.isClosed(), is(false)); + conn.close(); + assertThat(conn.isClosed(), is(true)); } @Test public void shouldCallIsReadOnly() throws SQLException { - assertThat(conn.isReadOnly(), is(true)); + assertThat(conn.isReadOnly(), is(true)); } @Test public void shouldCallIsValid() throws SQLException { - assertThat(conn.isValid(0), is(true)); - assertThat(conn.isValid(120), is(true)); - assertThat(conn.isValid(1200), is(true)); + assertThat(conn.isValid(0), is(true)); + assertThat(conn.isValid(120), is(true)); + assertThat(conn.isValid(1200), is(true)); } /** * @throws SQLException */ - @Test(expected = SQLException.class) - public void shouldThrowExceptionWhenIsValidArgIsLessThanZero() - throws SQLException { - conn.isValid(-1); + @Test( expected = SQLException.class ) + public void shouldThrowExceptionWhenIsValidArgIsLessThanZero() throws SQLException { + conn.isValid(-1); } @Test public void shouldCallNativeSQL() throws SQLException { - conn.nativeSQL("sql"); + conn.nativeSQL("sql"); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) + @Test( expected = SQLFeatureNotSupportedException.class ) public void featureNotSupportedCallPrepareStatementAutoGenKeys() throws SQLException { - conn.prepareStatement("sql", 1); + conn.prepareStatement("sql", 1); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) + @Test( expected = SQLFeatureNotSupportedException.class ) public void featureNotSupportedCallPrepareStatementColumnIndexes() throws SQLException { - conn.prepareStatement("sql", new int[] {}); + conn.prepareStatement("sql", new int[] {}); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) + @Test( expected = SQLFeatureNotSupportedException.class ) public void featureNotSupportedCallPrepareStatementColumnNames() throws SQLException { - conn.prepareStatement("sql", new String[] {}); + conn.prepareStatement("sql", new String[] {}); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) + @Test( expected = SQLFeatureNotSupportedException.class ) public void featureNotSupportedCallingPrepareStatement() throws SQLException { - conn.prepareStatement("sql"); + conn.prepareStatement("sql"); } @Test public void shouldCallRollback() throws SQLException { - conn.rollback(); + conn.rollback(); } @Test public void shouldCallSetAutoCommit() throws SQLException { - conn.setAutoCommit(false); - assertThat(conn.getAutoCommit(), is(false)); + conn.setAutoCommit(false); + assertThat(conn.getAutoCommit(), is(false)); } @Test public void shouldCallSetClientInfoProperties() throws SQLException { - Properties props = new Properties(); - props.setProperty("prop1", "prop1Value1"); - props.setProperty("prop2", "prop1Value2"); + Properties props = new Properties(); + props.setProperty("prop1", "prop1Value1"); + props.setProperty("prop2", "prop1Value2"); - conn.setClientInfo(props); - assertThat(conn.getClientInfo(), is(props)); + conn.setClientInfo(props); + assertThat(conn.getClientInfo(), is(props)); } @Test public void shouldCallSetClientInfoPropertyValue() throws SQLException { - conn.setClientInfo("propertyname", "propvalue"); - matchClientInfoByName("propertyname", "propvalue"); + conn.setClientInfo("propertyname", "propvalue"); + matchClientInfoByName("propertyname", "propvalue"); } @Test public void shouldCallSetReadOnly() throws SQLException { - conn.setReadOnly(true); - // confirm that readonly mode is never changed - assertThat(conn.isReadOnly(), is(true)); + conn.setReadOnly(true); + // confirm that readonly mode is never changed + assertThat(conn.isReadOnly(), is(true)); } - @Test public void shouldCallIsWrapperFor() throws SQLException { - assertThat(conn.isWrapperFor(JcrConnection.class), is(true)); + assertThat(conn.isWrapperFor(JcrConnection.class), is(true)); } @Test public void shouldCallUnwrap() throws SQLException { - assertThat(conn.unwrap(JcrConnection.class), - is(instanceOf(JcrConnection.class))); + assertThat(conn.unwrap(JcrConnection.class), is(instanceOf(JcrConnection.class))); } // ***************************** @@ -294,177 +283,167 @@ public class JcrConnectionTest { /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) + @Test( expected = SQLFeatureNotSupportedException.class ) public void featureNotSupportedCallingSavepoint() throws SQLException { - conn.rollback(null); + conn.rollback(null); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) + @Test( expected = SQLFeatureNotSupportedException.class ) public void featureNotSupportedCallingSetSavepoint() throws SQLException { - conn.setSavepoint(); + conn.setSavepoint(); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) - public void featureNotSupportedCallingSetSavepointPassingArg() - throws SQLException { - conn.setSavepoint(null); + @Test( expected = SQLFeatureNotSupportedException.class ) + public void featureNotSupportedCallingSetSavepointPassingArg() throws SQLException { + conn.setSavepoint(null); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) + @Test( expected = SQLFeatureNotSupportedException.class ) public void featureNotSupportedCallingGetHoldability() throws SQLException { - conn.getHoldability(); + conn.getHoldability(); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) + @Test( expected = SQLFeatureNotSupportedException.class ) public void featureNotSupportedCallingSetHoldability() throws SQLException { - conn.setHoldability(1); + conn.setHoldability(1); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) - public void featureNotSupportedCallingCreateStatement3Parms() - throws SQLException { - conn.createStatement(1, 1, 1); + @Test( expected = SQLFeatureNotSupportedException.class ) + public void featureNotSupportedCallingCreateStatement3Parms() throws SQLException { + conn.createStatement(1, 1, 1); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) - public void featureNotSupportedCallingCreateStatement2Parms() - throws SQLException { - conn.createStatement(1, 1); + @Test( expected = SQLFeatureNotSupportedException.class ) + public void featureNotSupportedCallingCreateStatement2Parms() throws SQLException { + conn.createStatement(1, 1); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) - public void featureNotSupportedCallingPrepareCall3Parms() - throws SQLException { - conn.prepareCall("sql", 1, 1, 1); + @Test( expected = SQLFeatureNotSupportedException.class ) + public void featureNotSupportedCallingPrepareCall3Parms() throws SQLException { + conn.prepareCall("sql", 1, 1, 1); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) - public void featureNotSupportedCallingPrepareCall2Parms() - throws SQLException { - conn.prepareCall("sql", 1, 1); + @Test( expected = SQLFeatureNotSupportedException.class ) + public void featureNotSupportedCallingPrepareCall2Parms() throws SQLException { + conn.prepareCall("sql", 1, 1); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) + @Test( expected = SQLFeatureNotSupportedException.class ) public void featureNotSupportedCallingPrepareCall() throws SQLException { - conn.prepareCall("sql"); + conn.prepareCall("sql"); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) - public void featureNotSupportedCallingPrepareStatementWith3Parms() - throws SQLException { - conn.prepareStatement("sql", 1, 1); + @Test( expected = SQLFeatureNotSupportedException.class ) + public void featureNotSupportedCallingPrepareStatementWith3Parms() throws SQLException { + conn.prepareStatement("sql", 1, 1); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) - public void featureNotSupportedCallingPrepareStatementWith4Parms() - throws SQLException { - conn.prepareStatement("sql", 1, 1, conn.getHoldability()); + @Test( expected = SQLFeatureNotSupportedException.class ) + public void featureNotSupportedCallingPrepareStatementWith4Parms() throws SQLException { + conn.prepareStatement("sql", 1, 1, conn.getHoldability()); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) + @Test( expected = SQLFeatureNotSupportedException.class ) public void featureNotSupportedCallingCreateArrayOf() throws SQLException { - conn.createArrayOf("typename", new Object[] {}); + conn.createArrayOf("typename", new Object[] {}); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) + @Test( expected = SQLFeatureNotSupportedException.class ) public void featureNotSupportedCallingCreateBlob() throws SQLException { - conn.createBlob(); + conn.createBlob(); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) + @Test( expected = SQLFeatureNotSupportedException.class ) public void featureNotSupportedCallingCreateClob() throws SQLException { - conn.createClob(); + conn.createClob(); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) + @Test( expected = SQLFeatureNotSupportedException.class ) public void featureNotSupportedCallingCreateNClob() throws SQLException { - conn.createNClob(); + conn.createNClob(); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) + @Test( expected = SQLFeatureNotSupportedException.class ) public void featureNotSupportedCallinCreateSQLXML() throws SQLException { - conn.createSQLXML(); + conn.createSQLXML(); } /** * @throws SQLException */ - @Test(expected = SQLFeatureNotSupportedException.class) + @Test( expected = SQLFeatureNotSupportedException.class ) public void featureNotSupportedCallingCreateStruct() throws SQLException { - conn.createStruct("typeName", new Object[] {}); + conn.createStruct("typeName", new Object[] {}); } /** - * This feature is not supported, but it doesnt throw the - * SQLFeatureNotSupportedException, it silently ignores any passed in + * This feature is not supported, but it doesnt throw the SQLFeatureNotSupportedException, it silently ignores any passed in * argument. * * @throws SQLException */ @Test - public void featureNotSupportedCallingSetTransactionIsolation() - throws SQLException { - conn.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED); + public void featureNotSupportedCallingSetTransactionIsolation() throws SQLException { + conn.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED); } /** - * This feature is not supported, but it doesnt throw the - * SQLFeatureNotSupportedException, it silently ignores any passed in + * This feature is not supported, but it doesnt throw the SQLFeatureNotSupportedException, it silently ignores any passed in * argument. * * @throws SQLException */ @Test public void featureNotSupportedCallingSetCatalog() throws SQLException { - conn.setCatalog("catalog"); + conn.setCatalog("catalog"); } } Index: utils/modeshape-jdbc/src/test/java/org/modeshape/jdbc/JcrDriverIntegrationTest.java =================================================================== --- utils/modeshape-jdbc/src/test/java/org/modeshape/jdbc/JcrDriverIntegrationTest.java (revision 2647) +++ utils/modeshape-jdbc/src/test/java/org/modeshape/jdbc/JcrDriverIntegrationTest.java (working copy) @@ -410,10 +410,10 @@ public class JcrDriverIntegrationTest extends ConnectionResultsComparator { public void shouldBeAbleToExecuteSqlQueryWithChildAxisCriteria() throws SQLException { String[] expected = { "jcr:primaryType[STRING] jcr:path[PATH] jcr:name[STRING] jcr:score[DOUBLE] mode:localName[STRING] mode:depth[LONG]", - "nt:unstructured /Cars/Utility Utility 1.4142135381698608 Utility 2", - "nt:unstructured /Cars/Hybrid Hybrid 1.4142135381698608 Hybrid 2", - "nt:unstructured /Cars/Sports Sports 1.4142135381698608 Sports 2", - "nt:unstructured /Cars/Luxury Luxury 1.4142135381698608 Luxury 2"}; + "nt:unstructured /Cars/Utility Utility 1.0 Utility 2", + "nt:unstructured /Cars/Hybrid Hybrid 1.0 Hybrid 2", + "nt:unstructured /Cars/Sports Sports 1.0 Sports 2", + "nt:unstructured /Cars/Luxury Luxury 1.0 Luxury 2"}; ConnectionResultsComparator.executeTest(this.connection, "SELECT * FROM nt:base WHERE jcr:path LIKE '/Cars/%' AND NOT jcr:path LIKE '/Cars/%/%' ", expected, @@ -431,10 +431,10 @@ public class JcrDriverIntegrationTest extends ConnectionResultsComparator { public void shouldBeAbleToExecuteSqlQueryWithContainsCriteria() throws SQLException { String[] expected = { "jcr:primaryType[STRING] jcr:path[PATH] jcr:name[STRING] jcr:score[DOUBLE] mode:localName[STRING] mode:depth[LONG]", - "nt:unstructured /Cars/Utility Utility 1.4142135381698608 Utility 2", - "nt:unstructured /Cars/Hybrid Hybrid 1.4142135381698608 Hybrid 2", - "nt:unstructured /Cars/Sports Sports 1.4142135381698608 Sports 2", - "nt:unstructured /Cars/Luxury Luxury 1.4142135381698608 Luxury 2"}; + "nt:unstructured /Cars/Utility Utility 1.0 Utility 2", + "nt:unstructured /Cars/Hybrid Hybrid 1.0 Hybrid 2", + "nt:unstructured /Cars/Sports Sports 1.0 Sports 2", + "nt:unstructured /Cars/Luxury Luxury 1.0 Luxury 2"}; ConnectionResultsComparator.executeTest(this.connection, "SELECT * FROM nt:base WHERE jcr:path LIKE '/Cars/%' AND NOT jcr:path LIKE '/Cars/%/%'", Index: utils/modeshape-jdbc/src/test/java/org/modeshape/jdbc/JcrStatementTest.java =================================================================== --- utils/modeshape-jdbc/src/test/java/org/modeshape/jdbc/JcrStatementTest.java (revision 2647) +++ utils/modeshape-jdbc/src/test/java/org/modeshape/jdbc/JcrStatementTest.java (working copy) @@ -36,8 +36,6 @@ import java.sql.SQLException; import java.sql.Statement; import java.util.List; import java.util.Set; - -import javax.jcr.RepositoryException; import javax.jcr.nodetype.NodeType; import javax.jcr.query.QueryResult; import org.junit.After; @@ -226,7 +224,7 @@ public class JcrStatementTest { } @Test - public void shouldSupportEquals() throws SQLException { + public void shouldSupportEquals() { assertTrue(stmt.equals(stmt)); JcrStatement stmt2 = null; @@ -235,7 +233,6 @@ public class JcrStatementTest { assertFalse(stmt.equals(stmt2)); - } finally { if (stmt2 != null) { stmt2.close(); @@ -335,10 +332,10 @@ public class JcrStatementTest { @Override public void close() { } - + /** * {@inheritDoc} - * + * * @see org.modeshape.jdbc.delegate.RepositoryDelegate#closeStatement() */ @Override @@ -349,7 +346,7 @@ public class JcrStatementTest { public void commit() { } - @Override + @Override public boolean isValid( int timeout ) { return false; }