Skip to content

Commit

Permalink
MONDRIAN: fix checkFile violations
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//open/mondrian/": change = 12877]
  • Loading branch information
Matt Campbell authored and Matt Campbell committed Jun 17, 2009
1 parent 4edc603 commit 2766033
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 56 deletions.
52 changes: 29 additions & 23 deletions src/main/mondrian/olap/Util.java
Expand Up @@ -778,10 +778,10 @@ public static Exp lookup(
schemaReader.lookupCompound(
q.getCube(), namePartsButOne, false, Category.Member);
if (olapElement != null &&
isValidProperty((Member) olapElement, propertyName)) {
isValidProperty((Member) olapElement, propertyName)) {
return new UnresolvedFunCall(
propertyName, Syntax.Property, new Exp[] {
createExpr(olapElement)});
propertyName, Syntax.Property, new Exp[] {
createExpr(olapElement)});
}
}
// if we're in the middle of loading the schema, the property has
Expand All @@ -802,8 +802,8 @@ public static Exp lookup(
if (olapElement != null) {
olapElement = olapElement.getHierarchy().getNullMember();
} else {
throw MondrianResource.instance().MdxChildObjectNotFound.ex(
fullName, q.getCube().getQualifiedName());
throw MondrianResource.instance().MdxChildObjectNotFound.
ex(fullName, q.getCube().getQualifiedName());
}
} else {
throw MondrianResource.instance().MdxChildObjectNotFound.ex(
Expand Down Expand Up @@ -1096,7 +1096,10 @@ public static boolean isValidProperty(
* Finds a member property called <code>propertyName</code> at, or above,
* <code>level</code>.
*/
protected static Property lookupProperty(Level level, String propertyName) {
protected static Property lookupProperty(
Level level,
String propertyName)
{
do {
Property[] properties = level.getProperties();
for (Property property : properties) {
Expand Down Expand Up @@ -1645,8 +1648,10 @@ public static URL toURL(File file) throws MalformedURLException {
* <code>PropertyList</code> is an order-preserving list of key-value
* pairs. Lookup is case-insensitive, but the case of keys is preserved.
*/
public static class PropertyList implements Iterable<Pair<String, String>> {
List<Pair<String, String>> list = new ArrayList<Pair<String, String>>();
public static class PropertyList
implements Iterable<Pair<String, String>> {
List<Pair<String, String>> list =
new ArrayList<Pair<String, String>>();

public String get(String key) {
return get(key, null);
Expand Down Expand Up @@ -2008,7 +2013,8 @@ public FunDef getDef(Exp[] args, String name, Syntax syntax) {
final Resolver resolver = resolvers.get(0);
final List<Resolver.Conversion> conversionList =
new ArrayList<Resolver.Conversion>();
final FunDef def = resolver.resolve(args, this, conversionList);
final FunDef def =
resolver.resolve(args, this, conversionList);
assert conversionList.isEmpty();
return def;
}
Expand Down Expand Up @@ -2177,17 +2183,17 @@ public static FileContent readVirtualFile(String url)
FileObject file = fsManager.resolveFile(userDir, url);
FileContent fileContent = null;
try {
// Because of VFS caching, make sure we refresh to get the latest file
// content.
// This refresh may possibly solve the following workaround for defect
// MONDRIAN-508, but cannot be tested, so we will leave the work
// around for now
// Because of VFS caching, make sure we refresh to get the latest
// file content. This refresh may possibly solve the following
// workaround for defect MONDRIAN-508, but cannot be tested, so we
// will leave the work around for now.
file.refresh();

// Workaround to defect MONDRIAN-508. For HttpFileObjects, verifies the
// URL of the file retrieved matches the URL passed in. A VFS cache bug
// can cause it to treat URLs with different parameters as the same file
// (e.g. http://blah.com?param=A, http://blah.com?param=B)
// Workaround to defect MONDRIAN-508. For HttpFileObjects, verifies
// the URL of the file retrieved matches the URL passed in. A VFS
// cache bug can cause it to treat URLs with different parameters
// as the same file (e.g. http://blah.com?param=A,
// http://blah.com?param=B)
if (file instanceof HttpFileObject
&& !file.getName().getURI().equals(url))
{
Expand Down Expand Up @@ -2322,12 +2328,12 @@ public static <T> List<T> cast(List<?> list) {
/**
* Casts a collection to iterable.
*
* <p>Under JDK 1.4, {@link Collection} objects do not implement
* Under JDK 1.4, {@link Collection} objects do not implement
* {@link Iterable}, so this method inserts a casting wrapper. (Since
* Iterable does not exist under JDK 1.4, they will have been compiled under
* JDK 1.5 or later, then retrowoven to 1.4 class format. References to
* Iterable will have been replaced with references to
* <code>com.rc.retroweaver.runtime.Retroweaver_</code>.</p>
* Iterable does not exist under JDK 1.4, they will have been compiled
* under JDK 1.5 or later, then retrowoven to 1.4 class format. References
* to Iterable will have been replaced with references to
* <code>com.rc.retroweaver.runtime.Retroweaver_</code>.
*
* <p>Under later JDKs this method is trivial. This method can be deleted
* when we discontinue support for JDK 1.4.
Expand Down
69 changes: 36 additions & 33 deletions testsrc/main/mondrian/test/SolveOrderScopeIsolationTest.java
Expand Up @@ -28,8 +28,8 @@
* Further details at: http://msdn2.microsoft.com/en-us/library/ms144787.aspx
*
* This initial set of tests are added to indicate the kind of behavior that is
* expected to support this SSAS 2005 feature. All tests start with an underscore
* so as to not to execute even if the test class is added to Main
* expected to support this SSAS 2005 feature. All tests start with an
* underscore so as to not to execute even if the test class is added to Main
*
* @author ajogleka
* @version $Id$
Expand Down Expand Up @@ -115,7 +115,7 @@ public void testSetSolveOrderMode()
assertEquals(SCOPED, getSolveOrderMode());
}

public void testOverrideOverCubeMemberDoesNotHappenAbsolute() {
public void testOverrideCubeMemberDoesNotHappenAbsolute() {
final String mdx =
"with\n"
+ "member gender.override as 'gender.maleMinusFemale', "
Expand Down Expand Up @@ -145,7 +145,7 @@ public void testOverrideOverCubeMemberDoesNotHappenAbsolute() {
+ "Row #1: 1175\n");
}

public void testOverrideOverCubeMemberDoesNotHappenScoped() {
public void testOverrideCubeMemberDoesNotHappenScoped() {
final String mdx =
"with\n"
+ "member gender.override as 'gender.maleMinusFemale', "
Expand Down Expand Up @@ -179,7 +179,7 @@ public void testOverrideOverCubeMemberDoesNotHappenScoped() {
* Test for future capability: SCOPE_ISOLATION=CUBE which is implemented in
* Analysis Services but not yet in Mondrian.
*/
public void _future_testOverrideOverCubeMemberHappensWithScopeIsolation() {
public void _future_testOverrideCubeMemberHappensWithScopeIsolation() {
setSolveOrderMode(SCOPED);
assertQueryReturns(
"with\n"
Expand Down Expand Up @@ -211,7 +211,7 @@ public void _future_testOverrideOverCubeMemberHappensWithScopeIsolation() {
+ "Row #1: 1175\n");
}

public void testCubeMemberIsEvaluatedBeforeQueryMemberAbsolute() {
public void testCubeMemberEvalBeforeQueryMemberAbsolute() {
final String mdx =
"WITH MEMBER [Customers].USAByWA AS\n"
+ "'[Customers].[Country].[USA] / [Customers].[State Province].[WA]', "
Expand Down Expand Up @@ -243,7 +243,7 @@ public void testCubeMemberIsEvaluatedBeforeQueryMemberAbsolute() {
+ "Row #2: $0.000518\n");
}

public void testCubeMemberIsEvaluatedBeforeQueryMemberScoped() {
public void testCubeMemberEvalBeforeQueryMemberScoped() {
final String mdx =
"WITH MEMBER [Customers].USAByWA AS\n"
+ "'[Customers].[Country].[USA] / [Customers].[State Province].[WA]', "
Expand All @@ -265,7 +265,7 @@ public void testCubeMemberIsEvaluatedBeforeQueryMemberScoped() {
+ "Row #0: $2.143076\n");
}

public void testOverrideOverCubeMemberInTupleDoesNotHappenAbsolute() {
public void testOverrideCubeMemberInTupleDoesNotHappenAbsolute() {
final String mdx =
"with\n"
+ "member gender.override as "
Expand Down Expand Up @@ -296,7 +296,7 @@ public void testOverrideOverCubeMemberInTupleDoesNotHappenAbsolute() {
+ "Row #1: 1175\n");
}

public void testOverrideOverCubeMemberInTupleDoesNotHappenScoped() {
public void testOverrideCubeMemberInTupleDoesNotHappenScoped() {
final String mdx =
"with\n"
+ "member gender.override as "
Expand Down Expand Up @@ -327,7 +327,7 @@ public void testOverrideOverCubeMemberInTupleDoesNotHappenScoped() {
+ "Row #1: 1175\n");
}

public void testConditionalCubeMemberGetsEvaluatedBeforeOtherMembersAbsolute() {
public void testConditionalCubeMemberEvalBeforeOtherMembersAbsolute() {
final String mdx =
"with\n"
+ "member gender.override as 'iif(1=0,"
Expand Down Expand Up @@ -358,7 +358,7 @@ public void testConditionalCubeMemberGetsEvaluatedBeforeOtherMembersAbsolute() {
+ "Row #1: 1175\n");
}

public void testConditionalCubeMemberGetsEvaluatedBeforeOtherMembersScoped() {
public void testConditionalCubeMemberEvalBeforeOtherMembersScoped() {
final String mdx =
"with\n"
+ "member gender.override as 'iif(1=0,"
Expand Down Expand Up @@ -389,7 +389,7 @@ public void testConditionalCubeMemberGetsEvaluatedBeforeOtherMembersScoped() {
+ "Row #1: 1175\n");
}

public void testOverrideOverCubeMemberUsingStrToMemberDoesNotHappenAbsolute() {
public void testOverrideCubeMemberUsingStrToMemberDoesNotHappenAbsolute() {
final String mdx =
"with\n"
+ "member gender.override as 'iif(1=0,[gender].[all gender].[m], "
Expand Down Expand Up @@ -420,7 +420,7 @@ public void testOverrideOverCubeMemberUsingStrToMemberDoesNotHappenAbsolute() {
+ "Row #1: 1175\n");
}

public void testOverrideOverCubeMemberUsingStrToMemberDoesNotHappenScoped() {
public void testOverrideCubeMemberUsingStrToMemberDoesNotHappenScoped() {
final String mdx =
"with\n"
+ "member gender.override as 'iif(1=0,[gender].[all gender].[m], "
Expand Down Expand Up @@ -452,12 +452,13 @@ public void testOverrideOverCubeMemberUsingStrToMemberDoesNotHappenScoped() {
}

/**
* This test validates that behavior is consistent with Analysis Services 2000 when
* Solve order scope is ABSOLUTE. AS2K will throw an error whenever attempting to
* aggregate over calculated members (i.e. when the solve order of the Aggregate
* member is higher than the calculations it intersects with).
* This test validates that behavior is consistent with Analysis Services
* 2000 when Solve order scope is ABSOLUTE. AS2K will throw an error
* whenever attempting to aggregate over calculated members (i.e. when the
* solve order of the Aggregate member is higher than the calculations it
* intersects with).
*/
public void testAggregateMemberIsEvaluatedAfterOtherMembersAbsolute() {
public void testAggregateMemberEvalAfterOtherMembersAbsolute() {
final String mdx =
"With\n"
+ "member Time.Total1 as "
Expand Down Expand Up @@ -499,7 +500,7 @@ public void testAggregateMemberIsEvaluatedAfterOtherMembersAbsolute() {
+ "Row #3: 20,368\n");
}

public void testAggregateMemberIsEvaluatedAfterOtherMembersScoped() {
public void testAggregateMemberEvalAfterOtherMembersScoped() {
final String mdx =
"With\n"
+ "member Time.Total1 as "
Expand Down Expand Up @@ -542,12 +543,13 @@ public void testAggregateMemberIsEvaluatedAfterOtherMembersScoped() {
}

/**
* This test validates that behavior is consistent with Analysis Services 2000 when
* Solve order scope is ABSOLUTE. AS2K will throw an error whenever attempting to
* aggregate over calculated members (i.e. when the solve order of the Aggregate
* member is higher than the calculations it intersects with).
* This test validates that behavior is consistent with Analysis Services
* 2000 when Solve order scope is ABSOLUTE. AS2K will throw an error
* whenever attempting to aggregate over calculated members (i.e. when the
* solve order of the Aggregate member is higher than the calculations it
* intersects with).
*/
public void testConditionalAggregateMemberIsEvaluatedAfterOtherMembersAbsolute() {
public void testConditionalAggregateMemberEvalAfterOtherMembersAbsolute() {
final String mdx =
"With\n"
+ "member Time.Total1 as 'IIF(Measures.CURRENTMEMBER IS Measures.Profit, 1, "
Expand Down Expand Up @@ -588,7 +590,7 @@ public void testConditionalAggregateMemberIsEvaluatedAfterOtherMembersAbsolute()
+ "Row #3: 20,368\n");
}

public void testConditionalAggregateMemberIsEvaluatedAfterOtherMembersScoped() {
public void testConditionalAggregateMemberEvalAfterOtherMembersScoped() {
final String mdx =
"With\n"
+ "member Time.Total1 as 'IIF(Measures.CURRENTMEMBER IS Measures.Profit, 1, "
Expand Down Expand Up @@ -630,12 +632,13 @@ public void testConditionalAggregateMemberIsEvaluatedAfterOtherMembersScoped() {
}

/**
* This test validates that behavior is consistent with Analysis Services 2000 when
* Solve order scope is ABSOLUTE. AS2K will throw an error whenever attempting to
* aggregate over calculated members (i.e. when the solve order of the Aggregate
* member is higher than the calculations it intersects with).
* This test validates that behavior is consistent with Analysis Services
* 2000 when Solve order scope is ABSOLUTE. AS2K will throw an error
* whenever attempting to aggregate over calculated members (i.e. when the
* solve order of the Aggregate member is higher than the calculations it
* intersects with).
*/
public void testStrToMemberReturningAggregateIsEvaluatedAfterOtherMembersAbsolute() {
public void testStrToMemberReturningAggEvalAfterOtherMembersAbsolute() {
final String mdx =
"With\n"
+ "member Time.StrTotal as 'AGGREGATE({[Time].[1997].[Q1],[Time].[1997].[Q2]})', "
Expand Down Expand Up @@ -674,7 +677,7 @@ public void testStrToMemberReturningAggregateIsEvaluatedAfterOtherMembersAbsolut
+ "Row #2: 20,368\n");
}

public void testStrToMemberReturningAggregateIsEvaluatedAfterOtherMembersScoped() {
public void testStrToMemberReturningAggEvalAfterOtherMembersScoped() {
final String mdx =
"With\n"
+ "member Time.StrTotal as 'AGGREGATE({[Time].[1997].[Q1],[Time].[1997].[Q2]})', "
Expand Down Expand Up @@ -713,7 +716,7 @@ public void testStrToMemberReturningAggregateIsEvaluatedAfterOtherMembersScoped(
+ "Row #2: 20,368\n");
}

public void test2LevelOfOverrideOverCubeMemberDoesNotHappenAbsolute() {
public void test2LevelOfOverrideCubeMemberDoesNotHappenAbsolute() {
final String mdx =
"With member gender.override1 as 'gender.maleMinusFemale',\n"
+ "SOLVE_ORDER=20, FORMAT_STRING='#.##'\n"
Expand Down Expand Up @@ -754,7 +757,7 @@ public void test2LevelOfOverrideOverCubeMemberDoesNotHappenAbsolute() {
+ "Row #2: 1175\n");
}

public void test2LevelOfOverrideOverCubeMemberDoesNotHappenScoped() {
public void test2LevelOfOverrideCubeMemberDoesNotHappenScoped() {
final String mdx =
"With member gender.override1 as 'gender.maleMinusFemale',\n"
+ "SOLVE_ORDER=20, FORMAT_STRING='#.##'\n"
Expand Down

0 comments on commit 2766033

Please sign in to comment.