Ejemplo n.º 1
0
END_TEST

START_TEST (test_cometd_ext_fire_outgoing)
{
  cometd_ext* ext = cometd_ext_new();
  ext->outgoing = count_callback;
  cometd_ext_add(&exts, ext);
  cometd_ext_add(&exts, cometd_ext_new());

  cometd_ext_fire_outgoing(exts, NULL, NULL);

  ck_assert_int_eq(1, count);
}
Ejemplo n.º 2
0
int main(void)
{
  cometd			*cometd = cometd_new();
  JsonNode			*connect = json_node_new(JSON_NODE_OBJECT);
  
  /*After the new you can enable or disable the Websocket simply do this, disabled by defautl*/
  cometd->config->webSockState = true;
  
  
  if (cometd->config->webSockState)
    return(webSocketTest());
  
  cometd_configure(cometd, COMETDOPT_URL, "http://m.zpush.ovh:8080/str/strd");
  cometd_configure(cometd, COMETDOPT_MAX_BACKOFF, 5000);
  struct _cometd_ext* logger = cometd_ext_logger_new();
  cometd_ext_add(&cometd->exts, logger);
  cometd_connect(cometd);
  connect = cometd_msg_connect_new(cometd);
  cometd_transport_send(cometd, connect);


  //cometd_subscribe(cometd, "/service/GmY-HuzW/6sd0/echo", handler);
  cometd_transport_send(cometd, cometd_ping_ls(cometd, "/service/GmY-HuzW/6sd0/echo"));
  //cometd_subscribe(cometd, "/service/GmY-HuzW/6sd0/ls", handler);
  //cometd_subscribe(cometd, "service/GmY-HuzW/6sd0/updateMeta", handler);
  //cometd_subscribe(cometd, "/service/GmY-HuzW/6sd0/ls", handler);
  //cometd_subscribe(cometd, "/service/GmY-HuzW/6sd0/newFile", handler);

  
  cometd_listen(cometd);
  return 0;
}
Ejemplo n.º 3
0
END_TEST

START_TEST (test_cometd_transport_send_fires_outgoing_ext)
{
    cometd_conn_set_transport(g_instance->conn, &TEST_TRANSPORT);

    JsonNode* expected = cometd_json_str2node("{ \"foo\": 1}");
    gboolean ret = FALSE;

    cometd_ext* ext = cometd_ext_new();
    ext->outgoing = add_foo;
    cometd_ext_add(&g_instance->exts, ext);

    JsonNode* node = cometd_json_str2node("{}");

    cometd_transport_send(g_instance, node);
    ret = json_node_equal(expected, node, NULL);
    fail_unless(ret);

    json_node_free(node);
    json_node_free(expected);
}