Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions mondrian/src/test/java/mondrian/olap/type/TypeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,23 +45,21 @@
import org.eclipse.daanse.olap.api.type.Type;
import org.eclipse.daanse.olap.query.component.IdImpl;
import org.eclipse.daanse.olap.util.type.TypeUtil;
import org.eclipse.daanse.rolap.mapping.instance.emf.complex.foodmart.FoodmartTestInstance;
import org.eclipse.daanse.rolap.testkit.junit.api.RolapContextTest;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
import org.opencube.junit5.ContextSource;
import org.opencube.junit5.dataloader.FastFoodmardDataLoader;
import org.opencube.junit5.propupdator.AppandFoodMartCatalog;
import org.junit.jupiter.api.Test;

/**
* Unit test for mondrian type facility.
*
* @author jhyde
* @since Jan 17, 2008
*/

@RolapContextTest(FoodmartTestInstance.class)
class TypeTest {

@ParameterizedTest
@ContextSource(propertyUpdater = AppandFoodMartCatalog.class, dataloader = FastFoodmardDataLoader.class )
@Test
void testConversions(Context<?> foodMartContext) {
final Connection connection = foodMartContext.getConnectionWithDefaultRole();
Cube salesCube =
Expand Down Expand Up @@ -191,8 +189,7 @@ void testConversions(Context<?> foodMartContext) {
}
}

@ParameterizedTest
@ContextSource(propertyUpdater = AppandFoodMartCatalog.class, dataloader = FastFoodmardDataLoader.class )
@Test
void testCommonTypeWhenSetTypeHavingMemberTypeAndTupleType(Context<?> foodMartContext) {
Connection connection= foodMartContext.getConnectionWithDefaultRole();
MemberType measureMemberType =
Expand Down Expand Up @@ -222,8 +219,7 @@ void testCommonTypeWhenSetTypeHavingMemberTypeAndTupleType(Context<?> foodMartCo
assertEquals(type1, type2);
}

@ParameterizedTest
@ContextSource(propertyUpdater = AppandFoodMartCatalog.class, dataloader = FastFoodmardDataLoader.class )
@Test
void testCommonTypeOfMemberandTupleTypeIsTupleType(Context<?> foodMartContext) {
Connection connection= foodMartContext.getConnectionWithDefaultRole();
MemberType measureMemberType =
Expand All @@ -248,8 +244,7 @@ void testCommonTypeOfMemberandTupleTypeIsTupleType(Context<?> foodMartContext) {
assertEquals(type1, type2);
}

@ParameterizedTest
@ContextSource(propertyUpdater = AppandFoodMartCatalog.class, dataloader = FastFoodmardDataLoader.class )
@Test
void testCommonTypeBetweenTuplesOfDifferentSizesIsATupleType(Context<?> foodMartContext) {
Connection connection= foodMartContext.getConnectionWithDefaultRole();
MemberType measureMemberType =
Expand Down
21 changes: 10 additions & 11 deletions mondrian/src/test/java/mondrian/rolap/CancellationTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,21 @@
import org.eclipse.daanse.olap.api.result.Position;
import org.eclipse.daanse.olap.api.result.Result;
import org.eclipse.daanse.olap.calc.base.type.tuplebase.UnaryTupleList;
import org.eclipse.daanse.olap.common.ConfigConstants;
import org.eclipse.daanse.olap.execution.ExecutionImpl;
import org.eclipse.daanse.olap.function.def.crossjoin.CrossJoinFunDef;
import org.eclipse.daanse.rolap.common.result.RolapResult;
import org.eclipse.daanse.rolap.element.RolapCube;
import org.eclipse.daanse.rolap.mapping.instance.emf.complex.foodmart.FoodmartTestInstance;
import org.eclipse.daanse.rolap.testkit.junit.api.RolapConfig;
import org.eclipse.daanse.rolap.testkit.junit.api.RolapContextTest;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.params.ParameterizedTest;
import org.opencube.junit5.ContextSource;
import org.opencube.junit5.context.TestContextImpl;
import org.opencube.junit5.dataloader.FastFoodmardDataLoader;
import org.opencube.junit5.propupdator.AppandFoodMartCatalog;
import org.junit.jupiter.api.Test;

import mondrian.olap.fun.CrossJoinTest;

@RolapContextTest(FoodmartTestInstance.class)
class CancellationTest {

@BeforeEach
Expand All @@ -57,12 +58,11 @@ public void afterEach() {
/**
* Creates a cell region, runs a query, then flushes the cache.
*/
@ParameterizedTest
@ContextSource(propertyUpdater = AppandFoodMartCatalog.class, dataloader = FastFoodmardDataLoader.class)
@Test
@RolapConfig(key = ConfigConstants.CHECK_CANCEL_OR_TIMEOUT_INTERVAL, value = "1", type = Integer.class)
void testNonEmptyListCancellation(Context<?> context) throws OlapRuntimeException {
// tests that cancellation/timeout is checked in
// CrossJoinFunDef.nonEmptyList
((TestContextImpl)context).setCheckCancelOrTimeoutInterval(1);
CrossJoinFunDefTester crossJoinFunDef =
new CrossJoinFunDefTester(new CrossJoinTest.NullFunDef().getFunctionMetaData());
Result result =
Expand All @@ -80,12 +80,11 @@ void testNonEmptyListCancellation(Context<?> context) throws OlapRuntimeExceptio
verify(exec, times(list.size())).checkCancelOrTimeout();
}

@ParameterizedTest
@ContextSource(propertyUpdater = AppandFoodMartCatalog.class, dataloader = FastFoodmardDataLoader.class)
@Test
@RolapConfig(key = ConfigConstants.CHECK_CANCEL_OR_TIMEOUT_INTERVAL, value = "1", type = Integer.class)
void testMutableCrossJoinCancellation(Context<?> context) throws OlapRuntimeException {
// tests that cancellation/timeout is checked in
// CrossJoinFunDef.mutableCrossJoin
((TestContextImpl)context).setCheckCancelOrTimeoutInterval(1);
Connection connection = context.getConnectionWithDefaultRole();
RolapCube salesCube = (RolapCube) cubeByName(
connection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
import org.eclipse.daanse.olap.api.Context;
import org.eclipse.daanse.olap.api.connection.Connection;
import org.eclipse.daanse.olap.api.result.Result;
import org.eclipse.daanse.rolap.mapping.instance.emf.complex.foodmart.FoodmartTestInstance;
import org.eclipse.daanse.rolap.testkit.junit.api.RolapContextTest;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.opencube.junit5.ContextSource;
import org.opencube.junit5.TestUtil;
Expand All @@ -39,6 +42,7 @@
*
* @author Andrey Khayrutdinov
*/
@RolapContextTest(FoodmartTestInstance.class)
class TopCountWithTwoParamsVersusHeadTest extends BatchTestCase {

private void assertResultsAreEqual(
Expand Down Expand Up @@ -66,32 +70,28 @@ private void assertResultsAreEqual(
topCountQuery));
}

@ParameterizedTest
@ContextSource(propertyUpdater = AppandFoodMartCatalog.class, dataloader = FastFoodmardDataLoader.class )
@Test
void test_States(Context<?> context) throws Exception {
assertResultsAreEqual(context.getConnectionWithDefaultRole(),
"States",
TOPCOUNT_MIMICS_HEAD_WHEN_TWO_PARAMS_STATES_QUERY);
}

@ParameterizedTest
@ContextSource(propertyUpdater = AppandFoodMartCatalog.class, dataloader = FastFoodmardDataLoader.class )
@Test
void test_Cities(Context<?> context) throws Exception {
assertResultsAreEqual(context.getConnectionWithDefaultRole(),
"Cities",
TOPCOUNT_MIMICS_HEAD_WHEN_TWO_PARAMS_CITIES_QUERY);
}

@ParameterizedTest
@ContextSource(propertyUpdater = AppandFoodMartCatalog.class, dataloader = FastFoodmardDataLoader.class )
@Test
void test_ShowsNotMoreThanExist(Context<?> context) {
assertResultsAreEqual(context.getConnectionWithDefaultRole(),
"Not more than exists",
RESULTS_ARE_SHOWN_NOT_MORE_THAN_EXIST_2_PARAMS_QUERY);
}

@ParameterizedTest
@ContextSource(propertyUpdater = AppandFoodMartCatalog.class, dataloader = FastFoodmardDataLoader.class )
@Test
void test_DoesNotIgnoreNonEmpty(Context<?> context) {
assertResultsAreEqual(context.getConnectionWithDefaultRole(),
"Does not ignore NON EMPTY",
Expand Down
Loading