Clover coverage report -
Coverage timestamp: Wed Jan 31 2007 15:38:53 EST
file stats: LOC: 122   Methods: 6
NCLOC: 48   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ReplicatedNonSerializableTest.java - 92.9% 83.3% 90%
coverage coverage
 1    /*
 2    * JBoss, Home of Professional Open Source
 3    *
 4    * Distributable under LGPL license.
 5    * See terms of license at gnu.org.
 6    */
 7   
 8    package org.jboss.cache.pojo;
 9   
 10    import junit.framework.Test;
 11    import junit.framework.TestCase;
 12    import junit.framework.TestSuite;
 13    import org.apache.commons.logging.Log;
 14    import org.apache.commons.logging.LogFactory;
 15    import org.jboss.cache.config.Configuration.CacheMode;
 16    import org.jboss.cache.factories.UnitTestCacheFactory;
 17   
 18    import javax.naming.Context;
 19    import java.util.Properties;
 20   
 21    /**
 22    * New NewReplicatedAopTest that doesn't use TreeCacheAopTester.
 23    *
 24    * @author Ben Wang
 25    */
 26   
 27    public class ReplicatedNonSerializableTest extends TestCase
 28    {
 29    Log log_ = LogFactory.getLog(ReplicatedNonSerializableTest.class);
 30    PojoCache cache_;
 31    PojoCache cache1_;
 32   
 33  2 public ReplicatedNonSerializableTest(String name)
 34    {
 35  2 super(name);
 36    }
 37   
 38  2 protected void setUp() throws Exception
 39    {
 40  2 super.setUp();
 41  2 Properties prop = new Properties();
 42  2 prop.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.cache.transaction.DummyContextFactory");
 43  2 boolean toStart = false;
 44  2 cache_ = PojoCacheFactory.createCache(UnitTestCacheFactory.createConfiguration(CacheMode.REPL_SYNC), toStart);
 45  2 cache1_ = PojoCacheFactory.createCache(UnitTestCacheFactory.createConfiguration(CacheMode.REPL_SYNC), toStart);
 46  2 cache_.start();
 47  2 cache1_.start();
 48    }
 49   
 50  2 protected void tearDown() throws Exception
 51    {
 52  2 super.tearDown();
 53  2 cache_.stop();
 54  2 cache1_.stop();
 55    }
 56   
 57  2 public void testDummy()
 58    {
 59    }
 60   
 61    /* JBCACHE-770
 62    public void testNonSeriazable1() throws Exception
 63    {
 64    log_.info("testNonSerializable1() ....");
 65    // First the flag is set to false
 66    NonSerializableObject nso = new NonSerializableObject();
 67    nso.setId("2");
 68    try {
 69    cache_.attach("/test", nso);
 70    fail("should fail becuase vo is not Serializable");
 71    }
 72    catch (RuntimeException e) {
 73    }
 74   
 75    // Then we set the flag
 76    cache_.setMarshallNonSerializable(true);
 77    cache1_.setMarshallNonSerializable(true);
 78    cache_.attach("/test", nso);
 79    NonSerializableObject nso1 = (NonSerializableObject)cache1_.find("/test");
 80    assertNotNull("nso on remote cache should not be null", nso1);
 81    assertEquals("VO should be the same", nso, nso1);
 82   
 83    }
 84   
 85    public void testNonSeriazable2() throws Exception
 86    {
 87    log_.info("testNonSerializable2() ....");
 88    // First the flag is set to false
 89    NonSerializableObject nso = new NonSerializableObject();
 90    nso.setId("2");
 91   
 92    // Then we set the flag
 93    cache_.setMarshallNonSerializable(true);
 94    cache1_.setMarshallNonSerializable(true);
 95    cache_.attach("/test", nso);
 96    NonSerializableObject nso1 = (NonSerializableObject)cache1_.find("/test");
 97    assertNotNull("nso on remote cache should not be null", nso1);
 98    assertEquals("VO should be the same", nso, nso1);
 99   
 100    nso1 = new NonSerializableObject();
 101    nso1.setId("4");
 102    cache1_.attach("/test", nso1);
 103    nso = (NonSerializableObject)cache_.find("/test");
 104    assertNotNull("nso on remote cache should not be null", nso);
 105    assertEquals("VO should be the same", nso, nso1);
 106   
 107    }
 108   
 109    */
 110   
 111  2 public static Test suite() throws Exception
 112    {
 113  2 return new TestSuite(ReplicatedNonSerializableTest.class);
 114    }
 115   
 116   
 117  0 public static void main(String[] args) throws Exception
 118    {
 119  0 junit.textui.TestRunner.run(ReplicatedNonSerializableTest.suite());
 120    }
 121   
 122    }