mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
fix tests
This commit is contained in:
parent
4b14a98bc0
commit
636b9fa58d
3 changed files with 16 additions and 1 deletions
|
|
@ -93,6 +93,7 @@ public class ZeppelinClient {
|
|||
public void stop() {
|
||||
try {
|
||||
if (wsClient != null) {
|
||||
removeAllZeppelinConnections();
|
||||
wsClient.stop();
|
||||
} else {
|
||||
LOG.warn("Cannot stop zeppelin websocket client - isn't initialized");
|
||||
|
|
@ -214,6 +215,19 @@ public class ZeppelinClient {
|
|||
LOG.info("Removed Zeppelin ws connection for the following note {}", noteId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Close and remove all ZeppelinConnection
|
||||
*/
|
||||
public void removeAllZeppelinConnections() {
|
||||
for (Map.Entry<String, Session> entry: zeppelinConnectionMap.entrySet()) {
|
||||
if (isSessionOpen(entry.getValue())) {
|
||||
entry.getValue().close();
|
||||
}
|
||||
zeppelinConnectionMap.remove(entry.getKey());
|
||||
}
|
||||
LOG.info("Removed all Zeppelin ws connections");
|
||||
}
|
||||
|
||||
public int countConnectedNotes() {
|
||||
return zeppelinConnectionMap.size();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ public class ZeppelinhubClientTest {
|
|||
assertTrue(runStatus);
|
||||
runStatus = zeppelinhubClient.runAllParagraph("2AB7SY361", invalidRunNotebookMsg);
|
||||
assertFalse(runStatus);
|
||||
Client.getInstance().stop();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public class ZeppelinhubMessageTest {
|
|||
public void testThastCanDeserialiseZeppelinhubMessage() {
|
||||
Map<String,String> meta = Maps.newHashMap();
|
||||
meta.put("key1", "val1");
|
||||
ZeppelinhubMessage expected = ZeppelinhubMessage.newMessage(OP.LIST_NOTES, "my data", meta);
|
||||
ZeppelinhubMessage expected = ZeppelinhubMessage.newMessage(OP.LIST_NOTES.toString(), "my data", meta);
|
||||
ZeppelinhubMessage zeppelinHubMsg = ZeppelinhubMessage.deserialize(msg);
|
||||
|
||||
assertEquals(expected.op, zeppelinHubMsg.op);
|
||||
|
|
|
|||
Loading…
Reference in a new issue