com.twosigma.beakerx.message.Header.getType()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(8.2k)|赞(0)|评价(0)|浏览(118)

本文整理了Java中com.twosigma.beakerx.message.Header.getType()方法的一些代码示例,展示了Header.getType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Header.getType()方法的具体详情如下:
包路径:com.twosigma.beakerx.message.Header
类名称:Header
方法名:getType

Header.getType介绍

暂无

代码示例

代码示例来源:origin: twosigma/beakerx

private void verifyOpenCommMsgBeakerxWidget(List<Message> messages, String modelNameValue, String viewNameValue) {
 assertThat(messages.size()).isEqualTo(1);
 Message widget = messages.get(0);
 assertThat(widget.getHeader().getType()).isEqualTo(COMM_OPEN.getName());
 Map data = TestWidgetUtils.getData(widget);
 assertThat(data.get(Widget.MODEL_MODULE)).isEqualTo(BeakerxWidget.MODEL_MODULE_VALUE);
 assertThat(data.get(Widget.VIEW_MODULE)).isEqualTo(BeakerxWidget.VIEW_MODULE_VALUE);
 assertThat(data.get(Widget.MODEL_NAME)).isEqualTo(modelNameValue);
 assertThat(data.get(Widget.VIEW_NAME)).isEqualTo(viewNameValue);
}

代码示例来源:origin: twosigma/beakerx

public static List<Message> getListMessagesByType(List<Message> messages, JupyterMessages type){
 return messages.stream()
   .filter(m -> m.getHeader() != null
       && m.getHeader().getType() != null
       && m.getHeader().getType().equalsIgnoreCase(type.toString())
   )
   .collect(Collectors.toList());
}

代码示例来源:origin: twosigma/beakerx

@Test
 public void serializeConfig_createConfigWithProperties() {
  //when
  Header header = MessageSerializer.parse(srcJson, Header.class);
  //then
  Assertions.assertThat(header.getVersion()).isEqualTo("5.0");
  Assertions.assertThat(header.getType()).isEqualTo("execute_request");
  Assertions.assertThat(header.getId()).isEqualTo("9CEE9EE3351643CD83A6C2A29401A942");
  Assertions.assertThat(header.getUsername()).isEqualTo("username");
  Assertions.assertThat(header.getSession()).isEqualTo("605DC3793F6F402698418908DBC7C572");
 }
}

代码示例来源:origin: twosigma/beakerx

@Test
public void handle_sentMessageHasHeaderTypeIsKernelInfoReply() throws Exception {
 //when
 handler.handle(message);
 //then
 Message sentMessage = kernel.getSentMessages().get(0);
 Header header = sentMessage.getHeader();
 Assertions.assertThat(header).isNotNull();
 Assertions.assertThat(header.getType()).isEqualTo(KERNEL_INFO_REPLY.getName());
}

代码示例来源:origin: twosigma/beakerx

@Test
public void handle_sentMessageHasHeaderTypeIsKernelInfoReply() throws Exception {
 //when
 handler.handle(message);
 //then
 Message sentMessage = kernel.getSentMessages().get(0);
 Header header = sentMessage.getHeader();
 Assertions.assertThat(header).isNotNull();
 Assertions.assertThat(header.getType()).isEqualTo(KERNEL_INFO_REPLY.getName());
}

代码示例来源:origin: twosigma/beakerx

@Test
public void handle_sentMessageHasHeaderTypeIsCompleteReply() throws Exception {
 //when
 completeHandler.handle(message);
 //then
 Header header = kernel.getSentMessages().get(0).getHeader();
 Assertions.assertThat(header).isNotNull();
 Assertions.assertThat(header.getType()).isEqualTo(COMPLETE_REPLY.getName());
}

代码示例来源:origin: twosigma/beakerx

@Test
public void handle_sentMessageHasHeaderTypeIsKernelInfoReply() throws Exception {
 //when
 handler.handle(message);
 //then
 Message sentMessage = kernel.getSentMessages().get(0);
 Header header = sentMessage.getHeader();
 Assertions.assertThat(header).isNotNull();
 Assertions.assertThat(header.getType()).isEqualTo(KERNEL_INFO_REPLY.getName());
}

代码示例来源:origin: twosigma/beakerx

@Test
public void handle_sentMessageHasHeaderTypeIsKernelInfoReply() throws Exception {
 //when
 handler.handle(message);
 //then
 Message sentMessage = kernel.getSentMessages().get(0);
 Header header = sentMessage.getHeader();
 Assertions.assertThat(header).isNotNull();
 Assertions.assertThat(header.getType()).isEqualTo(KERNEL_INFO_REPLY.getName());
}

代码示例来源:origin: twosigma/beakerx

@Test
public void handle_sentMessageHasHeaderTypeIsKernelInfoReply() throws Exception {
 //when
 handler.handle(message);
 //then
 Message sentMessage = kernel.getSentMessages().get(0);
 Header header = sentMessage.getHeader();
 Assertions.assertThat(header).isNotNull();
 Assertions.assertThat(header.getType()).isEqualTo(KERNEL_INFO_REPLY.getName());
}

代码示例来源:origin: twosigma/beakerx

@Test
public void handleMessage_firstSentMessageHasTypeIsStatus() throws Exception {
 //when
 commMsgHandler.handle(message);
 //then
 Assertions.assertThat(kernel.getPublishedMessages()).isNotEmpty();
 Message publishMessage = kernel.getPublishedMessages().get(0);
 Assertions.assertThat(publishMessage.getHeader().getType())
   .isEqualTo(JupyterMessages.STATUS.getName());
}

代码示例来源:origin: twosigma/beakerx

@Test
public void commOpen_sentMessageHasTypeIsCommOpen() throws NoSuchAlgorithmException {
 //when
 comm.open();
 //then
 assertThat(kernel.getPublishedMessages()).isNotEmpty();
 Message sendMessage = kernel.getPublishedMessages().get(0);
 assertThat(sendMessage.getHeader().getType())
     .isEqualTo(JupyterMessages.COMM_OPEN.getName());
}

代码示例来源:origin: twosigma/beakerx

@Test
public void handleMessage_secondSendMessageHasTypeIsStatus() throws Exception {
 //when
 commMsgHandler.handle(message);
 //then
 Assertions.assertThat(kernel.getPublishedMessages()).isNotEmpty();
 Message publishMessage = kernel.getPublishedMessages().get(1);
 Assertions.assertThat(publishMessage.getHeader().getType())
   .isEqualTo(JupyterMessages.STATUS.getName());
}

代码示例来源:origin: twosigma/beakerx

@Test
public void handleMessage_sentMessageHasTypeIsCommInfoReply() throws Exception {
 //when
 commInfoHandler.handle(message);
 //then
 Assertions.assertThat(kernel.getSentMessages()).isNotEmpty();
 Message sendMessage = kernel.getSentMessages().get(0);
 Assertions.assertThat(sendMessage.getHeader().getType())
   .isEqualTo(JupyterMessages.COMM_INFO_REPLY.getName());
}

代码示例来源:origin: twosigma/beakerx

@Test
public void handleMessageWithoutTargetName_shouldSendCloseCommMessage() throws Exception {
 //given
 message.getContent().remove(TARGET_NAME);
 //when
 commOpenHandler.handle(message);
 //then
 Assertions.assertThat(kernel.getSentMessages()).isNotEmpty();
 Message sendMessage = kernel.getSentMessages().get(0);
 Assertions.assertThat(sendMessage.getHeader().getType())
   .isEqualTo(JupyterMessages.COMM_CLOSE.getName());
}

代码示例来源:origin: twosigma/beakerx

@Test
public void handleMessage_sentMessageHasTypeIsCommClose() throws Exception {
 //when
 commCloseHandler.handle(message);
 //then
 Assertions.assertThat(kernel.getSentMessages()).isNotEmpty();
 Message sendMessage = kernel.getSentMessages().get(0);
 Assertions.assertThat(sendMessage.getHeader().getType())
   .isEqualTo(JupyterMessages.COMM_CLOSE.getName());
}

代码示例来源:origin: twosigma/beakerx

@Test
public void handleMessageWithoutCommId_shouldSendCloseCommMessage() throws Exception {
 //given
 message.getContent().remove(COMM_ID);
 //when
 commOpenHandler.handle(message);
 //then
 Assertions.assertThat(kernel.getSentMessages()).isNotEmpty();
 Message sendMessage = kernel.getSentMessages().get(0);
 Assertions.assertThat(sendMessage.getHeader().getType())
   .isEqualTo(JupyterMessages.COMM_CLOSE.getName());
}

代码示例来源:origin: twosigma/beakerx

@Test
public void commClose_sentMessageHasTypeIsCommClose() throws NoSuchAlgorithmException {
 //when
 comm.close();
 //then
 assertThat(kernel.getPublishedMessages()).isNotEmpty();
 Message sendMessage = kernel.getPublishedMessages().get(0);
 assertThat(sendMessage.getHeader().getType())
     .isEqualTo(JupyterMessages.COMM_CLOSE.getName());
}

代码示例来源:origin: twosigma/beakerx

@Test
public void handleMessage_secondSendMessageHasTypeIsExecutionInput() throws Exception {
 //when
 executeRequestHandler.handle(message);
 waitForIdleMessage(kernel);
 //then
 assertThat(kernel.getPublishedMessages()).isNotEmpty();
 Message publishMessage = kernel.getPublishedMessages().get(1);
 assertThat(publishMessage.getHeader().getType())
     .isEqualTo(JupyterMessages.EXECUTE_INPUT.getName());
}

代码示例来源:origin: twosigma/beakerx

@Test
public void commSend_sentMessageHasTypeIsCommClose() throws NoSuchAlgorithmException {
 //when
 comm.send(COMM_MSG, Comm.Buffer.EMPTY, comm.getData());
 //then
 assertThat(kernel.getPublishedMessages()).isNotEmpty();
 Message sendMessage = kernel.getPublishedMessages().get(0);
 assertThat(sendMessage.getHeader().getType())
     .isEqualTo(JupyterMessages.COMM_MSG.getName());
}

代码示例来源:origin: twosigma/beakerx

@Test
public void handleMessage_firstSentMessageHasTypeIsStatus() throws Exception {
 //when
 executeRequestHandler.handle(message);
 waitForIdleMessage(kernel);
 //then
 assertThat(kernel.getPublishedMessages()).isNotEmpty();
 Message publishMessage = kernel.getPublishedMessages().get(0);
 assertThat(publishMessage.getHeader().getType())
     .isEqualTo(JupyterMessages.STATUS.getName());
}

相关文章