-
Notifications
You must be signed in to change notification settings - Fork 724
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
may use testcontainers to get a proper mysql
- Loading branch information
Showing
15 changed files
with
3,262 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
381 changes: 381 additions & 0 deletions
381
mondrian/src/test/java/mondrian/olap/fun/CachedExistsTest.java
Large diffs are not rendered by default.
Oops, something went wrong.
92 changes: 92 additions & 0 deletions
92
mondrian/src/test/java/mondrian/olap4j/MondrianInprocProxy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/* | ||
* This software is subject to the terms of the Eclipse Public License v1.0 | ||
* Agreement, available at the following URL: | ||
* http://www.eclipse.org/legal/epl-v10.html. | ||
* You must accept the terms of that agreement to use this software. | ||
* | ||
* Copyright (c) 2002-2017 Hitachi Vantara.. All rights reserved. | ||
*/ | ||
|
||
package mondrian.olap4j; | ||
|
||
import mondrian.olap.Util; | ||
import mondrian.tui.XmlaSupport; | ||
|
||
import org.apache.commons.collections.map.ReferenceMap; | ||
|
||
import org.olap4j.driver.xmla.XmlaOlap4jServerInfos; | ||
import org.olap4j.driver.xmla.proxy.XmlaOlap4jProxy; | ||
|
||
import java.util.*; | ||
import java.util.concurrent.*; | ||
|
||
/** | ||
* Proxy which implements XMLA requests by talking to mondrian | ||
* in-process. This is more convenient to debug than an inter-process | ||
* request using HTTP. | ||
* | ||
* @author jhyde | ||
*/ | ||
public class MondrianInprocProxy | ||
implements XmlaOlap4jProxy | ||
{ | ||
private final ExecutorService executor = | ||
Util.getExecutorService( | ||
1, 1, 1, "MondrianInprocProxy$executor", | ||
new ThreadPoolExecutor.CallerRunsPolicy()); | ||
private final Map<String, String> catalogNameUrls; | ||
private final String urlString; | ||
private final Map servletCache = | ||
new ReferenceMap(ReferenceMap.HARD, ReferenceMap.WEAK); | ||
|
||
/** | ||
* Creates and initializes a MondrianInprocProxy. | ||
* | ||
* @param catalogNameUrls Collection of catalog names and the URL where | ||
* their catalog is to be found. For testing purposes, this should contain | ||
* a catalog called "FoodMart". | ||
* | ||
* @param urlString JDBC connect string; must begin with "jdbc:mondrian:" | ||
*/ | ||
public MondrianInprocProxy( | ||
Map<String, String> catalogNameUrls, | ||
String urlString) | ||
{ | ||
this.catalogNameUrls = catalogNameUrls; | ||
if (!urlString.startsWith("jdbc:mondrian:")) { | ||
throw new IllegalArgumentException(); | ||
} | ||
this.urlString = urlString.substring("jdbc:mondrian:".length()); | ||
} | ||
|
||
public byte[] get( | ||
XmlaOlap4jServerInfos infos, | ||
String request) | ||
{ | ||
try { | ||
return XmlaSupport.processSoapXmla( | ||
request, urlString, catalogNameUrls, null, null, servletCache); | ||
} catch (Exception e) { | ||
throw new RuntimeException( | ||
"Error while reading '" + infos.getUrl() + "'", e); | ||
} | ||
} | ||
|
||
public Future<byte[]> submit( | ||
final XmlaOlap4jServerInfos infos, | ||
final String request) | ||
{ | ||
return this.executor.submit( | ||
new Callable<byte[]>() { | ||
public byte[] call() throws Exception { | ||
return get(infos, request); | ||
} | ||
}); | ||
} | ||
|
||
public String getEncodingCharsetName() { | ||
return "UTF-8"; | ||
} | ||
} | ||
|
||
// End MondrianInprocProxy.java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
mondrian/src/test/java/mondrian/test/DelegatingTestContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* This software is subject to the terms of the Eclipse Public License v1.0 | ||
* Agreement, available at the following URL: | ||
* http://www.eclipse.org/legal/epl-v10.html. | ||
* You must accept the terms of that agreement to use this software. | ||
* | ||
* Copyright (c) 2002-2017 Hitachi Vantara.. All rights reserved. | ||
*/ | ||
|
||
package mondrian.test; | ||
|
||
import mondrian.olap.Util; | ||
|
||
import java.io.PrintWriter; | ||
|
||
/** | ||
* Extension of {@link TestContext} which delegates all behavior to | ||
* a parent test context. | ||
* | ||
* <p>Derived classes can selectively override methods. | ||
* | ||
* @author jhyde | ||
* @since 7 September, 2005 | ||
*/ | ||
public class DelegatingTestContext extends TestContext { | ||
protected final TestContext context; | ||
|
||
protected DelegatingTestContext(TestContext context) { | ||
this.context = context; | ||
} | ||
|
||
public Util.PropertyList getConnectionProperties() { | ||
return context.getConnectionProperties(); | ||
} | ||
|
||
public String getDefaultCubeName() { | ||
return context.getDefaultCubeName(); | ||
} | ||
|
||
public PrintWriter getWriter() { | ||
return context.getWriter(); | ||
} | ||
} | ||
|
||
// End DelegatingTestContext.java |
Oops, something went wrong.