diff --git a/bin/common.sh b/bin/common.sh index 1e6dc257444..0ec09f79b35 100755 --- a/bin/common.sh +++ b/bin/common.sh @@ -38,7 +38,7 @@ if [[ -z "${SMART_CONF_DIR}" ]]; then fi if [[ -z "${SMART_LOG_DIR}" ]]; then - export SMART_LOG_DIR="${SMART_HOME}/logs" + export SMART_LOG_DIR="/var/log/ssm" fi export SMART_LOG_FILE=${SMART_LOG_DIR}/${SMART_LOG_FILE_NAME} diff --git a/conf/hazelcast.xml b/conf/hazelcast.xml index ccb00fb1252..8d4d473f8dc 100644 --- a/conf/hazelcast.xml +++ b/conf/hazelcast.xml @@ -1,7 +1,8 @@ - + diff --git a/conf/log4j.properties b/conf/log4j.properties index 49528320e71..46cc03d4fcb 100644 --- a/conf/log4j.properties +++ b/conf/log4j.properties @@ -12,7 +12,7 @@ # log4j configuration used during build and unit tests rootLogger.level = INFO -property.filename = ${smart.log.dir}/${smart.log.file} +property.filename = ${env:smart.log.dir}/${env:smart.log.file} appenders = R, console appender.console.type = Console diff --git a/pom.xml b/pom.xml index 11ccc80db6e..78c14dfcd04 100644 --- a/pom.xml +++ b/pom.xml @@ -58,7 +58,7 @@ 1.1.3 4.3.9.RELEASE 4.6 - 3.12.13 + 4.2.8 15.0 2.10.1 ${project.build.directory}/test-dir @@ -68,6 +68,8 @@ 42.6.0 5.1.42 3.34.0 + 2.1.1 + 1.9.4 diff --git a/smart-action/pom.xml b/smart-action/pom.xml index 6a195f8c589..f532ddca392 100644 --- a/smart-action/pom.xml +++ b/smart-action/pom.xml @@ -54,7 +54,7 @@ com.puppycrawl.tools checkstyle - 6.19 + 7.8.2 diff --git a/smart-admin/pom.xml b/smart-admin/pom.xml index 6464f0e6ed9..6cd94acb15c 100644 --- a/smart-admin/pom.xml +++ b/smart-admin/pom.xml @@ -49,7 +49,7 @@ com.puppycrawl.tools checkstyle - 6.19 + 7.8.2 diff --git a/smart-agent/pom.xml b/smart-agent/pom.xml index 047d49695c8..f1480cc46f7 100644 --- a/smart-agent/pom.xml +++ b/smart-agent/pom.xml @@ -88,7 +88,7 @@ com.puppycrawl.tools checkstyle - 6.19 + 7.8.2 diff --git a/smart-client/pom.xml b/smart-client/pom.xml index be527d201b4..72a1a9f88d2 100644 --- a/smart-client/pom.xml +++ b/smart-client/pom.xml @@ -53,7 +53,7 @@ com.puppycrawl.tools checkstyle - 6.19 + 7.8.2 diff --git a/smart-client/src/main/java/org/smartdata/client/SmartClient.java b/smart-client/src/main/java/org/smartdata/client/SmartClient.java index 4b8e98d54ae..6fceebb2cc1 100644 --- a/smart-client/src/main/java/org/smartdata/client/SmartClient.java +++ b/smart-client/src/main/java/org/smartdata/client/SmartClient.java @@ -20,7 +20,6 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.ipc.ProtobufRpcEngine; import org.apache.hadoop.ipc.RPC; - import org.smartdata.SmartConstants; import org.smartdata.conf.SmartConfKeys; import org.smartdata.metrics.FileAccessEvent; diff --git a/smart-common/pom.xml b/smart-common/pom.xml index 17d882d75f0..ea386ef7bb8 100644 --- a/smart-common/pom.xml +++ b/smart-common/pom.xml @@ -209,7 +209,7 @@ com.puppycrawl.tools checkstyle - 6.19 + 7.8.2 diff --git a/smart-common/src/main/java/org/smartdata/model/rule/RuleExecutorPlugin.java b/smart-common/src/main/java/org/smartdata/model/rule/RuleExecutorPlugin.java index 4381524471d..296602125e8 100644 --- a/smart-common/src/main/java/org/smartdata/model/rule/RuleExecutorPlugin.java +++ b/smart-common/src/main/java/org/smartdata/model/rule/RuleExecutorPlugin.java @@ -31,7 +31,7 @@ public interface RuleExecutorPlugin { * @param ruleInfo * @param tResult */ - void onNewRuleExecutor(final RuleInfo ruleInfo, TranslateResult tResult); + void onNewRuleExecutor(RuleInfo ruleInfo, TranslateResult tResult); /** * Called just before rule executor begin to execute rule. @@ -40,7 +40,7 @@ public interface RuleExecutorPlugin { * @param tResult * @return continue this execution if true. */ - boolean preExecution(final RuleInfo ruleInfo, TranslateResult tResult); + boolean preExecution(RuleInfo ruleInfo, TranslateResult tResult); /** * Called after rule condition checked. @@ -48,7 +48,7 @@ public interface RuleExecutorPlugin { * @param objects the result of checking rule condition. * @return object list that will be used for Cmdlet submission. */ - List preSubmitCmdlet(final RuleInfo ruleInfo, List objects); + List preSubmitCmdlet(RuleInfo ruleInfo, List objects); /** * Called right before the CmdletDescriptor been submitted to CmdletManager. @@ -56,7 +56,7 @@ public interface RuleExecutorPlugin { * @param descriptor * @return the descriptor that will be used to submit to CmdletManager */ - CmdletDescriptor preSubmitCmdletDescriptor(final RuleInfo ruleInfo, TranslateResult tResult, + CmdletDescriptor preSubmitCmdletDescriptor(RuleInfo ruleInfo, TranslateResult tResult, CmdletDescriptor descriptor); /** @@ -64,5 +64,5 @@ CmdletDescriptor preSubmitCmdletDescriptor(final RuleInfo ruleInfo, TranslateRes * * @param ruleInfo */ - void onRuleExecutorExit(final RuleInfo ruleInfo); + void onRuleExecutorExit(RuleInfo ruleInfo); } diff --git a/smart-engine/pom.xml b/smart-engine/pom.xml index 49ff4dae479..b7f29ed4cd1 100644 --- a/smart-engine/pom.xml +++ b/smart-engine/pom.xml @@ -280,7 +280,7 @@ com.puppycrawl.tools checkstyle - 6.19 + 7.8.2 diff --git a/smart-engine/src/main/java/org/smartdata/server/SmartEngine.java b/smart-engine/src/main/java/org/smartdata/server/SmartEngine.java index 5dba4811924..d0302f36dcf 100644 --- a/smart-engine/src/main/java/org/smartdata/server/SmartEngine.java +++ b/smart-engine/src/main/java/org/smartdata/server/SmartEngine.java @@ -36,7 +36,6 @@ import org.smartdata.server.engine.cmdlet.agent.AgentInfo; import java.io.IOException; - import java.util.ArrayList; import java.util.Arrays; import java.util.LinkedList; diff --git a/smart-engine/src/main/java/org/smartdata/server/cluster/ClusterMembershipListener.java b/smart-engine/src/main/java/org/smartdata/server/cluster/ClusterMembershipListener.java index 8a858b8ee1a..ef428bdebc6 100644 --- a/smart-engine/src/main/java/org/smartdata/server/cluster/ClusterMembershipListener.java +++ b/smart-engine/src/main/java/org/smartdata/server/cluster/ClusterMembershipListener.java @@ -17,9 +17,8 @@ */ package org.smartdata.server.cluster; -import com.hazelcast.core.MemberAttributeEvent; -import com.hazelcast.core.MembershipEvent; -import com.hazelcast.core.MembershipListener; +import com.hazelcast.cluster.MembershipEvent; +import com.hazelcast.cluster.MembershipListener; import org.smartdata.conf.SmartConf; import org.smartdata.conf.SmartConfKeys; import org.smartdata.server.utils.HazelcastUtil; @@ -59,8 +58,4 @@ public void memberRemoved(MembershipEvent membershipEvent) { this.daemon.becomeActive(); } } - - @Override - public void memberAttributeChanged(MemberAttributeEvent memberAttributeEvent) { - } } diff --git a/smart-engine/src/main/java/org/smartdata/server/cluster/HazelcastWorker.java b/smart-engine/src/main/java/org/smartdata/server/cluster/HazelcastWorker.java index 72fe1e786d1..c0982b31c9b 100644 --- a/smart-engine/src/main/java/org/smartdata/server/cluster/HazelcastWorker.java +++ b/smart-engine/src/main/java/org/smartdata/server/cluster/HazelcastWorker.java @@ -15,9 +15,9 @@ package org.smartdata.server.cluster; import com.hazelcast.core.HazelcastInstance; -import com.hazelcast.core.ITopic; -import com.hazelcast.core.Message; -import com.hazelcast.core.MessageListener; +import com.hazelcast.topic.ITopic; +import com.hazelcast.topic.Message; +import com.hazelcast.topic.MessageListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.smartdata.SmartContext; @@ -58,7 +58,7 @@ public HazelcastWorker(SmartContext smartContext) { this.executorService = Executors.newSingleThreadScheduledExecutor(); this.instance = HazelcastInstanceProvider.getInstance(); this.statusTopic = instance.getTopic(HazelcastExecutorService.STATUS_TOPIC); - String instanceId = instance.getCluster().getLocalMember().getUuid(); + String instanceId = String.valueOf(instance.getCluster().getLocalMember().getUuid()); this.masterMessages = instance.getTopic(HazelcastExecutorService.WORKER_TOPIC_PREFIX + instanceId); this.masterMessages.addMessageListener(new MasterMessageListener()); diff --git a/smart-engine/src/main/java/org/smartdata/server/engine/cmdlet/CmdletFactory.java b/smart-engine/src/main/java/org/smartdata/server/engine/cmdlet/CmdletFactory.java index 293e9121f4e..d436f64910f 100644 --- a/smart-engine/src/main/java/org/smartdata/server/engine/cmdlet/CmdletFactory.java +++ b/smart-engine/src/main/java/org/smartdata/server/engine/cmdlet/CmdletFactory.java @@ -23,9 +23,6 @@ import org.smartdata.action.ActionException; import org.smartdata.action.ActionRegistry; import org.smartdata.action.SmartAction; -//import org.smartdata.alluxio.AlluxioUtil; -//import org.smartdata.alluxio.action.AlluxioAction; -//import alluxio.client.file.FileSystem; import org.smartdata.conf.SmartConfKeys; import org.smartdata.hdfs.HadoopUtil; import org.smartdata.hdfs.action.HdfsAction; diff --git a/smart-engine/src/main/java/org/smartdata/server/engine/cmdlet/HazelcastExecutorService.java b/smart-engine/src/main/java/org/smartdata/server/engine/cmdlet/HazelcastExecutorService.java index db11e881661..bbe671385a6 100644 --- a/smart-engine/src/main/java/org/smartdata/server/engine/cmdlet/HazelcastExecutorService.java +++ b/smart-engine/src/main/java/org/smartdata/server/engine/cmdlet/HazelcastExecutorService.java @@ -17,14 +17,13 @@ */ package org.smartdata.server.engine.cmdlet; +import com.hazelcast.cluster.Member; +import com.hazelcast.cluster.MembershipEvent; +import com.hazelcast.cluster.MembershipListener; import com.hazelcast.core.HazelcastInstance; -import com.hazelcast.core.ITopic; -import com.hazelcast.core.Member; -import com.hazelcast.core.MemberAttributeEvent; -import com.hazelcast.core.MembershipEvent; -import com.hazelcast.core.MembershipListener; -import com.hazelcast.core.Message; -import com.hazelcast.core.MessageListener; +import com.hazelcast.topic.ITopic; +import com.hazelcast.topic.Message; +import com.hazelcast.topic.MessageListener; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.smartdata.model.ExecutorType; @@ -221,9 +220,6 @@ public void memberRemoved(MembershipEvent membershipEvent) { removeMember(member); } - @Override - public void memberAttributeChanged(MemberAttributeEvent memberAttributeEvent) { - } } private class StatusMessageListener implements MessageListener { diff --git a/smart-engine/src/main/java/org/smartdata/server/utils/HazelcastUtil.java b/smart-engine/src/main/java/org/smartdata/server/utils/HazelcastUtil.java index 9b11a796c86..6d3ac6a3c3e 100644 --- a/smart-engine/src/main/java/org/smartdata/server/utils/HazelcastUtil.java +++ b/smart-engine/src/main/java/org/smartdata/server/utils/HazelcastUtil.java @@ -17,8 +17,8 @@ */ package org.smartdata.server.utils; +import com.hazelcast.cluster.Member; import com.hazelcast.core.HazelcastInstance; -import com.hazelcast.core.Member; import java.util.ArrayList; import java.util.List; diff --git a/smart-hadoop-support/smart-hadoop-client-3.2/pom.xml b/smart-hadoop-support/smart-hadoop-client-3.2/pom.xml index 80f7a17e9d1..a83e5ea2bc2 100644 --- a/smart-hadoop-support/smart-hadoop-client-3.2/pom.xml +++ b/smart-hadoop-support/smart-hadoop-client-3.2/pom.xml @@ -164,15 +164,9 @@ test - commons-configuration - commons-configuration - 1.6 - - - commons-beanutils - commons-beanutils - - + org.apache.commons + commons-configuration2 + ${commons-configuration.version} diff --git a/smart-hadoop-support/smart-hadoop-client-3/pom.xml b/smart-hadoop-support/smart-hadoop-client-3/pom.xml index 1dc27466292..c97bcae9112 100644 --- a/smart-hadoop-support/smart-hadoop-client-3/pom.xml +++ b/smart-hadoop-support/smart-hadoop-client-3/pom.xml @@ -130,17 +130,6 @@ junit test - - commons-configuration - commons-configuration - 1.6 - - - commons-beanutils - commons-beanutils - - - diff --git a/smart-hadoop-support/smart-hadoop/pom.xml b/smart-hadoop-support/smart-hadoop/pom.xml index 814d73372ac..33e999d28cf 100644 --- a/smart-hadoop-support/smart-hadoop/pom.xml +++ b/smart-hadoop-support/smart-hadoop/pom.xml @@ -316,15 +316,9 @@ 4.5.5 - commons-configuration - commons-configuration - 1.6 - - - commons-beanutils - commons-beanutils - - + org.apache.commons + commons-configuration2 + ${commons-configuration.version} org.smartdata diff --git a/smart-hadoop-support/smart-hadoop/src/main/java/org/smartdata/hdfs/HdfsStatesUpdateService.java b/smart-hadoop-support/smart-hadoop/src/main/java/org/smartdata/hdfs/HdfsStatesUpdateService.java index 1c8b3d852f0..0bd258c67c7 100644 --- a/smart-hadoop-support/smart-hadoop/src/main/java/org/smartdata/hdfs/HdfsStatesUpdateService.java +++ b/smart-hadoop-support/smart-hadoop/src/main/java/org/smartdata/hdfs/HdfsStatesUpdateService.java @@ -182,7 +182,9 @@ private void checkAndCreateIdFiles(URI namenodeURI, Configuration conf) throws I throw e; } finally { try { - moverIdOutputStream.close(); + if (moverIdOutputStream != null) { + moverIdOutputStream.close(); + } moverIdOutputStream = null; } catch (IOException e) { // Ignore this exception @@ -201,7 +203,9 @@ private void checkAndCreateIdFiles(URI namenodeURI, Configuration conf) throws I throw e; } finally { try { - ssmIdOutputStream.close(); + if (ssmIdOutputStream != null) { + ssmIdOutputStream.close(); + } ssmIdOutputStream = null; } catch (IOException ie) { // Ignore this exception diff --git a/smart-hadoop-support/smart-hadoop/src/main/java/org/smartdata/hdfs/metric/NNMetricsAccessEventCollector.java b/smart-hadoop-support/smart-hadoop/src/main/java/org/smartdata/hdfs/metric/NNMetricsAccessEventCollector.java index f00b63e978c..65e33ef3f6c 100644 --- a/smart-hadoop-support/smart-hadoop/src/main/java/org/smartdata/hdfs/metric/NNMetricsAccessEventCollector.java +++ b/smart-hadoop-support/smart-hadoop/src/main/java/org/smartdata/hdfs/metric/NNMetricsAccessEventCollector.java @@ -18,9 +18,11 @@ package org.smartdata.hdfs.metric; import com.google.common.annotations.VisibleForTesting; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.PropertiesConfiguration; -import org.apache.commons.configuration.SubsetConfiguration; +import org.apache.commons.configuration2.PropertiesConfiguration; +import org.apache.commons.configuration2.SubsetConfiguration; +import org.apache.commons.configuration2.builder.fluent.Configurations; +import org.apache.commons.configuration2.builder.fluent.Parameters; +import org.apache.commons.configuration2.ex.ConfigurationException; import org.apache.commons.lang.time.FastDateFormat; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; @@ -314,20 +316,21 @@ public void close() { } private static SubsetConfiguration loadConfiguration(String prefix, String... fileNames) { + Configurations configs = new Configurations(); for (String fname : fileNames) { try { - org.apache.commons.configuration.Configuration cf = new PropertiesConfiguration(fname) - .interpolatedConfiguration(); + PropertiesConfiguration cf = configs.properties(fname); LOG.info("loaded properties from " + fname); return new SubsetConfiguration(cf, prefix, "."); } catch (ConfigurationException e) { - if (e.getMessage().startsWith("Cannot locate configuration")) { + if (e.getMessage().contains("Cannot locate configuration source")) { continue; } throw new RuntimeException(e); } } - return new SubsetConfiguration(new PropertiesConfiguration(), prefix); + PropertiesConfiguration emptyConfig = new PropertiesConfiguration(); + return new SubsetConfiguration(emptyConfig, prefix, "."); } /** diff --git a/smart-integration/pom.xml b/smart-integration/pom.xml index e7716b5f16e..cd79e138c8a 100644 --- a/smart-integration/pom.xml +++ b/smart-integration/pom.xml @@ -254,7 +254,7 @@ com.puppycrawl.tools checkstyle - 6.19 + 7.8.2 diff --git a/smart-maven-plugins/pom.xml b/smart-maven-plugins/pom.xml index a8bfd5ebeaa..a680600cf24 100644 --- a/smart-maven-plugins/pom.xml +++ b/smart-maven-plugins/pom.xml @@ -42,7 +42,7 @@ com.puppycrawl.tools checkstyle - 6.19 + 7.8.2 diff --git a/smart-metastore/pom.xml b/smart-metastore/pom.xml index eb6375312ba..5079b42b92d 100644 --- a/smart-metastore/pom.xml +++ b/smart-metastore/pom.xml @@ -145,7 +145,7 @@ com.puppycrawl.tools checkstyle - 6.19 + 7.8.2 diff --git a/smart-metrics/pom.xml b/smart-metrics/pom.xml index fa05ae1154c..e626c7dff95 100644 --- a/smart-metrics/pom.xml +++ b/smart-metrics/pom.xml @@ -73,7 +73,7 @@ com.puppycrawl.tools checkstyle - 6.19 + 7.8.2 diff --git a/smart-rule/pom.xml b/smart-rule/pom.xml index 734c1ed15e2..46a2c4e351e 100644 --- a/smart-rule/pom.xml +++ b/smart-rule/pom.xml @@ -89,7 +89,7 @@ com.puppycrawl.tools checkstyle - 6.19 + 7.8.2 diff --git a/smart-server/pom.xml b/smart-server/pom.xml index 930cb970161..7f2329bdc2c 100644 --- a/smart-server/pom.xml +++ b/smart-server/pom.xml @@ -323,7 +323,7 @@ com.puppycrawl.tools checkstyle - 6.19 + 7.8.2 diff --git a/smart-server/src/main/java/org/smartdata/server/SmartDaemon.java b/smart-server/src/main/java/org/smartdata/server/SmartDaemon.java index 8d976dc6a43..8e6e9842084 100644 --- a/smart-server/src/main/java/org/smartdata/server/SmartDaemon.java +++ b/smart-server/src/main/java/org/smartdata/server/SmartDaemon.java @@ -107,7 +107,7 @@ public static void main(String[] args) { try { daemon.start(); } catch (Exception e) { - e.printStackTrace(); + LOG.error("Failed to start SmartDaemon", e); } } } diff --git a/smart-zeppelin/pom.xml b/smart-zeppelin/pom.xml index 57b88e03075..aa8d8fc64db 100644 --- a/smart-zeppelin/pom.xml +++ b/smart-zeppelin/pom.xml @@ -72,12 +72,11 @@ 4.5.1 4.0.2 2.5 - 1.9 1.5 2.4 3.2.1 1.1.1 - 1.10.0 + 1.13.0 4.12 @@ -187,9 +186,15 @@ - commons-configuration - commons-configuration - ${commons.configuration.version} + org.apache.commons + commons-configuration2 + ${commons-configuration.version} + + + + commons-beanutils + commons-beanutils + ${commons-beanutils.version} diff --git a/smart-zeppelin/zeppelin-server/src/main/java/org/apache/zeppelin/server/SmartZeppelinServer.java b/smart-zeppelin/zeppelin-server/src/main/java/org/apache/zeppelin/server/SmartZeppelinServer.java index 8be250b75ac..54bc2e3f9ff 100644 --- a/smart-zeppelin/zeppelin-server/src/main/java/org/apache/zeppelin/server/SmartZeppelinServer.java +++ b/smart-zeppelin/zeppelin-server/src/main/java/org/apache/zeppelin/server/SmartZeppelinServer.java @@ -395,28 +395,36 @@ public Set getSingletons() { } } - private void setupRestApiContextHandler(WebAppContext webApp) throws Exception { - - webApp.setSessionHandler(new SessionHandler()); - - // There are two sets of rest api: Zeppelin's and SSM's. They have different path. - ResourceConfig smartConfig = new ApplicationAdapter(new SmartRestApp()); - ServletHolder smartServletHolder = new ServletHolder(new ServletContainer(smartConfig)); - webApp.addServlet(smartServletHolder, SMART_PATH_SPEC); - - ResourceConfig zeppelinConfig = new ApplicationAdapter(new ZeppelinRestApp()); - ServletHolder zeppelinServletHolder = new ServletHolder(new ServletContainer(zeppelinConfig)); - webApp.addServlet(zeppelinServletHolder, ZEPPELIN_PATH_SPEC); - - String shiroIniPath = zconf.getShiroPath(); - if (!StringUtils.isBlank(shiroIniPath)) { - webApp.setInitParameter("shiroConfigLocations", - new File(shiroIniPath).toURI().toString()); - SecurityUtils.initSecurityManager(shiroIniPath); - webApp.addFilter(ShiroFilter.class, ZEPPELIN_PATH_SPEC, EnumSet.allOf(DispatcherType.class)); - // To make shiro configuration (authentication, etc.) take effect for smart rest api as well. - webApp.addFilter(ShiroFilter.class, SMART_PATH_SPEC, EnumSet.allOf(DispatcherType.class)); - webApp.addEventListener(new EnvironmentLoaderListener()); + private void setupRestApiContextHandler(WebAppContext webApp) { + try { + webApp.setSessionHandler(new SessionHandler()); + + // There are two sets of rest api: Zeppelin's and SSM's. They have different path. + ResourceConfig smartConfig = new ApplicationAdapter(new SmartRestApp()); + ServletHolder smartServletHolder = new ServletHolder(new ServletContainer(smartConfig)); + webApp.addServlet(smartServletHolder, SMART_PATH_SPEC); + + ResourceConfig zeppelinConfig = new ApplicationAdapter(new ZeppelinRestApp()); + ServletHolder zeppelinServletHolder = new ServletHolder(new ServletContainer(zeppelinConfig)); + webApp.addServlet(zeppelinServletHolder, ZEPPELIN_PATH_SPEC); + + String shiroIniPath = zconf.getShiroPath(); + if (!StringUtils.isBlank(shiroIniPath)) { + webApp.setInitParameter("shiroConfigLocations", + new File(shiroIniPath).toURI().toString()); + SecurityUtils.initSecurityManager(shiroIniPath); + webApp.addFilter(ShiroFilter.class, ZEPPELIN_PATH_SPEC, + EnumSet.allOf(DispatcherType.class)); + // To make shiro configuration (authentication, etc.) + // take effect for smart rest api as well. + webApp.addFilter(ShiroFilter.class, SMART_PATH_SPEC, + EnumSet.allOf(DispatcherType.class)); + webApp.addEventListener(new EnvironmentLoaderListener()); + } + } + catch (Exception e) { + LOG.error("Cannot setupRestApiContextHandler", e); + throw e; } } diff --git a/smart-zeppelin/zeppelin-server/src/main/java/org/apache/zeppelin/utils/SecurityUtils.java b/smart-zeppelin/zeppelin-server/src/main/java/org/apache/zeppelin/utils/SecurityUtils.java index 85a92676dca..baa1faaff91 100644 --- a/smart-zeppelin/zeppelin-server/src/main/java/org/apache/zeppelin/utils/SecurityUtils.java +++ b/smart-zeppelin/zeppelin-server/src/main/java/org/apache/zeppelin/utils/SecurityUtils.java @@ -32,6 +32,7 @@ import org.apache.shiro.realm.text.IniRealm; import org.apache.shiro.subject.Subject; import org.apache.shiro.util.ThreadContext; +import org.apache.shiro.web.env.IniWebEnvironment; import org.apache.shiro.web.mgt.DefaultWebSecurityManager; import org.apache.zeppelin.conf.ZeppelinConfiguration; import org.apache.zeppelin.realm.LdapRealm; @@ -51,9 +52,17 @@ public class SecurityUtils { private static final Logger LOG = LoggerFactory.getLogger(SecurityUtils.class); public static void initSecurityManager(String shiroPath) { - IniSecurityManagerFactory factory = new IniSecurityManagerFactory("file:" + shiroPath); - SecurityManager securityManager = factory.getInstance(); - org.apache.shiro.SecurityUtils.setSecurityManager(securityManager); + try { + IniWebEnvironment environment = new IniWebEnvironment(); + environment.setConfigLocations("file:" + shiroPath); + environment.init(); + SecurityManager securityManager = environment.getSecurityManager(); + org.apache.shiro.SecurityUtils.setSecurityManager(securityManager); + } + catch (Exception e) { + LOG.error("Cannot init shiro", e); + throw e; + } isEnabled = true; } diff --git a/smart-zeppelin/zeppelin-zengine/pom.xml b/smart-zeppelin/zeppelin-zengine/pom.xml index 7daac6f8f46..537a6dfbfdf 100644 --- a/smart-zeppelin/zeppelin-zengine/pom.xml +++ b/smart-zeppelin/zeppelin-zengine/pom.xml @@ -86,8 +86,15 @@ - commons-configuration - commons-configuration + org.apache.commons + commons-configuration2 + ${commons-configuration.version} + + + + commons-beanutils + commons-beanutils + ${commons-beanutils.version} diff --git a/smart-zeppelin/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java b/smart-zeppelin/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java index d1ecc7c0c78..f3707745cda 100644 --- a/smart-zeppelin/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java +++ b/smart-zeppelin/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java @@ -17,173 +17,173 @@ package org.apache.zeppelin.conf; -import org.apache.commons.configuration.ConfigurationException; -import org.apache.commons.configuration.XMLConfiguration; -import org.apache.commons.configuration.tree.ConfigurationNode; -import org.apache.commons.lang.StringUtils; -import org.apache.zeppelin.util.Util; +import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder; +import org.apache.commons.configuration2.builder.fluent.Parameters; +import org.apache.commons.configuration2.ex.ConfigurationException; +import org.apache.commons.configuration2.XMLConfiguration; +import org.apache.commons.configuration2.io.ClasspathLocationStrategy; +import org.apache.commons.configuration2.io.CombinedLocationStrategy; +import org.apache.commons.configuration2.io.FileLocationStrategy; +import org.apache.commons.configuration2.tree.ImmutableNode; +import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; -import java.net.URL; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - +import java.util.*; /** * Zeppelin configuration. * */ -public class ZeppelinConfiguration extends XMLConfiguration { +public class ZeppelinConfiguration { private static final String ZEPPELIN_SITE_XML = "zeppelin-site.xml"; private static final long serialVersionUID = 4749305895693848035L; private static final Logger LOG = LoggerFactory.getLogger(ZeppelinConfiguration.class); private static ZeppelinConfiguration conf; - public ZeppelinConfiguration(URL url) throws ConfigurationException { - setDelimiterParsingDisabled(true); - load(url); - } - - public ZeppelinConfiguration() { - ConfVars[] vars = ConfVars.values(); - for (ConfVars v : vars) { - if (v.getType() == ConfVars.VarType.BOOLEAN) { - this.setProperty(v.getVarName(), v.getBooleanValue()); - } else if (v.getType() == ConfVars.VarType.LONG) { - this.setProperty(v.getVarName(), v.getLongValue()); - } else if (v.getType() == ConfVars.VarType.INT) { - this.setProperty(v.getVarName(), v.getIntValue()); - } else if (v.getType() == ConfVars.VarType.FLOAT) { - this.setProperty(v.getVarName(), v.getFloatValue()); - } else if (v.getType() == ConfVars.VarType.STRING) { - this.setProperty(v.getVarName(), v.getStringValue()); - } else { - throw new RuntimeException("Unsupported VarType"); - } + private ZeppelinConfiguration(String filename) { + try { + loadXMLConfig(filename); + } catch (ConfigurationException e) { + LOG.warn("Failed to load XML configuration, proceeding with a default," + + "for a stacktrace activate the debug log"); + LOG.debug("Failed to load XML configuration", e); } - } - + public static ZeppelinConfiguration create() { + if (conf != null) { + return conf; + } + return ZeppelinConfiguration.create(null); + } /** - * Load from resource. - *url = ZeppelinConfiguration.class.getResource(ZEPPELIN_SITE_XML); - * @throws ConfigurationException + * Load from via filename. */ - public static synchronized ZeppelinConfiguration create() { + public static synchronized ZeppelinConfiguration create(String filename) { if (conf != null) { return conf; } - ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - URL url; + conf = new ZeppelinConfiguration(filename); - url = ZeppelinConfiguration.class.getResource(ZEPPELIN_SITE_XML); - if (url == null) { - ClassLoader cl = ZeppelinConfiguration.class.getClassLoader(); - if (cl != null) { - url = cl.getResource(ZEPPELIN_SITE_XML); - } - } - if (url == null) { - url = classLoader.getResource(ZEPPELIN_SITE_XML); - } - if (url == null) { - LOG.warn("Failed to load configuration, proceeding with a default"); - conf = new ZeppelinConfiguration(); + LOG.info("Server Host: {}", conf.getServerAddress()); + if (conf.useSsl()) { + LOG.info("Server SSL Port: {}", conf.getServerSslPort()); } else { - try { - LOG.info("Load configuration from " + url); - conf = new ZeppelinConfiguration(url); - } catch (ConfigurationException e) { - LOG.warn("Failed to load configuration from " + url + " proceeding with a default", e); - conf = new ZeppelinConfiguration(); - } + LOG.info("Server Port: {}", conf.getServerPort()); } + LOG.info("Context Path: {}", conf.getServerContextPath()); + LOG.info("Zeppelin Version: {}", "0.9.0"); - LOG.info("Server Host: " + conf.getServerAddress()); - if (conf.useSsl() == false) { - LOG.info("Server Port: " + conf.getServerPort()); - } else { - LOG.info("Server SSL Port: " + conf.getServerSslPort()); + return conf; + } + + public static void reset() { + conf = null; + } + private final Map properties = new HashMap<>(); + + private List getChildren(List children, final String name) { + if (name == null) { + return new ArrayList<>(); } - LOG.info("Context Path: " + conf.getServerContextPath()); - LOG.info("Zeppelin Version: " + Util.getVersion()); - return conf; + List filteredList = new ArrayList<>(); + for (ImmutableNode in : children) { + if (name.equals(in.getNodeName())) { + filteredList.add(in); + } + } + return filteredList; + } + private void loadXMLConfig(String filename) throws ConfigurationException { + if (StringUtils.isBlank(filename)) { + filename = ZEPPELIN_SITE_XML; + } + List subs = Arrays.asList( + new ZeppelinLocationStrategy(), + new ClasspathLocationStrategy()); + FileLocationStrategy strategy = new CombinedLocationStrategy(subs); + Parameters params = new Parameters(); + FileBasedConfigurationBuilder xmlbuilder = + new FileBasedConfigurationBuilder(XMLConfiguration.class) + .configure(params.xml() + .setLocationStrategy(strategy) + .setFileName(filename) + .setBasePath(File.separator + "conf" + File.separator)); + XMLConfiguration xmlConfig = xmlbuilder.getConfiguration(); + List nodes = xmlConfig.getNodeModel().getRootNode().getChildren(); + if (nodes != null && !nodes.isEmpty()) { + for (ImmutableNode p : nodes) { + String name = String.valueOf(getChildren(p.getChildren(), "name").get(0).getValue()); + String value = String.valueOf(getChildren(p.getChildren(), "value").get(0).getValue()); + if (StringUtils.isNotBlank(name) && StringUtils.isNotBlank(value)) { + setProperty(name, value); + } + } + } } + public void setProperty(String name, String value) { + if (StringUtils.isNoneBlank(name, value)) { + this.properties.put(name, value); + } + } private String getStringValue(String name, String d) { - List properties = getRootNode().getChildren(); - if (properties == null || properties.isEmpty()) { - return d; - } - for (ConfigurationNode p : properties) { - if (p.getChildren("name") != null && !p.getChildren("name").isEmpty() - && name.equals(p.getChildren("name").get(0).getValue())) { - return (String) p.getChildren("value").get(0).getValue(); - } + String value = this.properties.get(name); + if (value != null) { + return value; } return d; } private int getIntValue(String name, int d) { - List properties = getRootNode().getChildren(); - if (properties == null || properties.isEmpty()) { - return d; - } - for (ConfigurationNode p : properties) { - if (p.getChildren("name") != null && !p.getChildren("name").isEmpty() - && name.equals(p.getChildren("name").get(0).getValue())) { - return Integer.parseInt((String) p.getChildren("value").get(0).getValue()); + String value = this.properties.get(name); + if (value != null) { + try { + return Integer.parseInt(value); + } catch (NumberFormatException e) { + LOG.warn("Can not parse the property {} with" + + " the value \"{}\" to an int value", name, value, e); } } return d; } private long getLongValue(String name, long d) { - List properties = getRootNode().getChildren(); - if (properties == null || properties.isEmpty()) { - return d; - } - for (ConfigurationNode p : properties) { - if (p.getChildren("name") != null && !p.getChildren("name").isEmpty() - && name.equals(p.getChildren("name").get(0).getValue())) { - return Long.parseLong((String) p.getChildren("value").get(0).getValue()); + String value = this.properties.get(name); + if (value != null) { + try { + return Long.parseLong(value); + } catch (NumberFormatException e) { + LOG.warn("Can not parse the property {} with" + + " the value \"{}\" to a long value", name, value, e); } } return d; } + private float getFloatValue(String name, float d) { - List properties = getRootNode().getChildren(); - if (properties == null || properties.isEmpty()) { - return d; - } - for (ConfigurationNode p : properties) { - if (p.getChildren("name") != null && !p.getChildren("name").isEmpty() - && name.equals(p.getChildren("name").get(0).getValue())) { - return Float.parseFloat((String) p.getChildren("value").get(0).getValue()); + String value = this.properties.get(name); + if (value != null) { + try { + return Float.parseFloat(value); + } catch (NumberFormatException e) { + LOG.warn("Can not parse the property {} with" + + " the value \"{}\" to a float value", name, value, e); } } return d; } private boolean getBooleanValue(String name, boolean d) { - List properties = getRootNode().getChildren(); - if (properties == null || properties.isEmpty()) { - return d; - } - for (ConfigurationNode p : properties) { - if (p.getChildren("name") != null && !p.getChildren("name").isEmpty() - && name.equals(p.getChildren("name").get(0).getValue())) { - return Boolean.parseBoolean((String) p.getChildren("value").get(0).getValue()); - } + String value = this.properties.get(name); + if (value != null) { + return Boolean.parseBoolean(value); } return d; } diff --git a/smart-zeppelin/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinLocationStrategy.java b/smart-zeppelin/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinLocationStrategy.java new file mode 100644 index 00000000000..81e9c60dfcd --- /dev/null +++ b/smart-zeppelin/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinLocationStrategy.java @@ -0,0 +1,74 @@ +/* + * 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.zeppelin.conf; + +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.util.Map; + +import org.apache.commons.configuration2.io.FileLocationStrategy; +import org.apache.commons.configuration2.io.FileLocator; +import org.apache.commons.configuration2.io.FileSystem; +import org.apache.commons.exec.environment.EnvironmentUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Implements a custom file location strategy for locating Zeppelin configuration files. + * This strategy checks for the presence of certain environment variables to determine + * the directory of Zeppelin configuration files and attempts to locate a specific configuration + * file within this directory. + *

+ * The strategy first checks the {@code ZEPPELIN_HOME} environment variable to construct the path + * to the configuration file. If {@code ZEPPELIN_HOME} is not set, it then checks + * the {@code ZEPPELIN_CONF_DIR} environment variable as an alternative. If the file + * exists at the constructed path, its URL is returned; otherwise, {@code null} is returned, + * indicating that the file could not be located. + */ +public class ZeppelinLocationStrategy implements FileLocationStrategy { + + private static final Logger LOGGER = LoggerFactory.getLogger(ZeppelinLocationStrategy.class); + + @Override + public URL locate(FileSystem fileSystem, FileLocator locator) { + try { + Map procEnv = EnvironmentUtils.getProcEnvironment(); + if (procEnv.containsKey("ZEPPELIN_HOME")) { + String zconfDir = procEnv.get("ZEPPELIN_HOME"); + File file = new File(zconfDir + File.separator + "conf" + File.separator + + locator.getFileName()); + if (file.isFile()) { + LOGGER.info("Load configuration from {}", file); + return file.toURI().toURL(); + } + } + + if (procEnv.containsKey("ZEPPELIN_CONF_DIR")) { + String zconfDir = procEnv.get("ZEPPELIN_CONF_DIR"); + File file = new File(zconfDir + File.separator + locator.getFileName()); + if (file.isFile()) { + LOGGER.info("Load configuration from {}", file); + return file.toURI().toURL(); + } + } + } catch (IOException e) { + LOGGER.error(e.getMessage(), e); + } + return null; + } +} diff --git a/smart-zeppelin/zeppelin-zengine/src/test/java/org/apache/zeppelin/conf/ZeppelinConfigurationTest.java b/smart-zeppelin/zeppelin-zengine/src/test/java/org/apache/zeppelin/conf/ZeppelinConfigurationTest.java index 3cc1022c2e7..bf12a87e418 100644 --- a/smart-zeppelin/zeppelin-zengine/src/test/java/org/apache/zeppelin/conf/ZeppelinConfigurationTest.java +++ b/smart-zeppelin/zeppelin-zengine/src/test/java/org/apache/zeppelin/conf/ZeppelinConfigurationTest.java @@ -18,7 +18,7 @@ import junit.framework.Assert; -import org.apache.commons.configuration.ConfigurationException; +import org.apache.commons.configuration2.ex.ConfigurationException; import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars; import org.junit.Before; @@ -34,67 +34,69 @@ * Created by joelz on 8/19/15. */ public class ZeppelinConfigurationTest { + @Before public void clearSystemVariables() { + ZeppelinConfiguration.reset(); System.clearProperty(ConfVars.ZEPPELIN_NOTEBOOK_DIR.getVarName()); } @Test public void getAllowedOrigins2Test() throws MalformedURLException, ConfigurationException { - - ZeppelinConfiguration conf = new ZeppelinConfiguration(this.getClass().getResource("/test-zeppelin-site2.xml")); + ZeppelinConfiguration conf = ZeppelinConfiguration.create("test-zeppelin-site2.xml"); List origins = conf.getAllowedOrigins(); Assert.assertEquals(2, origins.size()); Assert.assertEquals("http://onehost:8080", origins.get(0)); Assert.assertEquals("http://otherhost.com", origins.get(1)); + ZeppelinConfiguration.reset(); } @Test public void getAllowedOrigins1Test() throws MalformedURLException, ConfigurationException { - - ZeppelinConfiguration conf = new ZeppelinConfiguration(this.getClass().getResource("/test-zeppelin-site1.xml")); + ZeppelinConfiguration conf = ZeppelinConfiguration.create("test-zeppelin-site1.xml"); List origins = conf.getAllowedOrigins(); Assert.assertEquals(1, origins.size()); Assert.assertEquals("http://onehost:8080", origins.get(0)); + ZeppelinConfiguration.reset(); } @Test public void getAllowedOriginsNoneTest() throws MalformedURLException, ConfigurationException { - - ZeppelinConfiguration conf = new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml")); + ZeppelinConfiguration conf = ZeppelinConfiguration.create("zeppelin-site.xml"); List origins = conf.getAllowedOrigins(); Assert.assertEquals(1, origins.size()); + ZeppelinConfiguration.reset(); } @Test public void isWindowsPathTestTrue() throws ConfigurationException { - - ZeppelinConfiguration conf = new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml")); + ZeppelinConfiguration conf = ZeppelinConfiguration.create("zeppelin-site.xml"); Boolean isIt = conf.isWindowsPath("c:\\test\\file.txt"); Assert.assertTrue(isIt); + ZeppelinConfiguration.reset(); } @Test public void isWindowsPathTestFalse() throws ConfigurationException { - - ZeppelinConfiguration conf = new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml")); + ZeppelinConfiguration conf = ZeppelinConfiguration.create("zeppelin-site.xml"); Boolean isIt = conf.isWindowsPath("~/test/file.xml"); Assert.assertFalse(isIt); + ZeppelinConfiguration.reset(); } @Test public void getNotebookDirTest() throws ConfigurationException { - - ZeppelinConfiguration conf = new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml")); + ZeppelinConfiguration conf = ZeppelinConfiguration.create("zeppelin-site.xml"); String notebookLocation = conf.getNotebookDir(); Assert.assertEquals("notebook", notebookLocation); + ZeppelinConfiguration.reset(); } @Test public void isNotebookPublicTest() throws ConfigurationException { - - ZeppelinConfiguration conf = new ZeppelinConfiguration(this.getClass().getResource("/zeppelin-site.xml")); + ZeppelinConfiguration conf = ZeppelinConfiguration.create("zeppelin-site.xml"); boolean isIt = conf.isNotebokPublic(); assertTrue(isIt); + ZeppelinConfiguration.reset(); } } diff --git a/smart-zeppelin/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumVisualizationFactoryTest.java b/smart-zeppelin/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumVisualizationFactoryTest.java index e16ccd3a7c7..92d75aa5cdb 100644 --- a/smart-zeppelin/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumVisualizationFactoryTest.java +++ b/smart-zeppelin/zeppelin-zengine/src/test/java/org/apache/zeppelin/helium/HeliumVisualizationFactoryTest.java @@ -50,7 +50,7 @@ public void setUp() throws InstallationException, TaskRunnerException { String resDir = new File(res.getFile()).getParent(); File moduleDir = new File(resDir + "/../../../../zeppelin-web/src/app/"); - conf = new ZeppelinConfiguration(); + conf = ZeppelinConfiguration.create(); hvf = new HeliumVisualizationFactory(conf, tmpDir, diff --git a/smart-zeppelin/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/zeppelinhub/ZeppelinHubRepoTest.java b/smart-zeppelin/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/zeppelinhub/ZeppelinHubRepoTest.java index 251795a2131..2f73dfeda0d 100644 --- a/smart-zeppelin/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/zeppelinhub/ZeppelinHubRepoTest.java +++ b/smart-zeppelin/zeppelin-zengine/src/test/java/org/apache/zeppelin/notebook/repo/zeppelinhub/ZeppelinHubRepoTest.java @@ -34,7 +34,7 @@ public void setUp() throws Exception { System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, testAddr); System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_TOKEN, token); - ZeppelinConfiguration conf = new ZeppelinConfiguration(); + ZeppelinConfiguration conf = ZeppelinConfiguration.create(); repo = new ZeppelinHubRepo(conf); repo.setZeppelinhubRestApiHandler(getMockedZeppelinHandler()); } @@ -57,25 +57,25 @@ private ZeppelinhubRestApiHandler getMockedZeppelinHandler() throws HttpExceptio public void testGetZeppelinhubUrl() { System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, testAddr); - ZeppelinConfiguration config = new ZeppelinConfiguration(); + ZeppelinConfiguration config = ZeppelinConfiguration.create(); ZeppelinHubRepo repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinHubUrl(config)).isEqualTo("http://zeppelinhub.ltd"); System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, "yolow"); - config = new ZeppelinConfiguration(); + config = ZeppelinConfiguration.create(); repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinHubUrl(config)).isEqualTo("https://www.zeppelinhub.com"); System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, "http://zeppelinhub.ltd:4242"); - config = new ZeppelinConfiguration(); + config = ZeppelinConfiguration.create(); repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinHubUrl(config)).isEqualTo("http://zeppelinhub.ltd:4242"); System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, "http://zeppelinhub.ltd:0"); - config = new ZeppelinConfiguration(); + config = ZeppelinConfiguration.create(); repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinHubUrl(config)).isEqualTo("http://zeppelinhub.ltd"); } @@ -84,43 +84,43 @@ public void testGetZeppelinhubUrl() { public void testGetZeppelinHubWsEndpoint() { System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, testAddr); - ZeppelinConfiguration config = new ZeppelinConfiguration(); + ZeppelinConfiguration config = ZeppelinConfiguration.create(); ZeppelinHubRepo repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinhubWebsocketUri(config)).isEqualTo("ws://zeppelinhub.ltd:80/async"); System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, "https://zeppelinhub.ltd"); - config = new ZeppelinConfiguration(); + config = ZeppelinConfiguration.create(); repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinhubWebsocketUri(config)).isEqualTo("wss://zeppelinhub.ltd:443/async"); System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, "yolow"); - config = new ZeppelinConfiguration(); + config = ZeppelinConfiguration.create(); repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinhubWebsocketUri(config)).isEqualTo("wss://www.zeppelinhub.com:443/async"); System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, "http://zeppelinhub.ltd:4242"); - config = new ZeppelinConfiguration(); + config = ZeppelinConfiguration.create(); repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinhubWebsocketUri(config)).isEqualTo("ws://zeppelinhub.ltd:4242/async"); System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, "https://www.zeppelinhub.com"); - config = new ZeppelinConfiguration(); + config = ZeppelinConfiguration.create(); repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinhubWebsocketUri(config)).isEqualTo("wss://www.zeppelinhub.com:443/async"); System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, "http://www.zeppelinhub.com"); - config = new ZeppelinConfiguration(); + config = ZeppelinConfiguration.create(); repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinhubWebsocketUri(config)).isEqualTo("ws://www.zeppelinhub.com:80/async"); System.setProperty(ZeppelinHubRepo.ZEPPELIN_CONF_PROP_NAME_SERVER, "https://www.zeppelinhub.com:4242"); - config = new ZeppelinConfiguration(); + config = ZeppelinConfiguration.create(); repository = new ZeppelinHubRepo(config); assertThat(repository.getZeppelinhubWebsocketUri(config)).isEqualTo("wss://www.zeppelinhub.com:4242/async"); }