Skip to content

Commit 7c77db9

Browse files
authored
Merge pull request #6 from dbulahov/main031225
fix tests
2 parents ab349d9 + d225bdc commit 7c77db9

File tree

8 files changed

+2118
-2047
lines changed

8 files changed

+2118
-2047
lines changed

mondrian/src/test/java/mondrian/rolap/FastBatchingCellReaderTest.java

Lines changed: 2000 additions & 1961 deletions
Large diffs are not rendered by default.

mondrian/src/test/java/mondrian/rolap/MemberCacheControlTest.java

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ void testMemberOpsFailIfCacheEnabled(Context<?> context) {
362362
} catch (IllegalArgumentException e) {
363363
assertEquals(
364364
"Member cache control operations are not allowed unless "
365-
+ "property mondrian.rolap.EnableRolapCubeMemberCache is "
365+
+ "property daanse.rolap.EnableRolapCubeMemberCache is "
366366
+ "false",
367367
e.getMessage());
368368
}
@@ -482,7 +482,11 @@ void testSetPropertyCommandOnNonLeafMember(Context<?> context) {
482482
cc.filter(hqMember.getLevel(), memberSet);
483483
command =
484484
cc.createSetPropertyCommand(filteredMemberSet, propertyValues);
485-
cc.execute(command);
485+
final MemberEditCommand c = command;
486+
ExecutionContext.where(executionContext, () -> {
487+
cc.execute(c);
488+
});
489+
486490

487491
// Repeat same query; verify properties were changed.
488492
// Changing properties does not affect measures, so results unchanged.
@@ -601,21 +605,23 @@ void testAddCommand(Context<?> context) {
601605
AbstractBasicContext<?> abc = (AbstractBasicContext) conn.getContext();
602606
final IAggregationManager aggMgr =
603607
abc.getAggregationManager();
608+
ExecutionContext.where(executionContext, () -> {
604609
assertEquals(
605610
Double.valueOf("74748"),
606611
((AggregationManager)aggMgr).getCellFromAllCaches(
607612
AggregationManager.makeRequest(cacheRegionMembers), conn));
608-
613+
});
609614
// Now tell the cache that [CA].[Berkeley] is new
610615
final MemberEditCommand command =
611616
cc.createAddCommand(berkeleyMember);
612617
cc.execute(command);
613618

614619
// test that cells have been removed
615-
assertNull(
620+
ExecutionContext.where(executionContext, () -> {
621+
assertNull(
616622
((AggregationManager)aggMgr).getCellFromAllCaches(
617623
AggregationManager.makeRequest(cacheRegionMembers), conn));
618-
624+
});
619625
assertAxisReturns(conn, "Sales",
620626
"[Retail].[Retail].[CA].Children",
621627
"[Retail].[Retail].[CA].[Alameda]\n"
@@ -761,10 +767,12 @@ void testDeleteCommand(Context<?> context) {
761767
AbstractBasicContext<?> abc = (AbstractBasicContext) conn.getContext();
762768
final IAggregationManager aggMgr =
763769
abc.getAggregationManager();
764-
assertEquals(
765-
Double.valueOf("2117"),
766-
((AggregationManager)aggMgr).getCellFromAllCaches(
767-
AggregationManager.makeRequest(cacheRegionMembers), conn));
770+
ExecutionContext.where(executionContext, () -> {
771+
assertEquals(
772+
Double.valueOf("2117"),
773+
((AggregationManager)aggMgr).getCellFromAllCaches(
774+
AggregationManager.makeRequest(cacheRegionMembers), conn));
775+
});
768776

769777
// Now tell the cache that [CA].[San Francisco] has been removed.
770778
final MemberEditCommand command =
@@ -777,10 +785,11 @@ void testDeleteCommand(Context<?> context) {
777785
memberCache.getChildrenFromCache(caMember, null).size());
778786

779787
// test that cells have been removed
788+
ExecutionContext.where(executionContext, () -> {
780789
assertNull(
781790
((AggregationManager)aggMgr).getCellFromAllCaches(
782791
AggregationManager.makeRequest(cacheRegionMembers), conn));
783-
792+
});
784793
// The list of children should be updated.
785794
assertAxisReturns(conn, "Sales",
786795
"[Retail].[Retail].[CA].Children",

mondrian/src/test/java/mondrian/rolap/NativeFilterMatchingTest.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -689,13 +689,13 @@ void testNativeFilterWithCompoundSlicer(Context<?> context) {
689689
assertQueryReturns(context.getConnectionWithDefaultRole(),
690690
mdx,
691691
"Axis #0:\n"
692-
+ "{[Product].[Drink].[Alcoholic Beverages].[Beer and Wine].[Beer].[Good].[Good Imported Beer]}\n"
693-
+ "{[Product].[Drink].[Alcoholic Beverages].[Beer and Wine].[Beer].[Good].[Good Light Beer]}\n"
694-
+ "{[Product].[Drink].[Alcoholic Beverages].[Beer and Wine].[Beer].[Pearl].[Pearl Imported Beer]}\n"
692+
+ "{[Product].[Product].[Drink].[Alcoholic Beverages].[Beer and Wine].[Beer].[Good].[Good Imported Beer]}\n"
693+
+ "{[Product].[Product].[Drink].[Alcoholic Beverages].[Beer and Wine].[Beer].[Good].[Good Light Beer]}\n"
694+
+ "{[Product].[Product].[Drink].[Alcoholic Beverages].[Beer and Wine].[Beer].[Pearl].[Pearl Imported Beer]}\n"
695695
+ "Axis #1:\n"
696-
+ "{[Measures].[avgQtrs], [Gender].[All Gender]}\n"
697-
+ "{[Measures].[avgQtrs], [Gender].[F]}\n"
698-
+ "{[Measures].[avgQtrs], [Gender].[M]}\n"
696+
+ "{[Measures].[avgQtrs], [Gender].[Gender].[All Gender]}\n"
697+
+ "{[Measures].[avgQtrs], [Gender].[Gender].[F]}\n"
698+
+ "{[Measures].[avgQtrs], [Gender].[Gender].[M]}\n"
699699
+ "Row #0: 111\n"
700700
+ "Row #0: \n"
701701
+ "Row #0: \n");

mondrian/src/test/java/mondrian/rolap/TestAggregationManager.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,9 @@ void testFemaleUnitSales(Context<?> context) {
140140
Object value = aggMgr.getCellFromCache(request);
141141
assertNull(value); // before load, the cell is not found
142142
fbcr.recordCellRequest(request);
143-
fbcr.loadAggregations();
143+
ExecutionContext.where(executionContext, () -> {
144+
fbcr.loadAggregations();
145+
});
144146
value = aggMgr.getCellFromCache(request); // after load, cell found
145147
assertTrue(value instanceof Number);
146148
assertEquals(131558, ((Number) value).intValue());
@@ -159,7 +161,9 @@ void testFemaleCustomerCount(Context<?> context) {
159161
Object value = aggMgr.getCellFromCache(request);
160162
assertNull(value); // before load, the cell is not found
161163
fbcr.recordCellRequest(request);
162-
fbcr.loadAggregations();
164+
ExecutionContext.where(executionContext, () -> {
165+
fbcr.loadAggregations();
166+
});
163167
value = aggMgr.getCellFromCache(request); // after load, cell found
164168
assertTrue(value instanceof Number);
165169
assertEquals(2755, ((Number) value).intValue());
@@ -203,10 +207,12 @@ void testFemaleCustomerCountWithConstraints(Context<?> context) {
203207
Object value = aggMgr.getCellFromCache(request1);
204208
assertNull(value); // before load, the cell is not found
205209

206-
fbcr.recordCellRequest(request1);
207-
fbcr.recordCellRequest(request2);
208-
fbcr.recordCellRequest(request3);
209-
fbcr.loadAggregations();
210+
ExecutionContext.where(executionContext, () -> {
211+
fbcr.recordCellRequest(request1);
212+
fbcr.recordCellRequest(request2);
213+
fbcr.recordCellRequest(request3);
214+
fbcr.loadAggregations();
215+
});
210216

211217
value = aggMgr.getCellFromCache(request1); // after load, found
212218
assertTrue(value instanceof Number);

mondrian/src/test/java/mondrian/rolap/agg/AggregationOnDistinctCountMeasuresTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@ void testAggregationOverLargeListGeneratesError(Context<?> context) {
523523
+ "{[Measures].[Customer Count]}\n"
524524
+ "Axis #2:\n"
525525
+ "{[Product].[Product].[X]}\n"
526-
+ "Row #0: #ERR: org.eclipse.daanse.olap.fun.MondrianEvaluationException: "
526+
+ "Row #0: #ERR: org.eclipse.daanse.olap.fun.DaanseEvaluationException: "
527527
+ "Aggregation is not supported over a list with more than 7 predicates (see property MaxConstraints)\n");
528528

529529
// aggregation over a non-distinct-count measure is OK

mondrian/src/test/java/mondrian/rolap/agg/SegmentLoaderTest.java

Lines changed: 62 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -460,27 +460,30 @@ SqlStatement createExecuteSql(
460460
SortedSet<Comparable>[] axisValueSet =
461461
loader.getDistinctValueWorkspace(axisCount);
462462
boolean[] axisContainsNull = new boolean[axisCount];
463-
464-
SegmentLoader.RowList list =
465-
loader.processData(
466-
stmt,
467-
axisContainsNull,
468-
axisValueSet,
469-
new GroupingSetsList(groupingSets));
470-
int totalNoOfRows = 12;
471-
int lengthOfRowWithBitKey = 6;
472-
assertEquals(totalNoOfRows, list.size());
473-
assertEquals(lengthOfRowWithBitKey, list.getTypes().size());
474-
list.first();
475-
list.next();
476-
assertEquals(BitKey.Factory.makeBitKey(0), list.getObject(5));
477-
478-
BitKey bitKeyForSummaryRow = BitKey.Factory.makeBitKey(0);
479-
bitKeyForSummaryRow.set(0);
480-
list.next();
481-
list.next();
482-
assertEquals(bitKeyForSummaryRow, list.getObject(5));
483-
463+
ExecutionContext.where(executionContext, () -> {
464+
try {
465+
SegmentLoader.RowList list = loader.processData(
466+
stmt,
467+
axisContainsNull,
468+
axisValueSet,
469+
new GroupingSetsList(groupingSets));
470+
int totalNoOfRows = 12;
471+
int lengthOfRowWithBitKey = 6;
472+
assertEquals(totalNoOfRows, list.size());
473+
assertEquals(lengthOfRowWithBitKey, list.getTypes().size());
474+
list.first();
475+
list.next();
476+
assertEquals(BitKey.Factory.makeBitKey(0), list.getObject(5));
477+
478+
BitKey bitKeyForSummaryRow = BitKey.Factory.makeBitKey(0);
479+
bitKeyForSummaryRow.set(0);
480+
list.next();
481+
list.next();
482+
assertEquals(bitKeyForSummaryRow, list.getObject(5));
483+
} catch (SQLException e) {
484+
new RuntimeException(e.getMessage(), e);
485+
}
486+
});
484487
SortedSet<Comparable> yearAxis = axisValueSet[0];
485488
assertEquals(1, yearAxis.size());
486489
SortedSet<Comparable> productFamilyAxis = axisValueSet[1];
@@ -542,12 +545,17 @@ SqlStatement createExecuteSql(
542545
boolean[] axisContainsNull = new boolean[axisCount];
543546
List<GroupingSet> groupingSets = new ArrayList<>();
544547
groupingSets.add(groupingSetsInfo);
545-
546-
loader.processData(
547-
stmt,
548-
axisContainsNull,
549-
axisValueSet,
550-
new GroupingSetsList(groupingSets));
548+
ExecutionContext.where(executionContext, () -> {
549+
try {
550+
loader.processData(
551+
stmt,
552+
axisContainsNull,
553+
axisValueSet,
554+
new GroupingSetsList(groupingSets));
555+
} catch (SQLException e) {
556+
new RuntimeException(e.getMessage(), e);
557+
}
558+
});
551559

552560
assertFalse(axisContainsNull[0]);
553561
assertFalse(axisContainsNull[1]);
@@ -596,13 +604,17 @@ SqlStatement createExecuteSql(
596604
boolean[] axisContainsNull = new boolean[axisCount];
597605
List<GroupingSet> groupingSets = new ArrayList<>();
598606
groupingSets.add(groupingSetsInfo);
599-
600-
loader.processData(
601-
stmt,
602-
axisContainsNull,
603-
axisValueSet,
604-
new GroupingSetsList(groupingSets));
605-
607+
ExecutionContext.where(executionContext, () -> {
608+
try {
609+
loader.processData(
610+
stmt,
611+
axisContainsNull,
612+
axisValueSet,
613+
new GroupingSetsList(groupingSets));
614+
} catch (SQLException e) {
615+
new RuntimeException(e.getMessage(), e);
616+
}
617+
});
606618
Object[] values = axisValueSet[0].toArray();
607619
assertEquals( binaryData0, values[1] );
608620
assertEquals( binaryData1, values[0] );
@@ -643,17 +655,22 @@ SqlStatement createExecuteSql(
643655

644656
SortedSet<Comparable>[] axisValueSet =
645657
loader.getDistinctValueWorkspace(4);
646-
SegmentLoader.RowList list =
647-
loader.processData(
648-
stmt,
649-
new boolean[4],
650-
axisValueSet,
651-
new GroupingSetsList(groupingSets));
652-
int totalNoOfRows = 3;
653-
assertEquals(totalNoOfRows, list.size());
654-
int lengthOfRowWithoutBitKey = 5;
655-
assertEquals(lengthOfRowWithoutBitKey, list.getTypes().size());
656-
658+
ExecutionContext.where(executionContext, () -> {
659+
SegmentLoader.RowList list;
660+
try {
661+
list = loader.processData(
662+
stmt,
663+
new boolean[4],
664+
axisValueSet,
665+
new GroupingSetsList(groupingSets));
666+
int totalNoOfRows = 3;
667+
assertEquals(totalNoOfRows, list.size());
668+
int lengthOfRowWithoutBitKey = 5;
669+
assertEquals(lengthOfRowWithoutBitKey, list.getTypes().size());
670+
} catch (SQLException e) {
671+
new RuntimeException(e.getMessage(), e);
672+
}
673+
});
657674
SortedSet<Comparable> yearAxis = axisValueSet[0];
658675
assertEquals(1, yearAxis.size());
659676
SortedSet<Comparable> productFamilyAxis = axisValueSet[1];

mondrian/src/test/java/mondrian/test/BasicQueryTest.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3369,18 +3369,18 @@ public void _testDc4dtp2(Context<?> context) {
33693369
+ "Row #3: 2,015.528\n"
33703370
+ "Row #3: 1,641.615\n"
33713371
+ "Row #3: 1,584.334\n"
3372-
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.MondrianEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q1].[1]'\n"
3373-
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.MondrianEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q1].[2]'\n"
3374-
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.MondrianEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q1].[3]'\n"
3375-
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.MondrianEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q2].[4]'\n"
3376-
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.MondrianEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q2].[5]'\n"
3377-
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.MondrianEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q2].[6]'\n"
3378-
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.MondrianEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q3].[7]'\n"
3379-
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.MondrianEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q3].[8]'\n"
3380-
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.MondrianEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q3].[9]'\n"
3381-
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.MondrianEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q4].[10]'\n"
3382-
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.MondrianEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q4].[11]'\n"
3383-
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.MondrianEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q4].[12]'\n");
3372+
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.DaanseEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q1].[1]'\n"
3373+
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.DaanseEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q1].[2]'\n"
3374+
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.DaanseEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q1].[3]'\n"
3375+
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.DaanseEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q2].[4]'\n"
3376+
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.DaanseEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q2].[5]'\n"
3377+
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.DaanseEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q2].[6]'\n"
3378+
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.DaanseEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q3].[7]'\n"
3379+
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.DaanseEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q3].[8]'\n"
3380+
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.DaanseEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q3].[9]'\n"
3381+
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.DaanseEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q4].[10]'\n"
3382+
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.DaanseEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q4].[11]'\n"
3383+
+ "Row #4: #ERR: org.eclipse.daanse.olap.fun.DaanseEvaluationException: Property 'Dynamic Forecast Multiplier' is not valid for member '[Time].[Time].[1997].[Q4].[12]'\n");
33843384
}
33853385

33863386
@ParameterizedTest
@@ -5857,7 +5857,7 @@ void testMondrian2245(Context<?> context) {
58575857
*/
58585858
String expectedResultInBugCube =
58595859
"" + "Axis #0:\n" + "{}\n" + "Axis #1:\n" + "{[Measures].[Sales]}\n" + "Axis #2:\n"
5860-
+ "{[Product - Bug].[Product - Bug].[Drink]}\n" + "{[Product - Bug].[Product - Bug].[Food]}\n" + "{[Product - Bug].[Non-Consumable]}\n"
5860+
+ "{[Product - Bug].[Product - Bug].[Drink]}\n" + "{[Product - Bug].[Product - Bug].[Food]}\n" + "{[Product - Bug].[Product - Bug].[Non-Consumable]}\n"
58615861
+ "Row #0: 48,836.21\n" + "Row #1: 409,035.59\n" + "Row #2: 107,366.33\n";
58625862

58635863
String expectedResultInNoBugCube =

0 commit comments

Comments
 (0)