mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Removed public static void register(String name, String className)
This commit is contained in:
parent
6fd41fa3c5
commit
71a2377cf2
9 changed files with 69 additions and 48 deletions
|
|
@ -394,10 +394,6 @@ public abstract class Interpreter {
|
|||
public static Map<String, RegisteredInterpreter> registeredInterpreters = Collections
|
||||
.synchronizedMap(new HashMap<String, RegisteredInterpreter>());
|
||||
|
||||
public static void register(String name, String className) {
|
||||
register(name, name, className);
|
||||
}
|
||||
|
||||
public static void register(String name, String group, String className) {
|
||||
register(name, group, className, false, new HashMap<String, InterpreterProperty>());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,15 +29,6 @@ import java.util.Properties;
|
|||
* MockInterpreter to test outputstream
|
||||
*/
|
||||
public class MockInterpreterOutputStream extends Interpreter {
|
||||
static {
|
||||
Interpreter.register(
|
||||
"interpreterOutputStream",
|
||||
"group1",
|
||||
MockInterpreterA.class.getName(),
|
||||
new InterpreterPropertyBuilder().build());
|
||||
|
||||
}
|
||||
|
||||
private String lastSt;
|
||||
|
||||
public MockInterpreterOutputStream(Properties property) {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public class InterpreterInfo {
|
|||
private boolean defaultInterpreter = false;
|
||||
private Map<String, Object> editor;
|
||||
|
||||
InterpreterInfo(String className, String name, boolean defaultInterpreter,
|
||||
public InterpreterInfo(String className, String name, boolean defaultInterpreter,
|
||||
Map<String, Object> editor) {
|
||||
this.className = className;
|
||||
this.name = name;
|
||||
|
|
|
|||
|
|
@ -16,8 +16,10 @@
|
|||
*/
|
||||
package org.apache.zeppelin.helium;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.zeppelin.conf.ZeppelinConfiguration;
|
||||
import org.apache.zeppelin.dep.Dependency;
|
||||
import org.apache.zeppelin.dep.DependencyResolver;
|
||||
import org.apache.zeppelin.interpreter.*;
|
||||
import org.apache.zeppelin.interpreter.mock.MockInterpreter1;
|
||||
|
|
@ -35,9 +37,11 @@ import org.junit.Test;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.mock;
|
||||
|
|
@ -73,16 +77,11 @@ public class HeliumApplicationFactoryTest implements JobListenerFactory {
|
|||
System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_HOME.getVarName(), home.getAbsolutePath());
|
||||
System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_CONF_DIR.getVarName(), tmpDir.getAbsolutePath() + "/conf");
|
||||
System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_NOTEBOOK_DIR.getVarName(), notebookDir.getAbsolutePath());
|
||||
System.setProperty(ZeppelinConfiguration.ConfVars.ZEPPELIN_INTERPRETERS.getVarName(), "org.apache.zeppelin.interpreter.mock.MockInterpreter1,org.apache.zeppelin.interpreter.mock.MockInterpreter2");
|
||||
|
||||
conf = new ZeppelinConfiguration();
|
||||
|
||||
this.schedulerFactory = new SchedulerFactory();
|
||||
|
||||
MockInterpreter1.register("mock1", "org.apache.zeppelin.interpreter.mock.MockInterpreter1");
|
||||
MockInterpreter2.register("mock2", "org.apache.zeppelin.interpreter.mock.MockInterpreter2");
|
||||
|
||||
|
||||
heliumAppFactory = new HeliumApplicationFactory();
|
||||
depResolver = new DependencyResolver(tmpDir.getAbsolutePath() + "/local-repo");
|
||||
interpreterSettingManager = new InterpreterSettingManager(conf, depResolver, new InterpreterOption(true));
|
||||
|
|
@ -91,6 +90,18 @@ public class HeliumApplicationFactoryTest implements JobListenerFactory {
|
|||
env.put("ZEPPELIN_CLASSPATH", new File("./target/test-classes").getAbsolutePath());
|
||||
factory.setEnv(env);
|
||||
|
||||
ArrayList<InterpreterInfo> interpreterInfos = new ArrayList<>();
|
||||
interpreterInfos.add(new InterpreterInfo(MockInterpreter1.class.getName(), "mock1", true, new HashMap<String, Object>()));
|
||||
factory.add("mock1", interpreterInfos, new ArrayList<Dependency>(), new InterpreterOption(),
|
||||
Maps.<String, InterpreterProperty>newHashMap(), "mock1");
|
||||
factory.createNewSetting("mock1", "mock1", new ArrayList<Dependency>(), new InterpreterOption(), new Properties());
|
||||
|
||||
ArrayList<InterpreterInfo> interpreterInfos2 = new ArrayList<>();
|
||||
interpreterInfos2.add(new InterpreterInfo(MockInterpreter2.class.getName(), "mock2", true, new HashMap<String, Object>()));
|
||||
factory.add("mock2", interpreterInfos2, new ArrayList<Dependency>(), new InterpreterOption(),
|
||||
Maps.<String, InterpreterProperty>newHashMap(), "mock2");
|
||||
factory.createNewSetting("mock2", "mock2", new ArrayList<Dependency>(), new InterpreterOption(), new Properties());
|
||||
|
||||
SearchService search = mock(SearchService.class);
|
||||
notebookRepo = new VFSNotebookRepo(conf);
|
||||
NotebookAuthorization notebookAuthorization = NotebookAuthorization.init(conf);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import java.util.Map;
|
|||
import java.util.HashMap;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.gson.Gson;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang.NullArgumentException;
|
||||
|
|
@ -87,17 +88,17 @@ public class InterpreterFactoryTest {
|
|||
new File(tmpDir, "conf").mkdirs();
|
||||
FileUtils.copyDirectory(new File("src/test/resources/interpreter"), new File(tmpDir, "interpreter"));
|
||||
|
||||
Map<String, InterpreterProperty> propertiesMockInterpreter1 = new HashMap<>();
|
||||
propertiesMockInterpreter1.put("PROPERTY_1", new InterpreterProperty("PROPERTY_1", "", "VALUE_1", "desc"));
|
||||
propertiesMockInterpreter1.put("property_2", new InterpreterProperty("", "property_2", "value_2", "desc"));
|
||||
MockInterpreter1.register("mock1", "mock1", "org.apache.zeppelin.interpreter.mock.MockInterpreter1", propertiesMockInterpreter1);
|
||||
MockInterpreter2.register("mock2", "org.apache.zeppelin.interpreter.mock.MockInterpreter2");
|
||||
// Map<String, InterpreterProperty> propertiesMockInterpreter1 = new HashMap<>();
|
||||
// propertiesMockInterpreter1.put("PROPERTY_1", new InterpreterProperty("PROPERTY_1", "", "VALUE_1", "desc"));
|
||||
// propertiesMockInterpreter1.put("property_2", new InterpreterProperty("", "property_2", "value_2", "desc"));
|
||||
// MockInterpreter1.register("mock1", "mock1", "org.apache.zeppelin.interpreter.mock.MockInterpreter1", propertiesMockInterpreter1);
|
||||
// MockInterpreter2.register("mock2", "org.apache.zeppelin.interpreter.mock.MockInterpreter2");
|
||||
|
||||
System.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), tmpDir.getAbsolutePath());
|
||||
System.setProperty(ConfVars.ZEPPELIN_INTERPRETERS.getVarName(),
|
||||
"org.apache.zeppelin.interpreter.mock.MockInterpreter1," +
|
||||
"org.apache.zeppelin.interpreter.mock.MockInterpreter2," +
|
||||
"org.apache.zeppelin.interpreter.mock.MockInterpreter11");
|
||||
// System.setProperty(ConfVars.ZEPPELIN_INTERPRETERS.getVarName(),
|
||||
// "org.apache.zeppelin.interpreter.mock.MockInterpreter1," +
|
||||
// "org.apache.zeppelin.interpreter.mock.MockInterpreter2," +
|
||||
// "org.apache.zeppelin.interpreter.mock.MockInterpreter11");
|
||||
System.setProperty(ConfVars.ZEPPELIN_INTERPRETER_GROUP_ORDER.getVarName(),
|
||||
"mock1,mock2,mock11,dev");
|
||||
conf = new ZeppelinConfiguration();
|
||||
|
|
@ -107,6 +108,21 @@ public class InterpreterFactoryTest {
|
|||
factory = new InterpreterFactory(conf, null, null, null, depResolver, false, interpreterSettingManager);
|
||||
context = new InterpreterContext("note", "id", null, "title", "text", null, null, null, null, null, null, null);
|
||||
|
||||
ArrayList<InterpreterInfo> interpreterInfos = new ArrayList<>();
|
||||
interpreterInfos.add(new InterpreterInfo(MockInterpreter1.class.getName(), "mock1", true, new HashMap<String, Object>()));
|
||||
interpreterSettingManager.add("mock1", interpreterInfos, new ArrayList<Dependency>(), new InterpreterOption(),
|
||||
Maps.<String, InterpreterProperty>newHashMap(), "mock1");
|
||||
Properties intp1Properties = new Properties();
|
||||
intp1Properties.put("PROPERTY_1", "VALUE_1");
|
||||
intp1Properties.put("property_2", "value_2");
|
||||
interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList<Dependency>(), new InterpreterOption(true), intp1Properties);
|
||||
|
||||
ArrayList<InterpreterInfo> interpreterInfos2 = new ArrayList<>();
|
||||
interpreterInfos2.add(new InterpreterInfo(MockInterpreter2.class.getName(), "mock2", true, new HashMap<String, Object>()));
|
||||
interpreterSettingManager.add("mock2", interpreterInfos2, new ArrayList<Dependency>(), new InterpreterOption(),
|
||||
Maps.<String, InterpreterProperty>newHashMap(), "mock2");
|
||||
interpreterSettingManager.createNewSetting("mock2", "mock2", new ArrayList<Dependency>(), new InterpreterOption(), new Properties());
|
||||
|
||||
SearchService search = mock(SearchService.class);
|
||||
notebookRepo = new VFSNotebookRepo(conf);
|
||||
notebookAuthorization = NotebookAuthorization.init(conf);
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import com.google.common.collect.Sets;
|
|||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.zeppelin.conf.ZeppelinConfiguration;
|
||||
import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars;
|
||||
import org.apache.zeppelin.dep.Dependency;
|
||||
import org.apache.zeppelin.dep.DependencyResolver;
|
||||
import org.apache.zeppelin.display.AngularObjectRegistry;
|
||||
import org.apache.zeppelin.interpreter.*;
|
||||
|
|
@ -83,19 +84,28 @@ public class NotebookTest implements JobListenerFactory{
|
|||
System.setProperty(ConfVars.ZEPPELIN_CONF_DIR.getVarName(), tmpDir.toString() + "/conf");
|
||||
System.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), tmpDir.getAbsolutePath());
|
||||
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_DIR.getVarName(), notebookDir.getAbsolutePath());
|
||||
System.setProperty(ConfVars.ZEPPELIN_INTERPRETERS.getVarName(), "org.apache.zeppelin.interpreter.mock.MockInterpreter1,org.apache.zeppelin.interpreter.mock.MockInterpreter2");
|
||||
|
||||
conf = ZeppelinConfiguration.create();
|
||||
|
||||
this.schedulerFactory = new SchedulerFactory();
|
||||
|
||||
MockInterpreter1.register("mock1", "org.apache.zeppelin.interpreter.mock.MockInterpreter1");
|
||||
MockInterpreter2.register("mock2", "org.apache.zeppelin.interpreter.mock.MockInterpreter2");
|
||||
|
||||
depResolver = new DependencyResolver(tmpDir.getAbsolutePath() + "/local-repo");
|
||||
interpreterSettingManager = new InterpreterSettingManager(conf, depResolver, new InterpreterOption(false));
|
||||
factory = new InterpreterFactory(conf, null, null, null, depResolver, false, interpreterSettingManager);
|
||||
|
||||
ArrayList<InterpreterInfo> interpreterInfos = new ArrayList<>();
|
||||
interpreterInfos.add(new InterpreterInfo(MockInterpreter1.class.getName(), "mock1", true, new HashMap<String, Object>()));
|
||||
factory.add("mock1", interpreterInfos, new ArrayList<Dependency>(), new InterpreterOption(),
|
||||
Maps.<String, InterpreterProperty>newHashMap(), "mock1");
|
||||
factory.createNewSetting("mock1", "mock1", new ArrayList<Dependency>(), new InterpreterOption(), new Properties());
|
||||
|
||||
ArrayList<InterpreterInfo> interpreterInfos2 = new ArrayList<>();
|
||||
interpreterInfos2.add(new InterpreterInfo(MockInterpreter2.class.getName(), "mock2", true, new HashMap<String, Object>()));
|
||||
factory.add("mock2", interpreterInfos2, new ArrayList<Dependency>(), new InterpreterOption(),
|
||||
Maps.<String, InterpreterProperty>newHashMap(), "mock2");
|
||||
factory.createNewSetting("mock2", "mock2", new ArrayList<Dependency>(), new InterpreterOption(), new Properties());
|
||||
|
||||
|
||||
SearchService search = mock(SearchService.class);
|
||||
notebookRepo = new VFSNotebookRepo(conf);
|
||||
notebookAuthorization = NotebookAuthorization.init(conf);
|
||||
|
|
|
|||
|
|
@ -78,12 +78,8 @@ public class GitNotebookRepoTest {
|
|||
|
||||
System.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), zeppelinDir.getAbsolutePath());
|
||||
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_DIR.getVarName(), notebookDir.getAbsolutePath());
|
||||
System.setProperty(ConfVars.ZEPPELIN_INTERPRETERS.getVarName(), "org.apache.zeppelin.interpreter.mock.MockInterpreter1,org.apache.zeppelin.interpreter.mock.MockInterpreter2");
|
||||
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE.getVarName(), "org.apache.zeppelin.notebook.repo.GitNotebookRepo");
|
||||
|
||||
MockInterpreter1.register("mock1", "org.apache.zeppelin.interpreter.mock.MockInterpreter1");
|
||||
MockInterpreter2.register("mock2", "org.apache.zeppelin.interpreter.mock.MockInterpreter2");
|
||||
|
||||
conf = ZeppelinConfiguration.create();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,18 +35,13 @@ import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars;
|
|||
import org.apache.zeppelin.dep.DependencyResolver;
|
||||
import org.apache.zeppelin.interpreter.InterpreterFactory;
|
||||
import org.apache.zeppelin.interpreter.InterpreterOption;
|
||||
import org.apache.zeppelin.interpreter.InterpreterOutput;
|
||||
import org.apache.zeppelin.interpreter.InterpreterResultMessage;
|
||||
import org.apache.zeppelin.interpreter.InterpreterSettingManager;
|
||||
import org.apache.zeppelin.interpreter.mock.MockInterpreter1;
|
||||
import org.apache.zeppelin.interpreter.mock.MockInterpreter2;
|
||||
import org.apache.zeppelin.notebook.*;
|
||||
import org.apache.zeppelin.scheduler.Job;
|
||||
import org.apache.zeppelin.scheduler.Job.Status;
|
||||
import org.apache.zeppelin.scheduler.JobListener;
|
||||
import org.apache.zeppelin.scheduler.SchedulerFactory;
|
||||
import org.apache.zeppelin.search.SearchService;
|
||||
import org.apache.zeppelin.search.LuceneSearch;
|
||||
import org.apache.zeppelin.user.AuthenticationInfo;
|
||||
import org.apache.zeppelin.user.Credentials;
|
||||
import org.junit.After;
|
||||
|
|
@ -90,7 +85,6 @@ public class NotebookRepoSyncTest implements JobListenerFactory {
|
|||
|
||||
System.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), mainZepDir.getAbsolutePath());
|
||||
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_DIR.getVarName(), mainNotebookDir.getAbsolutePath());
|
||||
System.setProperty(ConfVars.ZEPPELIN_INTERPRETERS.getVarName(), "org.apache.zeppelin.interpreter.mock.MockInterpreter1,org.apache.zeppelin.interpreter.mock.MockInterpreter2");
|
||||
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE.getVarName(), "org.apache.zeppelin.notebook.repo.VFSNotebookRepo,org.apache.zeppelin.notebook.repo.mock.VFSNotebookRepoMock");
|
||||
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_ONE_WAY_SYNC.getVarName(), "false");
|
||||
LOG.info("main Note dir : " + mainNotePath);
|
||||
|
|
@ -99,9 +93,6 @@ public class NotebookRepoSyncTest implements JobListenerFactory {
|
|||
|
||||
this.schedulerFactory = new SchedulerFactory();
|
||||
|
||||
MockInterpreter1.register("mock1", "org.apache.zeppelin.interpreter.mock.MockInterpreter1");
|
||||
MockInterpreter2.register("mock2", "org.apache.zeppelin.interpreter.mock.MockInterpreter2");
|
||||
|
||||
depResolver = new DependencyResolver(mainZepDir.getAbsolutePath() + "/local-repo");
|
||||
interpreterSettingManager = new InterpreterSettingManager(conf, depResolver, new InterpreterOption(true));
|
||||
factory = new InterpreterFactory(conf, null, null, null, depResolver, false, interpreterSettingManager);
|
||||
|
|
|
|||
|
|
@ -22,15 +22,22 @@ import static org.mockito.Mockito.mock;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.zeppelin.conf.ZeppelinConfiguration;
|
||||
import org.apache.zeppelin.conf.ZeppelinConfiguration.ConfVars;
|
||||
import org.apache.zeppelin.dep.Dependency;
|
||||
import org.apache.zeppelin.dep.DependencyResolver;
|
||||
import org.apache.zeppelin.interpreter.InterpreterFactory;
|
||||
import org.apache.zeppelin.interpreter.InterpreterInfo;
|
||||
import org.apache.zeppelin.interpreter.InterpreterOption;
|
||||
import org.apache.zeppelin.interpreter.InterpreterProperty;
|
||||
import org.apache.zeppelin.interpreter.InterpreterSettingManager;
|
||||
import org.apache.zeppelin.interpreter.mock.MockInterpreter1;
|
||||
import org.apache.zeppelin.notebook.JobListenerFactory;
|
||||
|
|
@ -76,19 +83,22 @@ public class VFSNotebookRepoTest implements JobListenerFactory {
|
|||
|
||||
System.setProperty(ConfVars.ZEPPELIN_HOME.getVarName(), mainZepDir.getAbsolutePath());
|
||||
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_DIR.getVarName(), mainNotebookDir.getAbsolutePath());
|
||||
System.setProperty(ConfVars.ZEPPELIN_INTERPRETERS.getVarName(), "org.apache.zeppelin.interpreter.mock.MockInterpreter1");
|
||||
System.setProperty(ConfVars.ZEPPELIN_NOTEBOOK_STORAGE.getVarName(), "org.apache.zeppelin.notebook.repo.VFSNotebookRepo");
|
||||
conf = ZeppelinConfiguration.create();
|
||||
|
||||
this.schedulerFactory = new SchedulerFactory();
|
||||
|
||||
MockInterpreter1.register("mock1", "org.apache.zeppelin.interpreter.mock.MockInterpreter1");
|
||||
|
||||
this.schedulerFactory = new SchedulerFactory();
|
||||
depResolver = new DependencyResolver(mainZepDir.getAbsolutePath() + "/local-repo");
|
||||
interpreterSettingManager = new InterpreterSettingManager(conf, depResolver, new InterpreterOption(true));
|
||||
factory = new InterpreterFactory(conf, null, null, null, depResolver, false, interpreterSettingManager);
|
||||
|
||||
ArrayList<InterpreterInfo> interpreterInfos = new ArrayList<>();
|
||||
interpreterInfos.add(new InterpreterInfo(MockInterpreter1.class.getName(), "mock1", true, new HashMap<String, Object>()));
|
||||
interpreterSettingManager.add("mock1", interpreterInfos, new ArrayList<Dependency>(), new InterpreterOption(),
|
||||
Maps.<String, InterpreterProperty>newHashMap(), "mock1");
|
||||
interpreterSettingManager.createNewSetting("mock1", "mock1", new ArrayList<Dependency>(), new InterpreterOption(), new Properties());
|
||||
|
||||
SearchService search = mock(SearchService.class);
|
||||
notebookRepo = new VFSNotebookRepo(conf);
|
||||
notebookAuthorization = NotebookAuthorization.init(conf);
|
||||
|
|
|
|||
Loading…
Reference in a new issue