Repository: geode Updated Branches: refs/heads/feature/GEODE-3062 [created] d15934fcb
Add test that fails due to GEODE-3062 Project: http://git-wip-us.apache.org/repos/asf/geode/repo Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/d15934fc Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/d15934fc Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/d15934fc Branch: refs/heads/feature/GEODE-3062 Commit: d15934fcb41223f1d665d8b2885c6487bd55813e Parents: 2579a0d Author: Kirk Lund <[email protected]> Authored: Fri Jun 9 15:23:53 2017 -0700 Committer: Kirk Lund <[email protected]> Committed: Fri Jun 9 15:23:53 2017 -0700 ---------------------------------------------------------------------- .../ClusterConfigWithSecurityDUnitTest.java | 31 ++++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/geode/blob/d15934fc/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigWithSecurityDUnitTest.java ---------------------------------------------------------------------- diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigWithSecurityDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigWithSecurityDUnitTest.java index c551ca9..41e9525 100644 --- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigWithSecurityDUnitTest.java +++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigWithSecurityDUnitTest.java @@ -24,6 +24,7 @@ import static org.assertj.core.api.Assertions.assertThat; import org.apache.commons.io.FileUtils; import org.apache.geode.distributed.internal.ClusterConfigurationService; import org.apache.geode.distributed.internal.InternalLocator; +import org.apache.geode.internal.cache.InternalCache; import org.apache.geode.management.internal.cli.i18n.CliStrings; import org.apache.geode.management.internal.configuration.utils.ZipUtils; import org.apache.geode.security.SimpleTestSecurityManager; @@ -43,7 +44,10 @@ import java.util.Properties; @Category({DistributedTest.class, SecurityTest.class}) public class ClusterConfigWithSecurityDUnitTest { - public String clusterConfigZipPath; + + private String clusterConfigZipPath; + private MemberVM locator0; + private Properties locatorProps; @Rule public LocatorServerStartupRule lsRule = new LocatorServerStartupRule(); @@ -51,9 +55,6 @@ public class ClusterConfigWithSecurityDUnitTest { @Rule public GfshShellConnectionRule connector = new GfshShellConnectionRule(); - MemberVM locator0; - Properties locatorProps; - @Before public void before() throws Exception { clusterConfigZipPath = buildSecureClusterConfigZip(); @@ -64,8 +65,8 @@ public class ClusterConfigWithSecurityDUnitTest { } @Test - @Ignore("GEODE-2315") - public void testSecurityPropsInheritance() throws Exception { + @Ignore("Fails until GEODE-2315 is implemented") + public void testSecurityPropsInheritanceOnLocator() throws Exception { locatorProps.clear(); locatorProps.setProperty(LOCATORS, "localhost[" + locator0.getPort() + "]"); locatorProps.setProperty("security-username", "cluster"); @@ -104,6 +105,24 @@ public class ClusterConfigWithSecurityDUnitTest { }); } + @Test // fails due to GEODE-3062 + public void testSecurityPropsInheritanceOnServer() throws Exception { + Properties serverProps = new Properties(); + serverProps.setProperty(LOCATORS, "localhost[" + locator0.getPort() + "]"); + serverProps.setProperty("security-username", "cluster"); + serverProps.setProperty("security-password", "cluster"); + MemberVM server = lsRule.startServerVM(1, serverProps); + + // cluster config specifies a security-manager so integrated security should be enabled + server.invoke(() -> { + InternalCache cache = LocatorServerStartupRule.serverStarter.getCache(); + Properties properties = cache.getDistributedSystem().getSecurityProperties(); + assertThat(properties.getProperty(SECURITY_MANAGER)) + .isEqualTo(SimpleTestSecurityManager.class.getName()); + assertThat(cache.getSecurityService().isIntegratedSecurity()).isTrue(); + }); + } + private String buildSecureClusterConfigZip() throws Exception { File clusterDir = lsRule.getTempFolder().newFolder("cluster"); File clusterSubDir = new File(clusterDir, "cluster");
