geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationDUnitTest.java
@Test // FlakyTest: GEODE-1333
  public void testDestroyExtensions() throws Exception {
    Object[] result = setup();
    final int locatorPort = (Integer) result[0];

    createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
    createMockRegionExtension(REPLICATE_REGION, "value1");
    destroyMockRegionExtension(REPLICATE_REGION);
    createMockCacheExtension("value1");
    destroyMockCacheExtension();

    // Start a new member which receives the shared configuration
    // Verify the config creation on this member

    final String newMemberWorkingDir =
        this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;

    VM newMember = getHost(0).getVM(2);
    newMember.invoke(() -> {
      Properties localProps = new Properties();

      File workingDir = new File(newMemberWorkingDir);
      workingDir.mkdirs();

      localProps.setProperty(MCAST_PORT, "0");
      localProps.setProperty(LOCATORS, "localhost[" + locatorPort + "]");
      localProps.setProperty(NAME, ClusterConfigurationDUnitTest.newMember);
      localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
      localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());

      getSystem(localProps);
      InternalCache cache = getCache();

      assertNotNull(cache);

      Region<?, ?> region1 = cache.getRegion(REPLICATE_REGION);
      assertNotNull(region1);

      // MockRegionExtension verification
      @SuppressWarnings("unchecked")
      final Extensible<Region<?, ?>> extensibleRegion = (Extensible<Region<?, ?>>) region1;
      // Should not be any region extensions
      assertTrue(!extensibleRegion.getExtensionPoint().getExtensions().iterator().hasNext());

      // MockCacheExtension verification
      @SuppressWarnings("unchecked")
      final Extensible<Cache> extensibleCache = cache;
      // Should not be any cache extensions
      assertTrue(!extensibleCache.getExtensionPoint().getExtensions().iterator().hasNext());

      return getAllNormalMembers(cache);
    });
  }
/**
   * Tests for {@link Extension}, {@link Extensible}, {@link XmlParser}, {@link XmlGenerator},
   * {@link XmlEntity} as it applies to Extensions. Asserts that Mock Extension is created and
   * destroyed on region and cache.
   * 
   * @since GemFire 8.1
   */
Tests for  Extension,  Extensible,  XmlParser,  XmlGenerator,
XmlEntity as it applies to Extensions. Asserts that Mock Extension is created and
destroyed on region and cache.


Tests for Extension Extensible XmlParser XmlGenerator XmlEntity as it applies to Extensions . Asserts that Mock Extension is created and destroyed on region and cache .
@Test 
  public void testDestroyExtensions() throws Exception {
    Object[] result = setup();
    final int locatorPort = (Integer) result[0];
    createRegion(REPLICATE_REGION, RegionShortcut.REPLICATE, null);
    createMockRegionExtension(REPLICATE_REGION, "value1");
    destroyMockRegionExtension(REPLICATE_REGION);
    createMockCacheExtension("value1");
    destroyMockCacheExtension();
    final String newMemberWorkingDir =
        this.temporaryFolder.getRoot().getCanonicalPath() + File.separator + newMember;
    VM newMember = getHost(0).getVM(2);
    newMember.invoke(() -> {
      Properties localProps = new Properties();
      File workingDir = new File(newMemberWorkingDir);
      workingDir.mkdirs();
      localProps.setProperty(MCAST_PORT, "0");
      localProps.setProperty(LOCATORS, "localhost[" + locatorPort + "]");
      localProps.setProperty(NAME, ClusterConfigurationDUnitTest.newMember);
      localProps.setProperty(USE_CLUSTER_CONFIGURATION, "true");
      localProps.setProperty(DEPLOY_WORKING_DIR, workingDir.getCanonicalPath());
      getSystem(localProps);
      InternalCache cache = getCache();
      assertNotNull(cache);
      Region<?, ?> region1 = cache.getRegion(REPLICATE_REGION);
      assertNotNull(region1);
      @SuppressWarnings("unchecked")
      final Extensible<Region<?, ?>> extensibleRegion = (Extensible<Region<?, ?>>) region1;
      assertTrue(!extensibleRegion.getExtensionPoint().getExtensions().iterator().hasNext());
      @SuppressWarnings("unchecked")
      final Extensible<Cache> extensibleCache = cache;
      assertTrue(!extensibleCache.getExtensionPoint().getExtensions().iterator().hasNext());
      return getAllNormalMembers(cache);
    });
  }
@ Test public void testDestroyExtensions ( ) throws Exception { Object [ ] result = setup ( ) ; final int locatorPort = ( Integer ) result [ 0 ] ; createRegion ( REPLICATE_REGION , RegionShortcut . REPLICATE , null ) ; createMockRegionExtension ( REPLICATE_REGION , "value1" ) ; destroyMockRegionExtension ( REPLICATE_REGION ) ; createMockCacheExtension ( "value1" ) ; destroyMockCacheExtension ( ) ; final String newMemberWorkingDir = this . temporaryFolder . getRoot ( ) . getCanonicalPath ( ) + File . separator + newMember ; VM newMember = getHost ( 0 ) . getVM ( 2 ) ; newMember . invoke ( ( ) -> { Properties localProps = new Properties ( ) ; File workingDir = new File ( newMemberWorkingDir ) ; workingDir . mkdirs ( ) ; localProps . setProperty ( MCAST_PORT , "0" ) ; localProps . setProperty ( LOCATORS , "localhost[" + locatorPort + "]" ) ; localProps . setProperty ( NAME , ClusterConfigurationDUnitTest . newMember ) ; localProps . setProperty ( USE_CLUSTER_CONFIGURATION , "true" ) ; localProps . setProperty ( DEPLOY_WORKING_DIR , workingDir . getCanonicalPath ( ) ) ; getSystem ( localProps ) ; InternalCache cache = getCache ( ) ; assertNotNull ( cache ) ; Region < ? , ? > region1 = cache . getRegion ( REPLICATE_REGION ) ; assertNotNull ( region1 ) ; @ SuppressWarnings ( "unchecked" ) final Extensible < Region < ? , ? > > extensibleRegion = ( Extensible < Region < ? , ? > > ) region1 ; assertTrue ( ! extensibleRegion . getExtensionPoint ( ) . getExtensions ( ) . iterator ( ) . hasNext ( ) ) ; @ SuppressWarnings ( "unchecked" ) final Extensible < Cache > extensibleCache = cache ; assertTrue ( ! extensibleCache . getExtensionPoint ( ) . getExtensions ( ) . iterator ( ) . hasNext ( ) ) ; return getAllNormalMembers ( cache ) ; } ) ; }
Tests for {@link Extension}, {@link Extensible}, {@link XmlParser}, {@link XmlGenerator},
 {@link XmlEntity} as it applies to Extensions.
Tests for { @link Extension } { @link Extensible } { @link XmlParser } { @link XmlGenerator } { @link XmlEntity } as it applies to Extensions .
// FlakyTest: GEODE-1333 // Start a new member which receives the shared configuration // Verify the config creation on this member // MockRegionExtension verification // Should not be any region extensions // MockCacheExtension verification // Should not be any cache extensions