Exemple #1
0
Test(stomp_proto, test_only_command)
{
  stomp_frame frame;

  stomp_parse_frame(g_string_new("CONNECTED\n\n"), &frame);
  assert_stomp_command(&frame, "CONNECTED");
  stomp_frame_deinit(&frame);
}
Exemple #2
0
Test(stomp_proto, test_command_and_header)
{
  stomp_frame frame;

  stomp_parse_frame(g_string_new("CONNECTED\nsession:ID:tusa-38077-1378214843533-2:1\n"), &frame);
  assert_stomp_command(&frame, "CONNECTED");
  assert_stomp_header(&frame, "session", "ID:tusa-38077-1378214843533-2:1");
  stomp_frame_deinit(&frame);
};
Exemple #3
0
Test(stomp_proto, test_command_and_data)
{
  stomp_frame frame;

  stomp_parse_frame(g_string_new("CONNECTED\n\nalmafa"), &frame);
  assert_stomp_command(&frame, "CONNECTED");
  assert_stomp_body(&frame, "almafa");
  stomp_frame_deinit(&frame);
};
Exemple #4
0
Test(stomp_proto, test_command_and_header_and_data)
{
  stomp_frame frame;

  stomp_parse_frame(g_string_new("CONNECTED\nheader_name:header_value\n\nbelafa"), &frame);
  assert_stomp_command(&frame, "CONNECTED");
  assert_stomp_header(&frame, "header_name", "header_value");
  assert_stomp_body(&frame, "belafa");
  stomp_frame_deinit(&frame);
};
Exemple #5
0
int
stomp_receive_frame(stomp_connection *connection, stomp_frame *frame)
{
  GString* data = g_string_sized_new(4096);
  int res;

  if (!stomp_read_data(connection, data))
    {
      g_string_free(data, TRUE);
      return FALSE;
    }

  res = stomp_parse_frame(data, frame);
  msg_debug("Frame received",
            evt_tag_str("command",frame->command),
            NULL);
  g_string_free(data, TRUE);
  return res;
}