Index: src/main/java/org/modeshape/jdbc/JcrMetaData.java =================================================================== --- src/main/java/org/modeshape/jdbc/JcrMetaData.java (revision 2268) +++ src/main/java/org/modeshape/jdbc/JcrMetaData.java (working copy) @@ -32,7 +32,6 @@ import java.util.Arrays; import java.util.Collections; import java.util.Comparator; -import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -37,6 +36,7 @@ import java.util.List; import java.util.Map; import java.util.logging.Level; + import javax.jcr.Repository; import javax.jcr.RepositoryException; import javax.jcr.nodetype.NodeType; @@ -42,6 +42,7 @@ import javax.jcr.nodetype.NodeType; import javax.jcr.nodetype.PropertyDefinition; import javax.jcr.query.QueryResult; + import org.modeshape.jdbc.metadata.JDBCColumnNames; import org.modeshape.jdbc.metadata.JDBCColumnPositions; import org.modeshape.jdbc.metadata.MetaDataQueryResult; @@ -2388,14 +2389,8 @@ private List filterNodeTypes( String tableNamePattern ) throws RepositoryException { List nodetypes = null; - if (tableNamePattern.trim().equals(WILDCARD)) { - + if (tableNamePattern.trim().equals(WILDCARD)) { nodetypes = this.connection.getRepositoryDelegate().nodeTypes(); - Iterator nodeIt = nodetypes.iterator(); - while (nodeIt.hasNext()) { - NodeType type = nodeIt.next(); - if (!hasColumnedDefined(type)) nodeIt.remove(); - } } else if (tableNamePattern.contains(WILDCARD)) { nodetypes = new ArrayList(); @@ -2419,8 +2414,6 @@ while (nodeIt.hasNext()) { NodeType type = nodeIt.next(); - - if (!hasColumnedDefined(type)) continue; if (isLeading) { if (isTrailing) { @@ -2441,7 +2434,7 @@ } else { NodeType nt = this.connection.getRepositoryDelegate().nodeType(tableNamePattern); nodetypes = new ArrayList(1); - if (nt != null && hasColumnedDefined(nt)) { + if (nt != null) { nodetypes.add(nt); } } @@ -2459,12 +2452,9 @@ return nodetypes; } - private List filterPropertyDefnitions( String columnNamePattern, NodeType nodeType) { + private List filterPropertyDefnitions( String columnNamePattern, NodeType nodeType) throws RepositoryException { - List allDefns = new ArrayList(); - - addPropertyDefinitions(allDefns, nodeType); - addSuperPropertyDefinitions(allDefns, nodeType); + List allDefns = this.connection.getRepositoryDelegate().getPropertyDefinitions(nodeType); List resultDefns = null; @@ -2532,56 +2522,4 @@ return resultDefns; } - /** - * isTableValid determines if the node type should be exposed as a table. - * A table must have at least one column, and the property definitions - * and superTypes provide the columns. As long as one is - * defined, then one table is valid for exposure. - * - * @param nodeType - * @return true if a column is defined for the table - */ - private boolean hasColumnedDefined(NodeType nodeType) { - List allDefns = new ArrayList(); - addPropertyDefinitions(allDefns, nodeType); - addSuperPropertyDefinitions(allDefns, nodeType); - - return (allDefns.size() > 0 ? true : false); - - } - - /** - * search recursively thru the supertypes to find other columns that - * are to be exposed for a single table. - * @param allDefns - * @param nodetype - */ - private void addSuperPropertyDefinitions(List allDefns, NodeType nodetype) { - NodeType[] superTypes = nodetype.getSupertypes(); - if (superTypes != null && superTypes.length > 0) { - for (int i = 0; i mapDefns, NodeType nodetype) { - PropertyDefinition[] defns = nodetype.getPropertyDefinitions(); - if (defns != null && defns.length > 0) { - for (int i=0; i nodeTypes() throws RepositoryException { + protected List loadNodeTypes() throws RepositoryException { List types = new ArrayList(); NodeTypeIterator its = session().getWorkspace().getNodeTypeManager().getAllNodeTypes(); while (its.hasNext()) { @@ -142,7 +138,6 @@ types.add((NodeType)its.next()); } return types; - } /** Index: src/main/java/org/modeshape/jdbc/delegate/RepositoryDelegate.java =================================================================== --- src/main/java/org/modeshape/jdbc/delegate/RepositoryDelegate.java (revision 2268) +++ src/main/java/org/modeshape/jdbc/delegate/RepositoryDelegate.java (working copy) @@ -31,9 +31,11 @@ import javax.jcr.RepositoryException; import javax.jcr.nodetype.NodeType; +import javax.jcr.nodetype.PropertyDefinition; import javax.jcr.query.QueryResult; import org.modeshape.jdbc.JcrConnection; +import org.modeshape.jdbc.JcrMetaData; @@ -59,6 +61,17 @@ NodeType nodeType( String name ) throws RepositoryException; /** + * Call to get {@link PropertyDefinition}s for a specific {@link NodeType}. + * This method is provided so that {@link JcrMetaData} doesn't have to duplicate + * the same filtering logic that the delegate will do in order to determine + * if the {@link NodeType} is valid for inclusion as a table. + * @param nodeType + * @return PropertyDefinition + * @throws RepositoryException + */ + List getPropertyDefinitions(NodeType nodeType) throws RepositoryException; + + /** * Call to get all the {@link NodeType}s defined. * @return List of all the node types. * @throws RepositoryException Index: src/main/java/org/modeshape/jdbc/delegate/HttpRepositoryDelegate.java =================================================================== --- src/main/java/org/modeshape/jdbc/delegate/HttpRepositoryDelegate.java (revision 2268) +++ src/main/java/org/modeshape/jdbc/delegate/HttpRepositoryDelegate.java (working copy) @@ -101,52 +101,36 @@ public String getDescriptor(String descriptorKey) { return ""; } - + @Override - public synchronized NodeType nodeType( String name ) throws RepositoryException { - if (nodeTypes == null) nodeTypes(); - - NodeType nodetype = nodeTypes.get(name); - if (nodetype == null) { - throw new RepositoryException(JdbcI18n.unableToGetNodeType.text(name)); - } - - return nodetype; - } - - @Override - public synchronized List nodeTypes() throws RepositoryException { - if (nodeTypes == null) { - Collection results; - try { - results = this.restClient.getNodeTypes(workspace, URL_PATH, URL_DEPTH); - if (results == null || results.size() == 0) { - String msg = JdbcI18n.noNodeTypesReturned.text(this.workspace.getServer().getUrl() + "/" + - this.workspace.getRepository().getName() + "/" + - this.workspace.getName() + - URL_PATH + URL_DEPTH); - throw new RepositoryException(msg); - } - Map loadingNodeTypes = new HashMap(results.size()); - Iterator resultsIt = results.iterator(); - while (resultsIt.hasNext()) { - org.modeshape.web.jcr.rest.client.domain.NodeType nodetype = resultsIt.next(); - if (nodetype != null) { - - HttpNodeType localnodetype = new HttpNodeType(nodetype); - - loadingNodeTypes.put(localnodetype.getName(), localnodetype); - } - - } - this.nodeTypes = loadingNodeTypes; + protected List loadNodeTypes() throws RepositoryException { + List loadingNodeTypes = null; + Collection results; + try { + results = this.restClient.getNodeTypes(workspace, URL_PATH, URL_DEPTH); + if (results == null || results.size() == 0) { + String msg = JdbcI18n.noNodeTypesReturned.text(this.workspace.getServer().getUrl() + "/" + + this.workspace.getRepository().getName() + "/" + + this.workspace.getName() + + URL_PATH + URL_DEPTH); + throw new RepositoryException(msg); + } + loadingNodeTypes = new ArrayList(results.size()); + Iterator resultsIt = results.iterator(); + while (resultsIt.hasNext()) { + org.modeshape.web.jcr.rest.client.domain.NodeType nodetype = resultsIt.next(); + if (nodetype != null) { - } catch (Exception e) { - throw new RepositoryException(JdbcI18n.unableToGetNodeTypes.text(this.workspace.getRepository().getName()), e); + HttpNodeType localnodetype = new HttpNodeType(nodetype); + loadingNodeTypes.add(localnodetype); + } } - } - - return new ArrayList(nodeTypes.values()); + + } catch (Exception e) { + throw new RepositoryException(JdbcI18n.unableToGetNodeTypes.text(this.workspace.getRepository().getName()), e); + } + + return loadingNodeTypes; } @Override Index: src/main/java/org/modeshape/jdbc/delegate/AbstractRepositoryDelegate.java =================================================================== --- src/main/java/org/modeshape/jdbc/delegate/AbstractRepositoryDelegate.java (revision 2268) +++ src/main/java/org/modeshape/jdbc/delegate/AbstractRepositoryDelegate.java (working copy) @@ -26,6 +26,12 @@ import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.SQLException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; import java.util.Properties; import java.util.Set; @@ -30,6 +36,9 @@ import java.util.Set; import javax.jcr.Repository; +import javax.jcr.RepositoryException; +import javax.jcr.nodetype.NodeType; +import javax.jcr.nodetype.PropertyDefinition; import org.modeshape.jdbc.JcrConnection; import org.modeshape.jdbc.JcrMetaData; @@ -48,6 +57,21 @@ private ConnectionInfo connInfo = null; private String url; private Properties propertiesInfo; + private Map nodeTypes; + private Map > nodeTypeDefns; + + + /** + * EXCLUDE_TYEPS are those node types that are to be excluded from the inclusion + * in the node types returned. + */ + private static Set EXCLUDE_TYPES = new HashSet() ; + + { + EXCLUDE_TYPES.add("mode:defined"); + EXCLUDE_TYPES.add("*"); + } + public AbstractRepositoryDelegate(String url, Properties info) { super(); @@ -104,6 +128,119 @@ protected void setRepositoryNames(Set repositoryNames) { this.repositoryNames = repositoryNames; } + + + public synchronized NodeType nodeType( String name ) throws RepositoryException { + if (nodeTypes == null) filterNodeTypes(); + + NodeType nodetype = nodeTypes.get(name); + if (nodetype == null) { + throw new RepositoryException(JdbcI18n.unableToGetNodeType.text(name)); + } + + return nodetype; + } + + public synchronized List nodeTypes() throws RepositoryException { + if (nodeTypes == null) filterNodeTypes(); + + return new ArrayList(nodeTypes.values()); + } + + public synchronized List getPropertyDefinitions(NodeType nodeType) throws RepositoryException { + if (nodeTypeDefns == null) filterNodeTypes(); + + return nodeTypeDefns.get(nodeType.getName()); + } + + @SuppressWarnings("unchecked") + private void filterNodeTypes() throws RepositoryException { + List prefiltered = loadNodeTypes(); + + Map localNodeTypes = new HashMap(); + Map > localnodeTypeDefns = new HashMap >(); + + for (Iterator it=prefiltered.iterator(); it.hasNext();) { + NodeType nt = it.next(); + + if (EXCLUDE_TYPES.contains(nt.getName())) { + //TODO log the type is excluded + continue; + } + + // the adding of definitions are as follows: + // example; + // NodeType A + // Definitions + // SuperType 1 Definitions + // SuperType 1.1 Definitions + // SuperType 1.2 Definitions + // SuperType 2 Definitions + // .... + // SuperType 3 Definitions + // 1 - the definitions of the NodeType A are applied first + // 2 - the definitions for a SuperType (i.e., 1) and its child SuperTypes (i.e., 1.1, 1.2) are applied in order + // before adding definitions for the next 1st level SuperType (i.e., 2, 3). + Map allDefns = new HashMap(); + addPropertyDefinitions(allDefns, nt); + addSuperPropertyDefinitions(allDefns, nt); + + if (allDefns.size() > 0) { + localNodeTypes.put(nt.getName(), nt); + localnodeTypeDefns.put(nt.getName(), new ArrayList(allDefns.values())); + } + } + + this.nodeTypes = localNodeTypes; + this.nodeTypeDefns = localnodeTypeDefns; + } + + + /** + * search recursively thru the supertypes to find other columns that + * are to be exposed for a single table. + * @param allDefns + * @param nodetype + */ + private void addSuperPropertyDefinitions(Map allDefns, NodeType nodetype) { + NodeType[] superTypes = nodetype.getSupertypes(); + if (superTypes != null && superTypes.length > 0) { + for (int i = 0; i allDefns, NodeType nodetype) { + PropertyDefinition[] defns = nodetype.getPropertyDefinitions(); + if (defns != null && defns.length > 0) { + for (int i=0; i loadNodeTypes() throws RepositoryException; /** * {@inheritDoc} Index: src/test/java/org/modeshape/jdbc/JcrStatementTest.java =================================================================== --- src/test/java/org/modeshape/jdbc/JcrStatementTest.java (revision 2268) +++ src/test/java/org/modeshape/jdbc/JcrStatementTest.java (working copy) @@ -41,6 +41,7 @@ import javax.jcr.Repository; import javax.jcr.RepositoryException; import javax.jcr.nodetype.NodeType; +import javax.jcr.nodetype.PropertyDefinition; import javax.jcr.query.QueryResult; import org.junit.After; @@ -363,7 +364,18 @@ public List nodeTypes( ) throws RepositoryException { return null; } + + /** + * {@inheritDoc} + * + * @see org.modeshape.jdbc.delegate.RepositoryDelegate#getPropertyDefinitions(javax.jcr.nodetype.NodeType) + */ + @Override + public List getPropertyDefinitions(NodeType nodeType) { + return null; + } + @Override public void rollback() { } Index: src/test/java/org/modeshape/jdbc/JcrDriverIntegrationTest.java =================================================================== --- src/test/java/org/modeshape/jdbc/JcrDriverIntegrationTest.java (revision 2268) +++ src/test/java/org/modeshape/jdbc/JcrDriverIntegrationTest.java (working copy) @@ -423,53 +423,53 @@ this.compareColumns = false; String[] expected = { - "TABLE_CAT[String] TABLE_SCHEM[String] TABLE_NAME[String] TABLE_TYPE[String] REMARKS[String] TYPE_CAT[String] TYPE_SCHEM[String] TYPE_NAME[String] SELF_REFERENCING_COL_NAME[String] REF_GENERATION[String]", - "cars NULL car:Car VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL mix:created VIEW Is Mixin: true NULL NULL NULL null DERIVED", - "cars NULL mix:etag VIEW Is Mixin: true NULL NULL NULL null DERIVED", - "cars NULL mix:language VIEW Is Mixin: true NULL NULL NULL null DERIVED", - "cars NULL mix:lastModified VIEW Is Mixin: true NULL NULL NULL null DERIVED", - "cars NULL mix:lifecycle VIEW Is Mixin: true NULL NULL NULL null DERIVED", - "cars NULL mix:lockable VIEW Is Mixin: true NULL NULL NULL null DERIVED", - "cars NULL mix:managedRetention VIEW Is Mixin: true NULL NULL NULL null DERIVED", - "cars NULL mix:mimeType VIEW Is Mixin: true NULL NULL NULL null DERIVED", - "cars NULL mix:referenceable VIEW Is Mixin: true NULL NULL NULL null DERIVED", - "cars NULL mix:shareable VIEW Is Mixin: true NULL NULL NULL null DERIVED", - "cars NULL mix:simpleVersionable VIEW Is Mixin: true NULL NULL NULL null DERIVED", - "cars NULL mix:title VIEW Is Mixin: true NULL NULL NULL null DERIVED", - "cars NULL mix:versionable VIEW Is Mixin: true NULL NULL NULL null DERIVED", - "cars NULL mode:defined VIEW Is Mixin: true NULL NULL NULL null DERIVED", - "cars NULL mode:hashed VIEW Is Mixin: true NULL NULL NULL null DERIVED", - "cars NULL mode:lock VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL mode:locks VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL mode:namespace VIEW Is Mixin: false NULL NULL NULL mode:uri DERIVED", - "cars NULL mode:namespaces VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL mode:nodeTypes VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL mode:resource VIEW Is Mixin: false NULL NULL NULL jcr:data DERIVED", - "cars NULL mode:root VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL mode:share VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL mode:system VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL mode:versionStorage VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:activity VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:address VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:base VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:childNodeDefinition VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:configuration VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:file VIEW Is Mixin: false NULL NULL NULL jcr:content DERIVED", - "cars NULL nt:folder VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:frozenNode VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:hierarchyNode VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:linkedFile VIEW Is Mixin: false NULL NULL NULL jcr:content DERIVED", - "cars NULL nt:naturalText VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:nodeType VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:propertyDefinition VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:query VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:resource VIEW Is Mixin: false NULL NULL NULL jcr:data DERIVED", - "cars NULL nt:unstructured VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:version VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:versionHistory VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:versionLabels VIEW Is Mixin: false NULL NULL NULL null DERIVED", - "cars NULL nt:versionedChild VIEW Is Mixin: false NULL NULL NULL null DERIVED"}; + "TABLE_CAT[String] TABLE_SCHEM[String] TABLE_NAME[String] TABLE_TYPE[String] REMARKS[String] TYPE_CAT[String] TYPE_SCHEM[String] TYPE_NAME[String] SELF_REFERENCING_COL_NAME[String] REF_GENERATION[String]", + "cars NULL car:Car VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL mix:created VIEW Is Mixin: true NULL NULL NULL null DERIVED", + "cars NULL mix:etag VIEW Is Mixin: true NULL NULL NULL null DERIVED", + "cars NULL mix:language VIEW Is Mixin: true NULL NULL NULL null DERIVED", + "cars NULL mix:lastModified VIEW Is Mixin: true NULL NULL NULL null DERIVED", + "cars NULL mix:lifecycle VIEW Is Mixin: true NULL NULL NULL null DERIVED", + "cars NULL mix:lockable VIEW Is Mixin: true NULL NULL NULL null DERIVED", + "cars NULL mix:managedRetention VIEW Is Mixin: true NULL NULL NULL null DERIVED", + "cars NULL mix:mimeType VIEW Is Mixin: true NULL NULL NULL null DERIVED", + "cars NULL mix:referenceable VIEW Is Mixin: true NULL NULL NULL null DERIVED", + "cars NULL mix:shareable VIEW Is Mixin: true NULL NULL NULL null DERIVED", + "cars NULL mix:simpleVersionable VIEW Is Mixin: true NULL NULL NULL null DERIVED", + "cars NULL mix:title VIEW Is Mixin: true NULL NULL NULL null DERIVED", + "cars NULL mix:versionable VIEW Is Mixin: true NULL NULL NULL null DERIVED", + "cars NULL mode:hashed VIEW Is Mixin: true NULL NULL NULL null DERIVED", + "cars NULL mode:lock VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL mode:locks VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL mode:namespace VIEW Is Mixin: false NULL NULL NULL mode:uri DERIVED", + "cars NULL mode:namespaces VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL mode:nodeTypes VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL mode:resource VIEW Is Mixin: false NULL NULL NULL jcr:data DERIVED", + "cars NULL mode:root VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL mode:share VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL mode:system VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL mode:versionStorage VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:activity VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:address VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:base VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:childNodeDefinition VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:configuration VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:file VIEW Is Mixin: false NULL NULL NULL jcr:content DERIVED", + "cars NULL nt:folder VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:frozenNode VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:hierarchyNode VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:linkedFile VIEW Is Mixin: false NULL NULL NULL jcr:content DERIVED", + "cars NULL nt:naturalText VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:nodeType VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:propertyDefinition VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:query VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:resource VIEW Is Mixin: false NULL NULL NULL jcr:data DERIVED", + "cars NULL nt:unstructured VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:version VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:versionHistory VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:versionLabels VIEW Is Mixin: false NULL NULL NULL null DERIVED", + "cars NULL nt:versionedChild VIEW Is Mixin: false NULL NULL NULL null DERIVED" + }; ResultSet rs = dbmd.getTables("%", "%", "%", new String[] {}); assertResultsSetEquals(rs, expected); @@ -539,7 +539,7 @@ @Test public void shouldGetAllColumnsFor1Table() throws SQLException { this.compareColumns = false; - + String[] expected = { "TABLE_CAT[String] TABLE_SCHEM[String] TABLE_NAME[String] COLUMN_NAME[String] DATA_TYPE[Long] TYPE_NAME[String] COLUMN_SIZE[Long] BUFFER_LENGTH[Long] DECIMAL_DIGITS[Long] NUM_PREC_RADIX[Long] NULLABLE[Long] REMARKS[String] COLUMN_DEF[String] SQL_DATA_TYPE[Long] SQL_DATETIME_SUB[Long] CHAR_OCTET_LENGTH[Long] ORDINAL_POSITION[Long] IS_NULLABLE[String] SCOPE_CATLOG[String] SCOPE_SCHEMA[String] SCOPE_TABLE[String] SOURCE_DATA_TYPE[Long]", "cars NULL car:Car car:engine 12 String 50 NULL 0 0 2 NULL 0 0 0 1 YES NULL NULL NULL 0", @@ -553,34 +553,12 @@ "cars NULL car:Car car:valueRating -5 Long 20 NULL 0 0 2 NULL 0 0 0 9 YES NULL NULL NULL 0", "cars NULL car:Car car:wheelbaseInInches 6 Double 20 NULL 0 0 2 NULL 0 0 0 10 YES NULL NULL NULL 0", "cars NULL car:Car car:year 12 String 50 NULL 0 0 2 NULL 0 0 0 11 YES NULL NULL NULL 0", - "cars NULL car:Car jcr:mixinTypes 12 Name 20 NULL 0 0 2 NULL 0 0 0 12 YES NULL NULL NULL 0", - "cars NULL car:Car jcr:mixinTypes 12 Name 20 NULL 0 0 2 NULL 0 0 0 13 YES NULL NULL NULL 0", - "cars NULL car:Car jcr:mixinTypes 12 Name 20 NULL 0 0 2 NULL 0 0 0 14 YES NULL NULL NULL 0", - "cars NULL car:Car jcr:mixinTypes 12 Name 20 NULL 0 0 2 NULL 0 0 0 15 YES NULL NULL NULL 0", - "cars NULL car:Car jcr:primaryType 12 Name 20 NULL 0 0 1 NULL 0 0 0 16 NO NULL NULL NULL 0", - "cars NULL car:Car jcr:primaryType 12 Name 20 NULL 0 0 1 NULL 0 0 0 17 NO NULL NULL NULL 0", - "cars NULL car:Car jcr:primaryType 12 Name 20 NULL 0 0 1 NULL 0 0 0 18 NO NULL NULL NULL 0", - "cars NULL car:Car jcr:primaryType 12 Name 20 NULL 0 0 1 NULL 0 0 0 19 NO NULL NULL NULL 0", - "cars NULL car:Car modeint:multiValuedProperties 12 String 50 NULL 0 0 2 NULL 0 0 0 20 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:multiValuedProperties 12 String 50 NULL 0 0 2 NULL 0 0 0 21 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:multiValuedProperties 12 String 50 NULL 0 0 2 NULL 0 0 0 22 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:multiValuedProperties 12 String 50 NULL 0 0 2 NULL 0 0 0 23 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:multiValuedProperties 12 String 50 NULL 0 0 2 NULL 0 0 0 24 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:multiValuedProperties 12 String 50 NULL 0 0 2 NULL 0 0 0 25 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:multiValuedProperties 12 String 50 NULL 0 0 2 NULL 0 0 0 26 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:multiValuedProperties 12 String 50 NULL 0 0 2 NULL 0 0 0 27 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 28 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 29 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 30 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 31 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 32 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 33 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 34 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 35 YES NULL NULL NULL 0" + "cars NULL car:Car jcr:primaryType 12 Name 20 NULL 0 0 1 NULL 0 0 0 12 NO NULL NULL NULL 0", + "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 13 YES NULL NULL NULL 0" }; + ResultSet rs = dbmd.getColumns("%", "%", "car:Car", "%"); - assertResultsSetEquals(rs, expected); assertRowCount(17); @@ -589,7 +567,7 @@ @Test public void shouldGetOnlyColumnsForCarPrefixedTables() throws SQLException { this.compareColumns = false; - + String[] expected = { "TABLE_CAT[String] TABLE_SCHEM[String] TABLE_NAME[String] COLUMN_NAME[String] DATA_TYPE[Long] TYPE_NAME[String] COLUMN_SIZE[Long] BUFFER_LENGTH[Long] DECIMAL_DIGITS[Long] NUM_PREC_RADIX[Long] NULLABLE[Long] REMARKS[String] COLUMN_DEF[String] SQL_DATA_TYPE[Long] SQL_DATETIME_SUB[Long] CHAR_OCTET_LENGTH[Long] ORDINAL_POSITION[Long] IS_NULLABLE[String] SCOPE_CATLOG[String] SCOPE_SCHEMA[String] SCOPE_TABLE[String] SOURCE_DATA_TYPE[Long]", "cars NULL car:Car car:engine 12 String 50 NULL 0 0 2 NULL 0 0 0 1 YES NULL NULL NULL 0", @@ -603,35 +581,14 @@ "cars NULL car:Car car:valueRating -5 Long 20 NULL 0 0 2 NULL 0 0 0 9 YES NULL NULL NULL 0", "cars NULL car:Car car:wheelbaseInInches 6 Double 20 NULL 0 0 2 NULL 0 0 0 10 YES NULL NULL NULL 0", "cars NULL car:Car car:year 12 String 50 NULL 0 0 2 NULL 0 0 0 11 YES NULL NULL NULL 0", - "cars NULL car:Car jcr:mixinTypes 12 Name 20 NULL 0 0 2 NULL 0 0 0 12 YES NULL NULL NULL 0", - "cars NULL car:Car jcr:mixinTypes 12 Name 20 NULL 0 0 2 NULL 0 0 0 13 YES NULL NULL NULL 0", - "cars NULL car:Car jcr:mixinTypes 12 Name 20 NULL 0 0 2 NULL 0 0 0 14 YES NULL NULL NULL 0", - "cars NULL car:Car jcr:mixinTypes 12 Name 20 NULL 0 0 2 NULL 0 0 0 15 YES NULL NULL NULL 0", - "cars NULL car:Car jcr:primaryType 12 Name 20 NULL 0 0 1 NULL 0 0 0 16 NO NULL NULL NULL 0", - "cars NULL car:Car jcr:primaryType 12 Name 20 NULL 0 0 1 NULL 0 0 0 17 NO NULL NULL NULL 0", - "cars NULL car:Car jcr:primaryType 12 Name 20 NULL 0 0 1 NULL 0 0 0 18 NO NULL NULL NULL 0", - "cars NULL car:Car jcr:primaryType 12 Name 20 NULL 0 0 1 NULL 0 0 0 19 NO NULL NULL NULL 0", - "cars NULL car:Car modeint:multiValuedProperties 12 String 50 NULL 0 0 2 NULL 0 0 0 20 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:multiValuedProperties 12 String 50 NULL 0 0 2 NULL 0 0 0 21 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:multiValuedProperties 12 String 50 NULL 0 0 2 NULL 0 0 0 22 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:multiValuedProperties 12 String 50 NULL 0 0 2 NULL 0 0 0 23 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:multiValuedProperties 12 String 50 NULL 0 0 2 NULL 0 0 0 24 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:multiValuedProperties 12 String 50 NULL 0 0 2 NULL 0 0 0 25 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:multiValuedProperties 12 String 50 NULL 0 0 2 NULL 0 0 0 26 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:multiValuedProperties 12 String 50 NULL 0 0 2 NULL 0 0 0 27 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 28 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 29 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 30 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 31 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 32 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 33 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 34 YES NULL NULL NULL 0", - "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 35 YES NULL NULL NULL 0" + "cars NULL car:Car jcr:primaryType 12 Name 20 NULL 0 0 1 NULL 0 0 0 12 NO NULL NULL NULL 0", + "cars NULL car:Car modeint:nodeDefinition 12 String 50 NULL 0 0 2 NULL 0 0 0 13 YES NULL NULL NULL 0" }; + ResultSet rs = dbmd.getColumns("%", "%", "car%", "%"); - assertResultsSetEquals(rs, expected); + assertResultsSetEquals(rs, expected); assertRowCount(11); }