forked from olap4j/olap4j
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed deadlock bug in Xmla Driver, added unit test to verify fix. Als…
…o added generated java files and testclasses directory to svn:ignore. git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@102 c6a108a4-781c-0410-a6c6-c2d559e19af0
- Loading branch information
Will Gorman
committed
Jul 25, 2008
1 parent
e1280ce
commit bc26a47
Showing
4 changed files
with
88 additions
and
13 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
package org.olap4j; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.sql.DriverManager; | ||
import java.util.Properties; | ||
import java.util.concurrent.Future; | ||
|
||
import org.olap4j.driver.xmla.XmlaOlap4jDriver; | ||
import org.olap4j.driver.xmla.proxy.XmlaOlap4jProxy; | ||
|
||
import junit.framework.TestCase; | ||
|
||
public class XmlaConnectionTest extends TestCase { | ||
|
||
public static final String DRIVER_CLASS_NAME = | ||
"org.olap4j.driver.xmla.XmlaOlap4jDriver"; | ||
|
||
static class XmlaOlap4jProxyMock implements XmlaOlap4jProxy { | ||
|
||
public byte[] get(URL url, String request) throws IOException { | ||
throw new RuntimeException("Non-Trivial Call!"); | ||
} | ||
|
||
public String getEncodingCharsetName() { | ||
return "UTF-8"; | ||
} | ||
|
||
public Future<byte[]> submit(URL url, String request) { | ||
throw new RuntimeException("Non-Trivial Call!"); | ||
} | ||
|
||
} | ||
|
||
/** | ||
* this test verifies that the construction of the necessary | ||
* xmla objects during DriverManager.getConnection() do not make | ||
* calls that could cause deadlocks. | ||
*/ | ||
public void testNoNonTrivalCallsOnConnect() throws Exception { | ||
String cookie = XmlaOlap4jDriver.nextCookie(); | ||
try { | ||
|
||
XmlaOlap4jDriver.PROXY_MAP.put(cookie, new XmlaOlap4jProxyMock()); | ||
|
||
try { | ||
Class.forName(DRIVER_CLASS_NAME); | ||
} catch (ClassNotFoundException e) { | ||
throw new RuntimeException("oops", e); | ||
} | ||
Properties info = new Properties(); | ||
info.setProperty( | ||
XmlaOlap4jDriver.Property.Catalog.name(), "FoodMart"); | ||
DriverManager.getConnection( | ||
"jdbc:xmla:Server=http://foo;Catalog=FoodMart;TestProxyCookie=" + cookie, | ||
info); | ||
} catch (Throwable t) { | ||
t.printStackTrace(); | ||
fail("Non-Trival Call executed during construction of XmlaOlap4j Connection"); | ||
} | ||
|
||
} | ||
} |