THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block |
---|
A complete example: Note, it mixed dunit tests and junit tests. package comorg.gemstoneapache.gemfiregeode.internal.cache.wan; import comorg.gemstoneapache.gemfiregeode.internal.cache.DistributedRegionJUnitTest; import comorg.gemstoneapache.gemfiregeode.internal.cache.PartitionedRegionRedundancyZoneDUnitTest; import comorg.gemstoneapache.gemfiregeode.internal.cache.PartitionedRegionTestUtilsDUnitTest; import comorg.gemstoneapache.gemfiregeode.internal.cache.wan.misc.ShutdownAllPersistentGatewaySenderDUnitTest; import junit.framework.Test; import junit.framework.TestCase; import junit.framework.TestSuite; @Category(UnitTest.class) public class MyTestCase extends TestCase { public static Test suite() { Class[] classes = new Class[] { CacheClientNotifierDUnitTest.class, ShutdownAllPersistentGatewaySenderDUnitTest.class, PartitionedRegionRedundancyZoneDUnitTest.class, PartitionedRegionTestUtilsDUnitTest.class, DistributedRegionJUnitTest.class }; return new TestSuite(classes); } } Or a new version: @RunWith(Suite.class) @Suite.SuiteClasses({ CacheClientNotifierDUnitTest.class, DistributedRegionJUnitTest.class }) //@Category(UnitTest.class) public class MyTestCase2 extends TestCase { } |
...
Code Block |
---|
<?xml version="1.0" encoding="UTF-8"?> <Configuration status="ERROR" shutdownHook="disable" packages="comorg.gemstoneapache.gemfiregeode.internal.logging.log4j"> <Properties> <Property name="gemfire-pattern">[%level{lowerCase=true} %date{yyyy/MM/dd HH:mm:ss.SSS z} <%thread> tid=%tid] %message%n%throwable%n</Property> </Properties> <filters> <MarkerFilter marker="DISTRIBUTION" onMatch="ACCEPT" onMismatch="NEUTRAL"/> <MarkerFilter marker="DISK_STORE_MONITOR" onMatch="ACCEPT" onMismatch="NEUTRAL"/> <MarkerFilter marker="TOMBSTONE" onMatch="ACCEPT" onMismatch="NEUTRAL"/> <!--MarkerFilter marker="PERSIST_RECOVERY" onMatch="ACCEPT" onMismatch="NEUTRAL"/--> <!--MarkerFilter marker="PERSIST_WRITES" onMatch="ACCEPT" onMismatch="NEUTRAL"/--> <!-- have to explicitly DENY all the markers' log, then explicitly add back one by one --> <MarkerFilter marker="GEMFIRE_MARKER" onMatch="DENY" onMismatch="NEUTRAL"/> </filters> <Appenders> <Console name="STDOUT" target="SYSTEM_OUT"> <PatternLayout pattern="${gemfire-pattern}"/> </Console> <Console name="STDERR" target="SYSTEM_ERR"> <PatternLayout pattern="${gemfire-pattern}"/> </Console> <!--RollingFile name="RollingFile" fileName="${filename}"--> <File name="Log" fileName="system.log" bufferedIO="true"> <PatternLayout pattern="${gemfire-pattern}"/> </File> </Appenders> <Loggers> <Logger name="comorg.apache.gemstonegeode" level="INFO" additivity="false"> <AppenderRef ref="Log"/> </Logger> <Logger name="comorg.gemstoneapache.gemfiregeode.distributed.internal" level="TRACE" additivity="false"> <AppenderRef ref="STDOUT" level="DEBUG"/> </Logger> <Logger name="comorg.gemstoneapache.gemfiregeode.cache.client.internal" level="TRACE" additivity="false"> <AppenderRef ref="STDOUT" level="DEBUG"/> </Logger> <Logger name="comorg.gemstoneapache.gemfiregeode.internal.cache" level="TRACE" additivity="false"> <AppenderRef ref="STDOUT" level="TRACE"/> </Logger> <!--Logger name="comorg.gemstoneapache.gemfiregeode.distributed.internal.DistributionManager" level="TRACE" additivity="false"> <AppenderRef ref="Log" level="DEBUG"/> </Logger--> <!--Logger name="comorg.gemstoneapache.gemfiregeode.distributed.internal.DistributionMessage" level="TRACE" additivity="false"> <AppenderRef ref="Log" level="DEBUG"/> </Logger--> <Root level="ERROR"> <!--AppenderRef ref="STDOUT"/--> </Root> </Loggers> </Configuration> |
...
The challenge is how to mock the required components to create region, event, version tag.
The comTheorg.gemstoneapache.gemfiregeode.test.fake.Fakes class has done the major mocking for us and also defined the expected behaviors between these mock objects. You only need to use it:
...