Search in sources :

Example 41 with DistributionConfigImpl

use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.

the class SSLConfigurationFactoryJUnitTest method getNonSSLConfiguration.

@Test
public void getNonSSLConfiguration() throws Exception {
    Properties properties = new Properties();
    DistributionConfigImpl distributionConfig = new DistributionConfigImpl(properties);
    SSLConfigurationFactory.setDistributionConfig(distributionConfig);
    for (SecurableCommunicationChannel securableComponent : SecurableCommunicationChannel.values()) {
        assertSSLConfig(properties, SSLConfigurationFactory.getSSLConfigForComponent(securableComponent), securableComponent, distributionConfig);
    }
}
Also used : DistributionConfigImpl(org.apache.geode.distributed.internal.DistributionConfigImpl) Properties(java.util.Properties) RestoreSystemProperties(org.junit.contrib.java.lang.system.RestoreSystemProperties) SecurableCommunicationChannel(org.apache.geode.internal.security.SecurableCommunicationChannel) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test) MembershipTest(org.apache.geode.test.junit.categories.MembershipTest)

Example 42 with DistributionConfigImpl

use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.

the class SSLConfigurationFactoryJUnitTest method getSSLConfigForComponentHTTPServiceWithAlias.

@Test
public void getSSLConfigForComponentHTTPServiceWithAlias() throws Exception {
    Properties properties = new Properties();
    properties.setProperty(SSL_ENABLED_COMPONENTS, SecurableCommunicationChannel.WEB.getConstant());
    properties.setProperty(SSL_KEYSTORE, "someKeyStore");
    properties.setProperty(SSL_KEYSTORE_PASSWORD, "keystorePassword");
    properties.setProperty(SSL_KEYSTORE_TYPE, "JKS");
    properties.setProperty(SSL_TRUSTSTORE, "someKeyStore");
    properties.setProperty(SSL_TRUSTSTORE_PASSWORD, "keystorePassword");
    properties.setProperty(SSL_DEFAULT_ALIAS, "defaultAlias");
    properties.setProperty(SSL_WEB_ALIAS, "httpAlias");
    properties.setProperty(SSL_CIPHERS, "any");
    properties.setProperty(SSL_PROTOCOLS, "any");
    DistributionConfigImpl distributionConfig = new DistributionConfigImpl(properties);
    SSLConfigurationFactory.setDistributionConfig(distributionConfig);
    for (SecurableCommunicationChannel securableCommunicationChannel : SecurableCommunicationChannel.values()) {
        assertSSLConfig(properties, SSLConfigurationFactory.getSSLConfigForComponent(securableCommunicationChannel), securableCommunicationChannel, distributionConfig);
    }
}
Also used : DistributionConfigImpl(org.apache.geode.distributed.internal.DistributionConfigImpl) Properties(java.util.Properties) RestoreSystemProperties(org.junit.contrib.java.lang.system.RestoreSystemProperties) SecurableCommunicationChannel(org.apache.geode.internal.security.SecurableCommunicationChannel) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test) MembershipTest(org.apache.geode.test.junit.categories.MembershipTest)

Example 43 with DistributionConfigImpl

use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.

the class SSLConfigurationFactoryJUnitTest method getSSLConfigWithCommaDelimitedProtocols.

@Test
public void getSSLConfigWithCommaDelimitedProtocols() throws Exception {
    Properties properties = new Properties();
    properties.setProperty(SSL_ENABLED_COMPONENTS, "all");
    properties.setProperty(SSL_KEYSTORE, "someKeyStore");
    properties.setProperty(SSL_KEYSTORE_PASSWORD, "keystorePassword");
    properties.setProperty(SSL_KEYSTORE_TYPE, "JKS");
    properties.setProperty(SSL_TRUSTSTORE, "someKeyStore");
    properties.setProperty(SSL_TRUSTSTORE_PASSWORD, "keystorePassword");
    properties.setProperty(SSL_DEFAULT_ALIAS, "defaultAlias");
    properties.setProperty(SSL_CIPHERS, "Cipher1,Cipher2");
    properties.setProperty(SSL_PROTOCOLS, "Protocol1,Protocol2");
    DistributionConfigImpl distributionConfig = new DistributionConfigImpl(properties);
    SSLConfigurationFactory.setDistributionConfig(distributionConfig);
    for (SecurableCommunicationChannel securableComponent : SecurableCommunicationChannel.values()) {
        assertSSLConfig(properties, SSLConfigurationFactory.getSSLConfigForComponent(securableComponent), securableComponent, distributionConfig);
    }
}
Also used : DistributionConfigImpl(org.apache.geode.distributed.internal.DistributionConfigImpl) Properties(java.util.Properties) RestoreSystemProperties(org.junit.contrib.java.lang.system.RestoreSystemProperties) SecurableCommunicationChannel(org.apache.geode.internal.security.SecurableCommunicationChannel) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test) MembershipTest(org.apache.geode.test.junit.categories.MembershipTest)

Example 44 with DistributionConfigImpl

use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.

the class SocketCreatorFactoryJUnitTest method testNewSSLConfigSSLComponentCLUSTER.

@Test
public void testNewSSLConfigSSLComponentCLUSTER() throws Exception {
    Properties properties = configureSSLProperties(SecurableCommunicationChannel.CLUSTER.getConstant());
    DistributionConfigImpl distributionConfig = new DistributionConfigImpl(properties);
    SocketCreatorFactory.setDistributionConfig(distributionConfig);
    assertTrue(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.CLUSTER).useSSL());
    assertFalse(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.GATEWAY).useSSL());
    assertFalse(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.JMX).useSSL());
    assertFalse(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.SERVER).useSSL());
    assertFalse(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.WEB).useSSL());
    assertFalse(SocketCreatorFactory.getSocketCreatorForComponent(SecurableCommunicationChannel.LOCATOR).useSSL());
}
Also used : DistributionConfigImpl(org.apache.geode.distributed.internal.DistributionConfigImpl) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 45 with DistributionConfigImpl

use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.

the class LogWriterUtils method createLogWriter.

/**
   * Creates a new LogWriter and adds it to the config properties. The config can then be used to
   * connect to DistributedSystem, thus providing early access to the LogWriter before connecting.
   * This call does not connect to the DistributedSystem. It simply creates and returns the
   * LogWriter that will eventually be used by the DistributedSystem that connects using config.
   * 
   * @param properties the DistributedSystem config properties to add LogWriter to
   * @return early access to the DistributedSystem LogWriter
   * @deprecated Please use a <code>Logger</code> from {@link LogService#getLogger()} instead.
   */
public static LogWriter createLogWriter(final Properties properties) {
    Properties nonDefault = properties;
    if (nonDefault == null) {
        nonDefault = new Properties();
    }
    DistributedTestUtils.addHydraProperties(nonDefault);
    DistributionConfig dc = new DistributionConfigImpl(nonDefault);
    LogWriter logger = LogWriterFactory.createLogWriterLogger(false, /* isLoner */
    false, /* isSecurityLog */
    dc, false);
    // if config was non-null, then these will be added to it...
    nonDefault.put(DistributionConfig.LOG_WRITER_NAME, logger);
    return logger;
}
Also used : DistributionConfig(org.apache.geode.distributed.internal.DistributionConfig) ManagerLogWriter(org.apache.geode.internal.logging.ManagerLogWriter) LogWriter(org.apache.geode.LogWriter) InternalLogWriter(org.apache.geode.internal.logging.InternalLogWriter) DistributionConfigImpl(org.apache.geode.distributed.internal.DistributionConfigImpl) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties)

Aggregations

DistributionConfigImpl (org.apache.geode.distributed.internal.DistributionConfigImpl)61 Properties (java.util.Properties)59 Test (org.junit.Test)50 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)45 UnitTest (org.apache.geode.test.junit.categories.UnitTest)26 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)23 SecurityTest (org.apache.geode.test.junit.categories.SecurityTest)20 RestoreSystemProperties (org.junit.contrib.java.lang.system.RestoreSystemProperties)11 MembershipTest (org.apache.geode.test.junit.categories.MembershipTest)10 File (java.io.File)6 SecurableCommunicationChannel (org.apache.geode.internal.security.SecurableCommunicationChannel)6 DistributionConfig (org.apache.geode.distributed.internal.DistributionConfig)5 ServiceConfig (org.apache.geode.distributed.internal.membership.gms.ServiceConfig)4 Services (org.apache.geode.distributed.internal.membership.gms.Services)4 RemoteTransportConfig (org.apache.geode.internal.admin.remote.RemoteTransportConfig)4 Before (org.junit.Before)3 Map (java.util.Map)2 LogWriter (org.apache.geode.LogWriter)2 Cache (org.apache.geode.cache.Cache)2 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)2