Search in sources :

Example 6 with AuthenticationInfo

use of org.apache.zeppelin.user.AuthenticationInfo in project zeppelin by apache.

the class JDBCInterpreterTest method setUp.

@Before
public void setUp() throws Exception {
    Class.forName("org.h2.Driver");
    Connection connection = DriverManager.getConnection(getJdbcConnection());
    Statement statement = connection.createStatement();
    statement.execute("DROP TABLE IF EXISTS test_table; " + "CREATE TABLE test_table(id varchar(255), name varchar(255));");
    PreparedStatement insertStatement = connection.prepareStatement("insert into test_table(id, name) values ('a', 'a_name'),('b', 'b_name'),('c', ?);");
    insertStatement.setString(1, null);
    insertStatement.execute();
    interpreterContext = new InterpreterContext("", "1", null, "", "", new AuthenticationInfo(), null, null, null, null, null, null);
}
Also used : InterpreterContext(org.apache.zeppelin.interpreter.InterpreterContext) AuthenticationInfo(org.apache.zeppelin.user.AuthenticationInfo) Before(org.junit.Before)

Example 7 with AuthenticationInfo

use of org.apache.zeppelin.user.AuthenticationInfo in project zeppelin by apache.

the class JDBCInterpreterTest method getUserAuth.

private AuthenticationInfo getUserAuth(String user, String entityName, String dbUser, String dbPassword) {
    UserCredentials userCredentials = new UserCredentials();
    if (entityName != null && dbUser != null && dbPassword != null) {
        UsernamePassword up = new UsernamePassword(dbUser, dbPassword);
        userCredentials.putUsernamePassword(entityName, up);
    }
    AuthenticationInfo authInfo = new AuthenticationInfo();
    authInfo.setUserCredentials(userCredentials);
    authInfo.setUser(user);
    return authInfo;
}
Also used : UserCredentials(org.apache.zeppelin.user.UserCredentials) AuthenticationInfo(org.apache.zeppelin.user.AuthenticationInfo) UsernamePassword(org.apache.zeppelin.user.UsernamePassword)

Example 8 with AuthenticationInfo

use of org.apache.zeppelin.user.AuthenticationInfo in project zeppelin by apache.

the class RemoteAngularObjectTest method setUp.

@Before
public void setUp() throws Exception {
    onAdd = new AtomicInteger(0);
    onUpdate = new AtomicInteger(0);
    onRemove = new AtomicInteger(0);
    intpGroup = new InterpreterGroup("intpId");
    localRegistry = new RemoteAngularObjectRegistry("intpId", this, intpGroup);
    intpGroup.setAngularObjectRegistry(localRegistry);
    env = new HashMap<>();
    env.put("ZEPPELIN_CLASSPATH", new File("./target/test-classes").getAbsolutePath());
    Properties p = new Properties();
    intp = new RemoteInterpreter(p, "note", MockInterpreterAngular.class.getName(), new File(INTERPRETER_SCRIPT).getAbsolutePath(), "fake", "fakeRepo", env, 10 * 1000, null, null, "anonymous", false);
    intpGroup.put("note", new LinkedList<Interpreter>());
    intpGroup.get("note").add(intp);
    intp.setInterpreterGroup(intpGroup);
    context = new InterpreterContext("note", "id", null, "title", "text", new AuthenticationInfo(), new HashMap<String, Object>(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), new LocalResourcePool("pool1"), new LinkedList<InterpreterContextRunner>(), null);
    intp.open();
}
Also used : LocalResourcePool(org.apache.zeppelin.resource.LocalResourcePool) HashMap(java.util.HashMap) Properties(java.util.Properties) AuthenticationInfo(org.apache.zeppelin.user.AuthenticationInfo) LinkedList(java.util.LinkedList) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) File(java.io.File) Before(org.junit.Before)

Example 9 with AuthenticationInfo

use of org.apache.zeppelin.user.AuthenticationInfo in project zeppelin by apache.

the class DepInterpreterTest method setUp.

@Before
public void setUp() throws Exception {
    Properties p = getTestProperties();
    dep = new DepInterpreter(p);
    dep.open();
    InterpreterGroup intpGroup = new InterpreterGroup();
    intpGroup.put("note", new LinkedList<Interpreter>());
    intpGroup.get("note").add(new SparkInterpreter(p));
    intpGroup.get("note").add(dep);
    dep.setInterpreterGroup(intpGroup);
    context = new InterpreterContext("note", "id", null, "title", "text", new AuthenticationInfo(), new HashMap<String, Object>(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), null, new LinkedList<InterpreterContextRunner>(), null);
}
Also used : HashMap(java.util.HashMap) GUI(org.apache.zeppelin.display.GUI) Properties(java.util.Properties) AuthenticationInfo(org.apache.zeppelin.user.AuthenticationInfo) AngularObjectRegistry(org.apache.zeppelin.display.AngularObjectRegistry) LinkedList(java.util.LinkedList) Before(org.junit.Before)

Example 10 with AuthenticationInfo

use of org.apache.zeppelin.user.AuthenticationInfo in project zeppelin by apache.

the class SparkInterpreterTest method testParagraphUrls.

@Test
public void testParagraphUrls() {
    String paraId = "test_para_job_url";
    InterpreterContext intpCtx = new InterpreterContext("note", paraId, null, "title", "text", new AuthenticationInfo(), new HashMap<String, Object>(), new GUI(), new AngularObjectRegistry(intpGroup.getId(), null), new LocalResourcePool("id"), new LinkedList<InterpreterContextRunner>(), new InterpreterOutput(null));
    repl.interpret("sc.parallelize(1 to 10).map(x => {x}).collect", intpCtx);
    Map<String, String> paraInfos = paraIdToInfosMap.get(intpCtx.getParagraphId());
    String jobUrl = null;
    if (paraInfos != null) {
        jobUrl = paraInfos.get("jobUrl");
    }
    String sparkUIUrl = repl.getSparkUIUrl();
    assertNotNull(jobUrl);
    assertTrue(jobUrl.startsWith(sparkUIUrl + "/jobs/job?id="));
}
Also used : LocalResourcePool(org.apache.zeppelin.resource.LocalResourcePool) GUI(org.apache.zeppelin.display.GUI) AuthenticationInfo(org.apache.zeppelin.user.AuthenticationInfo) AngularObjectRegistry(org.apache.zeppelin.display.AngularObjectRegistry)

Aggregations

AuthenticationInfo (org.apache.zeppelin.user.AuthenticationInfo)88 HashMap (java.util.HashMap)27 Note (org.apache.zeppelin.notebook.Note)27 Test (org.junit.Test)22 LinkedList (java.util.LinkedList)19 Properties (java.util.Properties)19 AngularObjectRegistry (org.apache.zeppelin.display.AngularObjectRegistry)19 GUI (org.apache.zeppelin.display.GUI)19 LocalResourcePool (org.apache.zeppelin.resource.LocalResourcePool)17 ZeppelinApi (org.apache.zeppelin.annotation.ZeppelinApi)16 InterpreterResultMessage (org.apache.zeppelin.interpreter.InterpreterResultMessage)15 Path (javax.ws.rs.Path)14 Message (org.apache.zeppelin.notebook.socket.Message)14 WatcherMessage (org.apache.zeppelin.notebook.socket.WatcherMessage)14 Paragraph (org.apache.zeppelin.notebook.Paragraph)12 Before (org.junit.Before)12 Map (java.util.Map)11 File (java.io.File)10 AngularObject (org.apache.zeppelin.display.AngularObject)9 POST (javax.ws.rs.POST)6