Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 101   Methods: 6
NCLOC: 55   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
CachedMapImplTest.java - 94.7% 83.3% 92%
coverage coverage
 1    /*
 2    * JBoss, Home of Professional Open Source.
 3    * Copyright 2006, Red Hat Middleware LLC, and individual contributors
 4    * as indicated by the @author tags. See the copyright.txt file in the
 5    * distribution for a full listing of individual contributors.
 6    *
 7    * This is free software; you can redistribute it and/or modify it
 8    * under the terms of the GNU Lesser General Public License as
 9    * published by the Free Software Foundation; either version 2.1 of
 10    * the License, or (at your option) any later version.
 11    *
 12    * This software is distributed in the hope that it will be useful,
 13    * but WITHOUT ANY WARRANTY; without even the implied warranty of
 14    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 15    * Lesser General Public License for more details.
 16    *
 17    * You should have received a copy of the GNU Lesser General Public
 18    * License along with this software; if not, write to the Free
 19    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 20    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 21    */
 22   
 23    package org.jboss.cache.pojo.collection;
 24   
 25    import junit.framework.Test;
 26    import junit.framework.TestCase;
 27    import junit.framework.TestSuite;
 28    import org.apache.commons.logging.Log;
 29    import org.apache.commons.logging.LogFactory;
 30    import org.jboss.cache.Fqn;
 31    import org.jboss.cache.config.Configuration.CacheMode;
 32    import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
 33    import org.jboss.cache.pojo.PojoCache;
 34    import org.jboss.cache.pojo.PojoCacheFactory;
 35   
 36    import java.util.HashMap;
 37    import java.util.Map;
 38   
 39    /**
 40    * List implementation testing.
 41    *
 42    * @author Ben Wang
 43    */
 44   
 45    public class CachedMapImplTest extends TestCase
 46    {
 47    Log log = LogFactory.getLog(CachedMapImplTest.class);
 48    PojoCache cache_, cache1_;
 49   
 50  1 public CachedMapImplTest(String name)
 51    {
 52  1 super(name);
 53    }
 54   
 55   
 56  1 protected void setUp() throws Exception
 57    {
 58  1 super.setUp();
 59  1 log.info("setUp() ....");
 60  1 boolean toStart = true;
 61  1 cache_ = PojoCacheFactory.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), toStart);
 62   
 63  1 cache1_ = PojoCacheFactory.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), toStart);
 64    }
 65   
 66  1 protected void tearDown() throws Exception
 67    {
 68  1 super.tearDown();
 69  1 cache_.stop();
 70  1 cache1_.stop();
 71    }
 72   
 73  1 public void testSimpleRepl()
 74    {
 75  1 Map map = new HashMap();
 76  1 map.put("1", "1");
 77  1 map.put("2", "2");
 78   
 79  1 cache_.attach("map", map);
 80   
 81    // Can't use proxy here. JBCACHE-975.
 82  1 map = (Map) cache_.detach("map");
 83   
 84    // test repl
 85  1 cache_.getCache().put(Fqn.fromString("test"), "1", map);
 86   
 87  1 Map m1 = (Map) cache1_.getCache().get(Fqn.fromString("test"), "1");
 88  1 System.out.println(" map : " + m1);
 89    }
 90   
 91  1 public static Test suite() throws Exception
 92    {
 93  1 return new TestSuite(CachedMapImplTest.class);
 94    }
 95   
 96  0 public static void main(String[] args) throws Exception
 97    {
 98  0 junit.textui.TestRunner.run(suite());
 99    }
 100   
 101    }