use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.
the class LogWriterPerformanceTest method createLogWriter.
protected LogWriter createLogWriter() {
final Properties props = createGemFireProperties();
// create configuration with log-file and log-level
// this.configDirectory = new File(getUniqueName());
this.configDirectory.mkdir();
assertTrue(this.configDirectory.isDirectory() && this.configDirectory.canWrite());
// this.gemfireProperties = new File(this.configDirectory, "gemfire.properties");
// writeProperties(props, this.gemfireProperties);
final DistributionConfig config = new DistributionConfigImpl(props, false, false);
// create a LogWriter that writes to log-file
final boolean appendToFile = false;
final boolean isLoner = true;
final boolean isSecurityLog = false;
final boolean logConfig = true;
final FileOutputStream[] fosHolder = null;
final LogWriter logWriter = TestLogWriterFactory.createLogWriter(appendToFile, isLoner, isSecurityLog, config, logConfig, fosHolder);
return logWriter;
}
use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.
the class SSLConfigJUnitTest method testConfigCopyWithClusterSSL.
@Test
public void testConfigCopyWithClusterSSL() throws Exception {
boolean sslenabled = false;
String sslprotocols = "any";
String sslciphers = "any";
boolean requireAuth = true;
DistributionConfigImpl config = new DistributionConfigImpl(new Properties());
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
Properties props = new Properties();
sslciphers = "RSA_WITH_GARBAGE";
props.setProperty(CLUSTER_SSL_CIPHERS, sslciphers);
config = new DistributionConfigImpl(props);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
sslprotocols = "SSLv7";
props.setProperty(CLUSTER_SSL_PROTOCOLS, sslprotocols);
config = new DistributionConfigImpl(props);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
requireAuth = false;
props.setProperty(CLUSTER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(requireAuth));
config = new DistributionConfigImpl(props);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
sslenabled = true;
props.setProperty(CLUSTER_SSL_ENABLED, String.valueOf(sslenabled));
props.setProperty(MCAST_PORT, "0");
config = new DistributionConfigImpl(props);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
config = new DistributionConfigImpl(config);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
}
use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.
the class SSLConfigJUnitTest method testCacheServerDefaultConfig.
@Test
public void testCacheServerDefaultConfig() throws Exception {
boolean sslenabled = false;
String sslprotocols = "any";
String sslciphers = "any";
boolean requireAuth = true;
boolean cacheServerSslenabled = false;
String cacheServerSslprotocols = "any";
String cacheServerSslciphers = "any";
boolean cacheServerSslRequireAuth = true;
DistributionConfigImpl config = new DistributionConfigImpl(new Properties());
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
isEqual(config.getServerSSLEnabled(), cacheServerSslenabled);
isEqual(config.getServerSSLProtocols(), cacheServerSslprotocols);
isEqual(config.getServerSSLCiphers(), cacheServerSslciphers);
isEqual(config.getServerSSLRequireAuthentication(), cacheServerSslRequireAuth);
}
use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.
the class SSLConfigJUnitTest method testP2pSSLPropsOverriden_ServerPropsNotOverriden.
@Test
public void testP2pSSLPropsOverriden_ServerPropsNotOverriden() throws Exception {
boolean sslenabled = true;
String sslprotocols = "overrriden";
String sslciphers = "overrriden";
boolean requireAuth = true;
boolean cacheServerSslenabled = false;
String cacheServerSslprotocols = "SSLv7";
String cacheServerSslciphers = "RSA_WITH_GARBAGE";
boolean cacheServerSslRequireAuth = false;
Properties gemFireProps = new Properties();
gemFireProps.put(MCAST_PORT, "0");
gemFireProps.put(CLUSTER_SSL_ENABLED, String.valueOf(sslenabled));
gemFireProps.put(CLUSTER_SSL_PROTOCOLS, sslprotocols);
gemFireProps.put(CLUSTER_SSL_CIPHERS, sslciphers);
gemFireProps.put(CLUSTER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(requireAuth));
gemFireProps.putAll(getGfSecurityPropertiesForCS(true));
DistributionConfigImpl config = new DistributionConfigImpl(gemFireProps);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
isEqual(config.getServerSSLEnabled(), sslenabled);
isEqual(config.getServerSSLProtocols(), sslprotocols);
isEqual(config.getServerSSLCiphers(), sslciphers);
isEqual(config.getServerSSLRequireAuthentication(), requireAuth);
assertFalse(config.getServerSSLEnabled() == cacheServerSslenabled);
assertFalse(config.getServerSSLProtocols().equals(cacheServerSslprotocols));
assertFalse(config.getServerSSLCiphers().equals(cacheServerSslciphers));
assertFalse(config.getServerSSLRequireAuthentication() == cacheServerSslRequireAuth);
System.out.println(config.toLoggerString());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE), config.getClusterSSLKeyStore());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE_TYPE), config.getClusterSSLKeyStoreType());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE_PASSWORD), config.getClusterSSLKeyStorePassword());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_TRUSTSTORE), config.getClusterSSLTrustStore());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_TRUSTSTORE_PASSWORD), config.getClusterSSLTrustStorePassword());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE), config.getServerSSLKeyStore());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE_TYPE), config.getServerSSLKeyStoreType());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_KEYSTORE_PASSWORD), config.getServerSSLKeyStorePassword());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_TRUSTSTORE), config.getServerSSLTrustStore());
isEqual(CLUSTER_SSL_PROPS_MAP.get(CLUSTER_SSL_TRUSTSTORE_PASSWORD), config.getServerSSLTrustStorePassword());
}
use of org.apache.geode.distributed.internal.DistributionConfigImpl in project geode by apache.
the class SSLConfigJUnitTest method testCacheServerConfig.
@Test
public void testCacheServerConfig() throws Exception {
boolean sslenabled = false;
String sslprotocols = "any";
String sslciphers = "any";
boolean requireAuth = true;
boolean cacheServerSslenabled = true;
String cacheServerSslprotocols = "SSLv7";
String cacheServerSslciphers = "RSA_WITH_GARBAGE";
boolean cacheServerSslRequireAuth = true;
Properties gemFireProps = new Properties();
gemFireProps.put(CLUSTER_SSL_ENABLED, String.valueOf(sslenabled));
gemFireProps.put(CLUSTER_SSL_PROTOCOLS, sslprotocols);
gemFireProps.put(CLUSTER_SSL_CIPHERS, sslciphers);
gemFireProps.put(CLUSTER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(requireAuth));
gemFireProps.put(SERVER_SSL_ENABLED, String.valueOf(cacheServerSslenabled));
gemFireProps.put(SERVER_SSL_PROTOCOLS, cacheServerSslprotocols);
gemFireProps.put(SERVER_SSL_CIPHERS, cacheServerSslciphers);
gemFireProps.put(SERVER_SSL_REQUIRE_AUTHENTICATION, String.valueOf(cacheServerSslRequireAuth));
DistributionConfigImpl config = new DistributionConfigImpl(gemFireProps);
isEqual(config.getClusterSSLEnabled(), sslenabled);
isEqual(config.getClusterSSLProtocols(), sslprotocols);
isEqual(config.getClusterSSLCiphers(), sslciphers);
isEqual(config.getClusterSSLRequireAuthentication(), requireAuth);
isEqual(config.getServerSSLEnabled(), cacheServerSslenabled);
isEqual(config.getServerSSLProtocols(), cacheServerSslprotocols);
isEqual(config.getServerSSLCiphers(), cacheServerSslciphers);
isEqual(config.getServerSSLRequireAuthentication(), cacheServerSslRequireAuth);
}
Aggregations