Use new constructor introduced with ZEPPELIN-5170

This commit is contained in:
Philipp Dallig 2021-01-04 14:28:20 +01:00
parent 136140c858
commit b45c0f5709
31 changed files with 47 additions and 47 deletions

View file

@ -400,7 +400,7 @@ public class FlinkInterpreterTest {
private InterpreterContext getInterpreterContext() {
InterpreterContext context = InterpreterContext.builder()
.setParagraphId("paragraphId")
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setAngularObjectRegistry(angularObjectRegistry)
.setIntpEventClient(mock(RemoteInterpreterEventClient.class))
.build();

View file

@ -470,7 +470,7 @@ public class IPyFlinkInterpreterTest extends IPythonInterpreterTest {
InterpreterContext context = InterpreterContext.builder()
.setNoteId("noteId")
.setParagraphId("paragraphId")
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setIntpEventClient(mock(RemoteInterpreterEventClient.class))
.setAngularObjectRegistry(angularObjectRegistry)
.build();
@ -482,7 +482,7 @@ public class IPyFlinkInterpreterTest extends IPythonInterpreterTest {
InterpreterContext context = InterpreterContext.builder()
.setNoteId("noteId")
.setParagraphId("paragraphId")
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setAngularObjectRegistry(angularObjectRegistry)
.setIntpEventClient(mock(RemoteInterpreterEventClient.class))
.build();

View file

@ -133,7 +133,7 @@ public class PyFlinkInterpreterTest extends PythonInterpreterTest {
InterpreterContext context = InterpreterContext.builder()
.setNoteId("noteId")
.setParagraphId("paragraphId")
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setAngularObjectRegistry(IPyFlinkInterpreterTest.angularObjectRegistry)
.setIntpEventClient(mock(RemoteInterpreterEventClient.class))
.build();

View file

@ -567,10 +567,9 @@ public abstract class SqlInterpreterTest {
protected InterpreterContext getInterpreterContext() {
InterpreterContext context = InterpreterContext.builder()
.setParagraphId("paragraphId")
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setAngularObjectRegistry(angularObjectRegistry)
.setIntpEventClient(mock(RemoteInterpreterEventClient.class))
.setInterpreterOut(new InterpreterOutput(null))
.build();
InterpreterContext.set(context);
return context;

View file

@ -196,7 +196,7 @@ public class JDBCInterpreterInterpolationTest extends BasicJDBCTestCaseAdapter {
.setParagraphId("paragraph_1")
.setAuthenticationInfo(new AuthenticationInfo("testUser"))
.setResourcePool(resourcePool)
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.build();
}
}

View file

@ -109,7 +109,7 @@ public class JDBCInterpreterTest extends BasicJDBCTestCaseAdapter {
context = InterpreterContext.builder()
.setAuthenticationInfo(new AuthenticationInfo("testUser"))
.setParagraphId("paragraphId")
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.build();
}
@ -546,7 +546,7 @@ public class JDBCInterpreterTest extends BasicJDBCTestCaseAdapter {
// user1 runs default
InterpreterContext context = InterpreterContext.builder()
.setAuthenticationInfo(user1Credential)
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setReplName("jdbc")
.build();
jdbc.interpret("", context);
@ -558,7 +558,7 @@ public class JDBCInterpreterTest extends BasicJDBCTestCaseAdapter {
// user2 run default
context = InterpreterContext.builder()
.setAuthenticationInfo(user2Credential)
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setReplName("jdbc")
.build();
jdbc.interpret("", context);
@ -572,7 +572,7 @@ public class JDBCInterpreterTest extends BasicJDBCTestCaseAdapter {
localProperties.put("db", "hive");
context = InterpreterContext.builder()
.setAuthenticationInfo(user2Credential)
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setLocalProperties(localProperties)
.setReplName("jdbc")
.build();
@ -598,7 +598,7 @@ public class JDBCInterpreterTest extends BasicJDBCTestCaseAdapter {
// user1 runs default
InterpreterContext context = InterpreterContext.builder()
.setAuthenticationInfo(user1Credential)
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setReplName("hive")
.build();
jdbc.interpret("", context);
@ -610,7 +610,7 @@ public class JDBCInterpreterTest extends BasicJDBCTestCaseAdapter {
// user2 run default
context = InterpreterContext.builder()
.setAuthenticationInfo(user2Credential)
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setReplName("hive")
.build();
jdbc.interpret("", context);
@ -690,7 +690,7 @@ public class JDBCInterpreterTest extends BasicJDBCTestCaseAdapter {
localProperties.put("db", "anotherPrefix");
InterpreterContext context = InterpreterContext.builder()
.setAuthenticationInfo(new AuthenticationInfo("testUser"))
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setLocalProperties(localProperties)
.build();
jdbcInterpreter.executePrecode(context);
@ -773,7 +773,7 @@ public class JDBCInterpreterTest extends BasicJDBCTestCaseAdapter {
localProperties.put("db", "anotherPrefix");
InterpreterContext context = InterpreterContext.builder()
.setAuthenticationInfo(new AuthenticationInfo("testUser"))
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setLocalProperties(localProperties)
.build();
@ -822,7 +822,7 @@ public class JDBCInterpreterTest extends BasicJDBCTestCaseAdapter {
return InterpreterContext.builder()
.setAuthenticationInfo(new AuthenticationInfo("testUser"))
.setParagraphId("paragraphId")
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.build();
}
}

View file

@ -298,7 +298,7 @@ public class KotlinInterpreterTest {
private static InterpreterContext getInterpreterContext() {
output = "";
InterpreterContext context = InterpreterContext.builder()
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.build();
context.out = new InterpreterOutput(
new InterpreterOutputListener() {

View file

@ -53,7 +53,7 @@ public class KSQLInterpreterTest {
@Before
public void setUpZeppelin() throws IOException {
context = InterpreterContext.builder()
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setParagraphId("ksql-test")
.build();
}

View file

@ -72,7 +72,7 @@ public class LivySparkSQLInterpreter extends BaseLivyInterpreter {
// to judge whether it is using spark2.
try {
InterpreterContext context = InterpreterContext.builder()
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.build();
InterpreterResult result = sparkInterpreter.interpret("spark", context);
if (result.code() == InterpreterResult.Code.SUCCESS &&

View file

@ -92,7 +92,7 @@ public class Neo4jCypherInterpreterTest {
p.setProperty(Neo4jCypherInterpreter.NEO4J_MULTI_STATEMENT, "false");
interpreter = new Neo4jCypherInterpreter(p);
context = InterpreterContext.builder()
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.build();
}
@ -334,7 +334,7 @@ public class Neo4jCypherInterpreterTest {
p.setProperty(Neo4jCypherInterpreter.NEO4J_MULTI_STATEMENT, "true");
Neo4jCypherInterpreter multiLineInterpreter = new Neo4jCypherInterpreter(p);
context = InterpreterContext.builder()
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.build();
InterpreterResult result = multiLineInterpreter.interpret("CREATE (n:Node{name: ';'});" +
"\nRETURN 1 AS val;", context);

View file

@ -403,7 +403,7 @@ public abstract class BasePythonInterpreterTest extends ConcurrentTestCase {
return InterpreterContext.builder()
.setNoteId("noteId")
.setParagraphId("paragraphId")
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setIntpEventClient(mock(RemoteInterpreterEventClient.class))
.build();
}

View file

@ -134,7 +134,7 @@ public class PythonCondaInterpreterTest {
private InterpreterContext getInterpreterContext() {
return InterpreterContext.builder()
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.build();
}

View file

@ -78,7 +78,7 @@ public class PythonDockerInterpreterTest {
private InterpreterContext getInterpreterContext() {
return InterpreterContext.builder()
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.build();
}
}

View file

@ -38,7 +38,7 @@ public class IRInterpreterTest extends IRKernelTest {
InterpreterContext context = InterpreterContext.builder()
.setNoteId("note_1")
.setParagraphId("paragraph_1")
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setLocalProperties(new HashMap<>())
.build();
return context;

View file

@ -137,7 +137,7 @@ public class RInterpreterTest {
InterpreterContext context = InterpreterContext.builder()
.setNoteId("note_1")
.setParagraphId("paragraph_1")
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setLocalProperties(new HashMap<>())
.build();
return context;

View file

@ -240,7 +240,7 @@ public class ShinyInterpreterTest {
InterpreterContext context = InterpreterContext.builder()
.setNoteId("note_1")
.setParagraphId("paragraph_1")
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setLocalProperties(new HashMap<>())
.setInterpreterClassName(ShinyInterpreter.class.getName())
.setIntpEventClient(mock(RemoteInterpreterEventClient.class))

View file

@ -74,7 +74,7 @@ public abstract class BaseInterpreterTest {
.setParagraphId("paragraphId")
.setAuthenticationInfo(authenticationInfo)
.setAngularObjectRegistry(registry)
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setIntpEventClient(mock(RemoteInterpreterEventClient.class))
.build();
}

View file

@ -272,7 +272,7 @@ public class IPySparkInterpreterTest extends IPythonInterpreterTest {
.setNoteId("noteId")
.setParagraphId("paragraphId")
.setIntpEventClient(mockRemoteEventClient)
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.build();
}
}

View file

@ -103,7 +103,7 @@ public class KotlinSparkInterpreterTest {
.setParagraphTitle("title")
.setAngularObjectRegistry(new AngularObjectRegistry(intpGroup.getId(), null))
.setResourcePool(new LocalResourcePool("id"))
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setIntpEventClient(mock(RemoteInterpreterEventClient.class))
.build();
context.out = new InterpreterOutput(

View file

@ -126,7 +126,7 @@ public class PySparkInterpreterMatplotlibTest {
intpGroup.put("note", new LinkedList<Interpreter>());
context = InterpreterContext.builder()
.setNoteId("note")
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setIntpEventClient(mock(RemoteInterpreterEventClient.class))
.setAngularObjectRegistry(new AngularObjectRegistry(intpGroup.getId(), null))
.build();

View file

@ -62,7 +62,7 @@ public class PySparkInterpreterTest extends PythonInterpreterTest {
intpGroup.put("note", new LinkedList<Interpreter>());
InterpreterContext context = InterpreterContext.builder()
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setIntpEventClient(mockRemoteEventClient)
.build();
InterpreterContext.set(context);

View file

@ -54,6 +54,7 @@ public class SparkIRInterpreterTest extends IRInterpreterTest {
return new SparkIRInterpreter(properties);
}
@Override
@Before
public void setUp() throws InterpreterException {
Properties properties = new Properties();
@ -144,7 +145,7 @@ public class SparkIRInterpreterTest extends IRInterpreterTest {
InterpreterContext context = InterpreterContext.builder()
.setNoteId("note_1")
.setParagraphId("paragraph_1")
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setLocalProperties(new HashMap<>())
.setIntpEventClient(mockRemoteIntpEventClient)
.build();

View file

@ -78,7 +78,7 @@ public class SparkInterpreterTest {
properties.setProperty("zeppelin.spark.deprecatedMsg.show", "false");
InterpreterContext context = InterpreterContext.builder()
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setIntpEventClient(mockRemoteEventClient)
.setAngularObjectRegistry(new AngularObjectRegistry("spark", null))
.build();
@ -596,7 +596,7 @@ public class SparkInterpreterTest {
private InterpreterContext getInterpreterContext() {
output = "";
InterpreterContext context = InterpreterContext.builder()
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setIntpEventClient(mockRemoteEventClient)
.setAngularObjectRegistry(new AngularObjectRegistry("spark", null))
.build();

View file

@ -57,7 +57,7 @@ public class SparkRInterpreterTest {
properties.setProperty("zeppelin.R.knitr", "true");
properties.setProperty("spark.r.backendConnectionTimeout", "10");
properties.setProperty("zeppelin.spark.deprecatedMsg.show", "false");
InterpreterContext context = getInterpreterContext();
InterpreterContext.set(context);
sparkRInterpreter = new SparkRInterpreter(properties);
@ -157,7 +157,7 @@ public class SparkRInterpreterTest {
properties.setProperty("zeppelin.R.cmd", "invalid_r");
properties.setProperty(SparkStringConstants.MASTER_PROP_NAME, "local");
properties.setProperty(SparkStringConstants.APP_NAME_PROP_NAME, "test");
InterpreterGroup interpreterGroup = new InterpreterGroup();
Interpreter sparkRInterpreter = new LazyOpenInterpreter(new SparkRInterpreter(properties));
Interpreter sparkInterpreter = new LazyOpenInterpreter(new SparkInterpreter(properties));
@ -183,7 +183,7 @@ public class SparkRInterpreterTest {
.setNoteId("note_1")
.setParagraphId("paragraph_1")
.setIntpEventClient(mockRemoteIntpEventClient)
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setLocalProperties(new HashMap<>())
.build();
return context;

View file

@ -73,7 +73,7 @@ public class SparkSqlInterpreterTest {
.setParagraphTitle("title")
.setAngularObjectRegistry(new AngularObjectRegistry(intpGroup.getId(), null))
.setResourcePool(new LocalResourcePool("id"))
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setIntpEventClient(mock(RemoteInterpreterEventClient.class))
.build();
InterpreterContext.set(context);
@ -188,7 +188,7 @@ public class SparkSqlInterpreterTest {
.setParagraphTitle("title")
.setAngularObjectRegistry(new AngularObjectRegistry(intpGroup.getId(), null))
.setResourcePool(new LocalResourcePool("id"))
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setIntpEventClient(mock(RemoteInterpreterEventClient.class))
.build();
context.getLocalProperties().put("template", "Total count: <h1>{0}</h1>, Total age: <h1>{1}</h1>");
@ -224,7 +224,7 @@ public class SparkSqlInterpreterTest {
if (!sparkInterpreter.getSparkVersion().isSpark1()) {
assertTrue(context.out.toString(), context.out.toInterpreterResultMessage().get(1).getData().contains("mismatched input"));
}
// One correct sql + One invalid sql + One valid sql (skipped)
ret = sqlInterpreter.interpret("select * from gr;invalid_sql; select count(1) from gr", context);
assertEquals(InterpreterResult.Code.ERROR, ret.code());

View file

@ -74,7 +74,7 @@ public abstract class BaseInterpreterTest {
.setParagraphId("paragraphId")
.setAuthenticationInfo(authenticationInfo)
.setAngularObjectRegistry(registry)
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setIntpEventClient(mock(RemoteInterpreterEventClient.class))
.build();
}

View file

@ -37,7 +37,7 @@ trait AbstractAngularElemTest
val context = InterpreterContext.builder
.setNoteId("noteId")
.setAngularObjectRegistry(new AngularObjectRegistry(intpGroup.getId(), null))
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.build()
InterpreterContext.set(context)

View file

@ -32,7 +32,7 @@ with BeforeAndAfter with BeforeAndAfterEach with Eventually with Matchers {
val context = InterpreterContext.builder
.setNoteId("noteId")
.setAngularObjectRegistry(new AngularObjectRegistry(intpGroup.getId(), null))
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.build()
InterpreterContext.set(context)

View file

@ -92,7 +92,7 @@ public class ApplicationLoaderTest {
paragraphId,
appInstanceId,
null,
new InterpreterOutput(null));
new InterpreterOutput());
return context1;
}
}

View file

@ -300,7 +300,7 @@ public class IPythonKernelTest {
return InterpreterContext.builder()
.setNoteId("noteId")
.setParagraphId("paragraphId")
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setIntpEventClient(mock(RemoteInterpreterEventClient.class))
.setLocalProperties(localProperties)
.setResourcePool(resourcePool)

View file

@ -152,7 +152,7 @@ public class IRKernelTest {
InterpreterContext context = InterpreterContext.builder()
.setNoteId("note_1")
.setParagraphId("paragraph_1")
.setInterpreterOut(new InterpreterOutput(null))
.setInterpreterOut(new InterpreterOutput())
.setLocalProperties(localProperties)
.build();
return context;