Class GeodeEmbeddedPolicy

  • All Implemented Interfaces:
    org.junit.rules.TestRule
    Direct Known Subclasses:
    GeodeEmbeddedPolicy.RefCountPolicy

    public class GeodeEmbeddedPolicy
    extends org.junit.rules.ExternalResource
    Manages embedded Geode instance using native ServerLauncher.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  GeodeEmbeddedPolicy.RefCountPolicy
      Calls before() and after() methods only once (for first and last subscriber respectively).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private org.apache.geode.distributed.ServerLauncher launcher  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private GeodeEmbeddedPolicy​(org.apache.geode.distributed.ServerLauncher launcher)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void after()  
      protected void before()  
      (package private) org.apache.geode.cache.Cache cache()
      Returns current cache instance which was initialized for tests.
      (package private) static GeodeEmbeddedPolicy create()  
      private void requireStatus​(org.apache.geode.distributed.AbstractLauncher.Status expected)  
      (package private) GeodeEmbeddedPolicy share()
      Allows this instance to be shared by multiple test classes (in parallel).
      • Methods inherited from class org.junit.rules.ExternalResource

        apply
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • launcher

        private final org.apache.geode.distributed.ServerLauncher launcher
    • Constructor Detail

      • GeodeEmbeddedPolicy

        private GeodeEmbeddedPolicy​(org.apache.geode.distributed.ServerLauncher launcher)
    • Method Detail

      • before

        protected void before()
        Overrides:
        before in class org.junit.rules.ExternalResource
      • after

        protected void after()
        Overrides:
        after in class org.junit.rules.ExternalResource
      • share

        GeodeEmbeddedPolicy share()
        Allows this instance to be shared by multiple test classes (in parallel). Guarantees that before() and after() methods will be called only once. This setup is useful for maven (surefire) plugin which executes tests in parallel (including @ClassRule methods) and may initialize (or destroy) same resource multiple times.
      • cache

        org.apache.geode.cache.Cache cache()
        Returns current cache instance which was initialized for tests.
        Throws:
        java.lang.IllegalStateException - if server process didn't start
      • requireStatus

        private void requireStatus​(org.apache.geode.distributed.AbstractLauncher.Status expected)