Skip to content

Commit

Permalink
Fixes bug 3060643. Cache properties are not ignoring the case of the …
Browse files Browse the repository at this point in the history
…passed parameters. Everything is evaluated as upper case.

git-svn-id: https://olap4j.svn.sourceforge.net/svnroot/olap4j/trunk@429 c6a108a4-781c-0410-a6c6-c2d559e19af0
  • Loading branch information
lucboudreau committed Mar 24, 2011
1 parent 47b89a4 commit 46a1c34
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,17 +84,17 @@ public XmlaOlap4jConcurrentMemoryCache(
throws IllegalArgumentException
{
for (Entry<String, String> entry : props.entrySet()) {
if (Property.Size.name().equalsIgnoreCase(
if (Property.SIZE.name().equalsIgnoreCase(
entry.getKey().toString()))
{
this.setCacheSize(
Integer.parseInt(entry.getValue().toString()));
} else if (Property.Timeout.name().equalsIgnoreCase(
} else if (Property.TIMEOUT.name().equalsIgnoreCase(
entry.getKey().toString()))
{
this.setCacheTimeout(
Integer.parseInt(entry.getValue().toString()));
} else if (Property.Mode.name().equalsIgnoreCase(
} else if (Property.MODE.name().equalsIgnoreCase(
entry.getKey().toString()))
{
this.setCacheMode(
Expand Down
26 changes: 13 additions & 13 deletions src/org/olap4j/driver/xmla/cache/XmlaOlap4jNamedMemoryCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
* <p>All parameters are optional.
*
* <ul>
* <li><b>Name</b><br />A unique identifier which allows two connections
* <li><b>NAME</b><br />A unique identifier which allows two connections
* to share a same cache space. Setting this to an already existing cache
* space will cause the cache manager to ignore other configuration properties,
* such as eviction mode and so on. Not setting this property will
* assign a random name to the cache space, thus creating a unique space.</li>
* <li><b>Size</b><br />The number of entries to maintain in cache under
* <li><b>SIZE</b><br />The number of entries to maintain in cache under
* the given cache name.</li>
* <li><b>Timeout</b><br />The number of seconds to maintain entries in
* <li><b>TIMEOUT</b><br />The number of seconds to maintain entries in
* cache before expiration.</li>
* <li><b>Mode</b><br />Supported eviction modes are LIFO (last in first out),
* <li><b>MODE</b><br />Supported eviction modes are LIFO (last in first out),
* FIFO (first in first out), LFU (least frequently used) and MFU
* (most frequently used)</li>
* </ul>
Expand Down Expand Up @@ -63,21 +63,21 @@ public static enum Property {
* property will assign a random name to the cache space, thus creating
* a unique space.
*/
Name("Name of a cache to create or to share."),
NAME("Name of a cache to create or to share."),

/**
* The number of entries to maintain in cache under
* the given cache name.
*/
Size(
SIZE(
"Maximum number of SOAP requests which will be cached under the "
+ "given cache name."),

/**
* The number of seconds to maintain
* entries in cache before expiration.
*/
Timeout(
TIMEOUT(
"Maximum TTL of SOAP requests which will be cached under the given "
+ "cache name."),

Expand All @@ -86,7 +86,7 @@ public static enum Property {
* LIFO (last in first out), FIFO (first in first out),
* LFU (least frequently used) and MFU (most frequently used).
*/
Mode("Eviction mode to set to the given cache name.");
MODE("Eviction mode to set to the given cache name.");

/**
* Creates a property.
Expand Down Expand Up @@ -149,13 +149,13 @@ public String setParameters(
// Make sure there's a name for the cache. Generate a
// random one if needed.
if (props.containsKey(
XmlaOlap4jNamedMemoryCache.Property.Name.name()))
XmlaOlap4jNamedMemoryCache.Property.NAME.name()))
{
refId = (String)props.get(
XmlaOlap4jNamedMemoryCache.Property.Name.name());
XmlaOlap4jNamedMemoryCache.Property.NAME.name());
} else {
refId = String.valueOf(UUID.randomUUID());
props.put(XmlaOlap4jNamedMemoryCache.Property.Name.name(), refId);
props.put(XmlaOlap4jNamedMemoryCache.Property.NAME.name(), refId);
}


Expand All @@ -164,11 +164,11 @@ public String setParameters(
// Create a cache for this URL if it is not created yet
if (!caches.containsKey(
props.get(
XmlaOlap4jNamedMemoryCache.Property.Name.name())))
XmlaOlap4jNamedMemoryCache.Property.NAME.name())))
{
caches.put(
(String) props.get(
XmlaOlap4jNamedMemoryCache.Property.Name.name()),
XmlaOlap4jNamedMemoryCache.Property.NAME.name()),
new XmlaOlap4jConcurrentMemoryCache(props));
}
}
Expand Down
60 changes: 30 additions & 30 deletions testsrc/org/olap4j/driver/xmla/proxy/XmlaCachedProxyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ public void testCacheConfig() throws Exception
XmlaOlap4jDriver.Property.Cache.name(),
"org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Name.name(),
XmlaOlap4jNamedMemoryCache.Property.NAME.name(),
"testCacheConfig");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Mode.name(),
XmlaOlap4jNamedMemoryCache.Property.MODE.name(),
"LFU");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Timeout.name(),
XmlaOlap4jNamedMemoryCache.Property.TIMEOUT.name(),
"30");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Size.name(),
XmlaOlap4jNamedMemoryCache.Property.SIZE.name(),
"50");

proxy.setCache(driverParameters, cacheProperties);
Expand All @@ -82,16 +82,16 @@ public void testCacheModeError() throws Exception {
XmlaOlap4jDriver.Property.Cache.name(),
"org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Name.name(),
XmlaOlap4jNamedMemoryCache.Property.NAME.name(),
"testCacheModeError");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Mode.name(),
XmlaOlap4jNamedMemoryCache.Property.MODE.name(),
"ERRONOUS VALUE MWAHAHAHAHA");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Timeout.name(),
XmlaOlap4jNamedMemoryCache.Property.TIMEOUT.name(),
"30");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Size.name(),
XmlaOlap4jNamedMemoryCache.Property.SIZE.name(),
"50");

try {
Expand Down Expand Up @@ -125,24 +125,24 @@ public void testCacheTimeoutError() throws Exception
XmlaOlap4jDriver.Property.Cache.name(),
"org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Name.name(),
XmlaOlap4jNamedMemoryCache.Property.NAME.name(),
"testCacheTimeoutError");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Mode.name(),
XmlaOlap4jNamedMemoryCache.Property.MODE.name(),
"LFU");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Timeout.name(),
XmlaOlap4jNamedMemoryCache.Property.TIMEOUT.name(),
"EEE");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Size.name(),
XmlaOlap4jNamedMemoryCache.Property.SIZE.name(),
"50");

try {
proxy.setCache(driverParameters, cacheProperties);
} catch (OlapException t) {
try {
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Timeout.name(),
XmlaOlap4jNamedMemoryCache.Property.TIMEOUT.name(),
"-30");
proxy.setCache(driverParameters, cacheProperties);
} catch (OlapException t2) {
Expand Down Expand Up @@ -175,24 +175,24 @@ public void testCacheSizeError() throws Exception
XmlaOlap4jDriver.Property.Cache.name(),
"org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Name.name(),
XmlaOlap4jNamedMemoryCache.Property.NAME.name(),
"testCacheSizeError");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Mode.name(),
XmlaOlap4jNamedMemoryCache.Property.MODE.name(),
"LFU");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Timeout.name(),
XmlaOlap4jNamedMemoryCache.Property.TIMEOUT.name(),
"600");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Size.name(),
XmlaOlap4jNamedMemoryCache.Property.SIZE.name(),
"EEE");

try {
proxy.setCache(driverParameters, cacheProperties);
} catch (OlapException t) {
try {
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Size.name(),
XmlaOlap4jNamedMemoryCache.Property.SIZE.name(),
"-30");
proxy.setCache(driverParameters, cacheProperties);
} catch (OlapException t2) {
Expand Down Expand Up @@ -224,16 +224,16 @@ public void testCacheNameError() throws Exception
XmlaOlap4jDriver.Property.Cache.name(),
"Class which doesn't exist");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Name.name(),
XmlaOlap4jNamedMemoryCache.Property.NAME.name(),
"testCacheNameError");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Mode.name(),
XmlaOlap4jNamedMemoryCache.Property.MODE.name(),
"LFU");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Timeout.name(),
XmlaOlap4jNamedMemoryCache.Property.TIMEOUT.name(),
"600");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Size.name(),
XmlaOlap4jNamedMemoryCache.Property.SIZE.name(),
"50");

try {
Expand Down Expand Up @@ -271,16 +271,16 @@ public void testCacheSharing() throws Exception
XmlaOlap4jDriver.Property.Cache.name(),
"org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Name.name(),
XmlaOlap4jNamedMemoryCache.Property.NAME.name(),
"testCacheSharing");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Mode.name(),
XmlaOlap4jNamedMemoryCache.Property.MODE.name(),
"LFU");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Timeout.name(),
XmlaOlap4jNamedMemoryCache.Property.TIMEOUT.name(),
"600");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Size.name(),
XmlaOlap4jNamedMemoryCache.Property.SIZE.name(),
"50");

try {
Expand All @@ -299,16 +299,16 @@ public void testCacheSharing() throws Exception
XmlaOlap4jDriver.Property.Cache.name(),
"org.olap4j.driver.xmla.cache.XmlaOlap4jNamedMemoryCache");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Name.name(),
XmlaOlap4jNamedMemoryCache.Property.NAME.name(),
"testCacheSharing");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Mode.name(),
XmlaOlap4jNamedMemoryCache.Property.MODE.name(),
"Erronous value which won't trigger an exception since a shared cache should be used.");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Timeout.name(),
XmlaOlap4jNamedMemoryCache.Property.TIMEOUT.name(),
"Erronous value which won't trigger an exception since a shared cache should be used.");
cacheProperties.put(
XmlaOlap4jNamedMemoryCache.Property.Size.name(),
XmlaOlap4jNamedMemoryCache.Property.SIZE.name(),
"Erronous value which won't trigger an exception since a shared cache should be used.");

try {
Expand Down

0 comments on commit 46a1c34

Please sign in to comment.