Clover coverage report -
Coverage timestamp: Thu Jul 5 2007 20:02:32 EDT
file stats: LOC: 108   Methods: 6
NCLOC: 63   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ReplicatedByteTest.java - 96.8% 83.3% 94.6%
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;
 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.config.Configuration.CacheMode;
 31    import org.jboss.cache.factories.UnitTestCacheConfigurationFactory;
 32    import org.jboss.cache.pojo.test.Resource;
 33   
 34    /**
 35    * Replicate POJO with byte array field.
 36    *
 37    * @author Ben Wang
 38    */
 39    public class ReplicatedByteTest extends TestCase
 40    {
 41    Log log = LogFactory.getLog(ReplicatedByteTest.class);
 42    PojoCache cache, cache1;
 43   
 44   
 45  1 public ReplicatedByteTest(String name)
 46    {
 47  1 super(name);
 48    }
 49   
 50  1 protected void setUp() throws Exception
 51    {
 52  1 super.setUp();
 53  1 log.info("setUp() ....");
 54  1 boolean toStart = false;
 55  1 cache = PojoCacheFactory.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), toStart);
 56  1 cache.start();
 57  1 cache1 = PojoCacheFactory.createCache(UnitTestCacheConfigurationFactory.createConfiguration(CacheMode.REPL_SYNC), toStart);
 58  1 cache1.start();
 59    }
 60   
 61  1 protected void tearDown() throws Exception
 62    {
 63  1 super.tearDown();
 64  1 cache.stop();
 65  1 cache1.stop();
 66    }
 67   
 68  1 public void testSimple() throws Exception
 69    {
 70  1 log.info("testSimple() ....");
 71  1 Resource res = new Resource();
 72  1 res.setName("mapping");
 73  1 res.setConnection("wire");
 74  1 String s = "This is a test";
 75  1 byte by = 1;
 76  1 byte[] b = new byte[1];
 77  1 b[0] = by;
 78  1 res.setByte(b);
 79   
 80  1 cache.attach("resource", res);
 81   
 82  1 Resource res1 = (Resource) cache1.find("resource");
 83  1 assertEquals("Name ", res.getName(), res1.getName());
 84   
 85  1 assertEquals("byte ", res.getByte()[0], res1.getByte()[0]);
 86   
 87    // field modification
 88  1 by = 2;
 89  1 b[0] = by;
 90  1 res1.setByte(b);
 91  1 assertEquals("Name ", res.getName(), res1.getName());
 92   
 93  1 assertEquals("byte ", res.getByte()[0], res1.getByte()[0]);
 94   
 95    }
 96   
 97  1 public static Test suite() throws Exception
 98    {
 99  1 return new TestSuite(ReplicatedByteTest.class);
 100    }
 101   
 102   
 103  0 public static void main(String[] args) throws Exception
 104    {
 105  0 junit.textui.TestRunner.run(suite());
 106    }
 107   
 108    }