Skip to content

Commit

Permalink
fixed test failure: Jbc2InfinispanTransformerTest
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarkus committed Feb 7, 2011
1 parent c3b2ed3 commit 03b483d
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 47 deletions.
53 changes: 27 additions & 26 deletions core/src/main/resources/xslt/jbc3x2infinispan4x.xslt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet xmlns="urn:infinispan:config:4.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:stylesheet xmlns="urn:infinispan:config:5.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes" version="1.0" encoding="UTF-8" omit-xml-declaration="no"/>

<xsl:template match="/jbosscache">
Expand Down Expand Up @@ -86,20 +86,22 @@
<xsl:value-of select="clustering/sync/@replTimeout"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="clustering/jgroupsConfig[@configFile]">
<xsl:element name="property">
<xsl:attribute name="name">configurationFile</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="clustering/jgroupsConfig/@configFile"/>
</xsl:attribute>
</xsl:element>
</xsl:if>
<xsl:if test="clustering/jgroupsConfig/*">
<xsl:element name="property">
<xsl:attribute name="name">configurationFile</xsl:attribute>
<xsl:attribute name="value">jgroupsConfig.xml</xsl:attribute>
</xsl:element>
</xsl:if>
<xsl:element name="properties">
<xsl:if test="clustering/jgroupsConfig[@configFile]">
<xsl:element name="property">
<xsl:attribute name="name">configurationFile</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="clustering/jgroupsConfig/@configFile"/>
</xsl:attribute>
</xsl:element>
</xsl:if>
<xsl:if test="clustering/jgroupsConfig/*">
<xsl:element name="property">
<xsl:attribute name="name">configurationFile</xsl:attribute>
<xsl:attribute name="value">jgroupsConfig.xml</xsl:attribute>
</xsl:element>
</xsl:if>
</xsl:element>

</xsl:element>

Expand Down Expand Up @@ -332,16 +334,6 @@
<xsl:value-of select="@purgeOnStartup"/>
</xsl:attribute>
</xsl:if>
<xsl:if test="@async">
<async enabled="true"/>
</xsl:if>
<xsl:if test="properties">
<xsl:message terminate="no">WARNING! Please configure cache loader props manually!</xsl:message>
<properties>
<!--<property name="TODO set name here..." value="...set value here..."/>-->
<!--<property name="TODO set name here..." value="...set value here..."/>-->
</properties>
</xsl:if>
<xsl:if test="singletonStore">
<xsl:element name="singletonStore">
<xsl:if test="singletonStore[@enabled]">
Expand All @@ -354,7 +346,16 @@
</xsl:if>
</xsl:if>
</xsl:element>

</xsl:if>
<xsl:if test="@async">
<async enabled="true"/>
</xsl:if>
<xsl:if test="properties">
<xsl:message terminate="no">WARNING! Please configure cache loader props manually!</xsl:message>
<!--<properties>-->
<!--<property name="TODO set name here..." value="...set value here..."/>-->
<!--<property name="TODO set name here..." value="...set value here..."/>-->
<!--</properties>-->
</xsl:if>
</xsl:element>
</xsl:for-each>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@
import org.infinispan.loaders.decorators.AsyncStoreConfig;
import org.infinispan.loaders.decorators.SingletonStoreConfig;
import org.infinispan.loaders.dummy.DummyInMemoryCacheStore;
import org.infinispan.manager.DefaultCacheManager;
import org.infinispan.manager.EmbeddedCacheManager;
import org.infinispan.marshall.VersionAwareMarshaller;
import org.infinispan.test.AbstractInfinispanTest;
import org.infinispan.test.TestingUtil;
import org.infinispan.util.concurrent.IsolationLevel;
import org.testng.annotations.Test;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.util.Map;
import java.util.concurrent.ConcurrentMap;

/**
* @author Mircea.Markus@jboss.com
Expand All @@ -41,10 +45,9 @@ public void testAllFile() throws Exception {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
convertor.parse(fileName, baos, XSLT_FILE);

XmlConfigurationParser newParser = InfinispanConfiguration.newInfinispanConfiguration(new ByteArrayInputStream(baos.toByteArray()));
GlobalConfiguration globalConfig = newParser.parseGlobalConfiguration();
Map<String, Configuration> map = newParser.parseNamedConfigurations();
Configuration defaultConfig = newParser.parseDefaultConfiguration();
EmbeddedCacheManager ecm = new DefaultCacheManager(new ByteArrayInputStream(baos.toByteArray()), false);
Configuration defaultConfig = ecm.getDefaultConfiguration();
GlobalConfiguration globalConfig = ecm.getGlobalConfiguration();
assert defaultConfig.getIsolationLevel().equals(IsolationLevel.READ_COMMITTED);
assert defaultConfig.getLockAcquisitionTimeout() == 234000;
assert defaultConfig.isWriteSkewCheck();
Expand All @@ -68,13 +71,15 @@ public void testAllFile() throws Exception {
assert defaultConfig.getExpirationMaxIdle() == 1001 : "Received " + defaultConfig.getExpirationLifespan();
assert defaultConfig.getEvictionWakeUpInterval() == 50015;

Configuration regionOne = map.get("/org/jboss/data1");
ConcurrentMap<String, Configuration> configurationOverrides = (ConcurrentMap<String, Configuration>) TestingUtil.extractField(ecm, "configurationOverrides");

Configuration regionOne = configurationOverrides.get("/org/jboss/data1");
assert regionOne != null;
assert regionOne.getEvictionStrategy().equals(EvictionStrategy.LRU);
assert regionOne.getExpirationMaxIdle() == 2002;
assert regionOne.getEvictionWakeUpInterval() == 50015;

Configuration regionTwo = map.get("/org/jboss/data2");
Configuration regionTwo = configurationOverrides.get("/org/jboss/data2");
assert regionTwo != null;
assert regionTwo.getEvictionStrategy().equals(EvictionStrategy.FIFO);
assert regionTwo.getEvictionMaxEntries() == 3003;
Expand All @@ -87,7 +92,7 @@ public void testAllFile() throws Exception {

assert loaderManagerConfig.getCacheLoaderConfigs().size() == 1;
CacheStoreConfig config = (CacheStoreConfig) loaderManagerConfig.getCacheLoaderConfigs().get(0);
assert config.getCacheLoaderClassName().equals("org.infinispan.loaders.jdbc.stringbased.JdbcStringBasedCacheStore");
assert config.getCacheLoaderClassName().equals("org.infinispan.loaders.file.FileCacheStore");
AsyncStoreConfig asyncStoreConfig = config.getAsyncStoreConfig();
assert asyncStoreConfig != null;
assert asyncStoreConfig.isEnabled();
Expand Down
16 changes: 2 additions & 14 deletions core/src/test/resources/configs/jbosscache3x/all.xml
Original file line number Diff line number Diff line change
Expand Up @@ -172,23 +172,11 @@
<!--
we can have multiple cache loaders, which get chained
-->
<loader class="org.jboss.cache.loader.JDBCCacheLoader" async="true" fetchPersistentState="true"
<loader class="org.jboss.cache.loader.FileCacheLoader" async="true" fetchPersistentState="true"
ignoreModifications="true" purgeOnStartup="true">

<properties>
cache.jdbc.table.name=jbosscache
cache.jdbc.table.create=true
cache.jdbc.table.drop=true
cache.jdbc.table.primarykey=jbosscache_pk
cache.jdbc.fqn.column=fqn
cache.jdbc.fqn.type=VARCHAR(255)
cache.jdbc.node.column=node
cache.jdbc.node.type=BINARY
cache.jdbc.parent.column=parent
cache.jdbc.driver=org.hsqldb.jdbcDriver
cache.jdbc.url=jdbc:hsqldb:mem:jbosscache
cache.jdbc.user=sa
cache.jdbc.password=
location=jbosscache
</properties>
<!-- alternatively use a connection from a datasource, as per the code sample below-->
<!--<properties>-->
Expand Down

0 comments on commit 03b483d

Please sign in to comment.