mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
added unit tests for GuavaCacheConfigurationReader
This commit is contained in:
74
scm-webapp/src/main/java/sonia/scm/cache/CacheConfigurationLoader.java
vendored
Normal file
74
scm-webapp/src/main/java/sonia/scm/cache/CacheConfigurationLoader.java
vendored
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2010, Sebastian Sdorra All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer. 2. Redistributions in
|
||||||
|
* binary form must reproduce the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer in the documentation and/or other
|
||||||
|
* materials provided with the distribution. 3. Neither the name of SCM-Manager;
|
||||||
|
* nor the names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* http://bitbucket.org/sdorra/scm-manager
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
package sonia.scm.cache;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Sebastian Sdorra
|
||||||
|
*/
|
||||||
|
public interface CacheConfigurationLoader
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public URL getDefaultResource();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public File getManualFileResource();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param path
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public Iterator<URL> getModuleResources();
|
||||||
|
}
|
||||||
119
scm-webapp/src/main/java/sonia/scm/cache/DefaultCacheConfigurationLoader.java
vendored
Normal file
119
scm-webapp/src/main/java/sonia/scm/cache/DefaultCacheConfigurationLoader.java
vendored
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2010, Sebastian Sdorra All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer. 2. Redistributions in
|
||||||
|
* binary form must reproduce the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer in the documentation and/or other
|
||||||
|
* materials provided with the distribution. 3. Neither the name of SCM-Manager;
|
||||||
|
* nor the names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* http://bitbucket.org/sdorra/scm-manager
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
package sonia.scm.cache;
|
||||||
|
|
||||||
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import sonia.scm.SCMContext;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Sebastian Sdorra
|
||||||
|
*/
|
||||||
|
public class DefaultCacheConfigurationLoader implements CacheConfigurationLoader
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs ...
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param defaultResource
|
||||||
|
* @param manualFileResource
|
||||||
|
* @param moduleResources
|
||||||
|
*/
|
||||||
|
public DefaultCacheConfigurationLoader(String defaultResource,
|
||||||
|
String manualFileResource, String moduleResources)
|
||||||
|
{
|
||||||
|
this.defaultResource = defaultResource;
|
||||||
|
this.manualFileResource = manualFileResource;
|
||||||
|
this.moduleResources = moduleResources;
|
||||||
|
}
|
||||||
|
|
||||||
|
//~--- get methods ----------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public URL getDefaultResource()
|
||||||
|
{
|
||||||
|
return DefaultCacheConfigurationLoader.class.getResource(defaultResource);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public File getManualFileResource()
|
||||||
|
{
|
||||||
|
return new File(SCMContext.getContext().getBaseDirectory(),
|
||||||
|
manualFileResource);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Iterator<URL> getModuleResources()
|
||||||
|
{
|
||||||
|
return CacheConfigurations.findModuleResources(
|
||||||
|
EhCacheConfigurationReader.class, moduleResources);
|
||||||
|
}
|
||||||
|
|
||||||
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private String defaultResource;
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private String manualFileResource;
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private String moduleResources;
|
||||||
|
}
|
||||||
@@ -48,7 +48,6 @@ import org.w3c.dom.NamedNodeMap;
|
|||||||
import org.w3c.dom.Node;
|
import org.w3c.dom.Node;
|
||||||
import org.w3c.dom.NodeList;
|
import org.w3c.dom.NodeList;
|
||||||
|
|
||||||
import sonia.scm.SCMContext;
|
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
@@ -103,9 +102,14 @@ public class EhCacheConfigurationReader
|
|||||||
/**
|
/**
|
||||||
* Constructs ...
|
* Constructs ...
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @param loader
|
||||||
*/
|
*/
|
||||||
public EhCacheConfigurationReader()
|
@VisibleForTesting
|
||||||
|
EhCacheConfigurationReader(CacheConfigurationLoader loader)
|
||||||
{
|
{
|
||||||
|
this.loader = loader;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
|
||||||
@@ -118,15 +122,21 @@ public class EhCacheConfigurationReader
|
|||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
//~--- methods --------------------------------------------------------------
|
||||||
|
|
||||||
|
public static InputStream read(){
|
||||||
|
return new EhCacheConfigurationReader(new DefaultCacheConfigurationLoader(
|
||||||
|
DEFAULT, MANUAL_RESOURCE, MODULE_RESOURCES)).doRead();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public InputStream read()
|
@VisibleForTesting
|
||||||
|
InputStream doRead()
|
||||||
{
|
{
|
||||||
URL defaultConfig = getDefaultResource();
|
URL defaultConfig = loader.getDefaultResource();
|
||||||
|
|
||||||
if (defaultConfig == null)
|
if (defaultConfig == null)
|
||||||
{
|
{
|
||||||
@@ -136,14 +146,14 @@ public class EhCacheConfigurationReader
|
|||||||
|
|
||||||
readConfiguration(defaultConfig, true);
|
readConfiguration(defaultConfig, true);
|
||||||
|
|
||||||
Iterator<URL> it = getModuleResources();
|
Iterator<URL> it = loader.getModuleResources();
|
||||||
|
|
||||||
while (it.hasNext())
|
while (it.hasNext())
|
||||||
{
|
{
|
||||||
readConfiguration(it.next(), false);
|
readConfiguration(it.next(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
File manualFile = getManualFileResource();
|
File manualFile = loader.getManualFileResource();
|
||||||
|
|
||||||
if (manualFile.exists())
|
if (manualFile.exists())
|
||||||
{
|
{
|
||||||
@@ -166,52 +176,6 @@ public class EhCacheConfigurationReader
|
|||||||
return createInputStream(doc);
|
return createInputStream(doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- get methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param path
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@VisibleForTesting
|
|
||||||
protected URL getDefaultResource()
|
|
||||||
{
|
|
||||||
return EhCacheConfigurationReader.class.getResource(DEFAULT);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@VisibleForTesting
|
|
||||||
protected File getManualFileResource()
|
|
||||||
{
|
|
||||||
return new File(SCMContext.getContext().getBaseDirectory(),
|
|
||||||
MANUAL_RESOURCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param path
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@VisibleForTesting
|
|
||||||
protected Iterator<URL> getModuleResources()
|
|
||||||
{
|
|
||||||
return CacheConfigurations.findModuleResources(
|
|
||||||
EhCacheConfigurationReader.class, MODULE_RESOURCES);
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
@@ -467,6 +431,9 @@ public class EhCacheConfigurationReader
|
|||||||
/** Field description */
|
/** Field description */
|
||||||
private DocumentBuilder builder;
|
private DocumentBuilder builder;
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private CacheConfigurationLoader loader;
|
||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private Map<Id, Node> nodeMap = Maps.newLinkedHashMap();
|
private Map<Id, Node> nodeMap = Maps.newLinkedHashMap();
|
||||||
|
|
||||||
|
|||||||
@@ -74,9 +74,7 @@ public class EhCacheManager implements CacheManager
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
EhCacheConfigurationReader reader = new EhCacheConfigurationReader();
|
stream = EhCacheConfigurationReader.read();
|
||||||
|
|
||||||
stream = reader.read();
|
|
||||||
cacheManager = new net.sf.ehcache.CacheManager(stream);
|
cacheManager = new net.sf.ehcache.CacheManager(stream);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
@@ -40,8 +40,6 @@ import com.google.common.collect.Maps;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import sonia.scm.SCMContext;
|
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -84,9 +82,14 @@ public class GuavaCacheConfigurationReader
|
|||||||
/**
|
/**
|
||||||
* Constructs ...
|
* Constructs ...
|
||||||
*
|
*
|
||||||
|
*
|
||||||
|
* @param loader
|
||||||
*/
|
*/
|
||||||
private GuavaCacheConfigurationReader()
|
@VisibleForTesting
|
||||||
|
GuavaCacheConfigurationReader(CacheConfigurationLoader loader)
|
||||||
{
|
{
|
||||||
|
this.loader = loader;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
this.context =
|
this.context =
|
||||||
@@ -109,21 +112,9 @@ public class GuavaCacheConfigurationReader
|
|||||||
*/
|
*/
|
||||||
public static GuavaCacheManagerConfiguration read()
|
public static GuavaCacheManagerConfiguration read()
|
||||||
{
|
{
|
||||||
return new GuavaCacheConfigurationReader().doRead();
|
return new GuavaCacheConfigurationReader(
|
||||||
}
|
new DefaultCacheConfigurationLoader(
|
||||||
|
DEFAULT, MANUAL_RESOURCE, MODULE_RESOURCES)).doRead();
|
||||||
//~--- get methods ----------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@VisibleForTesting
|
|
||||||
protected URL getDefaultResource()
|
|
||||||
{
|
|
||||||
return GuavaCacheConfigurationReader.class.getResource(DEFAULT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -133,59 +124,9 @@ public class GuavaCacheConfigurationReader
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
protected File getManualFileResource()
|
GuavaCacheManagerConfiguration doRead()
|
||||||
{
|
{
|
||||||
return new File(SCMContext.getContext().getBaseDirectory(),
|
URL defaultConfigUrl = loader.getDefaultResource();
|
||||||
MANUAL_RESOURCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param path
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@VisibleForTesting
|
|
||||||
protected Iterator<URL> getModuleResources()
|
|
||||||
{
|
|
||||||
return CacheConfigurations.findModuleResources(
|
|
||||||
EhCacheConfigurationReader.class, MODULE_RESOURCES);
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- methods --------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param caches
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private Map<String, GuavaNamedCacheConfiguration> createNamedCacheMap(
|
|
||||||
List<GuavaNamedCacheConfiguration> caches)
|
|
||||||
{
|
|
||||||
Map<String, GuavaNamedCacheConfiguration> map = Maps.newLinkedHashMap();
|
|
||||||
|
|
||||||
for (GuavaNamedCacheConfiguration ncc : caches)
|
|
||||||
{
|
|
||||||
map.put(ncc.getName(), ncc);
|
|
||||||
}
|
|
||||||
|
|
||||||
return map;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private GuavaCacheManagerConfiguration doRead()
|
|
||||||
{
|
|
||||||
URL defaultConfigUrl = getDefaultResource();
|
|
||||||
|
|
||||||
if (defaultConfigUrl == null)
|
if (defaultConfigUrl == null)
|
||||||
{
|
{
|
||||||
@@ -196,7 +137,7 @@ public class GuavaCacheConfigurationReader
|
|||||||
GuavaCacheManagerConfiguration config = readConfiguration(defaultConfigUrl,
|
GuavaCacheManagerConfiguration config = readConfiguration(defaultConfigUrl,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
Iterator<URL> it = getModuleResources();
|
Iterator<URL> it = loader.getModuleResources();
|
||||||
|
|
||||||
while (it.hasNext())
|
while (it.hasNext())
|
||||||
{
|
{
|
||||||
@@ -209,7 +150,7 @@ public class GuavaCacheConfigurationReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
File manualFile = getManualFileResource();
|
File manualFile = loader.getManualFileResource();
|
||||||
|
|
||||||
if (manualFile.exists())
|
if (manualFile.exists())
|
||||||
{
|
{
|
||||||
@@ -233,6 +174,27 @@ public class GuavaCacheConfigurationReader
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param caches
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private Map<String, GuavaNamedCacheConfiguration> createNamedCacheMap(
|
||||||
|
List<GuavaNamedCacheConfiguration> caches)
|
||||||
|
{
|
||||||
|
Map<String, GuavaNamedCacheConfiguration> map = Maps.newLinkedHashMap();
|
||||||
|
|
||||||
|
for (GuavaNamedCacheConfiguration ncc : caches)
|
||||||
|
{
|
||||||
|
map.put(ncc.getName(), ncc);
|
||||||
|
}
|
||||||
|
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
@@ -305,4 +267,7 @@ public class GuavaCacheConfigurationReader
|
|||||||
|
|
||||||
/** Field description */
|
/** Field description */
|
||||||
private JAXBContext context;
|
private JAXBContext context;
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private CacheConfigurationLoader loader;
|
||||||
}
|
}
|
||||||
|
|||||||
239
scm-webapp/src/test/java/sonia/scm/cache/CacheConfigurationTestLoader.java
vendored
Normal file
239
scm-webapp/src/test/java/sonia/scm/cache/CacheConfigurationTestLoader.java
vendored
Normal file
@@ -0,0 +1,239 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2010, Sebastian Sdorra All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer. 2. Redistributions in
|
||||||
|
* binary form must reproduce the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer in the documentation and/or other
|
||||||
|
* materials provided with the distribution. 3. Neither the name of SCM-Manager;
|
||||||
|
* nor the names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* http://bitbucket.org/sdorra/scm-manager
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
package sonia.scm.cache;
|
||||||
|
|
||||||
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.base.Function;
|
||||||
|
import com.google.common.collect.Iterators;
|
||||||
|
import com.google.common.io.Files;
|
||||||
|
import com.google.common.io.Resources;
|
||||||
|
|
||||||
|
import org.junit.rules.TemporaryFolder;
|
||||||
|
|
||||||
|
import static org.mockito.Mockito.mock;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import java.net.URL;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Sebastian Sdorra
|
||||||
|
*/
|
||||||
|
public class CacheConfigurationTestLoader implements CacheConfigurationLoader
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs ...
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param tempFolder
|
||||||
|
*/
|
||||||
|
public CacheConfigurationTestLoader(TemporaryFolder tempFolder)
|
||||||
|
{
|
||||||
|
this.tempFolder = tempFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs ...
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param tempFolder
|
||||||
|
* @param defaultConfiguration
|
||||||
|
*/
|
||||||
|
public CacheConfigurationTestLoader(TemporaryFolder tempFolder,
|
||||||
|
String defaultConfiguration)
|
||||||
|
{
|
||||||
|
this.tempFolder = tempFolder;
|
||||||
|
this.defaultConfiguration = defaultConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs ...
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param tempFolder
|
||||||
|
* @param defaultConfiguration
|
||||||
|
* @param moduleConfigurations
|
||||||
|
*/
|
||||||
|
public CacheConfigurationTestLoader(TemporaryFolder tempFolder,
|
||||||
|
String defaultConfiguration, Iterator<String> moduleConfigurations)
|
||||||
|
{
|
||||||
|
this.tempFolder = tempFolder;
|
||||||
|
this.defaultConfiguration = defaultConfiguration;
|
||||||
|
this.moduleConfigurations = moduleConfigurations;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs ...
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param tempFolder
|
||||||
|
* @param defaultConfiguration
|
||||||
|
* @param moduleConfigurations
|
||||||
|
* @param manualConfiguration
|
||||||
|
*/
|
||||||
|
public CacheConfigurationTestLoader(TemporaryFolder tempFolder,
|
||||||
|
String defaultConfiguration, Iterator<String> moduleConfigurations,
|
||||||
|
String manualConfiguration)
|
||||||
|
{
|
||||||
|
this.tempFolder = tempFolder;
|
||||||
|
this.defaultConfiguration = defaultConfiguration;
|
||||||
|
this.moduleConfigurations = moduleConfigurations;
|
||||||
|
this.manualConfiguration = manualConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
//~--- get methods ----------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public URL getDefaultResource()
|
||||||
|
{
|
||||||
|
URL url = null;
|
||||||
|
|
||||||
|
if (defaultConfiguration != null)
|
||||||
|
{
|
||||||
|
url = getResource(defaultConfiguration);
|
||||||
|
}
|
||||||
|
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public File getManualFileResource()
|
||||||
|
{
|
||||||
|
File file;
|
||||||
|
|
||||||
|
if (manualConfiguration == null)
|
||||||
|
{
|
||||||
|
file = mock(File.class);
|
||||||
|
when(file.exists()).thenReturn(Boolean.FALSE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
file = tempFolder.newFile();
|
||||||
|
|
||||||
|
URL manual = getResource(manualConfiguration);
|
||||||
|
|
||||||
|
Files.copy(Resources.newInputStreamSupplier(manual), file);
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
throw new RuntimeException("could not create manual config file", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return file;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Iterator<URL> getModuleResources()
|
||||||
|
{
|
||||||
|
Iterator<URL> urlIterator;
|
||||||
|
|
||||||
|
if (moduleConfigurations == null)
|
||||||
|
{
|
||||||
|
urlIterator = Iterators.emptyIterator();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
urlIterator = Iterators.transform(moduleConfigurations,
|
||||||
|
new Function<String, URL>()
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public URL apply(String resource)
|
||||||
|
{
|
||||||
|
return getResource(resource);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return urlIterator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param name
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private URL getResource(String name)
|
||||||
|
{
|
||||||
|
return Resources.getResource("sonia/scm/cache/".concat(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private String defaultConfiguration;
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private String manualConfiguration;
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private Iterator<String> moduleConfigurations;
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
private TemporaryFolder tempFolder;
|
||||||
|
}
|
||||||
@@ -33,11 +33,8 @@ package sonia.scm.cache;
|
|||||||
|
|
||||||
//~--- non-JDK imports --------------------------------------------------------
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.Iterators;
|
import com.google.common.collect.Iterators;
|
||||||
import com.google.common.io.Closeables;
|
import com.google.common.io.Closeables;
|
||||||
import com.google.common.io.Files;
|
|
||||||
import com.google.common.io.Resources;
|
|
||||||
|
|
||||||
import net.sf.ehcache.config.CacheConfiguration;
|
import net.sf.ehcache.config.CacheConfiguration;
|
||||||
import net.sf.ehcache.config.Configuration;
|
import net.sf.ehcache.config.Configuration;
|
||||||
@@ -49,16 +46,10 @@ import org.junit.rules.TemporaryFolder;
|
|||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
import static org.mockito.Mockito.*;
|
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
import java.net.URL;
|
|
||||||
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -75,13 +66,11 @@ public class EhConfigurationReaderTest
|
|||||||
@Test
|
@Test
|
||||||
public void testDefaultConfiguration()
|
public void testDefaultConfiguration()
|
||||||
{
|
{
|
||||||
EhConfigurationTestReader reader =
|
EhCacheConfigurationReader reader = createReader("ehcache.001.xml");
|
||||||
new EhConfigurationTestReader("ehcache.001.xml");
|
|
||||||
Configuration c = createConfiguration(reader);
|
Configuration c = createConfiguration(reader);
|
||||||
|
|
||||||
checkDefaultConfiguration(c);
|
checkDefaultConfiguration(c);
|
||||||
checkCacheConfiguration(c, "sonia.test.cache.001", 1000l, 30l, 60l);
|
checkCacheConfiguration(c, "sonia.test.cache.001", 1000l, 30l, 60l);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,8 +80,7 @@ public class EhConfigurationReaderTest
|
|||||||
@Test
|
@Test
|
||||||
public void testGlobalAttributes()
|
public void testGlobalAttributes()
|
||||||
{
|
{
|
||||||
EhConfigurationTestReader reader =
|
EhCacheConfigurationReader reader = createReader("ehcache.006.xml");
|
||||||
new EhConfigurationTestReader("ehcache.006.xml");
|
|
||||||
Configuration c = createConfiguration(reader);
|
Configuration c = createConfiguration(reader);
|
||||||
|
|
||||||
assertFalse(c.getUpdateCheck());
|
assertFalse(c.getUpdateCheck());
|
||||||
@@ -107,7 +95,7 @@ public class EhConfigurationReaderTest
|
|||||||
public void testMergeAndOverride()
|
public void testMergeAndOverride()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
EhConfigurationTestReader reader = new EhConfigurationTestReader(
|
EhCacheConfigurationReader reader = createReader(
|
||||||
"ehcache.001.xml",
|
"ehcache.001.xml",
|
||||||
Iterators.forArray("ehcache.002.xml", "ehcache.003.xml"),
|
Iterators.forArray("ehcache.002.xml", "ehcache.003.xml"),
|
||||||
"ehcache.004.xml"
|
"ehcache.004.xml"
|
||||||
@@ -129,8 +117,8 @@ public class EhConfigurationReaderTest
|
|||||||
@Test
|
@Test
|
||||||
public void testMergeWithManualConfiguration()
|
public void testMergeWithManualConfiguration()
|
||||||
{
|
{
|
||||||
EhConfigurationTestReader reader =
|
EhCacheConfigurationReader reader = createReader("ehcache.001.xml", null,
|
||||||
new EhConfigurationTestReader("ehcache.001.xml", null, "ehcache.002.xml");
|
"ehcache.002.xml");
|
||||||
|
|
||||||
Configuration c = createConfiguration(reader);
|
Configuration c = createConfiguration(reader);
|
||||||
|
|
||||||
@@ -147,9 +135,9 @@ public class EhConfigurationReaderTest
|
|||||||
@Test
|
@Test
|
||||||
public void testMergeWithModuleConfigurations()
|
public void testMergeWithModuleConfigurations()
|
||||||
{
|
{
|
||||||
EhConfigurationTestReader reader =
|
EhCacheConfigurationReader reader = createReader("ehcache.001.xml",
|
||||||
new EhConfigurationTestReader("ehcache.001.xml",
|
Iterators.forArray("ehcache.002.xml",
|
||||||
Iterators.forArray("ehcache.002.xml", "ehcache.003.xml"));
|
"ehcache.003.xml"));
|
||||||
|
|
||||||
Configuration c = createConfiguration(reader);
|
Configuration c = createConfiguration(reader);
|
||||||
|
|
||||||
@@ -167,9 +155,9 @@ public class EhConfigurationReaderTest
|
|||||||
@Test(expected = IllegalStateException.class)
|
@Test(expected = IllegalStateException.class)
|
||||||
public void testMissingDefaultConfiguration()
|
public void testMissingDefaultConfiguration()
|
||||||
{
|
{
|
||||||
EhConfigurationTestReader reader = new EhConfigurationTestReader();
|
EhCacheConfigurationReader reader = createReader();
|
||||||
|
|
||||||
reader.read();
|
reader.doRead();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -180,7 +168,7 @@ public class EhConfigurationReaderTest
|
|||||||
public void testOverrideDefaultConfiguration()
|
public void testOverrideDefaultConfiguration()
|
||||||
{
|
{
|
||||||
//J-
|
//J-
|
||||||
EhConfigurationTestReader reader = new EhConfigurationTestReader(
|
EhCacheConfigurationReader reader = createReader(
|
||||||
"ehcache.001.xml",
|
"ehcache.001.xml",
|
||||||
Iterators.forArray("ehcache.005.xml")
|
Iterators.forArray("ehcache.005.xml")
|
||||||
);
|
);
|
||||||
@@ -197,8 +185,8 @@ public class EhConfigurationReaderTest
|
|||||||
@Test
|
@Test
|
||||||
public void testOverrideGlobalAttributes()
|
public void testOverrideGlobalAttributes()
|
||||||
{
|
{
|
||||||
EhConfigurationTestReader reader =
|
EhCacheConfigurationReader reader = createReader("ehcache.006.xml", null,
|
||||||
new EhConfigurationTestReader("ehcache.006.xml", null, "ehcache.007.xml");
|
"ehcache.007.xml");
|
||||||
Configuration c = createConfiguration(reader);
|
Configuration c = createConfiguration(reader);
|
||||||
|
|
||||||
assertTrue(c.getUpdateCheck());
|
assertTrue(c.getUpdateCheck());
|
||||||
@@ -270,7 +258,7 @@ public class EhConfigurationReaderTest
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
content = reader.read();
|
content = reader.doRead();
|
||||||
config = ConfigurationFactory.parseConfiguration(content);
|
config = ConfigurationFactory.parseConfiguration(content);
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
@@ -283,178 +271,67 @@ public class EhConfigurationReaderTest
|
|||||||
return config;
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
//~--- inner classes --------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class description
|
* Method description
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @version Enter version here..., 13/03/19
|
* @param defaultConfiguration
|
||||||
* @author Enter your name here...
|
*
|
||||||
|
* @return
|
||||||
*/
|
*/
|
||||||
private class EhConfigurationTestReader extends EhCacheConfigurationReader
|
private EhCacheConfigurationReader createReader(String defaultConfiguration)
|
||||||
{
|
{
|
||||||
|
return new EhCacheConfigurationReader(
|
||||||
/**
|
new CacheConfigurationTestLoader(tempFolder, defaultConfiguration));
|
||||||
* Constructs ...
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public EhConfigurationTestReader() {}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs ...
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param defaultConfiguration
|
|
||||||
*/
|
|
||||||
public EhConfigurationTestReader(String defaultConfiguration)
|
|
||||||
{
|
|
||||||
this.defaultConfiguration = defaultConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs ...
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param defaultConfiguration
|
|
||||||
* @param moduleConfigurations
|
|
||||||
*/
|
|
||||||
public EhConfigurationTestReader(String defaultConfiguration,
|
|
||||||
Iterator<String> moduleConfigurations)
|
|
||||||
{
|
|
||||||
this.defaultConfiguration = defaultConfiguration;
|
|
||||||
this.moduleConfigurations = moduleConfigurations;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs ...
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param defaultConfiguration
|
|
||||||
* @param moduleConfigurations
|
|
||||||
* @param manualConfiguration
|
|
||||||
*/
|
|
||||||
public EhConfigurationTestReader(String defaultConfiguration,
|
|
||||||
Iterator<String> moduleConfigurations, String manualConfiguration)
|
|
||||||
{
|
|
||||||
this.defaultConfiguration = defaultConfiguration;
|
|
||||||
this.moduleConfigurations = moduleConfigurations;
|
|
||||||
this.manualConfiguration = manualConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- get methods --------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public URL getDefaultResource()
|
|
||||||
{
|
|
||||||
URL url = null;
|
|
||||||
|
|
||||||
if (defaultConfiguration != null)
|
|
||||||
{
|
|
||||||
url = getResource(defaultConfiguration);
|
|
||||||
}
|
|
||||||
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public Iterator<URL> getModuleResources()
|
|
||||||
{
|
|
||||||
Iterator<URL> urlIterator;
|
|
||||||
|
|
||||||
if (moduleConfigurations == null)
|
|
||||||
{
|
|
||||||
urlIterator = Iterators.emptyIterator();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
urlIterator = Iterators.transform(moduleConfigurations,
|
|
||||||
new Function<String, URL>()
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public URL apply(String resource)
|
|
||||||
{
|
|
||||||
return getResource(resource);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return urlIterator;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected File getManualFileResource()
|
|
||||||
{
|
|
||||||
File file;
|
|
||||||
|
|
||||||
if (manualConfiguration == null)
|
|
||||||
{
|
|
||||||
file = mock(File.class);
|
|
||||||
when(file.exists()).thenReturn(Boolean.FALSE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
file = tempFolder.newFile();
|
|
||||||
|
|
||||||
URL manual = getResource(manualConfiguration);
|
|
||||||
|
|
||||||
Files.copy(Resources.newInputStreamSupplier(manual), file);
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
throw new RuntimeException("could not create manual config file", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return file;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Method description
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param name
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private URL getResource(String name)
|
|
||||||
{
|
|
||||||
return Resources.getResource("sonia/scm/cache/".concat(name));
|
|
||||||
}
|
|
||||||
|
|
||||||
//~--- fields -------------------------------------------------------------
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private String defaultConfiguration;
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private String manualConfiguration;
|
|
||||||
|
|
||||||
/** Field description */
|
|
||||||
private Iterator<String> moduleConfigurations;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param defaultConfiguration
|
||||||
|
* @param moduleConfiguration
|
||||||
|
* @param manualConfiguration
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private EhCacheConfigurationReader createReader(String defaultConfiguration,
|
||||||
|
Iterator<String> moduleConfiguration, String manualConfiguration)
|
||||||
|
{
|
||||||
|
return new EhCacheConfigurationReader(
|
||||||
|
new CacheConfigurationTestLoader(
|
||||||
|
tempFolder, defaultConfiguration, moduleConfiguration,
|
||||||
|
manualConfiguration));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param defaultConfiguration
|
||||||
|
* @param moduleConfiguration
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private EhCacheConfigurationReader createReader(String defaultConfiguration,
|
||||||
|
Iterator<String> moduleConfiguration)
|
||||||
|
{
|
||||||
|
return new EhCacheConfigurationReader(
|
||||||
|
new CacheConfigurationTestLoader(
|
||||||
|
tempFolder, defaultConfiguration, moduleConfiguration));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private EhCacheConfigurationReader createReader()
|
||||||
|
{
|
||||||
|
return new EhCacheConfigurationReader(
|
||||||
|
new CacheConfigurationTestLoader(tempFolder));
|
||||||
|
}
|
||||||
|
|
||||||
//~--- fields ---------------------------------------------------------------
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
247
scm-webapp/src/test/java/sonia/scm/cache/GuavaConfigurationReaderTest.java
vendored
Normal file
247
scm-webapp/src/test/java/sonia/scm/cache/GuavaConfigurationReaderTest.java
vendored
Normal file
@@ -0,0 +1,247 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) 2010, Sebastian Sdorra All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer. 2. Redistributions in
|
||||||
|
* binary form must reproduce the above copyright notice, this list of
|
||||||
|
* conditions and the following disclaimer in the documentation and/or other
|
||||||
|
* materials provided with the distribution. 3. Neither the name of SCM-Manager;
|
||||||
|
* nor the names of its contributors may be used to endorse or promote products
|
||||||
|
* derived from this software without specific prior written permission.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||||
|
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||||
|
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||||
|
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||||
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*
|
||||||
|
* http://bitbucket.org/sdorra/scm-manager
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
package sonia.scm.cache;
|
||||||
|
|
||||||
|
//~--- non-JDK imports --------------------------------------------------------
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterators;
|
||||||
|
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.rules.TemporaryFolder;
|
||||||
|
|
||||||
|
import static org.junit.Assert.*;
|
||||||
|
|
||||||
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Sebastian Sdorra
|
||||||
|
*/
|
||||||
|
public class GuavaConfigurationReaderTest
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testDefaultConfiguration()
|
||||||
|
{
|
||||||
|
GuavaCacheConfiguration cfg =
|
||||||
|
readConfiguration("gcache.001.xml").getDefaultCache();
|
||||||
|
|
||||||
|
assertCacheValues(cfg, 200l, 1200l, 2400l);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testMergeAndOverride()
|
||||||
|
{
|
||||||
|
//J-
|
||||||
|
GuavaCacheManagerConfiguration gcm = readConfiguration(
|
||||||
|
"gcache.001.xml",
|
||||||
|
Iterators.forArray("gcache.002.xml", "gcache.003.xml"),
|
||||||
|
"gcache.004.xml"
|
||||||
|
);
|
||||||
|
//J+
|
||||||
|
|
||||||
|
// cache sonia.test.cache.001 override by cache.004.xml
|
||||||
|
assertCacheValues(getCache(gcm, "sonia.test.cache.001"), 6l, 2l, 8l);
|
||||||
|
assertCacheValues(getCache(gcm, "sonia.test.cache.002"), 1000l, 120l, 60l);
|
||||||
|
assertCacheValues(getCache(gcm, "sonia.test.cache.003"), 3000l, 120l,
|
||||||
|
2400l);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testMergeWithManualConfiguration()
|
||||||
|
{
|
||||||
|
GuavaCacheManagerConfiguration gcm = readConfiguration("gcache.001.xml",
|
||||||
|
null, "gcache.002.xml");
|
||||||
|
|
||||||
|
// check default
|
||||||
|
|
||||||
|
assertCacheValues(getCache(gcm, "sonia.test.cache.001"), 1000l, 60l, 30l);
|
||||||
|
assertCacheValues(getCache(gcm, "sonia.test.cache.002"), 1000l, 120l, 60l);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testMergeWithModuleConfigurations()
|
||||||
|
{
|
||||||
|
GuavaCacheManagerConfiguration gcm = readConfiguration("gcache.001.xml",
|
||||||
|
Iterators.forArray("gcache.002.xml",
|
||||||
|
"gcache.003.xml"));
|
||||||
|
|
||||||
|
assertCacheValues(getCache(gcm, "sonia.test.cache.001"), 1000l, 60l, 30l);
|
||||||
|
assertCacheValues(getCache(gcm, "sonia.test.cache.002"), 1000l, 120l, 60l);
|
||||||
|
assertCacheValues(getCache(gcm, "sonia.test.cache.003"), 3000l, 120l,
|
||||||
|
2400l);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testSimpleConfiguration()
|
||||||
|
{
|
||||||
|
GuavaCacheConfiguration cfg =
|
||||||
|
readConfiguration("gcache.001.xml").getCaches().get(0);
|
||||||
|
|
||||||
|
assertCacheValues(cfg, 1000l, 60l, 30l);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testWithoutDefaultConfiguration()
|
||||||
|
{
|
||||||
|
GuavaCacheConfiguration cfg =
|
||||||
|
readConfiguration("gcache.002.xml").getCaches().get(0);
|
||||||
|
|
||||||
|
assertCacheValues(cfg, 1000l, 120l, 60l);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param cfg
|
||||||
|
* @param maximumSize
|
||||||
|
* @param expireAfterAccess
|
||||||
|
* @param expireAfterWrite
|
||||||
|
*/
|
||||||
|
private void assertCacheValues(GuavaCacheConfiguration cfg, long maximumSize,
|
||||||
|
long expireAfterAccess, long expireAfterWrite)
|
||||||
|
{
|
||||||
|
assertEquals(Long.valueOf(maximumSize), cfg.getMaximumSize());
|
||||||
|
assertEquals(Long.valueOf(expireAfterAccess), cfg.getExpireAfterAccess());
|
||||||
|
assertEquals(Long.valueOf(expireAfterWrite), cfg.getExpireAfterWrite());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param defaultConfiguration
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private GuavaCacheManagerConfiguration readConfiguration(
|
||||||
|
String defaultConfiguration)
|
||||||
|
{
|
||||||
|
return readConfiguration(defaultConfiguration, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param defaultConfiguration
|
||||||
|
* @param moduleConfiguration
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private GuavaCacheManagerConfiguration readConfiguration(
|
||||||
|
String defaultConfiguration, Iterator<String> moduleConfiguration)
|
||||||
|
{
|
||||||
|
return readConfiguration(defaultConfiguration, moduleConfiguration, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param defaultConfiguration
|
||||||
|
* @param moduleConfiguration
|
||||||
|
* @param manualConfiguration
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private GuavaCacheManagerConfiguration readConfiguration(
|
||||||
|
String defaultConfiguration, Iterator<String> moduleConfiguration,
|
||||||
|
String manualConfiguration)
|
||||||
|
{
|
||||||
|
return new GuavaCacheConfigurationReader(
|
||||||
|
new CacheConfigurationTestLoader(
|
||||||
|
tempFolder, defaultConfiguration, moduleConfiguration,
|
||||||
|
manualConfiguration)).doRead();
|
||||||
|
}
|
||||||
|
|
||||||
|
//~--- get methods ----------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param gcmc
|
||||||
|
* @param name
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private GuavaNamedCacheConfiguration getCache(
|
||||||
|
GuavaCacheManagerConfiguration gcmc, String name)
|
||||||
|
{
|
||||||
|
GuavaNamedCacheConfiguration cache = null;
|
||||||
|
|
||||||
|
for (GuavaNamedCacheConfiguration gncc : gcmc.getCaches())
|
||||||
|
{
|
||||||
|
if (name.equals(gncc.getName()))
|
||||||
|
{
|
||||||
|
cache = gncc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cache;
|
||||||
|
}
|
||||||
|
|
||||||
|
//~--- fields ---------------------------------------------------------------
|
||||||
|
|
||||||
|
/** Field description */
|
||||||
|
@Rule
|
||||||
|
public TemporaryFolder tempFolder = new TemporaryFolder();
|
||||||
|
}
|
||||||
49
scm-webapp/src/test/resources/sonia/scm/cache/gcache.001.xml
vendored
Normal file
49
scm-webapp/src/test/resources/sonia/scm/cache/gcache.001.xml
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--*
|
||||||
|
Copyright (c) 2010, Sebastian Sdorra
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
3. Neither the name of SCM-Manager; nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from this
|
||||||
|
software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
http://bitbucket.org/sdorra/scm-manager
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
<caches>
|
||||||
|
|
||||||
|
<defaultCache
|
||||||
|
maximumSize="200"
|
||||||
|
expireAfterAccess="1200"
|
||||||
|
expireAfterWrite="2400"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<cache
|
||||||
|
name="sonia.test.cache.001"
|
||||||
|
maximumSize="1000"
|
||||||
|
expireAfterWrite="30"
|
||||||
|
expireAfterAccess="60"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</caches>
|
||||||
43
scm-webapp/src/test/resources/sonia/scm/cache/gcache.002.xml
vendored
Normal file
43
scm-webapp/src/test/resources/sonia/scm/cache/gcache.002.xml
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--*
|
||||||
|
Copyright (c) 2010, Sebastian Sdorra
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
3. Neither the name of SCM-Manager; nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from this
|
||||||
|
software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
http://bitbucket.org/sdorra/scm-manager
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
<caches>
|
||||||
|
|
||||||
|
<cache
|
||||||
|
name="sonia.test.cache.002"
|
||||||
|
maximumSize="1000"
|
||||||
|
expireAfterWrite="60"
|
||||||
|
expireAfterAccess="120"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</caches>
|
||||||
42
scm-webapp/src/test/resources/sonia/scm/cache/gcache.003.xml
vendored
Normal file
42
scm-webapp/src/test/resources/sonia/scm/cache/gcache.003.xml
vendored
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--*
|
||||||
|
Copyright (c) 2010, Sebastian Sdorra
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
3. Neither the name of SCM-Manager; nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from this
|
||||||
|
software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
http://bitbucket.org/sdorra/scm-manager
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
<caches>
|
||||||
|
|
||||||
|
<cache
|
||||||
|
name="sonia.test.cache.003"
|
||||||
|
maximumSize="3000"
|
||||||
|
expireAfterAccess="120"
|
||||||
|
expireAfterWrite="2400"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</caches>
|
||||||
43
scm-webapp/src/test/resources/sonia/scm/cache/gcache.004.xml
vendored
Normal file
43
scm-webapp/src/test/resources/sonia/scm/cache/gcache.004.xml
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--*
|
||||||
|
Copyright (c) 2010, Sebastian Sdorra
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
1. Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
3. Neither the name of SCM-Manager; nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from this
|
||||||
|
software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||||
|
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
http://bitbucket.org/sdorra/scm-manager
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
<caches>
|
||||||
|
|
||||||
|
<cache
|
||||||
|
name="sonia.test.cache.001"
|
||||||
|
maximumSize="6"
|
||||||
|
expireAfterAccess="2"
|
||||||
|
expireAfterWrite="8"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
</caches>
|
||||||
Reference in New Issue
Block a user