knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject [34/49] knox git commit: Merge branch 'master' into KNOX-998-Package_Restructuring
Date Thu, 14 Dec 2017 21:13:21 GMT
http://git-wip-us.apache.org/repos/asf/knox/blob/22a7304a/gateway-spi/src/main/java/org/apache/knox/gateway/config/GatewayConfig.java
----------------------------------------------------------------------
diff --cc gateway-spi/src/main/java/org/apache/knox/gateway/config/GatewayConfig.java
index 0ed7556,0000000..882bc71
mode 100644,000000..100644
--- a/gateway-spi/src/main/java/org/apache/knox/gateway/config/GatewayConfig.java
+++ b/gateway-spi/src/main/java/org/apache/knox/gateway/config/GatewayConfig.java
@@@ -1,302 -1,0 +1,352 @@@
 +/**
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package org.apache.knox.gateway.config;
 +
 +import java.net.InetSocketAddress;
 +import java.net.UnknownHostException;
 +import java.util.List;
 +import java.util.Map;
 +
 +public interface GatewayConfig {
 +
 +  // Used as the basis for any home directory that is not specified.
 +  static final String GATEWAY_HOME_VAR = "GATEWAY_HOME";
 +
 +  // Variable name for the location of configuration files edited by users
 +  static final String GATEWAY_CONF_HOME_VAR = "GATEWAY_CONF_HOME";
 +
 +  // Variable name for the location of data files generated by the gateway at runtime.
 +  static final String GATEWAY_DATA_HOME_VAR = "GATEWAY_DATA_HOME";
 +
 +  public static final String GATEWAY_CONFIG_ATTRIBUTE = "org.apache.knox.gateway.config";
 +  public static final String HADOOP_KERBEROS_SECURED = "gateway.hadoop.kerberos.secured";
 +  public static final String KRB5_CONFIG = "java.security.krb5.conf";
 +  public static final String KRB5_DEBUG = "sun.security.krb5.debug";
 +  public static final String KRB5_LOGIN_CONFIG = "java.security.auth.login.config";
 +  public static final String KRB5_USE_SUBJECT_CREDS_ONLY = "javax.security.auth.useSubjectCredsOnly";
 +  public static final String SIGNING_KEYSTORE_NAME = "gateway.signing.keystore.name";
 +  public static final String SIGNING_KEY_ALIAS = "gateway.signing.key.alias";
 +
++  String REMOTE_CONFIG_REGISTRY_TYPE = "type";
++  String REMOTE_CONFIG_REGISTRY_ADDRESS = "address";
++  String REMOTE_CONFIG_REGISTRY_NAMESPACE = "namespace";
++  String REMOTE_CONFIG_REGISTRY_AUTH_TYPE = "authType";
++  String REMOTE_CONFIG_REGISTRY_PRINCIPAL = "principal";
++  String REMOTE_CONFIG_REGISTRY_CREDENTIAL_ALIAS = "credentialAlias";
++  String REMOTE_CONFIG_REGISTRY_KEYTAB = "keytab";
++  String REMOTE_CONFIG_REGISTRY_USE_KEYTAB = "useKeytab";
++  String REMOTE_CONFIG_REGISTRY_USE_TICKET_CACHE = "useTicketCache";
++
 +  /**
 +   * The location of the gateway configuration.
 +   * Subdirectories will be: topologies
 +   * @return The location of the gateway configuration.
 +   */
 +  String getGatewayConfDir();
 +
 +  /**
 +   * The location of the gateway runtime generated data.
 +   * Subdirectories will be security, deployments
 +   * @return The location of the gateway runtime generated data.
 +   */
 +  String getGatewayDataDir();
 +
 +  /**
 +   * The location of the gateway services definition's root directory
 +   * @return The location of the gateway services top level directory.
 +   */
 +  String getGatewayServicesDir();
 +
 +  /**
 +   * The location of the gateway applications's root directory
 +   * @return The location of the gateway applications top level directory.
 +   */
 +  String getGatewayApplicationsDir();
 +
 +  String getHadoopConfDir();
 +
 +  String getGatewayHost();
 +
 +  int getGatewayPort();
 +
 +  String getGatewayPath();
 +
++  String getGatewayProvidersConfigDir();
++
++  String getGatewayDescriptorsDir();
++
 +  String getGatewayTopologyDir();
 +
 +  String getGatewaySecurityDir();
 +
 +  String getGatewayDeploymentDir();
 +
 +  InetSocketAddress getGatewayAddress() throws UnknownHostException;
 +
 +  boolean isSSLEnabled();
 +  
 +  List<String> getExcludedSSLProtocols();
 +
 +  List<String> getIncludedSSLCiphers();
 +
 +  List<String> getExcludedSSLCiphers();
 +
 +  boolean isHadoopKerberosSecured();
 +
 +  String getKerberosConfig();
 +
 +  boolean isKerberosDebugEnabled();
 +
 +  String getKerberosLoginConfig();
 +
 +  String getDefaultTopologyName();
 +
 +  String getDefaultAppRedirectPath();
 +
 +  String getFrontendUrl();
 +
 +  boolean isClientAuthNeeded();
 +
 +  boolean isClientAuthWanted();
 +
 +  String getTruststorePath();
 +
 +  boolean getTrustAllCerts();
 +
 +  String getKeystoreType();
 +
 +  String getTruststoreType();
 +
 +  boolean isXForwardedEnabled();
 +
 +  String getEphemeralDHKeySize();
 +
 +  int getHttpClientMaxConnections();
 +
 +  int getHttpClientConnectionTimeout();
 +
 +  int getHttpClientSocketTimeout();
 +
 +  int getThreadPoolMax();
 +
 +  int getHttpServerRequestBuffer();
 +
 +  int getHttpServerRequestHeaderBuffer();
 +
 +  int getHttpServerResponseBuffer();
 +
 +  int getHttpServerResponseHeaderBuffer();
 +
 +  int getGatewayDeploymentsBackupVersionLimit();
 +
 +  long getGatewayDeploymentsBackupAgeLimit();
 +
 +  long getGatewayIdleTimeout();
 +
 +  String getSigningKeystoreName();
 +
 +  String getSigningKeyAlias();
 +
 +  List<String> getGlobalRulesServices();
 +
 +  /**
 +   * Returns true if websocket feature enabled else false.
 +   * Default is false.
 +   * @since 0.10
 +   * @return
 +   */
 +  boolean isWebsocketEnabled();
 +
 +  /**
 +   * Websocket connection max text message size.
 +   * @since 0.10
 +   * @return
 +   */
 +  int getWebsocketMaxTextMessageSize();
 +
 +  /**
 +   * Websocket connection max binary message size.
 +   * @since 0.10
 +   * @return
 +   */
 +  int getWebsocketMaxBinaryMessageSize();
 +
 +  /**
 +   * Websocket connection max text message buffer size.
 +   * @since 0.10
 +   * @return
 +   */
 +  int getWebsocketMaxTextMessageBufferSize();
 +
 +  /**
 +   * Websocket connection max binary message buffer size.
 +   * @since 0.10
 +   * @return
 +   */
 +  int getWebsocketMaxBinaryMessageBufferSize();
 +
 +  /**
 +   * Websocket connection input buffer size.
 +   * @since 0.10
 +   * @return
 +   */
 +  int getWebsocketInputBufferSize();
 +
 +  /**
 +   * Websocket connection async write timeout.
 +   * @since 0.10
 +   * @return
 +   */
 +  int getWebsocketAsyncWriteTimeout();
 +
 +  /**
 +   * Websocket connection idle timeout.
 +   * @since 0.10
 +   * @return
 +   */
 +  int getWebsocketIdleTimeout();
 +
 +  boolean isMetricsEnabled();
 +
 +  boolean isJmxMetricsReportingEnabled();
 +
 +  boolean isGraphiteMetricsReportingEnabled();
 +
 +  String getGraphiteHost();
 +
 +  int getGraphitePort();
 +
 +  int getGraphiteReportingFrequency();
 +
 +  /**
 +   * List of MIME Type to be compressed.
 +   * @since 0.12
 +   */
 +  List<String> getMimeTypesToCompress();
 +
 +  /**
 +   * Enable cookie scoping to gateway path
 +   *
 +   * @since 0.13
 +   */
 +  boolean isCookieScopingToPathEnabled();
 +
 +  /**
 +   * Configured name of the HTTP Header that is expected
 +   * to be set by a proxy in front of the gateway.
 +   * @return
 +   */
 +  String getHeaderNameForRemoteAddress();
 +
 +  /**
 +   * Configured Algorithm name to be used by the CryptoService
 +   * and MasterService implementations
 +   * @return
 +   */
 +  String getAlgorithm();
 +
 +  /**
 +   * Configured Algorithm name to be used by the CryptoService
 +   * for password based encryption
 +   * @return
 +   */
 +  String getPBEAlgorithm();
 +
 +  /**
 +   * Configured Transformation name to be used by the CryptoService
 +   * and MasterService implementations
 +   * @return
 +   */
 +  String getTransformation();
 +
 +  /**
 +   * Configured SaltSize to be used by the CryptoService
 +   * and MasterService implementations
 +   * @return
 +   */
 +  String getSaltSize();
 +
 +  /**
 +   * Configured IterationCount to be used by the CryptoService
 +   * and MasterService implementations
 +   * @return
 +   */
 +  String getIterationCount();
 +
 +  /**
 +   * Configured KeyLength to be used by the CryptoService
 +   * and MasterService implementations
 +   * @return
 +   */
 +  String getKeyLength();
 +
 +  /**
 +   * Map of Topology names and their ports.
 +   *
 +   * @return
 +   */
 +  Map<String, Integer> getGatewayPortMappings();
 +
 +  /**
 +   * Is the Port Mapping feature on
 +   * @return
 +   */
 +  boolean isGatewayPortMappingEnabled();
 +
 +  /**
 +   * Is the Server header suppressed
 +   * @return
 +   */
 +  boolean isGatewayServerHeaderEnabled();
++  
++  /**
++   *
++   * @param type The type of cluster configuration monitor for which the interval should
be returned.
++   *
++   * @return The polling interval configuration value, or -1 if it has not been configured.
++   */
++  int getClusterMonitorPollingInterval(String type);
++  
++  /**
++   *
++   * @param type The type of cluster configuration monitor for which the interval should
be returned.
++   *
++   * @return The enabled status of the specified type of cluster configuration monitor.
++   */
++  boolean isClusterMonitorEnabled(String type);
++  
++  /**
++   * @return The list of the names of any remote registry configurations defined herein.
++   */
++  List<String> getRemoteRegistryConfigurationNames();
++
++  /**
++   *
++   * @param name The name of the remote registry configuration
++   *
++   * @return The configuration associated with the specified name.
++   */
++  String getRemoteRegistryConfiguration(String name);
++
++  /**
++   *
++   * @return The name of a remote configuration registry client
++   */
++  String getRemoteConfigurationMonitorClientName();
++
 +}

http://git-wip-us.apache.org/repos/asf/knox/blob/22a7304a/gateway-spi/src/main/java/org/apache/knox/gateway/services/GatewayServices.java
----------------------------------------------------------------------
diff --cc gateway-spi/src/main/java/org/apache/knox/gateway/services/GatewayServices.java
index 4a30800,0000000..8912c98
mode 100644,000000..100644
--- a/gateway-spi/src/main/java/org/apache/knox/gateway/services/GatewayServices.java
+++ b/gateway-spi/src/main/java/org/apache/knox/gateway/services/GatewayServices.java
@@@ -1,46 -1,0 +1,50 @@@
 +/**
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package org.apache.knox.gateway.services;
 +
 +import java.util.Collection;
 +
 +import org.apache.knox.gateway.deploy.ProviderDeploymentContributor;
 +
 +public interface GatewayServices extends Service,
 +    ProviderDeploymentContributor {
 +
 +  public static final String GATEWAY_CLUSTER_ATTRIBUTE = "org.apache.knox.gateway.gateway.cluster";
 +  public static final String GATEWAY_SERVICES_ATTRIBUTE = "org.apache.knox.gateway.gateway.services";
 +
 +  public static final String SSL_SERVICE = "SSLService";
 +  public static final String CRYPTO_SERVICE = "CryptoService";
 +  public static final String ALIAS_SERVICE = "AliasService";
 +  public static final String KEYSTORE_SERVICE = "KeystoreService";
 +  public static final String TOKEN_SERVICE = "TokenService";
 +  public static final String SERVICE_REGISTRY_SERVICE = "ServiceRegistryService";
 +  public static final String HOST_MAPPING_SERVICE = "HostMappingService";
 +  public static final String SERVER_INFO_SERVICE = "ServerInfoService";
 +  public static final String TOPOLOGY_SERVICE = "TopologyService";
 +  public static final String SERVICE_DEFINITION_REGISTRY = "ServiceDefinitionRegistry";
 +  public static final String METRICS_SERVICE = "MetricsService";
 +
++  String REMOTE_REGISTRY_CLIENT_SERVICE = "RemoteConfigRegistryClientService";
++
++  String CLUSTER_CONFIGURATION_MONITOR_SERVICE = "ClusterConfigurationMonitorService";
++
 +  public abstract Collection<String> getServiceNames();
 +
 +  public abstract <T> T getService( String serviceName );
 +
 +}

http://git-wip-us.apache.org/repos/asf/knox/blob/22a7304a/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestConfig.java
----------------------------------------------------------------------
diff --cc gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestConfig.java
index 8abf5aa,0000000..79a9292
mode 100644,000000..100644
--- a/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestConfig.java
+++ b/gateway-test-release-utils/src/main/java/org/apache/knox/gateway/GatewayTestConfig.java
@@@ -1,617 -1,0 +1,653 @@@
 +/**
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package org.apache.knox.gateway;
 +
 +import org.apache.commons.lang.StringUtils;
 +import org.apache.hadoop.conf.Configuration;
 +import org.apache.knox.gateway.config.GatewayConfig;
 +
 +import java.io.File;
 +import java.net.InetSocketAddress;
 +import java.net.UnknownHostException;
 +import java.util.ArrayList;
++import java.util.Collections;
 +import java.util.List;
 +import java.util.Map;
 +import java.util.concurrent.ConcurrentHashMap;
 +
 +public class GatewayTestConfig extends Configuration implements GatewayConfig {
 +
 +  /* Websocket defaults */
 +  public static final boolean DEFAULT_WEBSOCKET_FEATURE_ENABLED = false;
 +  public static final int DEFAULT_WEBSOCKET_MAX_TEXT_MESSAGE_SIZE = Integer.MAX_VALUE;;
 +  public static final int DEFAULT_WEBSOCKET_MAX_BINARY_MESSAGE_SIZE = Integer.MAX_VALUE;;
 +  public static final int DEFAULT_WEBSOCKET_MAX_TEXT_MESSAGE_BUFFER_SIZE = 32768;
 +  public static final int DEFAULT_WEBSOCKET_MAX_BINARY_MESSAGE_BUFFER_SIZE = 32768;
 +  public static final int DEFAULT_WEBSOCKET_INPUT_BUFFER_SIZE = 4096;
 +  public static final int DEFAULT_WEBSOCKET_ASYNC_WRITE_TIMEOUT = 60000;
 +  public static final int DEFAULT_WEBSOCKET_IDLE_TIMEOUT = 300000;
 +
 +  private String gatewayHomeDir = "gateway-home";
 +  private String hadoopConfDir = "hadoop";
 +  private String gatewayHost = "localhost";
 +  private int gatewayPort = 0;
 +  private String gatewayPath = "gateway";
 +  private boolean hadoopKerberosSecured = false;
 +  private String kerberosConfig = "/etc/knox/conf/krb5.conf";
 +  private boolean kerberosDebugEnabled = false;
 +  private String kerberosLoginConfig = "/etc/knox/conf/krb5JAASLogin.conf";
 +  private String frontendUrl = null;
 +  private boolean xForwardedEnabled = true;
 +  private String gatewayApplicationsDir = null;
 +  private String gatewayServicesDir;
 +  private String defaultTopologyName = "default";
 +  private List<String> includedSSLCiphers = null;
 +  private List<String> excludedSSLCiphers = null;
 +  private boolean sslEnabled = false;
 +  private String truststoreType = "jks";
 +  private String keystoreType = "jks";
 +  private boolean isTopologyPortMappingEnabled = true;
 +  private ConcurrentHashMap<String, Integer> topologyPortMapping = new ConcurrentHashMap<>();
 +  private int backupVersionLimit = -1;
 +  private long backupAgeLimit = -1;
 +
 +  public void setGatewayHomeDir( String gatewayHomeDir ) {
 +    this.gatewayHomeDir = gatewayHomeDir;
 +  }
 +
 +  public String getGatewayHomeDir() {
 +    return this.gatewayHomeDir;
 +  }
 +
 +  @Override
 +  public String getGatewayConfDir() {
 +    return gatewayHomeDir;
 +  }
 +
 +  @Override
 +  public String getGatewayDataDir() {
 +    return gatewayHomeDir;
 +  }
 +
 +  @Override
 +  public String getGatewaySecurityDir() {
 +    return gatewayHomeDir + "/security";
 +  }
 +
 +  @Override
 +  public String getGatewayTopologyDir() {
 +    return gatewayHomeDir + "/topologies";
 +  }
 +
 +  @Override
 +  public String getGatewayDeploymentDir() {
 +    return gatewayHomeDir + "/deployments";
 +  }
 +
 +//  public void setDeploymentDir( String clusterConfDir ) {
 +//    this.deployDir = clusterConfDir;
 +//  }
 +
 +  @Override
 +  public String getHadoopConfDir() {
 +    return hadoopConfDir;
 +  }
 +
 +//  public void setHadoopConfDir( String hadoopConfDir ) {
 +//    this.hadoopConfDir = hadoopConfDir;
 +//  }
 +
 +  @Override
 +  public String getGatewayHost() {
 +    return gatewayHost;
 +  }
 +
 +//  public void setGatewayHost( String gatewayHost ) {
 +//    this.gatewayHost = gatewayHost;
 +//  }
 +
 +  @Override
 +  public int getGatewayPort() {
 +    return gatewayPort;
 +  }
 +
 +//  public void setGatewayPort( int gatewayPort ) {
 +//    this.gatewayPort = gatewayPort;
 +//  }
 +
 +  @Override
 +  public String getGatewayPath() {
 +    return gatewayPath;
 +  }
 +
 +  public void setGatewayPath( String gatewayPath ) {
 +    this.gatewayPath = gatewayPath;
 +  }
 +
 +  @Override
 +  public InetSocketAddress getGatewayAddress() throws UnknownHostException {
 +    return new InetSocketAddress( getGatewayHost(), getGatewayPort() );
 +  }
 +
 +
 +  public long getGatewayIdleTimeout() {
 +    return 0l;
 +  }
 +
 +  @Override
 +  public boolean isSSLEnabled() {
 +    return sslEnabled;
 +  }
 +
 +  public void setSSLEnabled( boolean sslEnabled ) {
 +    this.sslEnabled = sslEnabled;
 +  }
 +
 +  @Override
 +  public boolean isHadoopKerberosSecured() {
 +    return hadoopKerberosSecured;
 +  }
 +
 +  public void setHadoopKerberosSecured(boolean hadoopKerberosSecured) {
 +    this.hadoopKerberosSecured = hadoopKerberosSecured;
 +  }
 +
 +  @Override
 +  public String getKerberosConfig() {
 +    return kerberosConfig;
 +  }
 +
 +  public void setKerberosConfig(String kerberosConfig) {
 +    this.kerberosConfig = kerberosConfig;
 +  }
 +
 +  @Override
 +  public boolean isKerberosDebugEnabled() {
 +    return kerberosDebugEnabled;
 +  }
 +
 +  public void setKerberosDebugEnabled(boolean kerberosDebugEnabled) {
 +    this.kerberosDebugEnabled = kerberosDebugEnabled;
 +  }
 +
 +  @Override
 +  public String getKerberosLoginConfig() {
 +    return kerberosLoginConfig;
 +  }
 +
 +  @Override
 +  public String getDefaultTopologyName() {
 +    return defaultTopologyName;
 +  }
 +
 +  public void setDefaultTopologyName( String defaultTopologyName ) {
 +    this.defaultTopologyName = defaultTopologyName;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getDefaultAppRedirectPath()
 +   */
 +  @Override
 +  public String getDefaultAppRedirectPath() {
 +
 +    if(StringUtils.isBlank(this.defaultTopologyName)) {
 +      return "/gateway/sandbox";
 +    } else {
 +      return "/gateway/"+this.defaultTopologyName;
 +    }
 +
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getFrontendUrl()
 +   */
 +  @Override
 +  public String getFrontendUrl() { return frontendUrl; }
 +
 +  public void setFrontendUrl( String frontendUrl ) {
 +    this.frontendUrl = frontendUrl;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getExcludedSSLProtocols()
 +   */
 +  @Override
 +  public List getExcludedSSLProtocols() {
 +    List<String> protocols = new ArrayList<String>();
 +    protocols.add("SSLv3");
 +    return protocols;
 +  }
 +
 +  @Override
 +  public List getIncludedSSLCiphers() {
 +    return includedSSLCiphers;
 +  }
 +
 +  public void setIncludedSSLCiphers( List<String> list ) {
 +    includedSSLCiphers = list;
 +  }
 +
 +  @Override
 +  public List getExcludedSSLCiphers() {
 +    return excludedSSLCiphers;
 +  }
 +
 +  public void setExcludedSSLCiphers( List<String> list ) {
 +    excludedSSLCiphers = list;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#isClientAuthNeeded()
 +   */
 +  @Override
 +  public boolean isClientAuthNeeded() {
 +    // TODO Auto-generated method stub
 +    return false;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getTruststorePath()
 +   */
 +  @Override
 +  public String getTruststorePath() {
 +    // TODO Auto-generated method stub
 +    return null;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getTrustAllCerts()
 +   */
 +  @Override
 +  public boolean getTrustAllCerts() {
 +    // TODO Auto-generated method stub
 +    return false;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getTruststoreType()
 +   */
 +  @Override
 +  public String getTruststoreType() {
 +    return truststoreType;
 +  }
 +
 +  public void setTruststoreType( String truststoreType ) {
 +    this.truststoreType = truststoreType;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getKeystoreType()
 +   */
 +  @Override
 +  public String getKeystoreType() {
 +    return keystoreType;
 +  }
 +
 +  public void setKeystoreType( String keystoreType ) {
 +    this.keystoreType = keystoreType;
 +  }
 +
 +  public void setKerberosLoginConfig(String kerberosLoginConfig) {
 +   this.kerberosLoginConfig = kerberosLoginConfig;
 +  }
 +
 +   @Override
 +   public String getGatewayServicesDir() {
 +    if( gatewayServicesDir != null ) {
 +      return gatewayServicesDir;
 +    } else {
 +      File targetDir = new File( System.getProperty( "user.dir" ), "target/services" );
 +      return targetDir.getPath();
 +    }
 +  }
 +
 +  public void setGatewayServicesDir( String gatewayServicesDir ) {
 +    this.gatewayServicesDir = gatewayServicesDir;
 +  }
 +
 +  @Override
 +  public String getGatewayApplicationsDir() {
 +    if( gatewayApplicationsDir != null ) {
 +      return gatewayApplicationsDir;
 +    } else {
 +      return getGatewayConfDir() + "/applications";
 +    }
 +  }
 +
 +  public void setGatewayApplicationsDir( String gatewayApplicationsDir ) {
 +    this.gatewayApplicationsDir = gatewayApplicationsDir;
 +   }
 +
 +  @Override
 +  public boolean isXForwardedEnabled() {
 +    return xForwardedEnabled;
 +  }
 +
 +  public void setXForwardedEnabled(boolean enabled) {
 +    xForwardedEnabled = enabled;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getEphemeralDHKeySize()
 +   */
 +  @Override
 +  public String getEphemeralDHKeySize() {
 +    return "2048";
 +  }
 +
 +  @Override
 +  public int getHttpClientMaxConnections() {
 +    return 16;
 +  }
 +
 +  @Override
 +  public int getHttpClientConnectionTimeout() {
 +    return -1;
 +  }
 +
 +  @Override
 +  public int getHttpClientSocketTimeout() {
 +    return -1;
 +  }
 +
 +  @Override
 +  public int getThreadPoolMax() {
-     return 16;
++    return 254;
 +  }
 +
 +  @Override
 +  public int getHttpServerRequestBuffer() {
 +    return 16*1024;
 +  }
 +
 +  @Override
 +  public int getHttpServerRequestHeaderBuffer() {
 +    return 8*1024;
 +  }
 +
 +  @Override
 +  public int getHttpServerResponseBuffer() {
 +    return 32*1024;
 +  }
 +
 +  @Override
 +  public int getHttpServerResponseHeaderBuffer() {
 +    return 8*1024;
 +  }
 +
 +  public void setGatewayDeploymentsBackupVersionLimit( int newBackupVersionLimit ) {
 +    backupVersionLimit = newBackupVersionLimit;
 +  }
 +
 +  public int getGatewayDeploymentsBackupVersionLimit() {
 +    return backupVersionLimit;
 +  }
 +
 +  public void setTopologyPortMapping(ConcurrentHashMap<String, Integer> topologyPortMapping)
{
 +    this.topologyPortMapping = topologyPortMapping;
 +  }
 +
 +  public void setGatewayPortMappingEnabled(
 +      boolean topologyPortMappingEnabled) {
 +    isTopologyPortMappingEnabled = topologyPortMappingEnabled;
 +  }
 +
 +  @Override
 +  public long getGatewayDeploymentsBackupAgeLimit() {
 +    return backupAgeLimit;
 +  }
 +
 +  public void setGatewayDeploymentsBackupAgeLimit( long newBackupAgeLimit ) {
 +    backupAgeLimit = newBackupAgeLimit;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getSigningKeystoreName()
 +   */
 +  @Override
 +  public String getSigningKeystoreName() {
 +    return null;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getSigningKeyAlias()
 +   */
 +  @Override
 +  public String getSigningKeyAlias() {
 +    return null;
 +  }
 +
 +  @Override
 +  public List<String> getGlobalRulesServices() {
 +    ArrayList<String> services = new ArrayList<>();
 +    services.add("WEBHDFS");
 +    services.add("HBASE");
 +    services.add("HIVE");
 +    services.add("OOZIE");
 +    services.add("RESOURCEMANAGER");
 +    services.add("STORM");
 +    return services;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#isWebsocketEnabled()
 +   */
 +  @Override
 +  public boolean isWebsocketEnabled() {
 +    return DEFAULT_WEBSOCKET_FEATURE_ENABLED;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getWebsocketMaxTextMessageSize()
 +   */
 +  @Override
 +  public int getWebsocketMaxTextMessageSize() {
 +    return DEFAULT_WEBSOCKET_MAX_TEXT_MESSAGE_SIZE;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getWebsocketMaxBinaryMessageSize()
 +   */
 +  @Override
 +  public int getWebsocketMaxBinaryMessageSize() {
 +    return DEFAULT_WEBSOCKET_MAX_BINARY_MESSAGE_SIZE;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getWebsocketMaxTextMessageBufferSize()
 +   */
 +  @Override
 +  public int getWebsocketMaxTextMessageBufferSize() {
 +    return DEFAULT_WEBSOCKET_MAX_TEXT_MESSAGE_BUFFER_SIZE;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getWebsocketMaxBinaryMessageBufferSize()
 +   */
 +  @Override
 +  public int getWebsocketMaxBinaryMessageBufferSize() {
 +    return DEFAULT_WEBSOCKET_MAX_BINARY_MESSAGE_BUFFER_SIZE;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getWebsocketInputBufferSize()
 +   */
 +  @Override
 +  public int getWebsocketInputBufferSize() {
 +    return DEFAULT_WEBSOCKET_INPUT_BUFFER_SIZE;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getWebsocketAsyncWriteTimeout()
 +   */
 +  @Override
 +  public int getWebsocketAsyncWriteTimeout() {
 +    return DEFAULT_WEBSOCKET_ASYNC_WRITE_TIMEOUT;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getWebsocketIdleTimeout()
 +   */
 +  @Override
 +  public int getWebsocketIdleTimeout() {
 +    return DEFAULT_WEBSOCKET_IDLE_TIMEOUT;
 +  }
 +
 +  @Override
 +  public boolean isMetricsEnabled() {
 +    return false;
 +  }
 +
 +  @Override
 +  public boolean isJmxMetricsReportingEnabled() {
 +    return false;
 +  }
 +
 +  @Override
 +  public boolean isGraphiteMetricsReportingEnabled() {
 +    return false;
 +  }
 +
 +  @Override
 +  public String getGraphiteHost() {
 +    return null;
 +  }
 +
 +  @Override
 +  public int getGraphitePort() {
 +    return 0;
 +  }
 +
 +  @Override
 +  public int getGraphiteReportingFrequency() {
 +    return 0;
 +  }
 +
 +  /* (non-Javadoc)
 +   * @see GatewayConfig#getMimeTypesToCompress()
 +   */
 +  @Override
 +  public List<String> getMimeTypesToCompress() {
 +    return new ArrayList<String>();
 +  }
 +
 +  @Override
 +  public  boolean isCookieScopingToPathEnabled() {
 +    return false;
 +  }
 +
 +  @Override
 +  public String getHeaderNameForRemoteAddress() {
 +    return "X-Forwarded-For";
 +  }
 +
 +  @Override
 +  public String getAlgorithm() {
 +    return null;
 +  }
 +
 +  @Override
 +  public String getPBEAlgorithm() {
 +    return null;
 +  }
 +
 +  @Override
 +  public String getTransformation() {
 +    return null;
 +  }
 +
 +  @Override
 +  public String getSaltSize() {
 +    return null;
 +  }
 +
 +  @Override
 +  public String getIterationCount() {
 +    return null;
 +  }
 +
 +  @Override
 +  public String getKeyLength() {
 +    return null;
 +  }
 +
 +  /**
 +   * Map of Topology names and their ports.
 +   *
 +   * @return
 +   */
 +  @Override
 +  public Map<String, Integer> getGatewayPortMappings() {
 +    return topologyPortMapping;
 +  }
 +
 +  /**
 +   * Is the Port Mapping feature on ?
 +   *
 +   * @return
 +   */
 +  @Override
 +  public boolean isGatewayPortMappingEnabled() {
 +    return isTopologyPortMappingEnabled;
 +  }
 +
 +  @Override
 +  public boolean isGatewayServerHeaderEnabled() {
 +	return false;
 +  }
 +
 +  @Override
 +  public boolean isClientAuthWanted() {
 +    return false;
 +  }
++
++  @Override
++  public String getGatewayProvidersConfigDir() {
++    return null;
++  }
++
++  @Override
++  public String getGatewayDescriptorsDir() {
++    return null;
++  }
++
++  @Override
++  public List<String> getRemoteRegistryConfigurationNames() {
++    return Collections.emptyList();
++  }
++
++  @Override
++  public String getRemoteRegistryConfiguration(String s) {
++    return null;
++  }
++
++  @Override
++  public String getRemoteConfigurationMonitorClientName() {
++    return null;
++  }
++
++  @Override
++  public int getClusterMonitorPollingInterval(String type) {
++    return 600;
++  }
++
++  @Override
++  public boolean isClusterMonitorEnabled(String type) {
++    return false;
++  }
 +}

http://git-wip-us.apache.org/repos/asf/knox/blob/22a7304a/gateway-test-utils/src/main/java/org/apache/knox/test/TestUtils.java
----------------------------------------------------------------------
diff --cc gateway-test-utils/src/main/java/org/apache/knox/test/TestUtils.java
index 5437ce1,0000000..e5ed5c9
mode 100644,000000..100644
--- a/gateway-test-utils/src/main/java/org/apache/knox/test/TestUtils.java
+++ b/gateway-test-utils/src/main/java/org/apache/knox/test/TestUtils.java
@@@ -1,216 -1,0 +1,216 @@@
 +/**
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + *
 + *     http://www.apache.org/licenses/LICENSE-2.0
 + *
 + * Unless required by applicable law or agreed to in writing, software
 + * distributed under the License is distributed on an "AS IS" BASIS,
 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 + * See the License for the specific language governing permissions and
 + * limitations under the License.
 + */
 +package org.apache.knox.test;
 +
 +import java.io.File;
 +import java.io.FileNotFoundException;
 +import java.io.IOException;
 +import java.io.InputStream;
 +import java.io.InputStreamReader;
 +import java.io.Reader;
 +import java.io.StringWriter;
 +import java.net.HttpURLConnection;
 +import java.net.InetSocketAddress;
 +import java.net.ServerSocket;
 +import java.net.Socket;
 +import java.net.URL;
 +import java.nio.ByteBuffer;
 +import java.util.Properties;
 +import java.util.UUID;
 +import java.util.concurrent.TimeUnit;
 +
 +import org.apache.commons.io.FileUtils;
 +import org.apache.commons.io.IOUtils;
 +import org.apache.log4j.Logger;
 +import org.apache.velocity.Template;
 +import org.apache.velocity.VelocityContext;
 +import org.apache.velocity.app.VelocityEngine;
 +import org.apache.velocity.runtime.RuntimeConstants;
 +import org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader;
 +import org.eclipse.jetty.http.HttpTester;
 +import org.eclipse.jetty.servlet.ServletTester;
 +
 +public class TestUtils {
 +
 +  private static Logger LOG = Logger.getLogger(TestUtils.class);
 +
 +  public static final long SHORT_TIMEOUT = 1000L;
-   public static final long MEDIUM_TIMEOUT = 20 * 1000L;
++  public static final long MEDIUM_TIMEOUT = 30 * 1000L;
 +  public static final long LONG_TIMEOUT = 60 * 1000L;
 +
 +  public static String getResourceName( Class clazz, String name ) {
 +    name = clazz.getName().replaceAll( "\\.", "/" ) + "/" + name;
 +    return name;
 +  }
 +
 +  public static URL getResourceUrl( Class clazz, String name ) throws FileNotFoundException
{
 +    name = getResourceName( clazz, name );
 +    URL url = ClassLoader.getSystemResource( name );
 +    if( url == null ) {
 +      throw new FileNotFoundException( name );
 +    }
 +    return url;
 +  }
 +
 +  public static URL getResourceUrl( String name ) throws FileNotFoundException {
 +    URL url = ClassLoader.getSystemResource( name );
 +    if( url == null ) {
 +      throw new FileNotFoundException( name );
 +    }
 +    return url;
 +  }
 +
 +  public static InputStream getResourceStream( String name ) throws IOException {
 +    URL url = ClassLoader.getSystemResource( name );
 +    InputStream stream = url.openStream();
 +    return stream;
 +  }
 +
 +  public static InputStream getResourceStream( Class clazz, String name ) throws IOException
{
 +    URL url = getResourceUrl( clazz, name );
 +    InputStream stream = url.openStream();
 +    return stream;
 +  }
 +
 +  public static Reader getResourceReader( String name, String charset ) throws IOException
{
 +    return new InputStreamReader( getResourceStream( name ), charset );
 +  }
 +
 +  public static Reader getResourceReader( Class clazz, String name, String charset ) throws
IOException {
 +    return new InputStreamReader( getResourceStream( clazz, name ), charset );
 +  }
 +
 +  public static String getResourceString( Class clazz, String name, String charset ) throws
IOException {
 +    return IOUtils.toString( getResourceReader( clazz, name, charset ) );
 +  }
 +
 +  public static File createTempDir( String prefix ) throws IOException {
 +    File targetDir = new File( System.getProperty( "user.dir" ), "target" );
 +    File tempDir = new File( targetDir, prefix + UUID.randomUUID() );
 +    FileUtils.forceMkdir( tempDir );
 +    return tempDir;
 +  }
 +
 +  public static void LOG_ENTER() {
 +    StackTraceElement caller = Thread.currentThread().getStackTrace()[2];
 +    System.out.flush();
 +    System.out.println( String.format( "Running %s#%s", caller.getClassName(), caller.getMethodName()
) );
 +    System.out.flush();
 +  }
 +
 +  public static void LOG_EXIT() {
 +    StackTraceElement caller = Thread.currentThread().getStackTrace()[2];
 +    System.out.flush();
 +    System.out.println( String.format( "Exiting %s#%s", caller.getClassName(), caller.getMethodName()
) );
 +    System.out.flush();
 +  }
 +
 +  public static void awaitPortOpen( InetSocketAddress address, int timeout, int delay )
throws InterruptedException {
 +    long maxTime = System.currentTimeMillis() + timeout;
 +    do {
 +      try {
 +        Socket socket = new Socket();
 +        socket.connect( address, delay );
 +        socket.close();
 +        return;
 +      } catch ( IOException e ) {
 +        //e.printStackTrace();
 +      }
 +    } while( System.currentTimeMillis() < maxTime );
 +    throw new IllegalStateException( "Timed out " + timeout + " waiting for port " + address
);
 +  }
 +
 +  public static void awaitNon404HttpStatus( URL url, int timeout, int delay ) throws InterruptedException
{
 +    long maxTime = System.currentTimeMillis() + timeout;
 +    do {
 +      Thread.sleep( delay );
 +      HttpURLConnection conn = null;
 +      try {
 +        conn = (HttpURLConnection)url.openConnection();
 +        conn.getInputStream().close();
 +        return;
 +      } catch ( IOException e ) {
 +        //e.printStackTrace();
 +        try {
 +          if( conn != null && conn.getResponseCode() != 404 ) {
 +            return;
 +          }
 +        } catch ( IOException ee ) {
 +          //ee.printStackTrace();
 +        }
 +      }
 +    } while( System.currentTimeMillis() < maxTime );
 +    throw new IllegalStateException( "Timed out " + timeout + " waiting for URL " + url
);
 +  }
 +
 +  public static String merge( String resource, Properties properties ) {
 +    ClasspathResourceLoader loader = new ClasspathResourceLoader();
 +    loader.getResourceStream( resource );
 +
 +    VelocityEngine engine = new VelocityEngine();
 +    Properties config = new Properties();
 +    config.setProperty( RuntimeConstants.RUNTIME_LOG_LOGSYSTEM_CLASS, "org.apache.velocity.runtime.log.NullLogSystem"
);
 +    config.setProperty( RuntimeConstants.RESOURCE_LOADER, "classpath" );
 +    config.setProperty( "classpath.resource.loader.class", ClasspathResourceLoader.class.getName()
);
 +    engine.init( config );
 +
 +    VelocityContext context = new VelocityContext( properties );
 +    Template template = engine.getTemplate( resource );
 +    StringWriter writer = new StringWriter();
 +    template.merge( context, writer );
 +    return writer.toString();
 +  }
 +
 +  public static String merge( Class base, String resource, Properties properties ) {
 +    String baseResource = base.getName().replaceAll( "\\.", "/" );
 +    String fullResource = baseResource + "/" + resource;
 +    return merge( fullResource, properties );
 +  }
 +
 +  public static int findFreePort() throws IOException {
 +    ServerSocket socket = new ServerSocket(0);
 +    int port = socket.getLocalPort();
 +    socket.close();
 +    return port;
 +  }
 +
 +  public static void waitUntilNextSecond() {
 +    long before = System.currentTimeMillis();
 +    long wait;
 +    while( ( wait = ( 1000 - ( System.currentTimeMillis() - before ) ) ) > 0 ) {
 +      try {
 +        Thread.sleep( wait );
 +      } catch( InterruptedException e ) {
 +        // Ignore.
 +      }
 +    }
 +  }
 +
 +  public static HttpTester.Response execute( ServletTester server, HttpTester.Request request
) throws Exception {
 +    LOG.debug( "execute: request=" + request );
 +    ByteBuffer requestBuffer = request.generate();
 +    LOG.trace( "execute: requestBuffer=[" + new String(requestBuffer.array(),0,requestBuffer.limit())
+ "]" );
 +    ByteBuffer responseBuffer = server.getResponses( requestBuffer, 30, TimeUnit.SECONDS
);
 +    HttpTester.Response response = HttpTester.parseResponse( responseBuffer );
 +    LOG.trace( "execute: responseBuffer=[" + new String(responseBuffer.array(),0,responseBuffer.limit())
+ "]" );
 +    LOG.debug( "execute: reponse=" + response );
 +    return response;
 +  }
 +
 +
 +}


Mime
View raw message