diff --git a/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java b/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java index 288db09..5fc9210 100644 --- a/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java +++ b/src/org/olap4j/driver/xmla/XmlaOlap4jConnection.java @@ -836,7 +836,8 @@ public void handle( California manager,No HR Cube */ - String catalogName = XmlaOlap4jUtil.stringElement(row, "CATALOG_NAME"); + String catalogName = + XmlaOlap4jUtil.stringElement(row, "CATALOG_NAME"); // Unused: DESCRIPTION, ROLES list.add( new XmlaOlap4jCatalog( @@ -1328,7 +1329,9 @@ static class CatalogSchemaHandler extends HandlerImpl { public CatalogSchemaHandler(String catalogName) { super(); if (catalogName == null) { - throw new RuntimeException("The CatalogSchemaHandler handler requires a catalog name."); + throw new RuntimeException( + "The CatalogSchemaHandler handler requires a catalog " + + "name."); } this.catalogName = catalogName; } @@ -1891,7 +1894,8 @@ public MetadataColumn getColumn(String name) { } } - private static final Pattern LOWERCASE_PATTERN = Pattern.compile(".*[a-z].*"); + private static final Pattern LOWERCASE_PATTERN = + Pattern.compile(".*[a-z].*"); static class MetadataColumn { final String name; diff --git a/src/org/olap4j/driver/xmla/cache/XmlaOlap4jNamedMemoryCache.java b/src/org/olap4j/driver/xmla/cache/XmlaOlap4jNamedMemoryCache.java index 9461743..627bf69 100644 --- a/src/org/olap4j/driver/xmla/cache/XmlaOlap4jNamedMemoryCache.java +++ b/src/org/olap4j/driver/xmla/cache/XmlaOlap4jNamedMemoryCache.java @@ -69,13 +69,17 @@ public static enum Property { * The number of entries to maintain in cache under * the given cache name. */ - Size("Maximum number of SOAP requests which will be cached under the given cache name."), + Size( + "Maximum number of SOAP requests which will be cached under the " + + "given cache name."), /** * The number of seconds to maintain * entries in cache before expiration. */ - Timeout("Maximum TTL of SOAP requests which will be cached under the given cache name."), + Timeout( + "Maximum TTL of SOAP requests which will be cached under the given " + + "cache name."), /** * Eviction mode. Supported eviction modes are diff --git a/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jCookieManager.java b/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jCookieManager.java index 64895ff..7e7d865 100644 --- a/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jCookieManager.java +++ b/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jCookieManager.java @@ -123,8 +123,9 @@ public void storeCookies(URLConnection conn) { domainStore.put(name, cookie); cookie.put(name, value); - if (this.debug == true) { - System.out.println("Saving cookie : " + name + "=" + value); + if (this.debug) { + System.out.println( + "Saving cookie : " + name + "=" + value); } } @@ -198,7 +199,7 @@ && isNotExpired((String) cookie.get(EXPIRES))) } } try { - if (this.debug == true + if (this.debug && !(cookieStringBuffer.toString().equals(""))) { System.out.println( diff --git a/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jHttpProxy.java b/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jHttpProxy.java index 81acfd3..4aaa063 100644 --- a/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jHttpProxy.java +++ b/src/org/olap4j/driver/xmla/proxy/XmlaOlap4jHttpProxy.java @@ -103,7 +103,9 @@ public byte[] getResponse(URL url, String request) // The response will only be available here anyways. } catch (Exception e) { throw new XmlaOlap4jProxyException( - "This proxy encountered an exception while processing the query.", e); + "This proxy encountered an exception while processing the " + + "query.", + e); } } diff --git a/src/org/olap4j/mdx/IdentifierNode.java b/src/org/olap4j/mdx/IdentifierNode.java index dad6eca..bd067c5 100644 --- a/src/org/olap4j/mdx/IdentifierNode.java +++ b/src/org/olap4j/mdx/IdentifierNode.java @@ -181,7 +181,8 @@ public IdentifierNode deepCopy() { * was {@link Quoting quoted}. For example, * *
- * parseIdentifier("[Customers].USA.[South Dakota].[Sioux Falls].&[1245]") + * parseIdentifier( + * "[Customers].USA.[South Dakota].[Sioux Falls].&[1245]") *
* * returns diff --git a/src/org/olap4j/mdx/parser/impl/DefaultMdxParser.cup b/src/org/olap4j/mdx/parser/impl/DefaultMdxParser.cup index 4099944..f2dd756 100644 --- a/src/org/olap4j/mdx/parser/impl/DefaultMdxParser.cup +++ b/src/org/olap4j/mdx/parser/impl/DefaultMdxParser.cup @@ -95,8 +95,8 @@ parser code {: return (ParseTreeNode) parse_tree.value; } catch (Exception e) { throw new RuntimeException( - "Syntax error while parsing MDX expression '" + queryString + - "'", + "Syntax error while parsing MDX expression '" + queryString + + "'", e); } finally { this.scanner = null; @@ -151,9 +151,9 @@ parser code {: List cellProps) { final AxisNode filterAxis = - filter == null ? - null : - new AxisNode( + filter == null + ? null + : new AxisNode( filter.getRegion(), false, Axis.FILTER, Collections.emptyList(), filter); // sort axes by ordinal @@ -202,8 +202,8 @@ parser code {: scanner.createRegion(cur_token.left, cur_token.right); throw new MdxParseException( region, - "Syntax error at " + region + - ", token '" + s + "'"); + "Syntax error at " + region + + ", token '" + s + "'"); } else { throw new RuntimeException( "Syntax error at token '" + s + "'"); @@ -763,7 +763,8 @@ term3 ::= ParseRegion region = createRegion(xleft, nright); RESULT = new CallNode(region, "IS NULL", Syntax.Postfix, x); :} - | term3:x IS term2:y {: // e.g. "x IS y"; but "x IS NULL" is handled elsewhere + | term3:x IS term2:y {: + // e.g. "x IS y"; but "x IS NULL" is handled elsewhere ParseRegion region = createRegion(xleft, yright); RESULT = new CallNode(region, "IS", Syntax.Infix, x, y); :} @@ -1502,8 +1503,8 @@ axis_specification ::= if (index < 0 || index != d) { throw new MdxParseException( createRegion(nleft, nright), - "Invalid axis specification. The axis number must be a " + - "non-negative integer, but it was " + d + "."); + "Invalid axis specification. The axis number must be a " + + "non-negative integer, but it was " + d + "."); } Axis axis = Axis.Factory.forOrdinal(index); diff --git a/src/org/olap4j/metadata/Datatype.java b/src/org/olap4j/metadata/Datatype.java index a539beb..a7423c4 100644 --- a/src/org/olap4j/metadata/Datatype.java +++ b/src/org/olap4j/metadata/Datatype.java @@ -31,9 +31,19 @@ public enum Datatype { DOUBLE(5, "DBTYPE_R8", "A double-precision floating-point value: Double"), - CURRENCY(6, "DBTYPE_CY", "A currency value: LARGE_INTEGER, Currency is a fixed-point number with four digits to the right of the decimal point. It is stored in an eight-byte signed integer, scaled by 10,000."), - - BOOLEAN(11, "DBTYPE_BOOL", "A Boolean value stored in the same way as in Automation: VARIANT_BOOL; 0 means false and ~0 (bitwise, the value is not 0; that is, all bits are set to 1) means true."), + CURRENCY( + 6, + "DBTYPE_CY", + "A currency value: LARGE_INTEGER, Currency is a fixed-point number with " + + "four digits to the right of the decimal point. It is stored in an " + + "eight-byte signed integer, scaled by 10,000."), + + BOOLEAN( + 11, + "DBTYPE_BOOL", + "A Boolean value stored in the same way as in Automation: VARIANT_BOOL; " + + "0 means false and ~0 (bitwise, the value is not 0; that is, all bits " + + "are set to 1) means true."), /** * Used by SQL Server for value. @@ -54,12 +64,28 @@ public enum Datatype { * The following values exactly match VARENUM * in Automation but cannot be used in VARIANT. */ - LARGE_INTEGER(20, "DBTYPE_I8", "An eight-byte, signed integer: LARGE_INTEGER"), + LARGE_INTEGER( + 20, + "DBTYPE_I8", + "An eight-byte, signed integer: LARGE_INTEGER"), /* * The following values are not in VARENUM in OLE. */ - STRING(130, "DBTYPE_WSTR", "A null-terminated Unicode character string: wchar_t[length]; If DBTYPE_WSTR is used by itself, the number of bytes allocated for the string, including the null-termination character, is specified by cbMaxLen in the DBBINDING structure. If DBTYPE_WSTR is combined with DBTYPE_BYREF, the number of bytes allocated for the string, including the null-termination character, is at least the length of the string plus two. In either case, the actual length of the string is determined from the bound length value. The maximum length of the string is the number of allocated bytes divided by sizeof(wchar_t) and truncated to the nearest integer."); + STRING( + 130, + "DBTYPE_WSTR", + "A null-terminated Unicode character string: wchar_t[length]; If " + + "DBTYPE_WSTR is used by itself, the number of bytes allocated " + + "for the string, including the null-termination character, is " + + "specified by cbMaxLen in the DBBINDING structure. If " + + "DBTYPE_WSTR is combined with DBTYPE_BYREF, the number of bytes " + + "allocated for the string, including the null-termination character, " + + "is at least the length of the string plus two. In either case, the " + + "actual length of the string is determined from the bound length " + + "value. The maximum length of the string is the number of allocated " + + "bytes divided by sizeof(wchar_t) and truncated to the nearest " + + "integer."); private final int xmlaOrdinal; diff --git a/src/org/olap4j/metadata/Property.java b/src/org/olap4j/metadata/Property.java index 4d179e1..f1333f5 100644 --- a/src/org/olap4j/metadata/Property.java +++ b/src/org/olap4j/metadata/Property.java @@ -167,111 +167,183 @@ enum StandardMemberProperty implements Property { * Definition of the property which * holds the name of the current catalog. */ - CATALOG_NAME(Datatype.STRING, 10, false, "Optional. The name of the catalog to which this member belongs. NULL if the provider does not support catalogs."), + CATALOG_NAME( + Datatype.STRING, + 10, + false, + "Optional. The name of the catalog to which this member belongs. NULL if the provider does not support catalogs."), /** * Definition of the property which * holds the name of the current schema. */ - SCHEMA_NAME(Datatype.STRING, 11, false, "Optional. The name of the schema to which this member belongs. NULL if the provider does not support schemas."), + SCHEMA_NAME( + Datatype.STRING, + 11, + false, + "Optional. The name of the schema to which this member belongs. NULL if the provider does not support schemas."), /** * Definition of the property which * holds the name of the current cube. */ - CUBE_NAME(Datatype.STRING, 12, false, "Required. Name of the cube to which this member belongs."), + CUBE_NAME( + Datatype.STRING, + 12, + false, + "Required. Name of the cube to which this member belongs."), /** * Definition of the property which * holds the unique name of the current dimension. */ - DIMENSION_UNIQUE_NAME(Datatype.STRING, 13, false, "Required. Unique name of the dimension to which this member belongs. For providers that generate unique names by qualification, each component of this name is delimited."), + DIMENSION_UNIQUE_NAME( + Datatype.STRING, + 13, + false, + "Required. Unique name of the dimension to which this member belongs. For providers that generate unique names by qualification, each component of this name is delimited."), /** * Definition of the property which * holds the unique name of the current hierarchy. */ - HIERARCHY_UNIQUE_NAME(Datatype.STRING, 14, false, "Required. Unique name of the hierarchy. If the member belongs to more than one hierarchy, there is one row for each hierarchy to which it belongs. For providers that generate unique names by qualification, each component of this name is delimited."), + HIERARCHY_UNIQUE_NAME( + Datatype.STRING, + 14, + false, + "Required. Unique name of the hierarchy. If the member belongs to more than one hierarchy, there is one row for each hierarchy to which it belongs. For providers that generate unique names by qualification, each component of this name is delimited."), /** * Definition of the property which * holds the unique name of the current level. */ - LEVEL_UNIQUE_NAME(Datatype.STRING, 15, false, "Required. Unique name of the level to which the member belongs. For providers that generate unique names by qualification, each component of this name is delimited."), + LEVEL_UNIQUE_NAME( + Datatype.STRING, + 15, + false, + "Required. Unique name of the level to which the member belongs. For providers that generate unique names by qualification, each component of this name is delimited."), /** * Definition of the property which * holds the ordinal of the current level. */ - LEVEL_NUMBER(Datatype.UNSIGNED_INTEGER, 16, false, "Required. The distance of the member from the root of the hierarchy. The root level is zero."), + LEVEL_NUMBER( + Datatype.UNSIGNED_INTEGER, + 16, + false, + "Required. The distance of the member from the root of the hierarchy. The root level is zero."), /** * Definition of the property which * holds the ordinal of the current member. */ - MEMBER_ORDINAL(Datatype.UNSIGNED_INTEGER, 17, false, "Required. Ordinal number of the member. Sort rank of the member when members of this dimension are sorted in their natural sort order. If providers do not have the concept of natural ordering, this should be the rank when sorted by MEMBER_NAME."), + MEMBER_ORDINAL( + Datatype.UNSIGNED_INTEGER, + 17, + false, + "Required. Ordinal number of the member. Sort rank of the member when members of this dimension are sorted in their natural sort order. If providers do not have the concept of natural ordering, this should be the rank when sorted by MEMBER_NAME."), /** * Definition of the property which * holds the name of the current member. */ - MEMBER_NAME(Datatype.STRING, 18, false, "Required. Name of the member."), + MEMBER_NAME( + Datatype.STRING, + 18, + false, + "Required. Name of the member."), /** * Definition of the property which * holds the unique name of the current member. */ - MEMBER_UNIQUE_NAME(Datatype.STRING, 19, false, "Required. Unique name of the member. For providers that generate unique names by qualification, each component of this name is delimited."), + MEMBER_UNIQUE_NAME( + Datatype.STRING, + 19, + false, + "Required. Unique name of the member. For providers that generate unique names by qualification, each component of this name is delimited."), /** * Definition of the property which * holds the type of the member. */ - MEMBER_TYPE(Datatype.STRING, 20, false, "Required. Type of the member. Can be one of the following values: MDMEMBER_Datatype.TYPE_REGULAR, MDMEMBER_Datatype.TYPE_ALL, MDMEMBER_Datatype.TYPE_FORMULA, MDMEMBER_Datatype.TYPE_MEASURE, MDMEMBER_Datatype.TYPE_UNKNOWN. MDMEMBER_Datatype.TYPE_FORMULA takes precedence over MDMEMBER_Datatype.TYPE_MEASURE. Therefore, if there is a formula (calculated) member on the Measures dimension, it is listed as MDMEMBER_Datatype.TYPE_FORMULA."), + MEMBER_TYPE( + Datatype.STRING, + 20, + false, + "Required. Type of the member. Can be one of the following values: MDMEMBER_Datatype.TYPE_REGULAR, MDMEMBER_Datatype.TYPE_ALL, MDMEMBER_Datatype.TYPE_FORMULA, MDMEMBER_Datatype.TYPE_MEASURE, MDMEMBER_Datatype.TYPE_UNKNOWN. MDMEMBER_Datatype.TYPE_FORMULA takes precedence over MDMEMBER_Datatype.TYPE_MEASURE. Therefore, if there is a formula (calculated) member on the Measures dimension, it is listed as MDMEMBER_Datatype.TYPE_FORMULA."), /** * Definition of the property which * holds the GUID of the member */ - MEMBER_GUID(Datatype.STRING, 21, false, "Optional. Member GUID. NULL if no GUID exists."), + MEMBER_GUID( + Datatype.STRING, + 21, + false, + "Optional. Member GUID. NULL if no GUID exists."), /** * Definition of the property which * holds the label or caption associated with the member, or the * member's name if no caption is defined. */ - MEMBER_CAPTION(Datatype.STRING, 22, false, "Required. A label or caption associated with the member. Used primarily for display purposes. If a caption does not exist, MEMBER_NAME is returned."), + MEMBER_CAPTION( + Datatype.STRING, + 22, + false, + "Required. A label or caption associated with the member. Used primarily for display purposes. If a caption does not exist, MEMBER_NAME is returned."), /** * Definition of the property which holds the * number of children this member has. */ - CHILDREN_CARDINALITY(Datatype.UNSIGNED_INTEGER, 23, false, "Required. Number of children that the member has. This can be an estimate, so consumers should not rely on this to be the exact count. Providers should return the best estimate possible."), + CHILDREN_CARDINALITY( + Datatype.UNSIGNED_INTEGER, + 23, + false, + "Required. Number of children that the member has. This can be an estimate, so consumers should not rely on this to be the exact count. Providers should return the best estimate possible."), /** * Definition of the property which holds the * distance from the root of the hierarchy of this member's parent. */ - PARENT_LEVEL(Datatype.UNSIGNED_INTEGER, 24, false, "Required. The distance of the member's parent from the root level of the hierarchy. The root level is zero."), + PARENT_LEVEL( + Datatype.UNSIGNED_INTEGER, + 24, + false, + "Required. The distance of the member's parent from the root level of the hierarchy. The root level is zero."), /** * Definition of the property which holds the * Name of the current catalog. */ - PARENT_UNIQUE_NAME(Datatype.STRING, 25, false, "Required. Unique name of the member's parent. NULL is returned for any members at the root level. For providers that generate unique names by qualification, each component of this name is delimited."), + PARENT_UNIQUE_NAME( + Datatype.STRING, + 25, + false, + "Required. Unique name of the member's parent. NULL is returned for any members at the root level. For providers that generate unique names by qualification, each component of this name is delimited."), /** * Definition of the property which holds the * number of parents that this member has. Generally 1, or 0 * for root members. */ - PARENT_COUNT(Datatype.UNSIGNED_INTEGER, 26, false, "Required. Number of parents that this member has."), + PARENT_COUNT( + Datatype.UNSIGNED_INTEGER, + 26, + false, + "Required. Number of parents that this member has."), /** * Definition of the property which holds the * description of this member. */ - DESCRIPTION(Datatype.STRING, 27, false, "Optional. A human-readable description of the member."), + DESCRIPTION( + Datatype.STRING, + 27, + false, + "Optional. A human-readable description of the member."), /** * Definition of the internal property which holds the @@ -279,7 +351,11 @@ enum StandardMemberProperty implements Property { * (especially a measure or calculated member) in a user interface such * as JPivot. */ - $visible(Datatype.BOOLEAN, 28, true, null), + $visible( + Datatype.BOOLEAN, + 28, + true, + null), /** * Definition of the internal property which holds the @@ -288,20 +364,32 @@ enum StandardMemberProperty implements Property { * non-composite keys, and MEMBER_KEY property is null for composite * keys. */ - MEMBER_KEY(Datatype.VARIANT, 29, true, "Optional. The value of the member key. Null for composite keys."), + MEMBER_KEY( + Datatype.VARIANT, + 29, + true, + "Optional. The value of the member key. Null for composite keys."), /** * Definition of the boolean property that indicates whether * a member is a placeholder member for an empty position in a * dimension hierarchy. */ - IS_PLACEHOLDERMEMBER(Datatype.BOOLEAN, 30, false, "Required. Whether the member is a placeholder member for an empty position in a dimension hierarchy."), + IS_PLACEHOLDERMEMBER( + Datatype.BOOLEAN, + 30, + false, + "Required. Whether the member is a placeholder member for an empty position in a dimension hierarchy."), /** * Definition of the property that indicates whether the member is a * data member. */ - IS_DATAMEMBER(Datatype.BOOLEAN, 31, false, "Required. whether the member is a data member"), + IS_DATAMEMBER( + Datatype.BOOLEAN, + 31, + false, + "Required. whether the member is a data member"), /** * Definition of the property which @@ -311,7 +399,11 @@ enum StandardMemberProperty implements Property { * from their levels. It's calculated from the underlying data * dynamically. */ - DEPTH(Datatype.UNSIGNED_INTEGER, 43, true, "The level depth of a member"), + DEPTH( + Datatype.UNSIGNED_INTEGER, + 43, + true, + "The level depth of a member"), /** * Definition of the property which @@ -320,14 +412,22 @@ enum StandardMemberProperty implements Property { *

Caution: This property's value is calculated based on a specified * MDX query, so its value is dynamic at runtime. */ - DISPLAY_INFO(Datatype.UNSIGNED_INTEGER, 44, false, "Display instruction of a member for XML/A"), + DISPLAY_INFO( + Datatype.UNSIGNED_INTEGER, + 44, + false, + "Display instruction of a member for XML/A"), /** * Definition of the property which * holds the value of a cell. Is usually numeric (since most measures * are numeric) but is occasionally another type. */ - VALUE(Datatype.VARIANT, 41, false, "The unformatted value of the cell."); + VALUE( + Datatype.VARIANT, + 41, + false, + "The unformatted value of the cell."); private final Datatype type; private final String description; @@ -398,57 +498,110 @@ public boolean isInternal() { * */ enum StandardCellProperty implements Property { - BACK_COLOR(Datatype.STRING, 30, false, "The background color for displaying the VALUE or FORMATTED_VALUE property. For more information, see FORE_COLOR and BACK_COLOR Contents."), - - CELL_EVALUATION_LIST(Datatype.STRING, 31, false, "The semicolon-delimited list of evaluated formulas applicable to the cell, in order from lowest to highest solve order. For more information about solve order, see Understanding Pass Order and Solve Order"), - - CELL_ORDINAL(Datatype.UNSIGNED_INTEGER, 32, false, "The ordinal number of the cell in the dataset."), - - FORE_COLOR(Datatype.STRING, 33, false, "The foreground color for displaying the VALUE or FORMATTED_VALUE property. For more information, see FORE_COLOR and BACK_COLOR Contents."), - - FONT_NAME(Datatype.STRING, 34, false, "The font to be used to display the VALUE or FORMATTED_VALUE property."), - - FONT_SIZE(Datatype.STRING, 35, false, "Font size to be used to display the VALUE or FORMATTED_VALUE property."), - - FONT_FLAGS(Datatype.UNSIGNED_INTEGER, 36, false, "The bitmask detailing effects on the font. The value is the result of a bitwise OR operation of one or more of the following constants: MDFF_BOLD = 1, MDFF_ITALIC = 2, MDFF_UNDERLINE = 4, MDFF_STRIKEOUT = 8. For example, the value 5 represents the combination of bold (MDFF_BOLD) and underline (MDFF_UNDERLINE) font effects."), + BACK_COLOR( + Datatype.STRING, + 30, + false, + "The background color for displaying the VALUE or FORMATTED_VALUE property. For more information, see FORE_COLOR and BACK_COLOR Contents."), + + CELL_EVALUATION_LIST( + Datatype.STRING, + 31, + false, + "The semicolon-delimited list of evaluated formulas applicable to the cell, in order from lowest to highest solve order. For more information about solve order, see Understanding Pass Order and Solve Order"), + + CELL_ORDINAL( + Datatype.UNSIGNED_INTEGER, + 32, + false, + "The ordinal number of the cell in the dataset."), + + FORE_COLOR( + Datatype.STRING, + 33, + false, + "The foreground color for displaying the VALUE or FORMATTED_VALUE property. For more information, see FORE_COLOR and BACK_COLOR Contents."), + + FONT_NAME( + Datatype.STRING, + 34, + false, + "The font to be used to display the VALUE or FORMATTED_VALUE property."), + + FONT_SIZE( + Datatype.STRING, + 35, + false, + "Font size to be used to display the VALUE or FORMATTED_VALUE property."), + + FONT_FLAGS( + Datatype.UNSIGNED_INTEGER, + 36, + false, + "The bitmask detailing effects on the font. The value is the result of a bitwise OR operation of one or more of the following constants: MDFF_BOLD = 1, MDFF_ITALIC = 2, MDFF_UNDERLINE = 4, MDFF_STRIKEOUT = 8. For example, the value 5 represents the combination of bold (MDFF_BOLD) and underline (MDFF_UNDERLINE) font effects."), /** * Definition of the property which * holds the formatted value of a cell. */ - FORMATTED_VALUE(Datatype.STRING, 37, false, "The character string that represents a formatted display of the VALUE property."), + FORMATTED_VALUE( + Datatype.STRING, + 37, + false, + "The character string that represents a formatted display of the VALUE property."), /** * Definition of the property which * holds the format string used to format cell values. */ - FORMAT_STRING(Datatype.STRING, 38, false, "The format string used to create the FORMATTED_VALUE property value. For more information, see FORMAT_STRING Contents."), + FORMAT_STRING( + Datatype.STRING, + 38, + false, + "The format string used to create the FORMATTED_VALUE property value. For more information, see FORMAT_STRING Contents."), - NON_EMPTY_BEHAVIOR(Datatype.STRING, 39, false, "The measure used to determine the behavior of calculated members when resolving empty cells."), + NON_EMPTY_BEHAVIOR( + Datatype.STRING, + 39, + false, + "The measure used to determine the behavior of calculated members when resolving empty cells."), /** * Definition of the property which * determines the solve order of a calculated member with respect to * other calculated members. */ - SOLVE_ORDER(Datatype.INTEGER, 40, false, "The solve order of the cell."), + SOLVE_ORDER( + Datatype.INTEGER, + 40, + false, + "The solve order of the cell."), /** * Definition of the property which * holds the value of a cell. Is usually numeric (since most measures * are numeric) but is occasionally another type. */ - VALUE(Datatype.VARIANT, 41, false, "The unformatted value of the cell."), + VALUE( + Datatype.VARIANT, + 41, + false, + "The unformatted value of the cell."), /** * Definition of the property which * holds the datatype of a cell. Valid values are "String", * "Numeric", "Integer". The property's value derives from the - * "datatype" attribute of the "Measure" element; if the datatype attribute - * is not specified, the datatype is "Numeric" by default, except measures - * whose aggregator is "Count", whose datatype is "Integer". + * "datatype" attribute of the "Measure" element; if the + * datatype attribute is not specified, the datatype is + * "Numeric" by default, except measures whose aggregator is + * "Count", whose datatype is "Integer". */ - DATATYPE(Datatype.STRING, 42, false, "The datatype of the cell."); + DATATYPE( + Datatype.STRING, + 42, + false, + "The datatype of the cell."); /** * The datatype of the property. @@ -463,7 +616,6 @@ private StandardCellProperty( boolean internal, String description) { -// assert ordinal == ordinal(); this.type = type; this.internal = internal; this.description = description; diff --git a/src/org/olap4j/query/Query.java b/src/org/olap4j/query/Query.java index e3c1339..3e6ec03 100644 --- a/src/org/olap4j/query/Query.java +++ b/src/org/olap4j/query/Query.java @@ -108,15 +108,15 @@ public void swapAxes() { tmpDown.addAll(down.getDimensions()); across.getDimensions().clear(); - Map acrossChildList = - new HashMap(); + Map acrossChildList = + new HashMap(); for (int cpt = 0; cpt < tmpAcross.size();cpt++) { acrossChildList.put(Integer.valueOf(cpt), tmpAcross.get(cpt)); } across.notifyRemove(acrossChildList); down.getDimensions().clear(); - Map downChildList = + Map downChildList = new HashMap(); for (int cpt = 0; cpt < tmpDown.size();cpt++) { downChildList.put(Integer.valueOf(cpt), tmpDown.get(cpt)); diff --git a/src/org/olap4j/query/QueryAxis.java b/src/org/olap4j/query/QueryAxis.java index 7e7f03d..775dbac 100644 --- a/src/org/olap4j/query/QueryAxis.java +++ b/src/org/olap4j/query/QueryAxis.java @@ -90,10 +90,10 @@ public String getName() { * It uses a zero based index. */ public void pullUp(int index) { - Map removed = new HashMap(); - removed.put(Integer.valueOf(index),this.dimensions.get(index)); - Map added = new HashMap(); - added.put(Integer.valueOf(index - 1),this.dimensions.get(index)); + Map removed = new HashMap(); + removed.put(Integer.valueOf(index), this.dimensions.get(index)); + Map added = new HashMap(); + added.put(Integer.valueOf(index - 1), this.dimensions.get(index)); Collections.swap(this.dimensions, index, index - 1); this.notifyRemove(removed); this.notifyAdd(added); @@ -110,10 +110,10 @@ public void pullUp(int index) { * It uses a zero based index. */ public void pushDown(int index) { - Map removed = new HashMap(); - removed.put(Integer.valueOf(index),this.dimensions.get(index)); - Map added = new HashMap(); - added.put(Integer.valueOf(index + 1),this.dimensions.get(index)); + Map removed = new HashMap(); + removed.put(Integer.valueOf(index), this.dimensions.get(index)); + Map added = new HashMap(); + added.put(Integer.valueOf(index + 1), this.dimensions.get(index)); Collections.swap(this.dimensions, index, index + 1); this.notifyRemove(removed); this.notifyAdd(added); @@ -128,7 +128,7 @@ public void addDimension(QueryDimension dimension) { this.getDimensions().add(dimension); Integer index = Integer.valueOf( this.getDimensions().indexOf(dimension)); - this.notifyAdd(dimension,index); + this.notifyAdd(dimension, index); } /** @@ -140,7 +140,7 @@ public void removeDimension(QueryDimension dimension) { Integer index = Integer.valueOf( this.getDimensions().indexOf(dimension)); this.getDimensions().remove(dimension); - this.notifyRemove(dimension,index); + this.notifyRemove(dimension, index); } /** @@ -195,7 +195,8 @@ public QueryDimension set(int index, QueryDimension dimension) { public void add(int index, QueryDimension dimension) { if (this.contains(dimension)) { - throw new IllegalStateException("dimension already on this axis"); + throw new IllegalStateException( + "dimension already on this axis"); } if (dimension.getAxis() != null && dimension.getAxis() != QueryAxis.this) diff --git a/src/org/olap4j/query/QueryDimension.java b/src/org/olap4j/query/QueryDimension.java index 94aaafc..afbea02 100644 --- a/src/org/olap4j/query/QueryDimension.java +++ b/src/org/olap4j/query/QueryDimension.java @@ -68,13 +68,14 @@ public void select(String... nameParts) { this.select(Selection.Operator.MEMBER, nameParts); } - public void select(Selection.Operator operator, - String... nameParts) + public void select( + Selection.Operator operator, + String... nameParts) { try { this.select( - operator, - this.getQuery().getCube().lookupMember(nameParts)); + operator, + this.getQuery().getCube().lookupMember(nameParts)); } catch (OlapException e) { // Nothing to do, but we'll still log the exception. e.printStackTrace(); @@ -99,16 +100,16 @@ private void select(Selection selection) { this.getSelections().add(selection); Integer index = Integer.valueOf( this.getSelections().indexOf(selection)); - this.notifyAdd(selection,index); + this.notifyAdd(selection, index); } public void clearSelection() { - Map removed = new HashMap(); + Map removed = new HashMap(); for (Selection node : this.selections) { removed.put( - Integer.valueOf(this.selections.indexOf(node)), - node); - ((QueryNodeImpl)node).clearListeners(); + Integer.valueOf(this.selections.indexOf(node)), + node); + ((QueryNodeImpl) node).clearListeners(); } this.selections.clear(); this.notifyRemove(removed); @@ -157,7 +158,9 @@ public List resolve(Selection selection) throws OlapException set, getNameParts(selection.getName())); } catch (Exception e) { - throw new OlapException("Error while resolving selection " + selection.toString(), e); + throw new OlapException( + "Error while resolving selection " + selection.toString(), + e); } } @@ -206,7 +209,8 @@ public Selection set(int index, Selection selection) { public void add(int index, Selection selection) { if (this.contains(selection)) { - throw new IllegalStateException("dimension already contains selection"); + throw new IllegalStateException( + "dimension already contains selection"); } list.add(index, selection); } diff --git a/src/org/olap4j/query/QueryEvent.java b/src/org/olap4j/query/QueryEvent.java index 5599dcb..d5d31e6 100644 --- a/src/org/olap4j/query/QueryEvent.java +++ b/src/org/olap4j/query/QueryEvent.java @@ -3,7 +3,7 @@ // This software is subject to the terms of the Eclipse Public License v1.0 // Agreement, available at the following URL: // http://www.eclipse.org/legal/epl-v10.html. -// Copyright (C) 2007-2009 Julian Hyde +// Copyright (C) 2009-2009 Julian Hyde // All Rights Reserved. // You must accept the terms of that agreement to use this software. */ @@ -14,7 +14,9 @@ /** * Describes which changes were performed to the query model. + * * @author Luc Boudreau + * @version $Id: $ */ public final class QueryEvent { @@ -40,29 +42,34 @@ public static enum Type { private final QueryNode source; private final QueryEvent.Type operation; - private Map children = + private Map children = new HashMap(); - QueryEvent(QueryEvent.Type operation, - QueryNode source, - QueryNode child, - int index) + QueryEvent( + QueryEvent.Type operation, + QueryNode source, + QueryNode child, + int index) { - this.children.put(Integer.valueOf(index),child); + this.children.put(Integer.valueOf(index), child); this.source = source; this.operation = operation; } - QueryEvent(QueryEvent.Type operation, - QueryNode source, - Map children) { + QueryEvent( + QueryEvent.Type operation, + QueryNode source, + Map children) + { this.children.putAll(children); this.source = source; this.operation = operation; } - QueryEvent(QueryEvent.Type operation, - QueryNode source) { + QueryEvent( + QueryEvent.Type operation, + QueryNode source) + { this.children = null; this.source = source; this.operation = operation; @@ -89,8 +96,9 @@ public QueryEvent.Type getOperation() { * this method will return null because the source object was affected * and not the children. */ - public Map getChildrens() { + public Map getChildrens() { return children; } } -// End QueryEvent.java \ No newline at end of file + +// End QueryEvent.java diff --git a/src/org/olap4j/query/QueryNode.java b/src/org/olap4j/query/QueryNode.java index 1d8ddea..8c7912b 100644 --- a/src/org/olap4j/query/QueryNode.java +++ b/src/org/olap4j/query/QueryNode.java @@ -19,17 +19,20 @@ interface QueryNode { /** - * Registers a new listener for a QueryNode. - * @param l The listener object. Must implement - * {@see QueryNodeListener} + * Registers a new listener for a {@link QueryNode}. + * + * @param listener Listener */ - public void addQueryNodeListener(QueryNodeListener l); + public void addQueryNodeListener(QueryNodeListener listener); /** - * De-registers a new listener for a QueryNode. - * @param l The listener object. Must implement - * {@see QueryNodeListener} + * De-registers a listener for a {@link QueryNode}. + * + *

REVIEW: Is it an error if the listener does not exist? + * + * @param listener Listener */ - public void removeQueryNodeListener(QueryNodeListener l); + public void removeQueryNodeListener(QueryNodeListener listener); } -// End QueryNode.java \ No newline at end of file + +// End QueryNode.java diff --git a/src/org/olap4j/query/QueryNodeImpl.java b/src/org/olap4j/query/QueryNodeImpl.java index 23012b4..6dacff9 100644 --- a/src/org/olap4j/query/QueryNodeImpl.java +++ b/src/org/olap4j/query/QueryNodeImpl.java @@ -3,7 +3,7 @@ // This software is subject to the terms of the Eclipse Public License v1.0 // Agreement, available at the following URL: // http://www.eclipse.org/legal/epl-v10.html. -// Copyright (C) 2007-2008 Julian Hyde +// Copyright (C) 2009-2009 Julian Hyde // All Rights Reserved. // You must accept the terms of that agreement to use this software. */ @@ -16,8 +16,9 @@ /** * Abstract implementation of QueryNode that * implements operations to support listeners. - * @author Luc Boudreau * + * @author Luc Boudreau + * @version $Id: $ */ abstract class QueryNodeImpl implements QueryNode { @@ -41,10 +42,10 @@ public void removeQueryNodeListener(QueryNodeListener l) { protected void notifyAdd(QueryNode child, int index) { QueryEvent event = new QueryEvent( - QueryEvent.Type.CHILDREN_ADDED, - this, - child, - index); + QueryEvent.Type.CHILDREN_ADDED, + this, + child, + index); notifyAddInternal(event); } @@ -54,12 +55,12 @@ protected void notifyAdd(QueryNode child, int index) * @param children A map of indexes and children QueryNode * objects that were just added. */ - protected void notifyAdd(Map children) + protected void notifyAdd(Map children) { QueryEvent event = new QueryEvent( - QueryEvent.Type.CHILDREN_ADDED, - this, - children); + QueryEvent.Type.CHILDREN_ADDED, + this, + children); notifyAddInternal(event); } @@ -81,10 +82,10 @@ private void notifyAddInternal(QueryEvent event) { protected void notifyRemove(QueryNode child, int index) { QueryEvent event = new QueryEvent( - QueryEvent.Type.CHILDREN_REMOVED, - this, - child, - index); + QueryEvent.Type.CHILDREN_REMOVED, + this, + child, + index); notifyRemoveInternal(event); } @@ -94,12 +95,12 @@ protected void notifyRemove(QueryNode child, int index) * @param children A map of indexes and children QueryNode * objects that were just added. */ - protected void notifyRemove(Map children) + protected void notifyRemove(Map children) { QueryEvent event = new QueryEvent( - QueryEvent.Type.CHILDREN_REMOVED, - this, - children); + QueryEvent.Type.CHILDREN_REMOVED, + this, + children); notifyRemoveInternal(event); } @@ -123,10 +124,10 @@ private void notifyRemoveInternal(QueryEvent event) { protected void notifyChange(QueryNode child, int index) { QueryEvent event = new QueryEvent( - QueryEvent.Type.SELECTION_CHANGED, - this, - child, - index); + QueryEvent.Type.SELECTION_CHANGED, + this, + child, + index); notifyChangeInternal(event); } @@ -138,12 +139,12 @@ protected void notifyChange(QueryNode child, int index) * @param index The index of the updated object in its * parent's list. */ - protected void notifyChange(Map children) + protected void notifyChange(Map children) { QueryEvent event = new QueryEvent( - QueryEvent.Type.SELECTION_CHANGED, - this, - children); + QueryEvent.Type.SELECTION_CHANGED, + this, + children); notifyChangeInternal(event); } @@ -162,4 +163,5 @@ void clearListeners() { abstract void tearDown(); } -// End QueryNodeImpl.java \ No newline at end of file + +// End QueryNodeImpl.java diff --git a/src/org/olap4j/query/QueryNodeListener.java b/src/org/olap4j/query/QueryNodeListener.java index 6393f7c..bc6e5ce 100644 --- a/src/org/olap4j/query/QueryNodeListener.java +++ b/src/org/olap4j/query/QueryNodeListener.java @@ -3,7 +3,7 @@ // This software is subject to the terms of the Eclipse Public License v1.0 // Agreement, available at the following URL: // http://www.eclipse.org/legal/epl-v10.html. -// Copyright (C) 2007-2008 Julian Hyde +// Copyright (C) 2009-2009 Julian Hyde // All Rights Reserved. // You must accept the terms of that agreement to use this software. */ @@ -12,28 +12,36 @@ /** * Objects that want to be notified of changes to the Query Model structure * have to implement this interface. + * * @author Luc Boudreau + * @version $Id: $ */ public interface QueryNodeListener { /** - * Gets invoked when one or more children of a QueryNode gets removed - * from it's list. + * Invoked when one or more children of a {@link QueryNode} are removed + * from its list. + * * @param event Describes in detail the actual event that just happened. */ public void childrenRemoved(QueryEvent event); + /** - * Gets invoked when one or more children get added to a QueryNode - * list f children. + * Invoked when one or more children are added to a {@link QueryNode} + * list of children. + * * @param event Describes in detail the actual event that just happened. */ public void childrenAdded(QueryEvent event); + /** - * Gets invoked when a selection operator has changed. This does not mean + * Invoked when a selection operator has changed. This does not mean * that a Selection object was either added or removed from a Dimension, - * it only means that it's operator value was modified. + * it only means that its operator value was modified. + * * @param event Describes in detail the actual event that just happened. - * @see {@link Selection} + * @see Selection */ public void selectionChanged(QueryEvent event); } -// End QueryNodeListener.java \ No newline at end of file + +// End QueryNodeListener.java diff --git a/testsrc/org/olap4j/ConnectionTest.java b/testsrc/org/olap4j/ConnectionTest.java index f2cff9f..f2c581f 100644 --- a/testsrc/org/olap4j/ConnectionTest.java +++ b/testsrc/org/olap4j/ConnectionTest.java @@ -351,12 +351,15 @@ public void testXmlaCatalogParameter() throws Exception { connection.getCatalog(); } catch (OlapException e) { if (e.getMessage().equals( - "There is no catalog named FoodMartError available to query against.")) + "There is no catalog named FoodMartError available to " + + "query against.")) { return; } } - fail("XmlaOlap4jConnection did not detect an inexistant catalog name."); + fail( + "XmlaOlap4jConnection did not detect an inexistant " + + "catalog name."); } } @@ -658,7 +661,8 @@ public void testPreparedStatement() throws SQLException { s); // Re-execute with a new MDX string. - CellSet cellSet3 = pstmt.executeOlapQuery("SELECT FROM [Sales] WHERE [Time.Weekly].[1997].[3]"); + CellSet cellSet3 = pstmt.executeOlapQuery( + "SELECT FROM [Sales] WHERE [Time.Weekly].[1997].[3]"); TestContext.assertEqualsVerbose( "Axis #0:\n" + "{[Measures].[Unit Sales], [Store].[All Stores], [Store Size in SQFT].[All Store Size in SQFTs], [Store Type].[All Store Types], [Time.Weekly].[All Time.Weeklys].[1997].[3], [Product].[All Products], [Promotion Media].[All Media], [Promotions].[All Promotions], [Customers].[All Customers], [Education Level].[All Education Levels], [Gender].[All Gender], [Marital Status].[All Marital Status], [Yearly Income].[All Yearly Incomes]}\n" @@ -890,31 +894,31 @@ public void testCellSet() throws SQLException { + "FROM [Sales]\n" + "WHERE [Time].[1997].[Q2]"); String s = TestContext.toString(cellSet); - assertEquals( - TestContext.fold("Axis #0:\n" - + "{[Store].[All Stores]," - + " [Store Size in SQFT].[All Store Size in SQFTs]," - + " [Store Type].[All Store Types]," - + " [Time].[1997].[Q2]," - + " [Promotion Media].[All Media]," - + " [Promotions].[All Promotions]," - + " [Customers].[All Customers]," - + " [Education Level].[All Education Levels]," - + " [Marital Status].[All Marital Status]," - + " [Yearly Income].[All Yearly Incomes]}\n" - + "Axis #1:\n" - + "{[Measures].[Unit Sales]}\n" - + "{[Measures].[Store Sales]}\n" - + "Axis #2:\n" - + "{[Gender].[All Gender].[M], [Product].[All Products].[Drink]}\n" - + "{[Gender].[All Gender].[M], [Product].[All Products].[Food]}\n" - + "{[Gender].[All Gender].[M], [Product].[All Products].[Non-Consumable]}\n" - + "Row #0: 3,023\n" - + "Row #0: 6,004.80\n" - + "Row #1: 22,558\n" - + "Row #1: 47,869.17\n" - + "Row #2: 6,037\n" - + "Row #2: 12,935.16\n").toString(), + TestContext.assertEqualsVerbose( + "Axis #0:\n" + + "{[Store].[All Stores]," + + " [Store Size in SQFT].[All Store Size in SQFTs]," + + " [Store Type].[All Store Types]," + + " [Time].[1997].[Q2]," + + " [Promotion Media].[All Media]," + + " [Promotions].[All Promotions]," + + " [Customers].[All Customers]," + + " [Education Level].[All Education Levels]," + + " [Marital Status].[All Marital Status]," + + " [Yearly Income].[All Yearly Incomes]}\n" + + "Axis #1:\n" + + "{[Measures].[Unit Sales]}\n" + + "{[Measures].[Store Sales]}\n" + + "Axis #2:\n" + + "{[Gender].[All Gender].[M], [Product].[All Products].[Drink]}\n" + + "{[Gender].[All Gender].[M], [Product].[All Products].[Food]}\n" + + "{[Gender].[All Gender].[M], [Product].[All Products].[Non-Consumable]}\n" + + "Row #0: 3,023\n" + + "Row #0: 6,004.80\n" + + "Row #1: 22,558\n" + + "Row #1: 47,869.17\n" + + "Row #2: 6,037\n" + + "Row #2: 12,935.16\n", s); } @@ -1452,8 +1456,8 @@ public void testCubeLookupMembers() throws Exception { cube.lookupMembers( EnumSet.of(Member.TreeOp.ANCESTORS, Member.TreeOp.PARENT), "Time", "1997", "Q2"); - assertEquals( - TestContext.fold("[Time].[1997]\n").toString(), + TestContext.assertEqualsVerbose( + "[Time].[1997]\n", memberListToString(memberList)); // ask for parent of root member, should not get null member in list @@ -1473,24 +1477,26 @@ public void testCubeLookupMembers() throws Exception { case XMLA: // TODO: fix mondrian's XMLA driver to return members ordered by // level then ordinal - expected = "[Time].[1997].[Q2].[4]\n" - + "[Time].[1997].[Q2].[5]\n" - + "[Time].[1997].[Q2].[6]\n" - + "[Time].[1997].[Q1]\n" - + "[Time].[1997].[Q3]\n" - + "[Time].[1997].[Q4]\n"; + expected = + "[Time].[1997].[Q2].[4]\n" + + "[Time].[1997].[Q2].[5]\n" + + "[Time].[1997].[Q2].[6]\n" + + "[Time].[1997].[Q1]\n" + + "[Time].[1997].[Q3]\n" + + "[Time].[1997].[Q4]\n"; break; default: - expected = "[Time].[1997].[Q1]\n" - + "[Time].[1997].[Q2].[4]\n" - + "[Time].[1997].[Q2].[5]\n" - + "[Time].[1997].[Q2].[6]\n" - + "[Time].[1997].[Q3]\n" - + "[Time].[1997].[Q4]\n"; + expected = + "[Time].[1997].[Q1]\n" + + "[Time].[1997].[Q2].[4]\n" + + "[Time].[1997].[Q2].[5]\n" + + "[Time].[1997].[Q2].[6]\n" + + "[Time].[1997].[Q3]\n" + + "[Time].[1997].[Q4]\n"; break; } - assertEquals( - TestContext.fold(expected).toString(), + TestContext.assertEqualsVerbose( + expected, memberListToString(memberList)); // siblings of the root member - potentially tricky @@ -1498,18 +1504,18 @@ public void testCubeLookupMembers() throws Exception { cube.lookupMembers( EnumSet.of(Member.TreeOp.SIBLINGS), "Time", "1997"); - assertEquals( - TestContext.fold("[Time].[1998]\n").toString(), + TestContext.assertEqualsVerbose( + "[Time].[1998]\n", memberListToString(memberList)); memberList = cube.lookupMembers( EnumSet.of(Member.TreeOp.SIBLINGS, Member.TreeOp.SELF), "Customers", "USA", "OR"); - assertEquals( - TestContext.fold("[Customers].[All Customers].[USA].[CA]\n" - + "[Customers].[All Customers].[USA].[OR]\n" - + "[Customers].[All Customers].[USA].[WA]\n").toString(), + TestContext.assertEqualsVerbose( + "[Customers].[All Customers].[USA].[CA]\n" + + "[Customers].[All Customers].[USA].[OR]\n" + + "[Customers].[All Customers].[USA].[WA]\n", memberListToString(memberList)); } @@ -1703,7 +1709,8 @@ public void testMetadata() throws Exception { "[Product].[All Products]", allProductsMember.getUniqueName()); assertEquals("(All)", allProductsMember.getLevel().getName()); - assertEquals("[Product].[(All)]", allProductsMember.getLevel().getUniqueName()); + assertEquals( + "[Product].[(All)]", allProductsMember.getLevel().getUniqueName()); assertEquals(1, allProductsMember.getLevel().getMembers().size()); assertTrue(allProductsMember.isAll()); assertNull(allProductsMember.getParentMember()); @@ -1855,7 +1862,8 @@ public void testParentChild() throws ClassNotFoundException, SQLException { member2.getUniqueName().equals( "[Employees].[All Employees].[Derrick Whelply]") || member2.getUniqueName().equals( - "[Employees].[All Employees].[Sheri Nowmer].[Derrick Whelply]")); + "[Employees].[All Employees].[Sheri Nowmer]." + + "[Derrick Whelply]")); assertEquals(2, member2.getDepth()); assertEquals(1, member2.getLevel().getDepth()); final Member parent = member2.getParentMember(); @@ -2004,8 +2012,10 @@ public void testAxisType() throws Throwable { final Cube cube = ((CubeType) select.getFrom().getType()).getCube(); final Dimension storeDimension = cube.getDimensions().get("Store"); final Dimension genderDimension = cube.getDimensions().get("Gender"); - final Dimension measuresDimension = cube.getDimensions().get("Measures"); - final Dimension customersDimension = cube.getDimensions().get("Customers"); + final Dimension measuresDimension = + cube.getDimensions().get("Measures"); + final Dimension customersDimension = + cube.getDimensions().get("Customers"); assertTrue(tupleType.usesDimension(storeDimension, false)); assertTrue(tupleType.usesDimension(genderDimension, false)); assertFalse(tupleType.usesDimension(measuresDimension, false)); @@ -2115,7 +2125,8 @@ public void testValidateError() throws Exception { assertEquals("Validation error", e.getMessage()); assertTrue( TestContext.getStackTrace(e).contains( - "Dimension '[Gender]' appears in more than one independent axis.")); + "Dimension '[Gender]' appears in more than one " + + "independent axis.")); } } @@ -2378,7 +2389,8 @@ public void testBuildQuery2() throws ClassNotFoundException, SQLException { Cube cube = schema.getCubes().get("Sales"); Measure measure = cube.getMeasures().get(0); assertEquals("Unit Sales", measure.getName()); - Dimension dimPromotionMedia = cube.getDimensions().get("Promotion Media"); + Dimension dimPromotionMedia = + cube.getDimensions().get("Promotion Media"); // // IdentifierNode cubeNode = // new IdentifierNode( diff --git a/testsrc/org/olap4j/MetadataTest.java b/testsrc/org/olap4j/MetadataTest.java index 31f57c3..dcd4b3f 100644 --- a/testsrc/org/olap4j/MetadataTest.java +++ b/testsrc/org/olap4j/MetadataTest.java @@ -31,21 +31,71 @@ public class MetadataTest extends TestCase { private final String propertyNamePattern = null; private final String dataSourceName = "xx"; - private static final List CUBE_COLUMN_NAMES = Arrays.asList("CATALOG_NAME", "SCHEMA_NAME", "CUBE_NAME", "CUBE_TYPE", "CUBE_GUID", "CREATED_ON", "LAST_SCHEMA_UPDATE", "SCHEMA_UPDATED_BY", "LAST_DATA_UPDATE", "DATA_UPDATED_BY", "IS_DRILLTHROUGH_ENABLED", "IS_WRITE_ENABLED", "IS_LINKABLE", "IS_SQL_ENABLED", "DESCRIPTION"); - private static final List LITERALS_COLUMN_NAMES = Arrays.asList("LITERAL_NAME", "LITERAL_VALUE", "LITERAL_INVALID_CHARS", "LITERAL_INVALID_STARTING_CHARS", "LITERAL_MAX_LENGTH"); - private static final List SETS_COLUMN_NAMES = Arrays.asList("CATALOG_NAME", "SCHEMA_NAME", "CUBE_NAME", "SET_NAME", "SCOPE"); - private static final List PROPERTIES_COLUMN_NAMES = Arrays.asList("CATALOG_NAME", "SCHEMA_NAME", "CUBE_NAME", "DIMENSION_UNIQUE_NAME", "HIERARCHY_UNIQUE_NAME", "LEVEL_UNIQUE_NAME", "MEMBER_UNIQUE_NAME", "PROPERTY_NAME", "PROPERTY_CAPTION", "PROPERTY_TYPE", "DATA_TYPE", "PROPERTY_CONTENT_TYPE", "DESCRIPTION"); - private static final List MEMBERS_COLUMN_NAMES = Arrays.asList("CATALOG_NAME", "SCHEMA_NAME", "CUBE_NAME", "DIMENSION_UNIQUE_NAME", "HIERARCHY_UNIQUE_NAME", "LEVEL_UNIQUE_NAME", "LEVEL_NUMBER", "MEMBER_ORDINAL", "MEMBER_NAME", "MEMBER_UNIQUE_NAME", "MEMBER_TYPE", "MEMBER_GUID", "MEMBER_CAPTION", "CHILDREN_CARDINALITY", "PARENT_LEVEL", "PARENT_UNIQUE_NAME", "PARENT_COUNT", "TREE_OP", "DEPTH"); - private static final List MEASURES_COLUMN_NAMES = Arrays.asList("CATALOG_NAME", "SCHEMA_NAME", "CUBE_NAME", "MEASURE_NAME", "MEASURE_UNIQUE_NAME", "MEASURE_CAPTION", "MEASURE_GUID", "MEASURE_AGGREGATOR", "DATA_TYPE", "MEASURE_IS_VISIBLE", "LEVELS_LIST", "DESCRIPTION"); - private static final List LEVELS_COLUMN_NAMES = Arrays.asList("CATALOG_NAME", "SCHEMA_NAME", "CUBE_NAME", "DIMENSION_UNIQUE_NAME", "HIERARCHY_UNIQUE_NAME", "LEVEL_NAME", "LEVEL_UNIQUE_NAME", "LEVEL_GUID", "LEVEL_CAPTION", "LEVEL_NUMBER", "LEVEL_CARDINALITY", "LEVEL_TYPE", "CUSTOM_ROLLUP_SETTINGS", "LEVEL_UNIQUE_SETTINGS", "LEVEL_IS_VISIBLE", "DESCRIPTION"); - private static final List HIERARCHIES_COLUMN_NAMES = Arrays.asList("CATALOG_NAME", "SCHEMA_NAME", "CUBE_NAME", "DIMENSION_UNIQUE_NAME", "HIERARCHY_NAME", "HIERARCHY_UNIQUE_NAME", "HIERARCHY_GUID", "HIERARCHY_CAPTION", "DIMENSION_TYPE", "HIERARCHY_CARDINALITY", "DEFAULT_MEMBER", "ALL_MEMBER", "DESCRIPTION", "STRUCTURE", "IS_VIRTUAL", "IS_READWRITE", "DIMENSION_UNIQUE_SETTINGS", "DIMENSION_IS_VISIBLE", "HIERARCHY_ORDINAL", "DIMENSION_IS_SHARED", "PARENT_CHILD"); - private static final List FUNCTIONS_COLUMN_NAMES = Arrays.asList("FUNCTION_NAME", "DESCRIPTION", "PARAMETER_LIST", "RETURN_TYPE", "ORIGIN", "INTERFACE_NAME", "LIBRARY_NAME", "CAPTION"); - private static final List DIMENSIONS_COLUMN_NAMES = Arrays.asList("CATALOG_NAME", "SCHEMA_NAME", "CUBE_NAME", "DIMENSION_NAME", "DIMENSION_UNIQUE_NAME", "DIMENSION_GUID", "DIMENSION_CAPTION", "DIMENSION_ORDINAL", "DIMENSION_TYPE", "DIMENSION_CARDINALITY", "DEFAULT_HIERARCHY", "DESCRIPTION", "IS_VIRTUAL", "IS_READWRITE", "DIMENSION_UNIQUE_SETTINGS", "DIMENSION_MASTER_UNIQUE_NAME", "DIMENSION_IS_VISIBLE"); - private static final List DATABASE_PROPERTIES_COLUMN_NAMES = Arrays.asList("PROPERTY_NAME", "PROPERTY_DESCRIPTION", "PROPERTY_TYPE", "PROPERTY_ACCESS_TYPE", "IS_REQUIRED", "PROPERTY_VALUE"); - private static final List DATASOURCES_COLUMN_NAMES = Arrays.asList("DATA_SOURCE_NAME", "DATA_SOURCE_DESCRIPTION", "URL", "DATA_SOURCE_INFO", "PROVIDER_NAME", "PROVIDER_TYPE", "AUTHENTICATION_MODE"); - private static final List CATALOGS_COLUMN_NAMES = Arrays.asList("TABLE_CAT"); - private static final List SCHEMAS_COLUMN_NAMES = Arrays.asList("TABLE_SCHEM", "TABLE_CAT"); - private static final List ACTIONS_COLUMN_NAMES = Arrays.asList("SCHEMA_NAME", "CUBE_NAME", "ACTION_NAME", "COORDINATE", "COORDINATE_TYPE"); + private static final List CUBE_COLUMN_NAMES = Arrays.asList( + "CATALOG_NAME", "SCHEMA_NAME", "CUBE_NAME", "CUBE_TYPE", "CUBE_GUID", + "CREATED_ON", "LAST_SCHEMA_UPDATE", "SCHEMA_UPDATED_BY", + "LAST_DATA_UPDATE", "DATA_UPDATED_BY", "IS_DRILLTHROUGH_ENABLED", + "IS_WRITE_ENABLED", "IS_LINKABLE", "IS_SQL_ENABLED", "DESCRIPTION"); + private static final List LITERALS_COLUMN_NAMES = Arrays.asList( + "LITERAL_NAME", "LITERAL_VALUE", "LITERAL_INVALID_CHARS", + "LITERAL_INVALID_STARTING_CHARS", "LITERAL_MAX_LENGTH"); + private static final List SETS_COLUMN_NAMES = Arrays.asList( + "CATALOG_NAME", "SCHEMA_NAME", "CUBE_NAME", "SET_NAME", "SCOPE"); + private static final List PROPERTIES_COLUMN_NAMES = Arrays.asList( + "CATALOG_NAME", "SCHEMA_NAME", "CUBE_NAME", "DIMENSION_UNIQUE_NAME", + "HIERARCHY_UNIQUE_NAME", "LEVEL_UNIQUE_NAME", "MEMBER_UNIQUE_NAME", + "PROPERTY_NAME", "PROPERTY_CAPTION", "PROPERTY_TYPE", "DATA_TYPE", + "PROPERTY_CONTENT_TYPE", "DESCRIPTION"); + private static final List MEMBERS_COLUMN_NAMES = Arrays.asList( + "CATALOG_NAME", "SCHEMA_NAME", "CUBE_NAME", "DIMENSION_UNIQUE_NAME", + "HIERARCHY_UNIQUE_NAME", "LEVEL_UNIQUE_NAME", "LEVEL_NUMBER", + "MEMBER_ORDINAL", "MEMBER_NAME", "MEMBER_UNIQUE_NAME", "MEMBER_TYPE", + "MEMBER_GUID", "MEMBER_CAPTION", "CHILDREN_CARDINALITY", "PARENT_LEVEL", + "PARENT_UNIQUE_NAME", "PARENT_COUNT", "TREE_OP", "DEPTH"); + private static final List MEASURES_COLUMN_NAMES = Arrays.asList( + "CATALOG_NAME", "SCHEMA_NAME", "CUBE_NAME", "MEASURE_NAME", + "MEASURE_UNIQUE_NAME", "MEASURE_CAPTION", "MEASURE_GUID", + "MEASURE_AGGREGATOR", "DATA_TYPE", "MEASURE_IS_VISIBLE", "LEVELS_LIST", + "DESCRIPTION"); + private static final List LEVELS_COLUMN_NAMES = Arrays.asList( + "CATALOG_NAME", "SCHEMA_NAME", "CUBE_NAME", "DIMENSION_UNIQUE_NAME", + "HIERARCHY_UNIQUE_NAME", "LEVEL_NAME", "LEVEL_UNIQUE_NAME", + "LEVEL_GUID", "LEVEL_CAPTION", "LEVEL_NUMBER", "LEVEL_CARDINALITY", + "LEVEL_TYPE", "CUSTOM_ROLLUP_SETTINGS", "LEVEL_UNIQUE_SETTINGS", + "LEVEL_IS_VISIBLE", "DESCRIPTION"); + private static final List HIERARCHIES_COLUMN_NAMES = Arrays.asList( + "CATALOG_NAME", "SCHEMA_NAME", "CUBE_NAME", "DIMENSION_UNIQUE_NAME", + "HIERARCHY_NAME", "HIERARCHY_UNIQUE_NAME", "HIERARCHY_GUID", + "HIERARCHY_CAPTION", "DIMENSION_TYPE", "HIERARCHY_CARDINALITY", + "DEFAULT_MEMBER", "ALL_MEMBER", "DESCRIPTION", "STRUCTURE", + "IS_VIRTUAL", "IS_READWRITE", "DIMENSION_UNIQUE_SETTINGS", + "DIMENSION_IS_VISIBLE", "HIERARCHY_ORDINAL", "DIMENSION_IS_SHARED", + "PARENT_CHILD"); + private static final List FUNCTIONS_COLUMN_NAMES = Arrays.asList( + "FUNCTION_NAME", "DESCRIPTION", "PARAMETER_LIST", "RETURN_TYPE", + "ORIGIN", "INTERFACE_NAME", "LIBRARY_NAME", "CAPTION"); + private static final List DIMENSIONS_COLUMN_NAMES = Arrays.asList( + "CATALOG_NAME", "SCHEMA_NAME", "CUBE_NAME", "DIMENSION_NAME", + "DIMENSION_UNIQUE_NAME", "DIMENSION_GUID", "DIMENSION_CAPTION", + "DIMENSION_ORDINAL", "DIMENSION_TYPE", "DIMENSION_CARDINALITY", + "DEFAULT_HIERARCHY", "DESCRIPTION", "IS_VIRTUAL", "IS_READWRITE", + "DIMENSION_UNIQUE_SETTINGS", "DIMENSION_MASTER_UNIQUE_NAME", + "DIMENSION_IS_VISIBLE"); + private static final List DATABASE_PROPERTIES_COLUMN_NAMES = + Arrays.asList( + "PROPERTY_NAME", "PROPERTY_DESCRIPTION", "PROPERTY_TYPE", + "PROPERTY_ACCESS_TYPE", "IS_REQUIRED", "PROPERTY_VALUE"); + private static final List DATASOURCES_COLUMN_NAMES = Arrays.asList( + "DATA_SOURCE_NAME", "DATA_SOURCE_DESCRIPTION", "URL", + "DATA_SOURCE_INFO", "PROVIDER_NAME", "PROVIDER_TYPE", + "AUTHENTICATION_MODE"); + private static final List CATALOGS_COLUMN_NAMES = Arrays.asList( + "TABLE_CAT"); + private static final List SCHEMAS_COLUMN_NAMES = Arrays.asList( + "TABLE_SCHEM", "TABLE_CAT"); + private static final List ACTIONS_COLUMN_NAMES = Arrays.asList( + "SCHEMA_NAME", "CUBE_NAME", "ACTION_NAME", "COORDINATE", + "COORDINATE_TYPE"); public MetadataTest() throws SQLException { tester = TestContext.instance().getTester(); @@ -260,7 +310,10 @@ public void testDatabaseMetaDataGetProperties() throws SQLException { olapDatabaseMetaData.getProperties( catalogName, null, null, null, null, null, null, null), PROPERTIES_COLUMN_NAMES); - assertContains("CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Warehouse and Sales, DIMENSION_UNIQUE_NAME=[Store], HIERARCHY_UNIQUE_NAME=[Store], LEVEL_UNIQUE_NAME=[Store].[Store Name], MEMBER_UNIQUE_NAME=null, PROPERTY_NAME=Frozen Sqft, PROPERTY_CAPTION=Frozen Sqft, PROPERTY_TYPE=1, DATA_TYPE=5, PROPERTY_CONTENT_TYPE=0, DESCRIPTION=Warehouse and Sales Cube - Store Hierarchy - Store Name Level - Frozen Sqft Property", s); + assertContains( + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Warehouse and Sales, DIMENSION_UNIQUE_NAME=[Store], HIERARCHY_UNIQUE_NAME=[Store], LEVEL_UNIQUE_NAME=[Store].[Store Name], MEMBER_UNIQUE_NAME=null, PROPERTY_NAME=Frozen Sqft, PROPERTY_CAPTION=Frozen Sqft, PROPERTY_TYPE=1, DATA_TYPE=5, PROPERTY_CONTENT_TYPE=0, DESCRIPTION=Warehouse and Sales Cube - Store Hierarchy - Store Name Level - Frozen Sqft Property", + s); assertEquals(s, 70, linecount(s)); s = checkResultSet( @@ -269,8 +322,14 @@ public void testDatabaseMetaDataGetProperties() throws SQLException { null, null, "[Store].[Store Name]", null, null), PROPERTIES_COLUMN_NAMES); - assertContains("CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Store], HIERARCHY_UNIQUE_NAME=[Store], LEVEL_UNIQUE_NAME=[Store].[Store Name], MEMBER_UNIQUE_NAME=null, PROPERTY_NAME=Has coffee bar, PROPERTY_CAPTION=Has coffee bar, PROPERTY_TYPE=1, DATA_TYPE=11, PROPERTY_CONTENT_TYPE=0, DESCRIPTION=Sales Cube - Store Hierarchy - Store Name Level - Has coffee bar Property", s); - assertNotContains("CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Warehouse and Sales, ", s); + assertContains( + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Store], HIERARCHY_UNIQUE_NAME=[Store], LEVEL_UNIQUE_NAME=[Store].[Store Name], MEMBER_UNIQUE_NAME=null, PROPERTY_NAME=Has coffee bar, PROPERTY_CAPTION=Has coffee bar, PROPERTY_TYPE=1, DATA_TYPE=11, PROPERTY_CONTENT_TYPE=0, DESCRIPTION=Sales Cube - Store Hierarchy - Store Name Level - Has coffee bar Property", + s); + assertNotContains( + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Warehouse and Sales, ", + s); assertEquals(8, linecount(s)); } @@ -287,7 +346,10 @@ public void testDatabaseMetaDataGetCubes() throws SQLException { null, null), CUBE_COLUMN_NAMES); - assertContains("CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, ", s); + assertContains( + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, ", + s); s = checkResultSet( olapDatabaseMetaData.getCubes( @@ -336,7 +398,10 @@ public void testDatabaseMetaDataGetDimensions() throws SQLException { olapDatabaseMetaData.getDimensions( catalogName, null, null, null), DIMENSIONS_COLUMN_NAMES); - assertContains("CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_NAME=Education Level, DIMENSION_UNIQUE_NAME=[Education Level], DIMENSION_GUID=null, DIMENSION_CAPTION=Education Level, DIMENSION_ORDINAL=9, DIMENSION_TYPE=3, DIMENSION_CARDINALITY=6, DEFAULT_HIERARCHY=[Education Level], DESCRIPTION=Sales Cube - Education Level Dimension, IS_VIRTUAL=false, IS_READWRITE=false, DIMENSION_UNIQUE_SETTINGS=0, DIMENSION_MASTER_UNIQUE_NAME=null, DIMENSION_IS_VISIBLE=true", s); + assertContains( + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_NAME=Education Level, DIMENSION_UNIQUE_NAME=[Education Level], DIMENSION_GUID=null, DIMENSION_CAPTION=Education Level, DIMENSION_ORDINAL=9, DIMENSION_TYPE=3, DIMENSION_CARDINALITY=6, DEFAULT_HIERARCHY=[Education Level], DESCRIPTION=Sales Cube - Education Level Dimension, IS_VIRTUAL=false, IS_READWRITE=false, DIMENSION_UNIQUE_SETTINGS=0, DIMENSION_MASTER_UNIQUE_NAME=null, DIMENSION_IS_VISIBLE=true", + s); assertEquals(62, linecount(s)); } @@ -344,7 +409,9 @@ public void testDatabaseMetaDataGetFunctions() throws SQLException { String s = checkResultSet( olapDatabaseMetaData.getOlapFunctions(null), FUNCTIONS_COLUMN_NAMES); - assertContains("FUNCTION_NAME=Name, DESCRIPTION=Returns the name of a member., PARAMETER_LIST=Member, RETURN_TYPE=8, ORIGIN=1, INTERFACE_NAME=, LIBRARY_NAME=null, CAPTION=Name", s); + assertContains( + "FUNCTION_NAME=Name, DESCRIPTION=Returns the name of a member., PARAMETER_LIST=Member, RETURN_TYPE=8, ORIGIN=1, INTERFACE_NAME=, LIBRARY_NAME=null, CAPTION=Name", + s); // Mondrian has 361 functions (as of 2008/1/23) final int functionCount = linecount(s); assertTrue(functionCount + " functions", functionCount > 360); @@ -361,14 +428,18 @@ public void testDatabaseMetaDataGetHierarchies() throws SQLException { olapDatabaseMetaData.getHierarchies( catalogName, null, null, null, null), HIERARCHIES_COLUMN_NAMES); - assertContains("CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=HR, DIMENSION_UNIQUE_NAME=[Employees], HIERARCHY_NAME=Employees, HIERARCHY_UNIQUE_NAME=[Employees], HIERARCHY_GUID=null, HIERARCHY_CAPTION=Employees, DIMENSION_TYPE=3, HIERARCHY_CARDINALITY=1156, DEFAULT_MEMBER=[Employees].[All Employees], ALL_MEMBER=[Employees].[All Employees], DESCRIPTION=HR Cube - Employees Hierarchy, STRUCTURE=0, IS_VIRTUAL=false, IS_READWRITE=false, DIMENSION_UNIQUE_SETTINGS=0, DIMENSION_IS_VISIBLE=true, HIERARCHY_ORDINAL=7, DIMENSION_IS_SHARED=true, PARENT_CHILD=true", s); + assertContains( + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=HR, DIMENSION_UNIQUE_NAME=[Employees], HIERARCHY_NAME=Employees, HIERARCHY_UNIQUE_NAME=[Employees], HIERARCHY_GUID=null, HIERARCHY_CAPTION=Employees, DIMENSION_TYPE=3, HIERARCHY_CARDINALITY=1156, DEFAULT_MEMBER=[Employees].[All Employees], ALL_MEMBER=[Employees].[All Employees], DESCRIPTION=HR Cube - Employees Hierarchy, STRUCTURE=0, IS_VIRTUAL=false, IS_READWRITE=false, DIMENSION_UNIQUE_SETTINGS=0, DIMENSION_IS_VISIBLE=true, HIERARCHY_ORDINAL=7, DIMENSION_IS_SHARED=true, PARENT_CHILD=true", + s); s = checkResultSet( olapDatabaseMetaData.getHierarchies( catalogName, null, "Sales", null, "Store"), HIERARCHIES_COLUMN_NAMES); TestContext.assertEqualsVerbose( - "CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Store], HIERARCHY_NAME=Store, HIERARCHY_UNIQUE_NAME=[Store], HIERARCHY_GUID=null, HIERARCHY_CAPTION=Store, DIMENSION_TYPE=3, HIERARCHY_CARDINALITY=63, DEFAULT_MEMBER=[Store].[All Stores], ALL_MEMBER=[Store].[All Stores], DESCRIPTION=Sales Cube - Store Hierarchy, STRUCTURE=0, IS_VIRTUAL=false, IS_READWRITE=false, DIMENSION_UNIQUE_SETTINGS=0, DIMENSION_IS_VISIBLE=true, HIERARCHY_ORDINAL=1, DIMENSION_IS_SHARED=true, PARENT_CHILD=false\n", + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Store], HIERARCHY_NAME=Store, HIERARCHY_UNIQUE_NAME=[Store], HIERARCHY_GUID=null, HIERARCHY_CAPTION=Store, DIMENSION_TYPE=3, HIERARCHY_CARDINALITY=63, DEFAULT_MEMBER=[Store].[All Stores], ALL_MEMBER=[Store].[All Stores], DESCRIPTION=Sales Cube - Store Hierarchy, STRUCTURE=0, IS_VIRTUAL=false, IS_READWRITE=false, DIMENSION_UNIQUE_SETTINGS=0, DIMENSION_IS_VISIBLE=true, HIERARCHY_ORDINAL=1, DIMENSION_IS_SHARED=true, PARENT_CHILD=false\n", s); // With dimension unique name (bug 2527862). @@ -377,7 +448,8 @@ public void testDatabaseMetaDataGetHierarchies() throws SQLException { catalogName, null, "Sales", "[Store]", null), HIERARCHIES_COLUMN_NAMES); TestContext.assertEqualsVerbose( - "CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Store], HIERARCHY_NAME=Store, HIERARCHY_UNIQUE_NAME=[Store], HIERARCHY_GUID=null, HIERARCHY_CAPTION=Store, DIMENSION_TYPE=3, HIERARCHY_CARDINALITY=63, DEFAULT_MEMBER=[Store].[All Stores], ALL_MEMBER=[Store].[All Stores], DESCRIPTION=Sales Cube - Store Hierarchy, STRUCTURE=0, IS_VIRTUAL=false, IS_READWRITE=false, DIMENSION_UNIQUE_SETTINGS=0, DIMENSION_IS_VISIBLE=true, HIERARCHY_ORDINAL=1, DIMENSION_IS_SHARED=true, PARENT_CHILD=false\n", + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Store], HIERARCHY_NAME=Store, HIERARCHY_UNIQUE_NAME=[Store], HIERARCHY_GUID=null, HIERARCHY_CAPTION=Store, DIMENSION_TYPE=3, HIERARCHY_CARDINALITY=63, DEFAULT_MEMBER=[Store].[All Stores], ALL_MEMBER=[Store].[All Stores], DESCRIPTION=Sales Cube - Store Hierarchy, STRUCTURE=0, IS_VIRTUAL=false, IS_READWRITE=false, DIMENSION_UNIQUE_SETTINGS=0, DIMENSION_IS_VISIBLE=true, HIERARCHY_ORDINAL=1, DIMENSION_IS_SHARED=true, PARENT_CHILD=false\n", s); } @@ -388,7 +460,8 @@ public void testDatabaseMetaDataGetLevels() throws SQLException { LEVELS_COLUMN_NAMES); assertContainsLine( "LEVEL_NAME=Product Category,", - "CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Product], HIERARCHY_UNIQUE_NAME=[Product], LEVEL_NAME=Product Category, LEVEL_UNIQUE_NAME=[Product].[Product Category], LEVEL_GUID=null, LEVEL_CAPTION=Product Category, LEVEL_NUMBER=3, LEVEL_CARDINALITY=55, LEVEL_TYPE=0, CUSTOM_ROLLUP_SETTINGS=0, LEVEL_UNIQUE_SETTINGS=0, LEVEL_IS_VISIBLE=true, DESCRIPTION=Sales Cube - Product Hierarchy - Product Category Level", + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Product], HIERARCHY_UNIQUE_NAME=[Product], LEVEL_NAME=Product Category, LEVEL_UNIQUE_NAME=[Product].[Product Category], LEVEL_GUID=null, LEVEL_CAPTION=Product Category, LEVEL_NUMBER=3, LEVEL_CARDINALITY=55, LEVEL_TYPE=0, CUSTOM_ROLLUP_SETTINGS=0, LEVEL_UNIQUE_SETTINGS=0, LEVEL_IS_VISIBLE=true, DESCRIPTION=Sales Cube - Product Hierarchy - Product Category Level", s); s = checkResultSet( @@ -414,7 +487,8 @@ public void testDatabaseMetaDataGetMeasures() throws SQLException { catalogName, null, null, null, null), MEASURES_COLUMN_NAMES); assertContains( - "CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, MEASURE_NAME=Profit, MEASURE_UNIQUE_NAME=[Measures].[Profit], MEASURE_CAPTION=Profit, MEASURE_GUID=null, MEASURE_AGGREGATOR=127, DATA_TYPE=130, MEASURE_IS_VISIBLE=true, LEVELS_LIST=null, DESCRIPTION=Sales Cube - Profit Member", + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, MEASURE_NAME=Profit, MEASURE_UNIQUE_NAME=[Measures].[Profit], MEASURE_CAPTION=Profit, MEASURE_GUID=null, MEASURE_AGGREGATOR=127, DATA_TYPE=130, MEASURE_IS_VISIBLE=true, LEVELS_LIST=null, DESCRIPTION=Sales Cube - Profit Member", s); // wildcard match @@ -439,9 +513,12 @@ public void testDatabaseMetaDataGetMembers() throws SQLException { null), MEMBERS_COLUMN_NAMES); TestContext.assertEqualsVerbose( - "CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Gender], HIERARCHY_UNIQUE_NAME=[Gender], LEVEL_UNIQUE_NAME=[Gender].[(All)], LEVEL_NUMBER=0, MEMBER_ORDINAL=0, MEMBER_NAME=All Gender, MEMBER_UNIQUE_NAME=[Gender].[All Gender], MEMBER_TYPE=2, MEMBER_GUID=null, MEMBER_CAPTION=All Gender, CHILDREN_CARDINALITY=2, PARENT_LEVEL=0, PARENT_UNIQUE_NAME=null, PARENT_COUNT=0, TREE_OP=null, DEPTH=0\n" - + "CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Gender], HIERARCHY_UNIQUE_NAME=[Gender], LEVEL_UNIQUE_NAME=[Gender].[Gender], LEVEL_NUMBER=1, MEMBER_ORDINAL=1, MEMBER_NAME=F, MEMBER_UNIQUE_NAME=[Gender].[All Gender].[F], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=F, CHILDREN_CARDINALITY=0, PARENT_LEVEL=0, PARENT_UNIQUE_NAME=[Gender].[All Gender], PARENT_COUNT=1, TREE_OP=null, DEPTH=1\n" - + "CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Gender], HIERARCHY_UNIQUE_NAME=[Gender], LEVEL_UNIQUE_NAME=[Gender].[Gender], LEVEL_NUMBER=1, MEMBER_ORDINAL=2, MEMBER_NAME=M, MEMBER_UNIQUE_NAME=[Gender].[All Gender].[M], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=M, CHILDREN_CARDINALITY=0, PARENT_LEVEL=0, PARENT_UNIQUE_NAME=[Gender].[All Gender], PARENT_COUNT=1, TREE_OP=null, DEPTH=1\n", + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Gender], HIERARCHY_UNIQUE_NAME=[Gender], LEVEL_UNIQUE_NAME=[Gender].[(All)], LEVEL_NUMBER=0, MEMBER_ORDINAL=0, MEMBER_NAME=All Gender, MEMBER_UNIQUE_NAME=[Gender].[All Gender], MEMBER_TYPE=2, MEMBER_GUID=null, MEMBER_CAPTION=All Gender, CHILDREN_CARDINALITY=2, PARENT_LEVEL=0, PARENT_UNIQUE_NAME=null, PARENT_COUNT=0, TREE_OP=null, DEPTH=0\n" + + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Gender], HIERARCHY_UNIQUE_NAME=[Gender], LEVEL_UNIQUE_NAME=[Gender].[Gender], LEVEL_NUMBER=1, MEMBER_ORDINAL=1, MEMBER_NAME=F, MEMBER_UNIQUE_NAME=[Gender].[All Gender].[F], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=F, CHILDREN_CARDINALITY=0, PARENT_LEVEL=0, PARENT_UNIQUE_NAME=[Gender].[All Gender], PARENT_COUNT=1, TREE_OP=null, DEPTH=1\n" + + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Gender], HIERARCHY_UNIQUE_NAME=[Gender], LEVEL_UNIQUE_NAME=[Gender].[Gender], LEVEL_NUMBER=1, MEMBER_ORDINAL=2, MEMBER_NAME=M, MEMBER_UNIQUE_NAME=[Gender].[All Gender].[M], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=M, CHILDREN_CARDINALITY=0, PARENT_LEVEL=0, PARENT_UNIQUE_NAME=[Gender].[All Gender], PARENT_COUNT=1, TREE_OP=null, DEPTH=1\n", s); // by member unique name @@ -451,7 +528,8 @@ public void testDatabaseMetaDataGetMembers() throws SQLException { "[Time].[1997].[Q2].[4]", null), MEMBERS_COLUMN_NAMES); TestContext.assertEqualsVerbose( - "CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Time], HIERARCHY_UNIQUE_NAME=[Time], LEVEL_UNIQUE_NAME=[Time].[Month], LEVEL_NUMBER=2, MEMBER_ORDINAL=6, MEMBER_NAME=4, MEMBER_UNIQUE_NAME=[Time].[1997].[Q2].[4], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=4, CHILDREN_CARDINALITY=0, PARENT_LEVEL=1, PARENT_UNIQUE_NAME=[Time].[1997].[Q2], PARENT_COUNT=1, TREE_OP=null, DEPTH=2\n", + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Time], HIERARCHY_UNIQUE_NAME=[Time], LEVEL_UNIQUE_NAME=[Time].[Month], LEVEL_NUMBER=2, MEMBER_ORDINAL=6, MEMBER_NAME=4, MEMBER_UNIQUE_NAME=[Time].[1997].[Q2].[4], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=4, CHILDREN_CARDINALITY=0, PARENT_LEVEL=1, PARENT_UNIQUE_NAME=[Time].[1997].[Q2], PARENT_COUNT=1, TREE_OP=null, DEPTH=2\n", s); // with treeop @@ -466,18 +544,26 @@ public void testDatabaseMetaDataGetMembers() throws SQLException { // TODO: fix mondrian driver so that members are returned sorted // by level depth TestContext.assertEqualsVerbose( - "CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Customers], HIERARCHY_UNIQUE_NAME=[Customers], LEVEL_UNIQUE_NAME=[Customers].[State Province], LEVEL_NUMBER=2, MEMBER_ORDINAL=7235, MEMBER_NAME=OR, MEMBER_UNIQUE_NAME=[Customers].[All Customers].[USA].[OR], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=OR, CHILDREN_CARDINALITY=11, PARENT_LEVEL=1, PARENT_UNIQUE_NAME=[Customers].[All Customers].[USA], PARENT_COUNT=1, TREE_OP=null, DEPTH=2\n" - + "CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Customers], HIERARCHY_UNIQUE_NAME=[Customers], LEVEL_UNIQUE_NAME=[Customers].[State Province], LEVEL_NUMBER=2, MEMBER_ORDINAL=8298, MEMBER_NAME=WA, MEMBER_UNIQUE_NAME=[Customers].[All Customers].[USA].[WA], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=WA, CHILDREN_CARDINALITY=22, PARENT_LEVEL=1, PARENT_UNIQUE_NAME=[Customers].[All Customers].[USA], PARENT_COUNT=1, TREE_OP=null, DEPTH=2\n" - + "CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Customers], HIERARCHY_UNIQUE_NAME=[Customers], LEVEL_UNIQUE_NAME=[Customers].[Country], LEVEL_NUMBER=1, MEMBER_ORDINAL=2966, MEMBER_NAME=USA, MEMBER_UNIQUE_NAME=[Customers].[All Customers].[USA], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=USA, CHILDREN_CARDINALITY=3, PARENT_LEVEL=0, PARENT_UNIQUE_NAME=[Customers].[All Customers], PARENT_COUNT=1, TREE_OP=null, DEPTH=1\n" - + "CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Customers], HIERARCHY_UNIQUE_NAME=[Customers], LEVEL_UNIQUE_NAME=[Customers].[(All)], LEVEL_NUMBER=0, MEMBER_ORDINAL=0, MEMBER_NAME=All Customers, MEMBER_UNIQUE_NAME=[Customers].[All Customers], MEMBER_TYPE=2, MEMBER_GUID=null, MEMBER_CAPTION=All Customers, CHILDREN_CARDINALITY=3, PARENT_LEVEL=0, PARENT_UNIQUE_NAME=null, PARENT_COUNT=0, TREE_OP=null, DEPTH=0\n", + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Customers], HIERARCHY_UNIQUE_NAME=[Customers], LEVEL_UNIQUE_NAME=[Customers].[State Province], LEVEL_NUMBER=2, MEMBER_ORDINAL=7235, MEMBER_NAME=OR, MEMBER_UNIQUE_NAME=[Customers].[All Customers].[USA].[OR], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=OR, CHILDREN_CARDINALITY=11, PARENT_LEVEL=1, PARENT_UNIQUE_NAME=[Customers].[All Customers].[USA], PARENT_COUNT=1, TREE_OP=null, DEPTH=2\n" + + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Customers], HIERARCHY_UNIQUE_NAME=[Customers], LEVEL_UNIQUE_NAME=[Customers].[State Province], LEVEL_NUMBER=2, MEMBER_ORDINAL=8298, MEMBER_NAME=WA, MEMBER_UNIQUE_NAME=[Customers].[All Customers].[USA].[WA], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=WA, CHILDREN_CARDINALITY=22, PARENT_LEVEL=1, PARENT_UNIQUE_NAME=[Customers].[All Customers].[USA], PARENT_COUNT=1, TREE_OP=null, DEPTH=2\n" + + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Customers], HIERARCHY_UNIQUE_NAME=[Customers], LEVEL_UNIQUE_NAME=[Customers].[Country], LEVEL_NUMBER=1, MEMBER_ORDINAL=2966, MEMBER_NAME=USA, MEMBER_UNIQUE_NAME=[Customers].[All Customers].[USA], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=USA, CHILDREN_CARDINALITY=3, PARENT_LEVEL=0, PARENT_UNIQUE_NAME=[Customers].[All Customers], PARENT_COUNT=1, TREE_OP=null, DEPTH=1\n" + + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Customers], HIERARCHY_UNIQUE_NAME=[Customers], LEVEL_UNIQUE_NAME=[Customers].[(All)], LEVEL_NUMBER=0, MEMBER_ORDINAL=0, MEMBER_NAME=All Customers, MEMBER_UNIQUE_NAME=[Customers].[All Customers], MEMBER_TYPE=2, MEMBER_GUID=null, MEMBER_CAPTION=All Customers, CHILDREN_CARDINALITY=3, PARENT_LEVEL=0, PARENT_UNIQUE_NAME=null, PARENT_COUNT=0, TREE_OP=null, DEPTH=0\n", s); break; default: TestContext.assertEqualsVerbose( - "CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Customers], HIERARCHY_UNIQUE_NAME=[Customers], LEVEL_UNIQUE_NAME=[Customers].[(All)], LEVEL_NUMBER=0, MEMBER_ORDINAL=0, MEMBER_NAME=All Customers, MEMBER_UNIQUE_NAME=[Customers].[All Customers], MEMBER_TYPE=2, MEMBER_GUID=null, MEMBER_CAPTION=All Customers, CHILDREN_CARDINALITY=3, PARENT_LEVEL=0, PARENT_UNIQUE_NAME=null, PARENT_COUNT=0, TREE_OP=null, DEPTH=0\n" - + "CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Customers], HIERARCHY_UNIQUE_NAME=[Customers], LEVEL_UNIQUE_NAME=[Customers].[Country], LEVEL_NUMBER=1, MEMBER_ORDINAL=2966, MEMBER_NAME=USA, MEMBER_UNIQUE_NAME=[Customers].[All Customers].[USA], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=USA, CHILDREN_CARDINALITY=3, PARENT_LEVEL=0, PARENT_UNIQUE_NAME=[Customers].[All Customers], PARENT_COUNT=1, TREE_OP=null, DEPTH=1\n" - + "CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Customers], HIERARCHY_UNIQUE_NAME=[Customers], LEVEL_UNIQUE_NAME=[Customers].[State Province], LEVEL_NUMBER=2, MEMBER_ORDINAL=7235, MEMBER_NAME=OR, MEMBER_UNIQUE_NAME=[Customers].[All Customers].[USA].[OR], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=OR, CHILDREN_CARDINALITY=11, PARENT_LEVEL=1, PARENT_UNIQUE_NAME=[Customers].[All Customers].[USA], PARENT_COUNT=1, TREE_OP=null, DEPTH=2\n" - + "CATALOG_NAME=" + catalogName + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Customers], HIERARCHY_UNIQUE_NAME=[Customers], LEVEL_UNIQUE_NAME=[Customers].[State Province], LEVEL_NUMBER=2, MEMBER_ORDINAL=8298, MEMBER_NAME=WA, MEMBER_UNIQUE_NAME=[Customers].[All Customers].[USA].[WA], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=WA, CHILDREN_CARDINALITY=22, PARENT_LEVEL=1, PARENT_UNIQUE_NAME=[Customers].[All Customers].[USA], PARENT_COUNT=1, TREE_OP=null, DEPTH=2\n", + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Customers], HIERARCHY_UNIQUE_NAME=[Customers], LEVEL_UNIQUE_NAME=[Customers].[(All)], LEVEL_NUMBER=0, MEMBER_ORDINAL=0, MEMBER_NAME=All Customers, MEMBER_UNIQUE_NAME=[Customers].[All Customers], MEMBER_TYPE=2, MEMBER_GUID=null, MEMBER_CAPTION=All Customers, CHILDREN_CARDINALITY=3, PARENT_LEVEL=0, PARENT_UNIQUE_NAME=null, PARENT_COUNT=0, TREE_OP=null, DEPTH=0\n" + + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Customers], HIERARCHY_UNIQUE_NAME=[Customers], LEVEL_UNIQUE_NAME=[Customers].[Country], LEVEL_NUMBER=1, MEMBER_ORDINAL=2966, MEMBER_NAME=USA, MEMBER_UNIQUE_NAME=[Customers].[All Customers].[USA], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=USA, CHILDREN_CARDINALITY=3, PARENT_LEVEL=0, PARENT_UNIQUE_NAME=[Customers].[All Customers], PARENT_COUNT=1, TREE_OP=null, DEPTH=1\n" + + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Customers], HIERARCHY_UNIQUE_NAME=[Customers], LEVEL_UNIQUE_NAME=[Customers].[State Province], LEVEL_NUMBER=2, MEMBER_ORDINAL=7235, MEMBER_NAME=OR, MEMBER_UNIQUE_NAME=[Customers].[All Customers].[USA].[OR], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=OR, CHILDREN_CARDINALITY=11, PARENT_LEVEL=1, PARENT_UNIQUE_NAME=[Customers].[All Customers].[USA], PARENT_COUNT=1, TREE_OP=null, DEPTH=2\n" + + "CATALOG_NAME=" + catalogName + + ", SCHEMA_NAME=FoodMart, CUBE_NAME=Sales, DIMENSION_UNIQUE_NAME=[Customers], HIERARCHY_UNIQUE_NAME=[Customers], LEVEL_UNIQUE_NAME=[Customers].[State Province], LEVEL_NUMBER=2, MEMBER_ORDINAL=8298, MEMBER_NAME=WA, MEMBER_UNIQUE_NAME=[Customers].[All Customers].[USA].[WA], MEMBER_TYPE=1, MEMBER_GUID=null, MEMBER_CAPTION=WA, CHILDREN_CARDINALITY=22, PARENT_LEVEL=1, PARENT_UNIQUE_NAME=[Customers].[All Customers].[USA], PARENT_COUNT=1, TREE_OP=null, DEPTH=2\n", s); break; } diff --git a/testsrc/org/olap4j/OlapTest.java b/testsrc/org/olap4j/OlapTest.java index f205e92..c6f0d46 100644 --- a/testsrc/org/olap4j/OlapTest.java +++ b/testsrc/org/olap4j/OlapTest.java @@ -97,7 +97,9 @@ public void testModel() { String schemaName = "FoodMart"; String userName = "foodmartuser"; String password = "foodmartpassword"; - String jdbc = "jdbc:mysql://localhost/foodmart?user=foodmartuser&password=foodmartpassword"; + String jdbc = + "jdbc:mysql://localhost/foodmart?user=foodmartuser" + + "&password=foodmartpassword"; // Create a connection object to the specific implementation of an // olap4j source. This is the only provider-specific code. @@ -217,7 +219,8 @@ public void testModel() { query.getAxis(Axis.ROWS).addDimension(storeQuery); fail("expected exception"); } catch (Exception e) { - assertTrue(e.getMessage().contains("dimension already on this axis")); + assertTrue( + e.getMessage().contains("dimension already on this axis")); } query.validate(); @@ -545,7 +548,6 @@ public void testDimensionsOrder() { timeDimension.select(Selection.Operator.CHILDREN, "Time", "1997"); QueryDimension measuresDimension = query.getDimension("Measures"); - measuresDimension.select("Measures", "Store Sales"); diff --git a/testsrc/org/olap4j/XmlaConnectionTest.java b/testsrc/org/olap4j/XmlaConnectionTest.java index 98393ce..34f33db 100644 --- a/testsrc/org/olap4j/XmlaConnectionTest.java +++ b/testsrc/org/olap4j/XmlaConnectionTest.java @@ -164,7 +164,8 @@ public byte[] get(URL url, String request) */ private void checkup(String request) { String hash = Encoder.convertToHex(request.getBytes()); - if (request.indexOf("MDSCHEMA_CUBES") == -1 + if (request.indexOf("MDSCHEMA_CUBES") + == -1 && this.requests.containsKey(hash)) { throw new RuntimeException("DOUBLE-REQUEST"); @@ -192,11 +193,14 @@ public void testNoNonTrivalCallsOnConnect() throws Exception { info.setProperty( XmlaOlap4jDriver.Property.Catalog.name(), "FoodMart"); DriverManager.getConnection( - "jdbc:xmla:Server=http://foo;Catalog=FoodMart;TestProxyCookie=" + cookie, + "jdbc:xmla:Server=http://foo;Catalog=FoodMart;TestProxyCookie=" + + cookie, info); } catch (Throwable t) { t.printStackTrace(); - fail("Non-Trival Call executed during construction of XmlaOlap4j Connection"); + fail( + "Non-Trival Call executed during construction of XmlaOlap4j " + + "Connection"); } } diff --git a/testsrc/org/olap4j/XmlaTester.java b/testsrc/org/olap4j/XmlaTester.java index d4b23ce..45b210a 100644 --- a/testsrc/org/olap4j/XmlaTester.java +++ b/testsrc/org/olap4j/XmlaTester.java @@ -129,7 +129,8 @@ public static String getProxyClassName() { public static final String DRIVER_URL_PREFIX = "jdbc:xmla:"; private static final String USER = "user"; private static final String PASSWORD = "password"; - private static String PROXY_CLASS_NAME = "mondrian.olap4j.MondrianInprocProxy"; + private static String PROXY_CLASS_NAME = + "mondrian.olap4j.MondrianInprocProxy"; } // End XmlaTester.java diff --git a/testsrc/org/olap4j/driver/xmla/proxy/XmlaCachedProxyTest.java b/testsrc/org/olap4j/driver/xmla/proxy/XmlaCachedProxyTest.java index dd3b4b5..e1866c6 100644 --- a/testsrc/org/olap4j/driver/xmla/proxy/XmlaCachedProxyTest.java +++ b/testsrc/org/olap4j/driver/xmla/proxy/XmlaCachedProxyTest.java @@ -320,7 +320,9 @@ public void testCacheSharing() throws Exception proxy = new XmlaOlap4jHttpProxy(dummyDriver); proxy.setCache(driverParameters, cacheProperties); } catch (Throwable e) { - fail("The cache is not properly shared since an error should not have been thrown."); + fail( + "The cache is not properly shared since an error should not " + + "have been thrown."); } } diff --git a/testsrc/org/olap4j/driver/xmla/proxy/XmlaCookieManagerTest.java b/testsrc/org/olap4j/driver/xmla/proxy/XmlaCookieManagerTest.java index ce449eb..74b00ea 100644 --- a/testsrc/org/olap4j/driver/xmla/proxy/XmlaCookieManagerTest.java +++ b/testsrc/org/olap4j/driver/xmla/proxy/XmlaCookieManagerTest.java @@ -12,8 +12,8 @@ public class XmlaCookieManagerTest extends TestCase { private static final String receivedCookieKey = "Set-Cookie"; public final static String sentCookieKey = "Cookie"; - public final static String cookieValue = "MyTestCookie=271B79EBCBAAA37C5C51B1979441E5AC"; - + public final static String cookieValue = + "MyTestCookie=271B79EBCBAAA37C5C51B1979441E5AC"; /** diff --git a/testsrc/org/olap4j/impl/Base64Test.java b/testsrc/org/olap4j/impl/Base64Test.java index 423c43a..403a279 100644 --- a/testsrc/org/olap4j/impl/Base64Test.java +++ b/testsrc/org/olap4j/impl/Base64Test.java @@ -75,9 +75,15 @@ public void testStreams() throws Exception public void testSimple() { - String s = "Man is distinguished, not only by his reason, but by this singular passion from other animals, which is a lust of the mind, that by a perseverance of delight in the continued and indefatigable generation of knowledge, exceeds the short vehemence of any carnal pleasure."; + String s = + "Man is distinguished, not only by his reason, but by this " + + "singular passion from other animals, which is a lust of the " + + "mind, that by a perseverance of delight in the continued and " + + "indefatigable generation of knowledge, exceeds the short " + + "vehemence of any carnal pleasure."; String encoded = Base64.encodeBytes(s.getBytes()); - String expected = "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz\n" + String expected = + "TWFuIGlzIGRpc3Rpbmd1aXNoZWQsIG5vdCBvbmx5IGJ5IGhpcyByZWFzb24sIGJ1dCBieSB0aGlz\n" + "IHNpbmd1bGFyIHBhc3Npb24gZnJvbSBvdGhlciBhbmltYWxzLCB3aGljaCBpcyBhIGx1c3Qgb2Yg\n" + "dGhlIG1pbmQsIHRoYXQgYnkgYSBwZXJzZXZlcmFuY2Ugb2YgZGVsaWdodCBpbiB0aGUgY29udGlu\n" + "dWVkIGFuZCBpbmRlZmF0aWdhYmxlIGdlbmVyYXRpb24gb2Yga25vd2xlZGdlLCBleGNlZWRzIHRo\n" diff --git a/testsrc/org/olap4j/impl/ConnectStringParserTest.java b/testsrc/org/olap4j/impl/ConnectStringParserTest.java index eacfb9d..672b22d 100644 --- a/testsrc/org/olap4j/impl/ConnectStringParserTest.java +++ b/testsrc/org/olap4j/impl/ConnectStringParserTest.java @@ -90,11 +90,13 @@ public void testBug1938151 () { Map properties; // ends in semi - properties = ConnectStringParser.parseConnectString("foo=true; bar=xxx;"); + properties = + ConnectStringParser.parseConnectString("foo=true; bar=xxx;"); assertEquals(2, properties.size()); // ends in semi+space - properties = ConnectStringParser.parseConnectString("foo=true; bar=xxx; "); + properties = + ConnectStringParser.parseConnectString("foo=true; bar=xxx; "); assertEquals(2, properties.size()); // ends in space @@ -136,7 +138,9 @@ public void testOleDbSpec() { // compatibility with ODBC connection strings. The ODBC connection // string in the following example can be passed in, and it will // successfully connect. - p("Driver={SQL Server};Server={localhost};Trusted_Connection={yes};db={Northwind};", "Provider", "MSDASQL"); + p( + "Driver={SQL Server};Server={localhost};Trusted_Connection={yes};" + + "db={Northwind};", "Provider", "MSDASQL"); } // Specifying a Keyword @@ -150,7 +154,10 @@ public void testOleDbSpec() { p("Provider='MSDASQL';Location='3Northwind'", "Location", "3Northwind"); // Keywords can contain any printable character except for the equal // sign (=). - p("Jet OLE DB:System Database=c:\\system.mda", "Jet OLE DB:System Database", "c:\\system.mda"); + p( + "Jet OLE DB:System Database=c:\\system.mda", + "Jet OLE DB:System Database", + "c:\\system.mda"); p("Authentication;Info=Column 5", "Authentication;Info", "Column 5"); // If a keyword contains an equal sign (=), it must be preceded by an // additional equal sign to indicate that it is part of the keyword. @@ -164,21 +171,38 @@ public void testOleDbSpec() { // To include values that contain a semicolon, single-quote character, // or double-quote character, the value must be enclosed in double // quotes. - p("ExtendedProperties=\"Integrated Security='SSPI';Initial Catalog='Northwind'\"", "ExtendedProperties", "Integrated Security='SSPI';Initial Catalog='Northwind'"); + p( + "ExtendedProperties=\"Integrated Security='SSPI';" + + "Initial Catalog='Northwind'\"", + "ExtendedProperties", + "Integrated Security='SSPI';Initial Catalog='Northwind'"); // If the value contains both a semicolon and a double-quote character, // the value can be enclosed in single quotes. - p("ExtendedProperties='Integrated Security=\"SSPI\";Databse=\"My Northwind DB\"'", "ExtendedProperties", "Integrated Security=\"SSPI\";Databse=\"My Northwind DB\""); + p( + "ExtendedProperties='Integrated Security=\"SSPI\";" + + "Databse=\"My Northwind DB\"'", + "ExtendedProperties", + "Integrated Security=\"SSPI\";Databse=\"My Northwind DB\""); // The single quote is also useful if the value begins with a // double-quote character. p("DataSchema='\"MyCustTable\"'", "DataSchema", "\"MyCustTable\""); // Conversely, the double quote can be used if the value begins with a // single quote. - p("DataSchema=\"'MyOtherCustTable'\"", "DataSchema", "'MyOtherCustTable'"); + p( + "DataSchema=\"'MyOtherCustTable'\"", + "DataSchema", + "'MyOtherCustTable'"); // If the value contains both single-quote and double-quote characters, // the quote character used to enclose the value must be doubled each // time it occurs within the value. - p("NewRecordsCaption='\"Company''s \"new\" customer\"'", "NewRecordsCaption", "\"Company's \"new\" customer\""); - p("NewRecordsCaption=\"\"\"Company's \"\"new\"\" customer\"\"\"", "NewRecordsCaption", "\"Company's \"new\" customer\""); + p( + "NewRecordsCaption='\"Company''s \"new\" customer\"'", + "NewRecordsCaption", + "\"Company's \"new\" customer\""); + p( + "NewRecordsCaption=\"\"\"Company's \"\"new\"\" customer\"\"\"", + "NewRecordsCaption", + "\"Company's \"new\" customer\""); // Setting Values That Use Spaces // // Any leading or trailing spaces around a keyword or value are @@ -218,11 +242,19 @@ public void testOleDbSpec() { // If a specific keyword in a keyword=value pair occurs multiple times // in a connection string, the last occurrence listed is used in the // value set. - p("Provider='MSDASQL';Location='Northwind';Cache Authentication='True';Prompt='Complete';Location='Customers'", "Location", "Customers"); + p( + "Provider='MSDASQL';Location='Northwind';" + + "Cache Authentication='True';Prompt='Complete';" + + "Location='Customers'", + "Location", + "Customers"); // One exception to the preceding rule is the Provider keyword. If this // keyword occurs multiple times in the string, the first occurrence is // used. - p("Provider='MSDASQL';Location='Northwind'; Provider='SQLOLEDB'", "Provider", "MSDASQL"); + p( + "Provider='MSDASQL';Location='Northwind'; Provider='SQLOLEDB'", + "Provider", + "MSDASQL"); if (false) { // (Not supported) // diff --git a/testsrc/org/olap4j/test/ParserTest.java b/testsrc/org/olap4j/test/ParserTest.java index 20612b2..c3eb698 100644 --- a/testsrc/org/olap4j/test/ParserTest.java +++ b/testsrc/org/olap4j/test/ParserTest.java @@ -158,8 +158,8 @@ public void testNegativeCases() throws Exception { assertParseQuery( "select [member] on axis(5) from sales", "SELECT\n" - + "[member] ON AXIS(5)\n" - + "FROM sales"); + + "[member] ON AXIS(5)\n" + + "FROM sales"); assertParseQueryFails( "select [member] on ^axes^(0) from sales", @@ -172,8 +172,8 @@ public void testNegativeCases() throws Exception { assertParseQuery( "select [member] on 555 from sales", "SELECT\n" - + "[member] ON AXIS(555)\n" - + "FROM sales"); + + "[member] ON AXIS(555)\n" + + "FROM sales"); } public void testScannerPunc() { @@ -181,8 +181,8 @@ public void testScannerPunc() { assertParseQuery( "select [measures].[$foo] on columns from sales", "SELECT\n" - + "[measures].[$foo] ON COLUMNS\n" - + "FROM sales"); + + "[measures].[$foo] ON COLUMNS\n" + + "FROM sales"); // todo: parser off by one assertParseQueryFails( @@ -198,17 +198,17 @@ public void testScannerPunc() { public void testUnparse() { checkUnparse( "with member [Measures].[Foo] as ' 123 '\n" - + "select {[Measures].members} on columns,\n" - + " CrossJoin([Product].members, {[Gender].Children}) on rows\n" - + "from [Sales]\n" - + "where [Marital Status].[S]", + + "select {[Measures].members} on columns,\n" + + " CrossJoin([Product].members, {[Gender].Children}) on rows\n" + + "from [Sales]\n" + + "where [Marital Status].[S]", "WITH\n" - + "MEMBER [Measures].[Foo] AS '123.0'\n" - + "SELECT\n" - + "{[Measures].members} ON COLUMNS,\n" - + "CrossJoin([Product].members, {[Gender].Children}) ON ROWS\n" - + "FROM [Sales]\n" - + "WHERE [Marital Status].[S]"); + + "MEMBER [Measures].[Foo] AS '123.0'\n" + + "SELECT\n" + + "{[Measures].members} ON COLUMNS,\n" + + "CrossJoin([Product].members, {[Gender].Children}) ON ROWS\n" + + "FROM [Sales]\n" + + "WHERE [Marital Status].[S]"); } private void checkUnparse(String queryString, final String expected) { @@ -466,42 +466,42 @@ public void testMultipleAxes() throws Exception { public void testCaseTest() { assertParseQuery( "with member [Measures].[Foo] as " - + " ' case when x = y then \"eq\" when x < y then \"lt\" else \"gt\" end '" - + "select {[foo]} on axis(0) from cube", + + " ' case when x = y then \"eq\" when x < y then \"lt\" else \"gt\" end '" + + "select {[foo]} on axis(0) from cube", "WITH\n" - + "MEMBER [Measures].[Foo] AS 'CASE WHEN (x = y) THEN \"eq\" WHEN (x < y) THEN \"lt\" ELSE \"gt\" END'\n" - + "SELECT\n" - + "{[foo]} ON COLUMNS\n" - + "FROM cube"); + + "MEMBER [Measures].[Foo] AS 'CASE WHEN (x = y) THEN \"eq\" WHEN (x < y) THEN \"lt\" ELSE \"gt\" END'\n" + + "SELECT\n" + + "{[foo]} ON COLUMNS\n" + + "FROM cube"); } public void testCaseSwitch() { assertParseQuery( "with member [Measures].[Foo] as " - + " ' case x when 1 then 2 when 3 then 4 else 5 end '" - + "select {[foo]} on axis(0) from cube", + + " ' case x when 1 then 2 when 3 then 4 else 5 end '" + + "select {[foo]} on axis(0) from cube", "WITH\n" - + "MEMBER [Measures].[Foo] AS 'CASE x WHEN 1.0 THEN 2.0 WHEN 3.0 THEN 4.0 ELSE 5.0 END'\n" - + "SELECT\n" - + "{[foo]} ON COLUMNS\n" - + "FROM cube"); + + "MEMBER [Measures].[Foo] AS 'CASE x WHEN 1.0 THEN 2.0 WHEN 3.0 THEN 4.0 ELSE 5.0 END'\n" + + "SELECT\n" + + "{[foo]} ON COLUMNS\n" + + "FROM cube"); } public void testDimensionProperties() { assertParseQuery( "select {[foo]} properties p1, p2 on columns from [cube]", "SELECT\n" - + "{[foo]} DIMENSION PROPERTIES p1, p2 ON COLUMNS\n" - + "FROM [cube]"); + + "{[foo]} DIMENSION PROPERTIES p1, p2 ON COLUMNS\n" + + "FROM [cube]"); } public void testCellProperties() { assertParseQuery( - "select {[foo]} on columns from [cube] CELL PROPERTIES FORMATTED_VALUE", - "SELECT\n" - + "{[foo]} ON COLUMNS\n" - + "FROM [cube]\n" - + "CELL PROPERTIES FORMATTED_VALUE"); + "select {[foo]} on columns from [cube] CELL PROPERTIES FORMATTED_VALUE", + "SELECT\n" + + "{[foo]} ON COLUMNS\n" + + "FROM [cube]\n" + + "CELL PROPERTIES FORMATTED_VALUE"); } public void testIsEmpty() { @@ -542,8 +542,8 @@ public void testIsNull() { "(x is null) + 56 > 6", "((((x IS NULL)) + 56.0) > 6.0)"); - // FIXME: Should be - // "(((((x IS NULL) AND (a = b)) OR ((c = (d + 5.0))) IS NULL) + 5.0)"); + // FIXME: Should be: + // "(((((x IS NULL) AND (a = b)) OR ((c = (d + 5.0))) IS NULL) + 5.0)" assertParseExpr( "x is null and a = b or c = d + 5 is null + 5", "(((x IS NULL) AND (a = b)) OR ((c = (d + 5.0)) IS (NULL + 5.0)))"); @@ -698,9 +698,11 @@ public void testNumbers() { // lots of digits left and right of point assertParseExpr("31415926535.89793", "3.141592653589793E10"); - assertParseExpr("31415926535897.9314159265358979", "3.141592653589793E13"); + assertParseExpr( + "31415926535897.9314159265358979", "3.141592653589793E13"); assertParseExpr("3.141592653589793", "3.141592653589793"); - assertParseExpr("-3141592653589793.14159265358979", "(- 3.141592653589793E15)"); + assertParseExpr( + "-3141592653589793.14159265358979", "(- 3.141592653589793E15)"); // exponents akimbo assertParseExpr("1e2", "100.0"); @@ -726,19 +728,19 @@ public void testLargePrecision() { // testcase for the bug. assertParseQuery( "with member [Measures].[Small Number] as '[Measures].[Store Sales] / 9000'\n" - + "select\n" - + "{[Measures].[Small Number]} on columns,\n" - + "{Filter([Product].[Product Department].members, [Measures].[Small Number] >= 0.3\n" - + "and [Measures].[Small Number] <= 0.5000001234)} on rows\n" - + "from Sales\n" - + "where ([Time].[1997].[Q2].[4])", + + "select\n" + + "{[Measures].[Small Number]} on columns,\n" + + "{Filter([Product].[Product Department].members, [Measures].[Small Number] >= 0.3\n" + + "and [Measures].[Small Number] <= 0.5000001234)} on rows\n" + + "from Sales\n" + + "where ([Time].[1997].[Q2].[4])", "WITH\n" - + "MEMBER [Measures].[Small Number] AS '([Measures].[Store Sales] / 9000.0)'\n" - + "SELECT\n" - + "{[Measures].[Small Number]} ON COLUMNS,\n" - + "{Filter([Product].[Product Department].members, (([Measures].[Small Number] >= 0.3) AND ([Measures].[Small Number] <= 0.5000001234)))} ON ROWS\n" - + "FROM Sales\n" - + "WHERE ([Time].[1997].[Q2].[4])"); + + "MEMBER [Measures].[Small Number] AS '([Measures].[Store Sales] / 9000.0)'\n" + + "SELECT\n" + + "{[Measures].[Small Number]} ON COLUMNS,\n" + + "{Filter([Product].[Product Department].members, (([Measures].[Small Number] >= 0.3) AND ([Measures].[Small Number] <= 0.5000001234)))} ON ROWS\n" + + "FROM Sales\n" + + "WHERE ([Time].[1997].[Q2].[4])"); } public void testIdentifier() { diff --git a/testsrc/org/olap4j/test/TestContext.java b/testsrc/org/olap4j/test/TestContext.java index 3ccd2b3..a8f14d6 100644 --- a/testsrc/org/olap4j/test/TestContext.java +++ b/testsrc/org/olap4j/test/TestContext.java @@ -625,13 +625,12 @@ private Property(String path) { */ public static class SafeString { - @Override - public String toString() { - return s; - } - public final String s; + /** + * Creates a SafeString. + * @param s String + */ private SafeString(String s) { this.s = s; }