mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Update to latest change in interpeter constructs
This commit is contained in:
parent
ecf8bc4cc6
commit
2300ebc916
2 changed files with 16 additions and 13 deletions
|
|
@ -157,19 +157,22 @@ public class SparkRInterpreter extends Interpreter {
|
|||
}
|
||||
|
||||
private SparkInterpreter getSparkInterpreter() {
|
||||
for (Interpreter intp : getInterpreterGroup()) {
|
||||
if (intp.getClassName().equals(SparkInterpreter.class.getName())) {
|
||||
Interpreter p = intp;
|
||||
while (p instanceof WrappedInterpreter) {
|
||||
if (p instanceof LazyOpenInterpreter) {
|
||||
p.open();
|
||||
}
|
||||
p = ((WrappedInterpreter) p).getInnerInterpreter();
|
||||
}
|
||||
return (SparkInterpreter) p;
|
||||
LazyOpenInterpreter lazy = null;
|
||||
SparkInterpreter spark = null;
|
||||
Interpreter p = getInterpreterInTheSameSessionByClassName(SparkInterpreter.class.getName());
|
||||
|
||||
while (p instanceof WrappedInterpreter) {
|
||||
if (p instanceof LazyOpenInterpreter) {
|
||||
lazy = (LazyOpenInterpreter) p;
|
||||
}
|
||||
p = ((WrappedInterpreter) p).getInnerInterpreter();
|
||||
}
|
||||
return null;
|
||||
spark = (SparkInterpreter) p;
|
||||
|
||||
if (lazy != null) {
|
||||
lazy.open();
|
||||
}
|
||||
return spark;
|
||||
}
|
||||
|
||||
protected static ZeppelinRFactory zeppelinR() {
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import org.apache.zeppelin.user.AuthenticationInfo;
|
|||
import org.junit.*;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
import org.powermock.core.classloader.annotations.PowerMockIgnore;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
|
@ -43,6 +44,7 @@ import org.powermock.modules.junit4.PowerMockRunner;
|
|||
|
||||
@RunWith(PowerMockRunner.class)
|
||||
@PrepareForTest(SparkRInterpreter.ZeppelinRFactory.class)
|
||||
@PowerMockIgnore({"org.apache.spark.*", "org.apache.hadoop.*", "akka.*", "org.w3c.*", "javax.xml.*", "org.xml.*", "scala.*", "org.apache.cxf.*"})
|
||||
public class SparkRInterpreterTest {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(SparkRInterpreterTest.class);
|
||||
|
||||
|
|
@ -74,7 +76,6 @@ public class SparkRInterpreterTest {
|
|||
|
||||
sparkInterpreter = new SparkInterpreter(p);
|
||||
intpGroup = new InterpreterGroup();
|
||||
intpGroup.add(sparkInterpreter);
|
||||
|
||||
zeppelinRFactory = mock(SparkRInterpreter.ZeppelinRFactory.class);
|
||||
doNothing().when(zeppelinRFactory).open(Mockito.anyString(), Mockito.anyString(), any(SparkInterpreter.class));
|
||||
|
|
@ -83,7 +84,6 @@ public class SparkRInterpreterTest {
|
|||
mockStatic(SparkRInterpreter.ZeppelinRFactory.class);
|
||||
when(SparkRInterpreter.ZeppelinRFactory.instance()).thenReturn(zeppelinRFactory);
|
||||
|
||||
intpGroup.add(sparkRInterpreter);
|
||||
sparkRInterpreter = new SparkRInterpreter(p);
|
||||
sparkRInterpreter.setInterpreterGroup(intpGroup);
|
||||
sparkRInterpreter.open();
|
||||
|
|
|
|||
Loading…
Reference in a new issue