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
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,16 @@ public QueryComponent parseStatement(
parser = getContext().getMdxParserProvider().newParser(queryToParse, funTable.getPropertyWords());
MdxStatement mdxStatement = parser.parseMdxStatement();
return getQueryProvider().createQuery(statement, mdxStatement, strictValidation);
} catch (MdxParserException mdxPE) {
} catch (Exception mdxPE) {

Optional<SqlGuardFactory> oSqlGuardFactory = getContext().getSqlGuardFactory();
if (oSqlGuardFactory.isEmpty()) {
throw new FailedToParseQueryException(queryToParse, mdxPE);
} else {
List<DatabaseSchema> ds = (List<DatabaseSchema>) this.getCatalogReader().getDatabaseSchemas();
org.eclipse.daanse.sql.guard.api.elements.DatabaseCatalog dc = new DatabaseCatalogImpl("", ds);
SqlGuard guard = oSqlGuardFactory.get().create("", "", dc, List.of(), this.getContext().getDialect());
//TODO need resolve function list from other place
SqlGuard guard = oSqlGuardFactory.get().create("", "", dc, List.of("sum", "avg", "min", "max", "count", "concat"), this.getContext().getDialect());
// TODO add white list functions
try {
String sanetizedSql = guard.guard(queryToParse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;

import org.eclipse.daanse.mdx.model.api.expression.operation.FunctionOperationAtom;
import org.eclipse.daanse.mdx.model.api.expression.operation.OperationAtom;
Expand Down Expand Up @@ -64,6 +65,7 @@
import org.eclipse.daanse.olap.function.core.FunctionParameterR;
import org.eclipse.daanse.olap.query.component.ResolvedFunCallImpl;
import org.eclipse.daanse.olap.api.execution.ExecutionContext;
import org.eclipse.daanse.olap.api.execution.ExecutionMetadata;
import org.eclipse.daanse.olap.execution.ExecutionImpl;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -137,7 +139,8 @@ void testListTupleListTupleIterCalc() {
when(rolapConnection.getContext()).thenReturn(context);
when(statement.getDaanseConnection()).thenReturn(rolapConnection);
when(excMock.getDaanseStatement()).thenReturn(statement);
ExecutionContext executionContext = mock(ExecutionContext.class);
ExecutionMetadata executionMetadata = mock(ExecutionMetadata.class);
ExecutionContext executionContext = ExecutionContext.root(Optional.empty(), executionMetadata);
when(excMock.asContext()).thenReturn(executionContext);
CrossJoinIterCalc calc =
new CrossJoinIterCalc( getResolvedFunCall(), null, crossJoinFunDef.getCtag() );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,16 @@ class FormatterFactoryTest {
void shouldCreateFormatterByClassName() {
FormatterCreateContext cellFormatterContext =
new FormatterCreateContext.Builder("name")
.formatterAttr("org.eclipse.daanse.rolap.common.format.CellFormatterTestImpl")
.formatterAttr("org.eclipse.daanse.olap.format.CellFormatterTestImpl")
.build();
FormatterCreateContext memberFormatterContext =
new FormatterCreateContext.Builder("name")
.formatterAttr("org.eclipse.daanse.rolap.common.format.MemberFormatterTestImpl")
.formatterAttr("org.eclipse.daanse.olap.format.MemberFormatterTestImpl")
.build();
FormatterCreateContext propertyFormatterContext =
new FormatterCreateContext.Builder("name")
.formatterAttr(
"org.eclipse.daanse.rolap.common.format.PropertyFormatterTestImpl")
"org.eclipse.daanse.olap.format.PropertyFormatterTestImpl")
.build();

CellFormatter cellFormatter =
Expand Down Expand Up @@ -109,18 +109,18 @@ void shouldCreateFormatterByScript() {
void shouldCreateFormatterByClassNameIfBothSpecified() {
FormatterCreateContext cellFormatterContext =
new FormatterCreateContext.Builder("name")
.formatterAttr("org.eclipse.daanse.rolap.common.format.CellFormatterTestImpl")
.formatterAttr("org.eclipse.daanse.olap.format.CellFormatterTestImpl")
.script("return null;", "JavaScript")
.build();
FormatterCreateContext memberFormatterContext =
new FormatterCreateContext.Builder("name")
.formatterAttr("org.eclipse.daanse.rolap.common.format.MemberFormatterTestImpl")
.formatterAttr("org.eclipse.daanse.olap.format.MemberFormatterTestImpl")
.script("return null;", "JavaScript")
.build();
FormatterCreateContext propertyFormatterContext =
new FormatterCreateContext.Builder("name")
.formatterAttr(
"org.eclipse.daanse.rolap.common.format.PropertyFormatterTestImpl")
"org.eclipse.daanse.olap.format.PropertyFormatterTestImpl")
.script("return null;", "JavaScript")
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
* SmartCity Jena - initial
* Stefan Bischof (bipolis.org) - initial
*/
package org.eclipse.daanse.olap.xmla.bridge;
package org.eclipse.daanse.olap.xmla.bridge.integration;

import org.eclipse.daanse.olap.xmla.bridge.ContextGroupXmlaService;
import org.eclipse.daanse.xmla.api.XmlaService;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
Expand Down
Loading