public class UdfTest extends FoodMartTestCase
user-defined functions
.
Also tests cell formatters
and member formatters
.
TODO: 1. test that function which does not return a name, description etc. gets a sensible error 2. document UDFs
Modifier and Type | Class and Description |
---|---|
static class |
UdfTest.AnotherMemberErrorUdf
A user-defined function which returns ignores its first parameter (a
member) and returns the default member from the second parameter (a
hierarchy).
|
static class |
UdfTest.BadPlusOneUdf
A simple user-defined function which adds one to its argument.
|
static class |
UdfTest.FooBarCellFormatter
Cell formatter for test purposes.
|
static class |
UdfTest.FooBarMemberFormatter
Member formatter for test purposes.
|
static class |
UdfTest.FooBarPropertyFormatter
Property formatter for test purposes.
|
static class |
UdfTest.MdcUdf
A simple UDF that checks the object inside of the MDC logging context.
|
static class |
UdfTest.MemberNameFunction
Function that takes a member and returns a name.
|
static class |
UdfTest.PlusOneUdf
A simple user-defined function which adds one to its argument.
|
static class |
UdfTest.PlusOrMinusOneUdf
A user-defined function which, depending on its given name, either adds
one to, or subtracts one from, its argument.
|
static class |
UdfTest.ReverseFunction
Function that reverses a list of members.
|
class |
UdfTest.ReverseFunctionNotStatic
Function that is non-static.
|
static class |
UdfTest.ReverseIterableFunction
Function that takes a set of members as argument, and returns a set of
members.
|
static class |
UdfTest.StringMultUdf
The "TimesString" user-defined function.
|
FoodMartTestCase.QueryAndResult
propSaver
Modifier and Type | Method and Description |
---|---|
TestContext |
getTestContext()
Returns the test context.
|
protected void |
setUp() |
protected void |
tearDown() |
void |
testAnotherMemberFun()
Tests a UDF whose return type is not the same as its first
parameter.
|
void |
testBadFun() |
void |
testCachingCurrentDate() |
void |
testCellFormatter()
Unit test for a cell formatter defined in the old way -- a 'formatter'
attribute of a Measure element.
|
void |
testCellFormatterNested()
As
testCellFormatter() , but using new-style nested
CellFormatter element. |
void |
testCellFormatterOnCalcMember()
Unit test for a cell formatter defined against a calculated member,
using the old syntax (a member property called "CELL_FORMATTER").
|
void |
testCellFormatterOnCalcMemberNested()
Unit test for a cell formatter defined against a calculated member,
using the new syntax (a nested CellFormatter element).
|
void |
testCellFormatterOnCalcMemberScript()
Unit test for a cell formatter defined against a calculated member,
using a script.
|
void |
testCellFormatterScript()
As
testCellFormatterNested() , but using a script. |
void |
testChildMemberIn() |
void |
testComplexFun() |
void |
testCurrentDateLag() |
void |
testCurrentDateMemberAfter() |
void |
testCurrentDateMemberBefore() |
void |
testCurrentDateMemberBeforeUsingQuotes() |
void |
testCurrentDateMemberExact() |
void |
testCurrentDateMemberHierarchy() |
void |
testCurrentDateMemberHierarchyNullReturn() |
void |
testCurrentDateMemberNoFindArg() |
void |
testCurrentDateMemberPrev() |
void |
testCurrentDateMemberRealAfter() |
void |
testCurrentDateMemberRealExact1() |
void |
testCurrentDateMemberRealExact2() |
void |
testCurrentDateString() |
void |
testException() |
void |
testFun() |
void |
testFunWithProfiling()
Test case for bug
MONDRIAN-1200,
"User-defined function + profiling causes NPE in CalcWriter".
|
void |
testGenericFun() |
void |
testIn() |
void |
testLastNonEmpty() |
void |
testLastNonEmptyBig()
Tests a performance issue with LastNonEmpty (bug 1533677).
|
void |
testListUdf()
Test case for a UDF that returns a list.
|
void |
testMatches() |
void |
testMdc()
This is a test for
MONDRIAN-994.
|
void |
testMemberFormatter()
Unit test for a member formatter defined in the old way -- a 'formatter'
attribute of a Measure element.
|
void |
testMemberFormatterNested()
As
testMemberFormatter() , but using new-style nested
memberFormatter element. |
void |
testMemberFormatterScript()
As
testMemberFormatterNested() , but using a script. |
void |
testMemberUdfDoesNotEvaluateToScalar()
Tests a function that takes a member as argument.
|
void |
testNonGuessableReturnType()
Tests that the inferred return type is correct for a UDF whose return
type is not the same as would be guessed by the default implementation
of
FunDefBase.getResultType(mondrian.olap.Validator, mondrian.olap.Exp[]) , which simply
guesses based on the type of the first argument. |
void |
testNonStaticUdfFails()
Tests that a non-static function gives an error.
|
void |
testNotIn() |
void |
testNotMatches() |
void |
testPropertyFormatter()
Unit test for a property formatter defined in the old way -- a
'formatter' attribute of a Property element.
|
void |
testPropertyFormatterNested()
As
testPropertyFormatter() , but using new-style nested
PropertyFormatter element. |
void |
testPropertyFormatterScript()
As
testPropertyFormatterNested() , but using a script. |
void |
testSanity() |
void |
testScriptUdf()
Unit test for a UDF defined in JavaScript.
|
void |
testScriptUdfFactorial()
Unit test for a UDF defined in JavaScript, this time the factorial
function.
|
void |
testScriptUdfInvalid()
Unit test that we get a nice error if a script UDF contains an error.
|
void |
testUdfBothScriptAndClassname()
Unit test that ensures that a UDF does not have both a script
and a className.
|
void |
testUdfNeitherScriptNorClassname()
Unit test that ensures that a UDF has either a script or a className.
|
void |
testUdfScriptBadLanguage()
Unit test that ensures that a UDF has either a script or a className.
|
void |
testUdfToString()
Test case for the problem where a string expression gave a
ClassCastException because it was evaluating to a member, whereas the
member should have been evaluated to a scalar.
|
allMember, assertAxisReturns, assertAxisThrows, assertBooleanExprReturns, assertExprReturns, assertExprThrows, assertQueriesReturnSimilarResults, assertQueryReturns, assertQueryThrows, assertSize, cubeByName, execute, executeExpr, executeQuery, executeSingletonAxis, genderMembersIncludingAll, getConnection, getDimensionWithName, isDefaultNullMemberRepresentation, isGroupingSetsSupported, member, productMembersPotScrubbersPotsAndPans, storeMembersCAAndOR, storeMembersUsaAndCanada, verifySameNativeAndNot, warehouseMembersCanadaMexicoUsa
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
public UdfTest()
public UdfTest(String name)
protected void setUp() throws Exception
setUp
in class junit.framework.TestCase
Exception
protected void tearDown() throws Exception
tearDown
in class FoodMartTestCase
Exception
public TestContext getTestContext()
FoodMartTestCase
getTestContext
in class FoodMartTestCase
public void testSanity()
public void testFun()
public void testFunWithProfiling() throws SQLException
SQLException
- on errorpublic void testLastNonEmpty()
public void testLastNonEmptyBig()
MondrianProperties.MaxEvalDepth
property.public void testBadFun()
public void testGenericFun()
public void testComplexFun()
public void testException()
public void testCurrentDateString()
public void testCurrentDateMemberBefore()
public void testCurrentDateMemberBeforeUsingQuotes()
public void testCurrentDateMemberAfter()
public void testCurrentDateMemberExact()
public void testCurrentDateMemberNoFindArg()
public void testCurrentDateMemberHierarchy()
public void testCurrentDateMemberHierarchyNullReturn()
public void testCurrentDateMemberRealAfter()
public void testCurrentDateMemberRealExact1()
public void testCurrentDateMemberRealExact2()
public void testCurrentDateMemberPrev()
public void testCurrentDateLag()
public void testMatches()
public void testNotMatches()
public void testIn()
public void testNotIn()
public void testChildMemberIn()
public void testNonGuessableReturnType()
FunDefBase.getResultType(mondrian.olap.Validator, mondrian.olap.Exp[])
, which simply
guesses based on the type of the first argument.public void testUdfToString()
public void testAnotherMemberFun()
Also tests applying a UDF to arguments of coercible type. In this case, applies f(member,dimension) to args(member,hierarchy).
public void testCachingCurrentDate()
public void testListUdf()
Test case for bug MONDRIAN-588, "UDF returning List works under 2.4, fails under 3.1.1".
Also test case for bug MONDRIAN-589, "UDF expecting List gets anonymous mondrian.rolap.RolapNamedSetEvaluator$1 instead".
public void testNonStaticUdfFails()
public void testMemberUdfDoesNotEvaluateToScalar()
public void testUdfNeitherScriptNorClassname()
public void testUdfBothScriptAndClassname()
public void testUdfScriptBadLanguage()
public void testScriptUdf()
public void testScriptUdfFactorial()
public void testScriptUdfInvalid()
public void testCellFormatter()
public void testCellFormatterNested()
testCellFormatter()
, but using new-style nested
CellFormatter element.public void testCellFormatterScript()
testCellFormatterNested()
, but using a script.public void testCellFormatterOnCalcMember()
public void testCellFormatterOnCalcMemberNested()
public void testCellFormatterOnCalcMemberScript()
public void testMemberFormatter()
public void testMemberFormatterNested()
testMemberFormatter()
, but using new-style nested
memberFormatter element.public void testMemberFormatterScript()
testMemberFormatterNested()
, but using a script.public void testPropertyFormatter() throws SQLException
SQLException
- on errorpublic void testPropertyFormatterNested() throws SQLException
testPropertyFormatter()
, but using new-style nested
PropertyFormatter element.SQLException
- on errorpublic void testPropertyFormatterScript() throws SQLException
testPropertyFormatterNested()
, but using a script.SQLException
- on errorpublic void testMdc()