[jboss-cvs] JBossCache/tests-50/functional/org/jboss/cache/pojo ...
Ben Wang
bwang at jboss.com
Wed Nov 8 03:48:51 EST 2006
User: bwang
Date: 06/11/08 03:48:51
Added: tests-50/functional/org/jboss/cache/pojo EnumTest.java
Log:
1. JBCACHE-619 to support Enum.
Revision Changes Path
1.1 date: 2006/11/08 08:48:51; author: bwang; state: Exp;JBossCache/tests-50/functional/org/jboss/cache/pojo/EnumTest.java
Index: EnumTest.java
===================================================================
/*
* JBoss, Home of Professional Open Source.
* Copyright 2006, Red Hat Middleware LLC, and individual contributors
* as indicated by the @author tags. See the copyright.txt file in the
* distribution for a full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.cache.pojo;
import junit.framework.TestCase;
import junit.framework.Test;
import junit.framework.TestSuite;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.cache.pojo.test.ArrayObject;
import org.jboss.cache.pojo.test.Person;
import org.jboss.cache.pojo.test.EnumPlanet;
/**
* Basic PojoCache test case for Enum.
*
* @author Ben Wang
*/
public class EnumTest extends TestCase
{
Log log = LogFactory.getLog(EnumTest.class);
PojoCache cache_, cache1_;
public EnumTest(String name)
{
super(name);
}
protected void setUp() throws Exception
{
super.setUp();
log.info("setUp() ....");
String configFile = "META-INF/replSync-service.xml";
boolean toStart = true;
cache_ = PojoCacheFactory.createCache(configFile, toStart);
cache1_ = PojoCacheFactory.createCache(configFile, toStart);
}
protected void tearDown() throws Exception
{
super.tearDown();
cache_.stop();
cache1_.stop();
}
public void testSimple() throws Exception
{
log.info("testSimple() ....");
double earthWeight = 165;
double mass = earthWeight / EnumPlanet.EARTH.surfaceGravity();
cache_.attach("enum", EnumPlanet.EARTH);
EnumPlanet ep = (EnumPlanet)cache1_.find("enum");
EnumPlanet.EARTH.setMass(7.0e+24);
assertEquals("Earth mass ", EnumPlanet.EARTH.mass(), ep.mass());
}
public static Test suite() throws Exception
{
return new TestSuite(EnumTest.class);
}
public static void main(String[] args) throws Exception
{
junit.textui.TestRunner.run(suite());
}
}
More information about the jboss-cvs-commits
mailing list