LCOV - code coverage report
 
Current view: directory - /home/trostler/JUTE/backend/nodejute/jute/actions - heartBeat.js (source / functions) Found Hit Coverage
Test: lcov.info Lines: 13 13 100.0 %
Date: Tue Aug 09 13:50:27 GMT-07:00 2011 Functions: 3 3 100.0 %
Colors: not hit hit
 
 


             1          : /*
             2          : Copyright (c) 2011, Yahoo! Inc.
             3          : All rights reserved.
             4          : 
             5          : Redistribution and use of this software in source and binary forms, 
             6          : with or without modification, are permitted provided that the following 
             7          : conditions are met:
             8          : 
             9          : * Redistributions of source code must retain the above
            10          :   copyright notice, this list of conditions and the
            11          :   following disclaimer.
            12          : 
            13          : * Redistributions in binary form must reproduce the above
            14          :   copyright notice, this list of conditions and the
            15          :   following disclaimer in the documentation and/or other
            16          :   materials provided with the distribution.
            17          : 
            18          : * Neither the name of Yahoo! Inc. nor the names of its
            19          :   contributors may be used to endorse or promote products
            20          :   derived from this software without specific prior
            21          :   written permission of Yahoo! Inc.
            22          : 
            23          : THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
            24          : IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 
            25          : TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
            26          : PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
            27          : OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
            28          : SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
            29          : LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
            30          : DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
            31          : THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
            32          : (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
            33          : OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
            34          : */
            35          : 
            36          : 
            37        1 : module.exports = {
            38          :     Create:  function(hub, common) {
            39          :         // Javascript is single threaded!  We don't have to worry about concurrency!
            40        1 :         var path = require('path');
            41          : 
            42          :         // Events I care about
            43        1 :         hub.addListener('action:heart_beat', heartBeat);
            44          : 
            45        1 :         function heartBeat(req, res, cache) {
            46          :             // Update heartbeat time
            47        1 :             if (!cache.browsers[req.session.uuid]) {
            48        1 :                 cache.browsers[req.session.uuid] = {};
            49          :             }
            50          : 
            51        1 :             cache.browsers[req.session.uuid].heart_beat = new Date().getTime();
            52        1 :             cache.browsers[req.session.uuid].name = common.browserName(req);
            53          : 
            54        1 :             hub.once('action:checkedResults', function(results) {
            55        1 :                 results.current_status = cache;
            56        1 :                 results.config = hub.config;
            57        1 :                 res.end(JSON.stringify(results));
            58          :             });
            59        1 :             hub.emit('action:checkResults');
            60          :         }
            61          :     }
            62          : };
            63          : 


      

 
Generated by: YUI Test