Branch Coverage

RabbitMQ.xs
Criterion Covered Total %
branch 29 558 5.2


line true false branch
91 0 0 if (amqp_release_buffers_ok(state)) {
119 1 0 if ( x == AMQP_STATUS_CONNECTION_CLOSED || x == AMQP_STATUS_SOCKET_ERROR ) {
0 1 if ( x == AMQP_STATUS_CONNECTION_CLOSED || x == AMQP_STATUS_SOCKET_ERROR ) {
124 1 0 else if (x < 0) {
142 0 0 x.library_error == AMQP_STATUS_CONNECTION_CLOSED
144 0 0 x.library_error == AMQP_STATUS_SOCKET_ERROR
152 0 0 (!x.library_error) ? "(end-of-stream)" :
153 0 0 (x.library_error == AMQP_STATUS_UNKNOWN_TYPE) ? "unknown AMQP type id" :
217 0 0 if ( SvROK( *perl_value ) ) {
219 0 0 if ( SvTYPE( SvRV( *perl_value ) ) == SVt_PVAV ) {
224 0 0 if ( SvTYPE( SvRV( *perl_value ) ) == SVt_PVHV ) {
235 0 0 if ( SvUOK( *perl_value ) ) {
246 0 0 if ( SvI64OK( *perl_value ) ) {
249 0 0 if ( SvU64OK( *perl_value ) ) {
253 0 0 if ( SvIOK( *perl_value ) ) {
254 0 0 if ( SvUOK( *perl_value ) ) {
262 0 0 if ( SvNOK( *perl_value ) ) {
268 0 0 if ( force_utf8 || SvUTF8( *perl_value ) ) {
0 0 if ( force_utf8 || SvUTF8( *perl_value ) ) {
274 0 0 if ( SvPOK( *perl_value ) || SvPOKp( *perl_value ) ) {
0 0 if ( SvPOK( *perl_value ) || SvPOKp( *perl_value ) ) {
275 0 0 if ( force_utf8 || SvUTF8( *perl_value ) ) {
0 0 if ( force_utf8 || SvUTF8( *perl_value ) ) {
280 0 0 if ( SvIOK( *perl_value ) || SvIOKp( *perl_value ) ) {
0 0 if ( SvIOK( *perl_value ) || SvIOKp( *perl_value ) ) {
281 0 0 if ( SvUOK( *perl_value ) ) {
286 0 0 if ( SvNOK( *perl_value ) || SvNOKp( *perl_value ) ) {
0 0 if ( SvNOK( *perl_value ) || SvNOKp( *perl_value ) ) {
291 0 0 if ( SvROK( *perl_value ) ) {
293 0 0 if ( SvTYPE( SvRV( *perl_value ) ) == SVt_PVAV ) {
298 0 0 if ( SvTYPE( SvRV( *perl_value ) ) == SVt_PVHV ) {
330 0 0 if (AMQP_STATUS_OK != res) {
336 0 0 if (AMQP_FRAME_HEADER != frame.frame_type) {
337 0 0 if (AMQP_FRAME_METHOD == frame.frame_type &&
338 0 0 (AMQP_CHANNEL_CLOSE_METHOD == frame.payload.method.id ||
339 0 0 AMQP_CONNECTION_CLOSE_METHOD == frame.payload.method.id)) {
360 0 0 if (p->_flags & AMQP_BASIC_CONTENT_TYPE_FLAG) {
363 0 0 if (p->_flags & AMQP_BASIC_CONTENT_ENCODING_FLAG) {
372 0 0 strnlen(p->content_encoding.bytes, p->content_encoding.len) > 0
374 0 0 (strncasecmp(p->content_encoding.bytes, "UTF-8", p->content_encoding.len) != 0)
379 0 0 if (p->_flags & AMQP_BASIC_CORRELATION_ID_FLAG) {
382 0 0 if (p->_flags & AMQP_BASIC_REPLY_TO_FLAG) {
385 0 0 if (p->_flags & AMQP_BASIC_EXPIRATION_FLAG) {
388 0 0 if (p->_flags & AMQP_BASIC_MESSAGE_ID_FLAG) {
391 0 0 if (p->_flags & AMQP_BASIC_TYPE_FLAG) {
394 0 0 if (p->_flags & AMQP_BASIC_USER_ID_FLAG) {
397 0 0 if (p->_flags & AMQP_BASIC_APP_ID_FLAG) {
400 0 0 if (p->_flags & AMQP_BASIC_DELIVERY_MODE_FLAG) {
403 0 0 if (p->_flags & AMQP_BASIC_PRIORITY_FLAG) {
406 0 0 if (p->_flags & AMQP_BASIC_TIMESTAMP_FLAG) {
409 0 0 if (p->_flags & AMQP_BASIC_HEADERS_FLAG) {
416 0 0 for( i=0; i < p->headers.num_entries; ++i ) {
534 0 0 hv_store( headers,
589 0 0 if (is_utf8_body)
594 0 0 while (body_remaining > 0) {
598 0 0 if (AMQP_STATUS_OK != res) {
604 0 0 if (AMQP_FRAME_BODY != frame.frame_type) {
605 0 0 if (AMQP_FRAME_METHOD == frame.frame_type &&
606 0 0 (AMQP_CHANNEL_CLOSE_METHOD == frame.payload.method.id ||
607 0 0 AMQP_CONNECTION_CLOSE_METHOD == frame.payload.method.id)) {
619 0 0 if (fragment_len > body_remaining) {
662 0 0 if (AMQP_STATUS_OK != res) {
668 0 0 if (AMQP_FRAME_METHOD != frame.frame_type ||
669 0 0 AMQP_BASIC_DELIVER_METHOD != frame.payload.method.id) {
671 0 0 if (AMQP_FRAME_METHOD == frame.frame_type &&
672 0 0 (AMQP_CHANNEL_CLOSE_METHOD == frame.payload.method.id ||
673 0 0 AMQP_CONNECTION_CLOSE_METHOD == frame.payload.method.id)) {
701 0 0 if (AMQP_RESPONSE_NORMAL != ret.reply_type)
731 0 0 for ( idx = 0; idx <= av_len(perl_array); idx += 1) {
787 0 0 for (; current_entry < mq_array->num_entries; current_entry += 1) {
886 0 0 for( i=0; i < mq_table->num_entries; i += 1 ) {
992 0 0 amqp_table_entry_t *new_entries = amqp_pool_alloc( &temp_memory_pool, HvKEYS(hash) * sizeof(amqp_table_entry_t) );
996 0 0 while (NULL != (he = hv_iternext(hash))) {
1001 0 0 if (SvGMAGICAL(value)) {
1013 0 0 strlen(key) > 2
1015 0 0 key[0] == 'x'
1017 0 0 key[1] == '-'
1093 0 0 if (AMQP_RESPONSE_NORMAL != ret.reply_type)
1096 0 0 if (AMQP_BASIC_GET_OK_METHOD != ret.reply.id)
1111 0 0 if (AMQP_RESPONSE_NORMAL != ret.reply_type)
1118 0 0 *envelope_sv_ptr = envelope_hv ? newRV_noinc(MUTABLE_SV(envelope_hv)) : &PL_sv_undef;
1137 0 35 PERL_MATH_INT64_LOAD_OR_CROAK;
1164 1 0 amqp_table_t client_properties_tbl = amqp_empty_table;
1166 1 0 str_from_hv(options, user);
1167 1 0 str_from_hv(options, password);
1168 1 0 str_from_hv(options, vhost);
1169 0 1 int_from_hv(options, channel_max);
1170 0 1 int_from_hv(options, frame_max);
1171 0 1 int_from_hv(options, heartbeat);
1172 0 1 int_from_hv(options, port);
1173 1 0 double_from_hv(options, timeout);
1175 1 0 int_from_hv(options, ssl);
1176 1 0 str_from_hv(options, ssl_cacert);
1177 0 1 str_from_hv(options, ssl_cert);
1178 0 1 str_from_hv(options, ssl_key);
1179 1 0 int_from_hv(options, ssl_verify_host);
1180 0 1 str_from_hv(options, sasl_method);
1182 0 1 if(client_properties)
1187 1 0 if(timeout >= 0) {
1192 0 1 if ( ssl ) {
1197 0 0 if (!hv_exists(options, "port", 4)) {
1201 0 0 if ( !sock ) {
1207 0 0 if ( ( ssl_cacert != NULL ) && strlen(ssl_cacert) ) {
0 0 if ( ( ssl_cacert != NULL ) && strlen(ssl_cacert) ) {
1208 0 0 if ( amqp_ssl_socket_set_cacert(sock, ssl_cacert) ) {
1213 0 0 if ( ( ssl_key != NULL ) && strlen(ssl_key) && ( ssl_cert != NULL ) && strlen(ssl_cert) ) {
0 0 if ( ( ssl_key != NULL ) && strlen(ssl_key) && ( ssl_cert != NULL ) && strlen(ssl_cert) ) {
0 0 if ( ( ssl_key != NULL ) && strlen(ssl_key) && ( ssl_cert != NULL ) && strlen(ssl_cert) ) {
0 0 if ( ( ssl_key != NULL ) && strlen(ssl_key) && ( ssl_cert != NULL ) && strlen(ssl_cert) ) {
1214 0 0 if ( amqp_ssl_socket_set_key( sock, ssl_cert, ssl_key ) ) {
1223 0 1 if (!sock) {
1229 0 1 while ( amqp_data_in_buffer(conn) ) {
1235 0 1 if (strcasecmp(sasl_method, "external") == 0) {
1239 0 1 die_on_error(aTHX_ amqp_socket_open_noblock(sock, hostname, port, (timeout<0)?NULL:&to), conn, "opening socket");
1244 0 0 RETVAL = 1;
1253 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1264 0 1 if ( ! has_valid_connection( conn ) ) {
0 0 if ( ! has_valid_connection( conn ) ) {
1282 0 0 amqp_table_t arguments = amqp_empty_table;
1284 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1286 0 0 if(options) {
1287 0 0 str_from_hv(options, exchange_type);
1288 0 0 int_from_hv(options, passive);
1289 0 0 int_from_hv(options, durable);
1290 0 0 int_from_hv(options, auto_delete);
1291 0 0 int_from_hv(options, internal);
1293 0 0 if(args)
1326 0 0 int if_unused = 1;
1328 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1330 0 0 if(options) {
1331 0 0 int_from_hv(options, if_unused);
1345 0 0 amqp_table_t arguments = amqp_empty_table;
1348 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1351 0 0 if( ( source == NULL || 0 == strlen(source) )
0 0 if( ( source == NULL || 0 == strlen(source) )
1352 0 0 ||
1353 0 0 ( destination == NULL || 0 == strlen(destination) )
1360 0 0 if(args)
1384 0 0 amqp_table_t arguments = amqp_empty_table;
1387 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1390 0 0 if( ( source == NULL || 0 == strlen(source) )
0 0 if( ( source == NULL || 0 == strlen(source) )
1391 0 0 ||
1392 0 0 ( destination == NULL || 0 == strlen(destination) )
1399 0 0 if(args)
1422 0 0 amqp_queue_delete_ok_t *reply = (amqp_queue_delete_ok_t*)NULL;
1424 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1426 0 0 if(options) {
1427 0 0 int_from_hv(options, if_unused);
1428 0 0 int_from_hv(options, if_empty);
1437 0 0 if (reply == NULL) {
1440 0 0 XPUSHs(sv_2mortal(newSVuv(reply->message_count)));
1456 0 0 amqp_queue_declare_ok_t *r = (amqp_queue_declare_ok_t*)NULL;
1458 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1460 0 0 if(queuename && strcmp(queuename, "")) queuename_b = amqp_cstring_bytes(queuename);
0 0 if(queuename && strcmp(queuename, "")) queuename_b = amqp_cstring_bytes(queuename);
1461 0 0 if(options) {
1462 0 0 int_from_hv(options, passive);
1463 0 0 int_from_hv(options, durable);
1464 0 0 int_from_hv(options, exclusive);
1465 0 0 int_from_hv(options, auto_delete);
1467 0 0 if(args)
1475 0 0 XPUSHs(sv_2mortal(newSVpvn(r->queue.bytes, r->queue.len)));
1476 0 0 if(GIMME_V == G_LIST) {
1477 0 0 XPUSHs(sv_2mortal(newSVuv(r->message_count)));
1478 0 0 XPUSHs(sv_2mortal(newSVuv(r->consumer_count)));
1490 0 0 amqp_table_t arguments = amqp_empty_table;
1492 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1494 0 0 if(queuename == NULL
1495 0 0 ||
1498 0 0 0 == strlen(queuename)
1500 0 0 0 == strlen(exchange)
1506 0 0 if(args)
1524 0 0 amqp_table_t arguments = amqp_empty_table;
1526 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1528 0 0 if(queuename == NULL || exchange == NULL)
0 0 if(queuename == NULL || exchange == NULL)
1533 0 0 if(args)
1555 0 0 int exclusive = 0;
1557 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1559 0 0 if(options) {
1560 0 0 str_from_hv(options, consumer_tag);
1561 0 0 int_from_hv(options, no_local);
1562 0 0 int_from_hv(options, no_ack);
1563 0 0 int_from_hv(options, exclusive);
1565 0 0 r = amqp_basic_consume(conn, channel, amqp_cstring_bytes(queuename),
1581 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1586 0 0 if ( r == NULL ) {
1590 0 0 if(strlen(consumer_tag) == r->consumer_tag.len && 0 == strcmp(consumer_tag, (char *)r->consumer_tag.bytes)) {
0 0 if(strlen(consumer_tag) == r->consumer_tag.len && 0 == strcmp(consumer_tag, (char *)r->consumer_tag.bytes)) {
1608 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1611 0 0 if (timeout > 0) {
1617 0 0 if (timeout == -1) {
1623 0 0 ret = consume_message(conn, &RETVAL, timeout ? &timeout_tv : NULL);
1624 0 0 if (AMQP_RESPONSE_LIBRARY_EXCEPTION != ret.reply_type || AMQP_STATUS_TIMEOUT != ret.library_error)
0 0 if (AMQP_RESPONSE_LIBRARY_EXCEPTION != ret.reply_type || AMQP_STATUS_TIMEOUT != ret.library_error)
1637 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1650 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1671 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1691 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1715 0 0 int force_utf8_in_header_strings = 0;
1717 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1722 0 0 if(options) {
1723 0 0 if(NULL != (v = hv_fetchs(options, "mandatory", 0))) {
1726 0 0 if(NULL != (v = hv_fetchs(options, "immediate", 0))) {
1729 0 0 if(NULL != (v = hv_fetchs(options, "exchange", 0))) {
1734 0 0 int_from_hv(options, force_utf8_in_header_strings);
1738 0 0 if (props) {
1739 0 0 if (NULL != (v = hv_fetchs(props, "content_type", 0))) {
1743 0 0 if (NULL != (v = hv_fetchs(props, "content_encoding", 0))) {
1747 0 0 if (NULL != (v = hv_fetchs(props, "correlation_id", 0))) {
1751 0 0 if (NULL != (v = hv_fetchs(props, "reply_to", 0))) {
1755 0 0 if (NULL != (v = hv_fetchs(props, "expiration", 0))) {
1759 0 0 if (NULL != (v = hv_fetchs(props, "message_id", 0))) {
1763 0 0 if (NULL != (v = hv_fetchs(props, "type", 0))) {
1767 0 0 if (NULL != (v = hv_fetchs(props, "user_id", 0))) {
1771 0 0 if (NULL != (v = hv_fetchs(props, "app_id", 0))) {
1775 0 0 if (NULL != (v = hv_fetchs(props, "delivery_mode", 0))) {
1779 0 0 if (NULL != (v = hv_fetchs(props, "priority", 0))) {
1783 0 0 if (NULL != (v = hv_fetchs(props, "timestamp", 0))) {
1787 0 0 if (NULL != (v = hv_fetchs(props, "headers", 0)) && SvOK(*v)) {
0 0 if (NULL != (v = hv_fetchs(props, "headers", 0)) && SvOK(*v)) {
1797 0 0 if ( rv == AMQP_STATUS_CONNECTION_CLOSED || rv == AMQP_STATUS_SOCKET_ERROR ) {
0 0 if ( rv == AMQP_STATUS_CONNECTION_CLOSED || rv == AMQP_STATUS_SOCKET_ERROR ) {
1803 0 0 if ( rv != AMQP_STATUS_OK ) {
1814 0 0 int no_ack = 1;
1816 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
1818 0 0 if (options)
1819 0 0 int_from_hv(options, no_ack);
1822 0 0 die_on_amqp_error(aTHX_ basic_get(conn, channel, queuename ? amqp_cstring_bytes(queuename) : amqp_empty_bytes, &RETVAL, no_ack), conn, "basic_get");
1850 0 0 if ( has_valid_connection( conn ) ) {
0 0 if ( has_valid_connection( conn ) ) {
1864 0 0 if ( has_valid_connection( conn ) ) {
0 0 if ( has_valid_connection( conn ) ) {
1880 0 0 if ( amqp_get_socket(conn) != NULL ) {
1897 1 32 if ( amqp_get_socket(conn) != NULL ) {
1954 0 0 if (timeout_tv == NULL) {
1975 0 0 int res = 0;
1980 0 0 if (args == NULL || !SvOK(args) || args == &PL_sv_undef) {
0 0 if (args == NULL || !SvOK(args) || args == &PL_sv_undef) {
0 0 if (args == NULL || !SvOK(args) || args == &PL_sv_undef) {
1983 0 0 if (old_timeout != NULL) {
1991 0 0 int_from_hv((HV*)SvRV(args), tv_sec);
1992 0 0 int_from_hv((HV*)SvRV(args), tv_usec);
2010 0 0 amqp_boolean_t global = 0;
2012 0 0 if(args) {
2013 0 0 if(NULL != (v = hv_fetchs(args, "prefetch_size", 0))) prefetch_size = SvIV(*v);
2014 0 0 if(NULL != (v = hv_fetchs(args, "prefetch_count", 0))) prefetch_count = SvIV(*v);
2015 0 0 if(NULL != (v = hv_fetchs(args, "global", 0))) global = SvIV(*v) ? 1 : 0;
2038 0 0 struct timeval timeout_tv = {0,0};
2044 0 0 if (timeout > 0) {
2047 0 0 } else if (timeout < 0) {
2051 0 0 ret = amqp_publisher_confirm_wait(
2059 0 0 if (AMQP_RESPONSE_LIBRARY_EXCEPTION == ret.reply_type &&
2060 0 0 AMQP_STATUS_TIMEOUT == ret.library_error) {
2125 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
2127 0 0 if ( server_properties )
2143 0 0 assert_amqp_connected(conn);
0 0 assert_amqp_connected(conn);
2145 0 0 if ( client_properties )