Skip to content

Commit

Permalink
MONDRIAN: fix java files to follow coding conventions: comments added…
Browse files Browse the repository at this point in the history
…, no tabs

[git-p4: depot-paths = "//open/mondrian/": change = 8918]
  • Loading branch information
Khanh Vu committed Mar 21, 2007
1 parent cca3548 commit 271c0e2
Show file tree
Hide file tree
Showing 10 changed files with 372 additions and 177 deletions.
2 changes: 1 addition & 1 deletion src/main/mondrian/rolap/RolapEvaluator.java
Expand Up @@ -663,7 +663,7 @@ public void clearExpResultCache() {
// expressions. This may be overconservative in some cases, but
// without this, there can be bugs when incorrect results get cached
// for named sets which depend on measures which haven't been loaded
// yet. See mondrian.test.ClearViewTest.testLer4260 for an
// yet. See mondrian.test.clearview.CVBasicTest.testLer4260 for an
// example.
root.clearNamedSets();
}
Expand Down
63 changes: 43 additions & 20 deletions testsrc/main/mondrian/test/clearview/CVBasicTest.java
@@ -1,29 +1,52 @@
/*
// $Id$
// This software is subject to the terms of the Common Public License
// Agreement, available at the following URL:
// http://www.opensource.org/licenses/cpl.html.
// Copyright (C) 2007 Julian Hyde and others
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
//
*/
package mondrian.test.clearview;

import junit.framework.*;

import mondrian.test.*;

/**
* <code>CVBasicTest</code> is a test suite which tests
* complex queries against the FoodMart database. MDX queries and their
* expected results are maintained separately in CVBasicTest.ref.xml file.
* If you would prefer to see them as inlined Java string literals, run
* ant target "generateDiffRepositoryJUnit" and then use
* file CVBasicTestJUnit.java which will be generated in this directory.
*
* @author Khanh Vu
* @version $Id$
*/
public class CVBasicTest extends ClearViewBase {
public CVBasicTest() {
super();
}
public CVBasicTest(String name) {
super(name);
}

protected DiffRepository getDiffRepos() {
return getDiffReposStatic();
}
private static DiffRepository getDiffReposStatic() {
return DiffRepository.lookup(CVBasicTest.class);
}
public static TestSuite suite() {
return constructSuite(getDiffReposStatic(), CVBasicTest.class);
}

public CVBasicTest() {
super();
}

public CVBasicTest(String name) {
super(name);
}

protected DiffRepository getDiffRepos() {
return getDiffReposStatic();
}

private static DiffRepository getDiffReposStatic() {
return DiffRepository.lookup(CVBasicTest.class);
}

public static TestSuite suite() {
return constructSuite(getDiffReposStatic(), CVBasicTest.class);
}

}

// End CVBasicTest.java
36 changes: 20 additions & 16 deletions testsrc/main/mondrian/test/clearview/ClearViewBase.java
Expand Up @@ -22,21 +22,23 @@
import java.lang.reflect.*;

/**
* <code>ClearViewTest</code> is a test case which tests complex queries
* against the FoodMart database. MDX queries and their expected results are
* maintained separately in ClearViewTest.ref.xml. If you would
* prefer to see them as inlined Java string literals, run
* <code>ClearViewBase</code> is the base class to build test cases which test
* queries against the FoodMart database. A concrete sub class and
* a ref.xml file will be needed for each test suites to be added. MDX queries
* and their expected results are maintained separately in *.ref.xml files.
* If you would prefer to see them as inlined Java string literals, run
* ant target "generateDiffRepositoryJUnit" and then use
* class ClearViewJUnit which will be generated in this directory.
* files *JUnit.java which will be generated in this directory.
*
* @author John Sichi
* @author Richard Emberson
* @author Khanh Vu
*
* @since Jan 25, 2007
* @version $Id$
*/
public abstract class ClearViewBase extends FoodMartTestCase {

public ClearViewBase() {
super();
}
Expand All @@ -55,25 +57,27 @@ protected void setUp() throws Exception {

// implement TestCase
protected void tearDown() throws Exception {
DiffRepository diffRepos = getDiffRepos();
DiffRepository diffRepos = getDiffRepos();
diffRepos.setCurrentTestCaseName(null);
}

// implement TestCase
public static TestSuite constructSuite(DiffRepository diffRepos, Class clazz) {
public static TestSuite constructSuite(
DiffRepository diffRepos,
Class clazz)
{
TestSuite suite = new TestSuite();
Class[] types = new Class[] { String.class };

for (String name : diffRepos.getTestCaseNames()) {
try {
Constructor cons = clazz.getConstructor(types);
Object[] args = new Object[] { name };
suite.addTest((Test) cons.newInstance(args));
} catch (Exception e) {
throw new Error(e.getMessage());
}
try {
Constructor cons = clazz.getConstructor(types);
Object[] args = new Object[] { name };
suite.addTest((Test) cons.newInstance(args));
} catch (Exception e) {
throw new Error(e.getMessage());
}
}

return suite;
}

Expand Down
63 changes: 43 additions & 20 deletions testsrc/main/mondrian/test/clearview/GrandTotalTest.java
@@ -1,29 +1,52 @@
/*
// $Id$
// This software is subject to the terms of the Common Public License
// Agreement, available at the following URL:
// http://www.opensource.org/licenses/cpl.html.
// Copyright (C) 2007 Julian Hyde and others
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
//
*/
package mondrian.test.clearview;

import junit.framework.*;

import mondrian.test.*;

/**
* <code>GrandTotalTest</code> is a test suite which tests scenarios of
* using grand total against the FoodMart database. MDX queries and their
* expected results are maintained separately in GrandTotalTest.ref.xml file.
* If you would prefer to see them as inlined Java string literals, run
* ant target "generateDiffRepositoryJUnit" and then use
* file GrandTotalTestJUnit.java which will be generated in this directory.
*
* @author Khanh Vu
* @version $Id$
*/
public class GrandTotalTest extends ClearViewBase {
public GrandTotalTest() {
super();
}
public GrandTotalTest(String name) {
super(name);
}

protected DiffRepository getDiffRepos() {
return getDiffReposStatic();
}
private static DiffRepository getDiffReposStatic() {
return DiffRepository.lookup(GrandTotalTest.class);
}
public static TestSuite suite() {
return constructSuite(getDiffReposStatic(), GrandTotalTest.class);
}

public GrandTotalTest() {
super();
}

public GrandTotalTest(String name) {
super(name);
}

protected DiffRepository getDiffRepos() {
return getDiffReposStatic();
}

private static DiffRepository getDiffReposStatic() {
return DiffRepository.lookup(GrandTotalTest.class);
}

public static TestSuite suite() {
return constructSuite(getDiffReposStatic(), GrandTotalTest.class);
}

}

// End GranTotalTest.java
64 changes: 44 additions & 20 deletions testsrc/main/mondrian/test/clearview/MetricFilterTest.java
@@ -1,29 +1,53 @@
/*
// $Id$
// This software is subject to the terms of the Common Public License
// Agreement, available at the following URL:
// http://www.opensource.org/licenses/cpl.html.
// Copyright (C) 2007 Julian Hyde and others
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
//
*/
package mondrian.test.clearview;

import junit.framework.*;

import mondrian.test.*;

/**
* <code>MetricFilterTest</code> is a test suite which tests scenarios of
* filtering out measures' values in the FoodMart database.
* MDX queries and their expected results are maintained separately in
* MetricFilterTest.ref.xml file.If you would prefer to see them as inlined
* Java string literals, run ant target "generateDiffRepositoryJUnit" and
* then use file MetricFilterTestJUnit.java which will be generated in
* this directory.
*
* @author Khanh Vu
* @version $Id$
*/
public class MetricFilterTest extends ClearViewBase {
public MetricFilterTest() {
super();
}
public MetricFilterTest(String name) {
super(name);
}

protected DiffRepository getDiffRepos() {
return getDiffReposStatic();
}
private static DiffRepository getDiffReposStatic() {
return DiffRepository.lookup(MetricFilterTest.class);
}
public static TestSuite suite() {
return constructSuite(getDiffReposStatic(), MetricFilterTest.class);
}

public MetricFilterTest() {
super();
}

public MetricFilterTest(String name) {
super(name);
}

protected DiffRepository getDiffRepos() {
return getDiffReposStatic();
}

private static DiffRepository getDiffReposStatic() {
return DiffRepository.lookup(MetricFilterTest.class);
}

public static TestSuite suite() {
return constructSuite(getDiffReposStatic(), MetricFilterTest.class);
}

}

// End MetricFilterTest.java
64 changes: 44 additions & 20 deletions testsrc/main/mondrian/test/clearview/PredicateFilterTest.java
@@ -1,29 +1,53 @@
/*
// $Id$
// This software is subject to the terms of the Common Public License
// Agreement, available at the following URL:
// http://www.opensource.org/licenses/cpl.html.
// Copyright (C) 2007 Julian Hyde and others
// All Rights Reserved.
// You must accept the terms of that agreement to use this software.
//
*/
package mondrian.test.clearview;

import junit.framework.*;

import mondrian.test.*;

/**
* <code>PredicateFilterTest</code> is a test suite which tests scenarios of
* filtering in the FoodMart database.
* MDX queries and their expected results are maintained separately in
* PredicateFilterTest.ref.xml file.If you would prefer to see them as inlined
* Java string literals, run ant target "generateDiffRepositoryJUnit" and
* then use file PredicateFilterTestJUnit.java which will be generated in
* this directory.
*
* @author Khanh Vu
* @version $Id$
*/
public class PredicateFilterTest extends ClearViewBase {
public PredicateFilterTest() {
super();
}
public PredicateFilterTest(String name) {
super(name);
}

protected DiffRepository getDiffRepos() {
return getDiffReposStatic();
}
private static DiffRepository getDiffReposStatic() {
return DiffRepository.lookup(PredicateFilterTest.class);
}
public static TestSuite suite() {
return constructSuite(getDiffReposStatic(), PredicateFilterTest.class);
}

public PredicateFilterTest() {
super();
}

public PredicateFilterTest(String name) {
super(name);
}

protected DiffRepository getDiffRepos() {
return getDiffReposStatic();
}

private static DiffRepository getDiffReposStatic() {
return DiffRepository.lookup(PredicateFilterTest.class);
}

public static TestSuite suite() {
return constructSuite(getDiffReposStatic(), PredicateFilterTest.class);
}

}

// End PredicateFilterTest.java

0 comments on commit 271c0e2

Please sign in to comment.