Package org.apache.jcs.engine.behavior

Examples of org.apache.jcs.engine.behavior.ICompositeCacheAttributes



    public String toString()
    {

        ICompositeCacheAttributes attributes = cache.getCacheAttributes();

        return "JCS[" + attributes.getCacheName()         //
               + ":" + attributes.getMemoryCacheName()    //
               + ":" + attributes.getMaxObjects() + "]";
    }
View Full Code Here


        + cacheName + ".cacheattributes.MaxObjects");

    int expected = Integer.parseInt(maxObjectsProperty);

    CompositeCache cache = cacheManager.getCache(cacheName);
    ICompositeCacheAttributes cacheAttributes = cache.getCacheAttributes();
    int actual = cacheAttributes.getMaxObjects();

    assertEquals(expected, actual);
  }
View Full Code Here

  private void setUpCacheAsMockObject(Method[] methodsToMock) throws Exception {
    Class[] constructorTypes = new Class[] { String.class,
        ICompositeCacheAttributes.class, IElementAttributes.class };

    ICompositeCacheAttributes cacheAttributes = new CompositeCacheAttributes();
    cacheAttributes.setCacheName(CACHE_NAME);
    cacheAttributes.setMaxObjects(10);
    cacheAttributes
        .setMemoryCacheName("org.apache.jcs.engine.memory.lru.LRUMemoryCache");
    ElementAttributes elementAttributes = new ElementAttributes();
    Object[] constructorArgs = new Object[] { CACHE_NAME, cacheAttributes,
        elementAttributes };
View Full Code Here

    }

    /** Set the default CompositeCacheAttributes for new caches. */
    protected void setDefaultCompositeCacheAttributes( Properties props )
    {
        ICompositeCacheAttributes icca =
            parseCompositeCacheAttributes( props, "", this.DEFAULT_REGION );
        ccMgr.setDefaultCacheAttributes( icca );

        log.info( "setting defaultCompositeCacheAttributes to " + icca );
    }
View Full Code Here

    protected ICompositeCacheAttributes
        parseCompositeCacheAttributes( Properties props,
                                       String regName,
                                       String regionPrefix )
    {
        ICompositeCacheAttributes ccAttr;

        String attrName = regionPrefix + regName + CACHE_ATTRIBUTE_PREFIX;

        // auxFactory was not previously initialized.
        //String prefix = regionPrefix + regName + ATTRIBUTE_PREFIX;
        ccAttr = ( ICompositeCacheAttributes ) OptionConverter.instantiateByKey( props, attrName,
                                                                                 org.apache.jcs.engine.behavior.ICompositeCacheAttributes.class,
                                                                                 null );
        if ( ccAttr == null )
        {
            log.warn( "Could not instantiate ccAttr named '" + attrName +
                      "', using defaults." );

            ICompositeCacheAttributes ccAttr2 = ccMgr.getDefaultCacheAttributes();
            ccAttr = ccAttr2.copy();
        }

        log.debug( "Parsing options for '" + attrName + "'" );

        PropertySetter.setProperties( ccAttr, props, attrName + "." );
View Full Code Here

     */
    public ICompositeCacheAttributes copy()
    {
        try
        {
            ICompositeCacheAttributes cattr = ( CompositeCacheAttributes ) this.clone();
            //System.out.println( "cattr = " + cattr );
            return cattr;
        }
        catch ( Exception e )
        {
View Full Code Here

     */
    public ICompositeCacheAttributes copy()
    {
        try
        {
            ICompositeCacheAttributes cattr = (CompositeCacheAttributes) this.clone();
            return cattr;
        }
        catch ( Exception e )
        {
            System.err.println( e.toString() );
View Full Code Here

        throws IOException
    {
        // SETUP
        String cacheName = "testCacheName";
        String mockMemoryCacheClassName = "org.apache.jcs.engine.memory.MemoryCacheMockImpl";
        ICompositeCacheAttributes cattr = new CompositeCacheAttributes();
        cattr.setMemoryCacheName( mockMemoryCacheClassName );

        IElementAttributes attr = new ElementAttributes();

        CompositeCache cache = new CompositeCache( cacheName, cattr, attr );
View Full Code Here

        throws IOException
    {
        // SETUP
        String cacheName = "testCacheName";
        String mockMemoryCacheClassName = "org.apache.jcs.engine.memory.MemoryCacheMockImpl";
        ICompositeCacheAttributes cattr = new CompositeCacheAttributes();
        cattr.setMemoryCacheName( mockMemoryCacheClassName );

        IElementAttributes attr = new ElementAttributes();

        CompositeCache cache = new CompositeCache( cacheName, cattr, attr );
View Full Code Here

     * item is put to disk.
     */
    public void testSpoolAllowed()
    {
        // SETUP
        ICompositeCacheAttributes cattr = new CompositeCacheAttributes();
        cattr.setDiskUsagePattern( ICompositeCacheAttributes.DISK_USAGE_PATTERN_SWAP );

        IElementAttributes attr = new ElementAttributes();

        CompositeCache cache = new CompositeCache( "testSpoolAllowed", cattr, attr );

View Full Code Here

TOP

Related Classes of org.apache.jcs.engine.behavior.ICompositeCacheAttributes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.