geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tush...@apache.org
Subject [03/79] [partial] incubator-geode git commit: GEODE-12: Imported pulse from geode-1.0.0-SNAPSHOT-2.src.tar
Date Tue, 03 Nov 2015 11:25:25 GMT
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1922937f/pulse/src/main/webapp/scripts/selectbox-customize/jquery.sb.js
----------------------------------------------------------------------
diff --git a/pulse/src/main/webapp/scripts/selectbox-customize/jquery.sb.js b/pulse/src/main/webapp/scripts/selectbox-customize/jquery.sb.js
new file mode 100644
index 0000000..4235f5e
--- /dev/null
+++ b/pulse/src/main/webapp/scripts/selectbox-customize/jquery.sb.js
@@ -0,0 +1,864 @@
+(function( $, window, undefined ) {
+    // utility functions
+    $.fn.borderWidth = function() { return $(this).outerWidth() - $(this).innerWidth(); };
+    $.fn.paddingWidth = function() { return $(this).innerWidth() - $(this).width(); };
+    $.fn.extraWidth = function() { return $(this).outerWidth(true) - $(this).width(); };
+    $.fn.offsetFrom = function( e ) {
+        var $e = $(e);
+        return {
+            left: $(this).offset().left - $e.offset().left,
+            top: $(this).offset().top - $e.offset().top
+        };
+    };
+    $.fn.maxWidth = function() {
+        var max = 0;
+        $(this).each(function() {
+            if($(this).width() > max) {
+              max = $(this).width();
+            }
+        });
+        return max;
+    };
+    $.fn.triggerAll = function(event, params) {
+      return $(this).each(function() {
+        $(this).triggerHandler(event, params);
+      });
+    };
+    var aps = Array.prototype.slice,
+        randInt = function() {
+            return Math.floor(Math.random() * 999999999);
+        };
+    
+    // jQuery-Proto
+    $.proto = function() {
+        var name = arguments[0],    // The name of the jQuery function that will be called
+            clazz = arguments[1],   // A reference to the class that you are associating
+            klazz = clazz,          // A version of clazz with a delayed constructor
+            extOpt = {},            // used to extend clazz with a variable name for the init function
+            undefined;              // safety net
+        
+        opts = $.extend({
+            elem: "elem",           // the property name on the object that will be set to the current jQuery context
+            access: "access",       // the name of the access function to be set on the object
+            init: "init",           // the name of the init function to be set on the object
+            instantAccess: false    // when true, treat all args as access args (ignore constructor args) and allow construct/function call at the same time
+        }, arguments[2]);
+        
+        if(clazz._super) {
+            extOpt[opts.init] = function(){};
+            klazz = clazz.extend(extOpt);
+        }
+        
+        $.fn[name] = function() {
+            var result, args = arguments;
+                
+            $(this).each(function() {
+                var $e = $(this),
+                    obj = $e.data(name),
+                    isNew = !obj;
+                
+                // if the object is not defined for this element, then construct
+                if(isNew) {
+                    
+                    // create the new object and restore init if necessary
+                    obj = new klazz();
+                    if(clazz._super) {
+                      obj[opts.init] = clazz.prototype.init;
+                    }
+                    
+                    // set the elem property and initialize the object
+                    obj[opts.elem] = $e[0];
+                    if(obj[opts.init]) {
+                        obj[opts.init].apply(obj, opts.instantAccess ? [] : aps.call(args, 0));
+                    }
+                    
+                    // associate it with the element
+                    $e.data(name, obj);
+                    
+                }
+                
+                // if it is defined or we allow instance access, then access
+                if(!isNew || opts.instantAccess) {
+                  
+                    // call the access function if it exists (allows lazy loading)
+                    if(obj[opts.access]) {
+                        obj[opts.access].apply(obj, aps.call(args, 0));
+                    }
+                    
+                    // do something with the object
+                    if(args.length > 0) {
+                    
+                        if($.isFunction(obj[args[0]])) {
+                        
+                            // use the method access interface
+                            result = obj[args[0]].apply(obj, aps.call(args, 1));
+                            
+                        } else if(args.length === 1) {
+                          
+                            // just retrieve the property (leverage deep access with getObject if we can)
+                            if($.getObject) {
+                              result = $.getObject(args[0], obj);
+                            } else {
+                              result = obj[args[0]];
+                            }
+                            
+                        } else {
+                          
+                            // set the property (leverage deep access with setObject if we can)
+                            if($.setObject) {
+                              $.setObject(args[0], args[1], obj);
+                            } else {
+                              obj[args[0]] = args[1];
+                            }
+                            
+                        }
+                        
+                    } else if(result === undefined) {
+                    
+                        // return the first object if there are no args
+                        result = $e.data(name);
+                        
+                    }
+                }
+            });
+            
+            // chain if no results were returned from the clazz's method (it's a setter)
+            if(result === undefined) {
+              return $(this);
+            }
+            
+            // return the first result if not chaining
+            return result;
+        };
+    };
+    
+    var falseFunc = function() {
+            return false;
+        },
+        SelectBox = function() {
+        
+        var self = this,
+            o = {},
+            $orig = null,
+            $label = null,
+            $sb = null,
+            $display = null,
+            $dd = null,
+            $items = null,
+            searchTerm = "",
+            cstTimeout = null,
+            delayReloadTimeout = null,
+            resizeTimeout = null,
+            
+            // functions
+            loadSB,
+            createOption,
+            focusOrig,
+            blurOrig,
+            destroySB,
+            reloadSB,
+            delayReloadSB,
+            openSB,
+            centerOnSelected,
+            closeSB,
+            positionSB,
+            positionSBIfOpen,
+            delayPositionSB,
+            clickSB,
+            clickSBItem,
+            keyupSB,
+            keydownSB,
+            focusSB,
+            blurSB,
+            addHoverState,
+            removeHoverState,
+            addActiveState,
+            removeActiveState,
+            getDDCtx,
+            getSelected,
+            getEnabled,
+            selectItem,
+            clearSearchTerm,
+            findMatchingItem,
+            selectMatchingItem,
+            selectNextItemStartsWith,
+            closeAll,
+            closeAllButMe,
+            closeAndUnbind,
+            blurAllButMe,
+            stopPageHotkeys,
+            flickerDisplay,
+            unbind;
+        
+        loadSB = function() {
+            
+            // create the new sb
+            $sb = $("<div class='sb " + o.selectboxClass + " " + $orig.attr("class") + "' id='sb" + randInt() + "'></div>")
+                .attr("role", "listbox")
+                .attr("aria-has-popup", "true")
+                .attr("aria-labelledby", $label.attr("id") ? $label.attr("id") : "");
+            $("body").append($sb);
+            
+            // generate the display markup
+            var displayMarkup = $orig.children().size() > 0
+                ? o.displayFormat.call($orig.find("option:selected")[0], 0, 0)
+                : "&nbsp;";
+            $display = $("<div class='display " + $orig.attr("class") + "' id='sbd" + randInt() + "'></div>")
+                .append($("<div class='text'></div>").append(displayMarkup))
+                .append(o.arrowMarkup);
+            $sb.append($display);
+            
+            // generate the dropdown markup
+            $dd = $("<ul class='" + o.selectboxClass + " items " + $orig.attr("class") + "' role='menu' id='sbdd" + randInt() + "'></ul>")
+                .attr("aria-hidden", "true");
+            $sb.append($dd)
+                .attr("aria-owns", $dd.attr("id"));
+            if($orig.children().size() === 0) {
+                $dd.append(createOption().addClass("selected"));
+            } else {
+                $orig.children().each(function( i ) {
+                    var $opt, $og, $ogItem, $ogList;
+                    if($(this).is("optgroup")) {
+                        $og = $(this);
+                        $ogItem = $("<li class='optgroup'>" + o.optgroupFormat.call($og[0], i+1) + "</li>")
+                            .addClass($og.is(":disabled") ? "disabled" : "")
+                            .attr("aria-disabled", $og.is(":disabled") ? "true" : "");
+                        $ogList = $("<ul class='items'></ul>");
+                        $ogItem.append($ogList);
+                        $dd.append($ogItem);
+                        $og.children("option").each(function() {
+                            $opt = createOption($(this), i)
+                                .addClass($og.is(":disabled") ? "disabled" : "")
+                                .attr("aria-disabled", $og.is(":disabled") ? "true" : "");
+                            $ogList.append($opt);
+                        });
+                    } else {
+                        $dd.append(createOption($(this), i));
+                    }
+                });
+            }
+            
+            // cache all sb items
+            $items = $dd.find("li").not(".optgroup");
+            
+            // for accessibility/styling
+            $sb.attr("aria-active-descendant", $items.filter(".selected").attr("id"));
+            $dd.children(":first").addClass("first");
+            $dd.children(":last").addClass("last");
+            
+            // modify width based on fixedWidth/maxWidth options
+            if(!o.fixedWidth) {
+                var largestWidth = $dd.find(".text, .optgroup").maxWidth() + $display.extraWidth() + 1;
+                $sb.width(o.maxWidth ? Math.min(o.maxWidth, largestWidth) : largestWidth);
+            } else if(o.maxWidth && $sb.width() > o.maxWidth) {
+                $sb.width(o.maxWidth);
+            }
+            
+            // place the new markup in its semantic location (hide/show fixes positioning bugs)
+            $orig.before($sb).addClass("has_sb").hide().show();
+            
+            // these two lines fix a div/span display bug on load in ie7
+            positionSB();
+            flickerDisplay();
+            
+            // hide the dropdown now that it's initialized
+            $dd.hide();
+            
+            // bind events
+            if(!$orig.is(":disabled")) {
+                $orig
+                    .bind("blur.sb", blurOrig)
+                    .bind("focus.sb", focusOrig);
+                $display
+                    .mouseup(addActiveState)
+                    .mouseup(clickSB)
+                    .click(falseFunc)
+                    .focus(focusSB)
+                    .blur(blurSB)
+                    .hover(addHoverState, removeHoverState);
+                getEnabled()
+                    .click(clickSBItem)
+                    .hover(addHoverState, removeHoverState);
+                $dd.find(".optgroup")
+                    .hover(addHoverState, removeHoverState)
+                    .click(falseFunc);
+                $items.filter(".disabled")
+                    .click(falseFunc);
+                if(!$.browser.msie || $.browser.version >= 9) {
+                    $(window).resize($.throttle ? $.throttle(100, positionSBIfOpen) : delayPositionSB);
+                }
+            } else {
+                $sb.addClass("disabled").attr("aria-disabled");
+                $display.click(function( e ) { e.preventDefault(); });
+            }
+            
+            // bind custom events
+            $sb.bind("close.sb", closeSB).bind("destroy.sb", destroySB);
+            $orig.bind("reload.sb", reloadSB);
+            if($.fn.tie && o.useTie) {
+                $orig.bind("domupdate.sb", delayReloadSB);
+            }
+        };
+        
+        delayPositionSB = function() {
+            clearTimeout(resizeTimeout);
+            resizeTimeout = setTimeout(positionSBIfOpen, 50);
+        };
+        
+        positionSBIfOpen = function() {
+            if($sb.is(".open")) {
+                positionSB();
+                openSB(true);
+            }
+        }
+        
+        // create new markup from an <option>
+        createOption = function( $option, index ) {
+            if(!$option) { 
+                $option = $("<option value=''>&nbsp;</option>");
+                index = 0;
+            }
+            var $li = $("<li id='sbo" + randInt() + "'></li>")
+                    .attr("role", "option")
+                    .data("orig", $option[0])
+                    .data("value", $option ? $option.attr("value") : "")
+                    .addClass($option.is(":selected") ? "selected" : "")
+                    .addClass($option.is(":disabled") ? "disabled" : "")
+                    .attr("aria-disabled", $option.is(":disabled") ? "true" : ""),
+                $inner = $("<div class='item'></div>"),
+                $text = $("<div class='text'></div>")
+                    .html(o.optionFormat.call($option[0], 0, index + 1));
+            return $li.append($inner.append($text));
+        };
+        
+        // causes focus if original is focused
+        focusOrig = function() {
+            blurAllButMe();
+            $display.triggerHandler("focus");
+        };
+        
+        // loses focus if original is blurred
+        blurOrig = function() {
+            if(!$sb.is(".open")) {
+                $display.triggerHandler("blur");
+            }
+        };
+        
+        // unbind and remove
+        destroySB = function( internal ) {
+            $sb.remove();
+            $orig
+                .unbind(".sb")
+                .removeClass("has_sb");
+            $(window).unbind("resize", delayPositionSB);
+            if(!internal) {
+                $orig.removeData("sb");
+            }
+        };
+        
+        // destroy then load, maintaining open/focused state if applicable
+        reloadSB = function() {
+            var isOpen = $sb.is(".open"),
+                isFocused = $display.is(".focused");
+            closeSB(true);
+            destroySB(true);
+            self.init(o);
+            if(isOpen) {
+                $orig.focus();
+                openSB(true);
+            } else if(isFocused) {
+                $orig.focus();
+            }
+        };
+        
+        // debouncing when useTie === true
+        delayReloadSB = function() {
+            clearTimeout(delayReloadTimeout);
+            delayReloadTimeout = setTimeout(reloadSB, 30);
+        };
+        
+        // when the user clicks outside the sb
+        closeAndUnbind = function() {
+            $sb.removeClass("focused");
+            closeSB();
+            unbind();
+        };
+        
+        unbind = function() {
+          $(document)
+              .unbind("click", closeAndUnbind)
+              .unbind("keyup", keyupSB)
+              .unbind("keypress", stopPageHotkeys)
+              .unbind("keydown", stopPageHotkeys)
+              .unbind("keydown", keydownSB);
+        };
+        
+        // trigger all sbs to close
+        closeAll = function() {
+            $(".sb.open." + o.selectboxClass).triggerAll("close");
+        };
+        
+        // trigger all sbs to blur
+        blurAllButMe = function() {
+            $(".sb.focused." + o.selectboxClass).not($sb[0]).find(".display").blur();
+        };
+        
+        // to prevent multiple selects open at once
+        closeAllButMe = function() {
+            $(".sb.open." + o.selectboxClass).not($sb[0]).triggerAll("close");
+        };
+        
+        // hide and reset dropdown markup
+        closeSB = function( instantClose ) {
+            if($sb.is(".open")) {
+                $display.blur();
+                $items.removeClass("hover");
+                unbind();
+                $dd.attr("aria-hidden", "true");
+                if(instantClose === true) {
+                  $dd.hide();
+                  $sb.removeClass("open");
+                  $sb.append($dd);
+                } else {
+                    $dd.fadeOut(o.animDuration, function() {
+                        $sb.removeClass("open");
+                        $sb.append($dd);
+                    });
+                }
+            }
+        };
+        
+        // since the context can change, we should get it dynamically
+        getDDCtx = function() {
+            var $ddCtx = null;
+            if(o.ddCtx === "self") {
+                $ddCtx = $sb;
+            } else if($.isFunction(o.ddCtx)) {
+                $ddCtx = $(o.ddCtx.call($orig[0]));
+            } else {
+                $ddCtx = $(o.ddCtx);
+            }
+            return $ddCtx;
+        };
+        
+        // DRY
+        getSelected = function() {
+          return $items.filter(".selected");
+        };
+        
+        // DRY
+        getEnabled = function() {
+          return $items.not(".disabled");
+        };
+        
+        // reposition the scroll of the dropdown so the selected option is centered (or appropriately onscreen)
+        centerOnSelected = function() {
+            $dd.scrollTop($dd.scrollTop() + getSelected().offsetFrom($dd).top - $dd.height() / 2 + getSelected().outerHeight(true) / 2);
+        };
+        
+        flickerDisplay = function() {
+            if($.browser.msie && $.browser.version < 8) {
+                $("." + o.selectboxClass + " .display").hide().show(); // fix ie7 display bug
+            }
+        };
+        
+        // show, reposition, and reset dropdown markup
+        openSB = function( instantOpen ) {
+            var dir,
+                $ddCtx = getDDCtx();
+            blurAllButMe();
+            $sb.addClass("open");
+            $ddCtx.append($dd);
+            dir = positionSB();
+            $dd.attr("aria-hidden", "false");
+            if(instantOpen === true) {
+                $dd.show();
+                centerOnSelected();
+            } else if(dir === "down") {
+                $dd.slideDown(o.animDuration, centerOnSelected);
+            } else {
+                $dd.fadeIn(o.animDuration, centerOnSelected);
+            }
+            $orig.focus();
+        };
+        
+        // position dropdown based on collision detection
+        positionSB = function() {
+            var $ddCtx = getDDCtx(),
+                ddMaxHeight = 0,
+                ddX = $display.offsetFrom($ddCtx).left,
+                ddY = 0,
+                dir = "",
+                ml, mt,
+                bottomSpace, topSpace,
+                bottomOffset, spaceDiff,
+                bodyX, bodyY;
+            
+            // modify dropdown css for getting values
+            $dd.removeClass("above");
+            $dd.show().css({
+                maxHeight: "none",
+                position: "relative",
+                visibility: "hidden"
+            });
+            if(!o.fixedWidth) {
+              $dd.width($display.outerWidth() - $dd.extraWidth() + 1);
+            }
+            
+            // figure out if we should show above/below the display box
+            bottomSpace = $(window).scrollTop() + $(window).height() - $display.offset().top - $display.outerHeight();
+            topSpace = $display.offset().top - $(window).scrollTop();
+            bottomOffset = $display.offsetFrom($ddCtx).top + $display.outerHeight();
+            spaceDiff = bottomSpace - topSpace + o.dropupThreshold;
+            if($dd.outerHeight() < bottomSpace) {
+                ddMaxHeight = o.maxHeight ? o.maxHeight : bottomSpace;
+                ddY = bottomOffset;
+                dir = "down";
+            } else if($dd.outerHeight() < topSpace) {
+                ddMaxHeight = o.maxHeight ? o.maxHeight : topSpace;
+                ddY = $display.offsetFrom($ddCtx).top - Math.min(ddMaxHeight, $dd.outerHeight());
+                dir = "up";
+            } else if(spaceDiff >= 0) {
+                ddMaxHeight = o.maxHeight ? o.maxHeight : bottomSpace;
+                ddY = bottomOffset;
+                dir = "down";
+            } else if(spaceDiff < 0) {
+                ddMaxHeight = o.maxHeight ? o.maxHeight : topSpace;
+                ddY = $display.offsetFrom($ddCtx).top - Math.min(ddMaxHeight, $dd.outerHeight());
+                dir = "up";
+            } else {
+                ddMaxHeight = o.maxHeight ? o.maxHeight : "none";
+                ddY = bottomOffset;
+                dir = "down";
+            }
+            
+            ml = ("" + $("body").css("margin-left")).match(/^\d+/) ? $("body").css("margin-left") : 0;
+            mt = ("" + $("body").css("margin-top")).match(/^\d+/) ? $("body").css("margin-top") : 0;
+            bodyX = $().jquery >= "1.4.2"
+                ? parseInt(ml)
+                : $("body").offset().left;
+            bodyY = $().jquery >= "1.4.2"
+                ? parseInt(mt)
+                : $("body").offset().top;
+            
+            
+            // modify dropdown css for display
+            $dd.hide().css({
+                left: ddX + ($ddCtx.is("body") ? bodyX : 0),
+                maxHeight: ddMaxHeight,
+                position: "absolute",
+                top: ddY + ($ddCtx.is("body") ? bodyY : 0),
+                visibility: "visible"
+            });
+            if(dir === "up") {
+              $dd.addClass("above");
+            }
+            return dir;
+        };
+        
+        // when the user explicitly clicks the display
+        clickSB = function( e ) {
+            if($sb.is(".open")) {
+                closeSB();
+            } else {
+                openSB();
+            }
+            return false;
+        };
+        
+        // when the user selects an item in any manner
+        selectItem = function() {
+            var $item = $(this),
+                oldVal = $orig.val(),
+                newVal = $item.data("value");
+            
+            // update the original <select>
+            $orig.find("option").each(function() { this.selected = false; });
+            $($item.data("orig")).each(function() { this.selected = true; });
+            
+            // change the selection to this item
+            $items.removeClass("selected");
+            $item.addClass("selected");
+            $sb.attr("aria-active-descendant", $item.attr("id"));
+            
+            // update the title attr and the display markup
+            $display.find(".text").attr("title", $item.find(".text").html());
+            $display.find(".text").html(o.displayFormat.call($item.data("orig")));
+            
+            // trigger change on the old <select> if necessary
+            if(oldVal !== newVal) {
+                $orig.change();
+            }
+        };
+        
+        // when the user explicitly clicks an item
+        clickSBItem = function( e ) {
+            closeAndUnbind();
+            $orig.focus();
+            selectItem.call(this);
+            return false;
+        };
+        
+        // start over for generating the search term
+        clearSearchTerm = function() {
+            searchTerm = "";
+        };
+        
+        // iterate over all the options to see if any match the search term
+        findMatchingItem = function( term ) {
+            var i, t, $tNode,
+                $available = getEnabled();
+            for(i=0; i < $available.size(); i++) {
+                $tNode = $available.eq(i).find(".text");
+                t = $tNode.children().size() == 0 ? $tNode.text() : $tNode.find("*").text();
+                if(term.length > 0 && t.toLowerCase().match("^" + term.toLowerCase())) {
+                    return $available.eq(i);
+                }
+            }
+            return null;
+        };
+        
+        // if we get a match for any options, select it
+        selectMatchingItem = function( text ) {
+            var $matchingItem = findMatchingItem(text);
+            if($matchingItem !== null) {
+                selectItem.call($matchingItem[0]);
+                return true;
+            }
+            return false;
+        };
+        
+        // stop up/down/backspace/space from moving the page
+        stopPageHotkeys = function( e ) {
+            if(e.ctrlKey || e.altKey) {
+                return;
+            }
+            if(e.which === 38 || e.which === 40 || e.which === 8 || e.which === 32) {
+                e.preventDefault();
+            }
+        };
+        
+        // if a normal match fails, try matching the next element that starts with the pressed letter
+        selectNextItemStartsWith = function( c ) {
+            var i, t,
+                $selected = getSelected(),
+                $available = getEnabled();
+            for(i = $available.index($selected) + 1; i < $available.size(); i++) {
+                t = $available.eq(i).find(".text").text();
+                if(t !== "" && t.substring(0,1).toLowerCase() === c.toLowerCase()) {
+                    selectItem.call($available.eq(i)[0]);
+                    return true;
+                }
+            }
+            return false;
+        };
+        
+        // go up/down using arrows or attempt to autocomplete based on string
+        keydownSB = function( e ) {
+            if(e.altKey || e.ctrlKey) {
+                return false;
+            }
+            var $selected = getSelected(),
+                $enabled = getEnabled();
+            switch(e.which) {
+            case 9: // tab
+                closeSB();
+                blurSB();
+                break;
+            case 35: // end
+                if($selected.size() > 0) {
+                    e.preventDefault();
+                    selectItem.call($enabled.filter(":last")[0]);
+                    centerOnSelected();
+                }
+                break;
+            case 36: // home
+                if($selected.size() > 0) {
+                    e.preventDefault();
+                    selectItem.call($enabled.filter(":first")[0]);
+                    centerOnSelected();
+                }
+                break;
+            case 38: // up
+                if($selected.size() > 0) {
+                    if($enabled.filter(":first")[0] !== $selected[0]) {
+                        e.preventDefault();
+                        selectItem.call($enabled.eq($enabled.index($selected)-1)[0]);
+                    }
+                    centerOnSelected();
+                }
+                break;
+            case 40: // down
+                if($selected.size() > 0) {
+                    if($enabled.filter(":last")[0] !== $selected[0]) {
+                        e.preventDefault();
+                        selectItem.call($enabled.eq($enabled.index($selected)+1)[0]);
+                        centerOnSelected();
+                    }
+                } else if($items.size() > 1) {
+                    e.preventDefault();
+                    selectItem.call($items.eq(0)[0]);
+                }
+                break;
+            default:
+                break;
+            }
+        };
+        
+        // the user is typing -- try to select an item based on what they press
+        keyupSB = function( e ) {
+            if(e.altKey || e.ctrlKey) {
+              return false;
+            }
+            if(e.which !== 38 && e.which !== 40) {
+                
+                // add to the search term
+                searchTerm += String.fromCharCode(e.keyCode);
+                
+                if(selectMatchingItem(searchTerm)) {
+                
+                    // we found a match, continue with the current search term
+                    clearTimeout(cstTimeout);
+                    cstTimeout = setTimeout(clearSearchTerm, o.acTimeout);
+                    
+                } else if(selectNextItemStartsWith(String.fromCharCode(e.keyCode))) {
+                    
+                    // we selected the next item that starts with what you just pressed
+                    centerOnSelected();
+                    clearTimeout(cstTimeout);
+                    cstTimeout = setTimeout(clearSearchTerm, o.acTimeout);
+                    
+                } else {
+                    
+                    // no matches were found, clear everything
+                    clearSearchTerm();
+                    clearTimeout(cstTimeout);
+                    
+                }
+            }
+        };
+        
+        // when the sb is focused (by tab or click), allow hotkey selection and kill all other selectboxes
+        focusSB = function() {
+            closeAllButMe();
+            $sb.addClass("focused");
+            $(document)
+                .click(closeAndUnbind)
+                .keyup(keyupSB)
+                .keypress(stopPageHotkeys)
+                .keydown(stopPageHotkeys)
+                .keydown(keydownSB);
+        };
+        
+        // when the sb is blurred (by tab or click), disable hotkey selection
+        blurSB = function() {
+            $sb.removeClass("focused");
+            $display.removeClass("active");
+            $(document)
+                .unbind("keyup", keyupSB)
+                .unbind("keydown", stopPageHotkeys)
+                .unbind("keypress", stopPageHotkeys)
+                .unbind("keydown", keydownSB);
+        };
+        
+        // add hover class to an element
+        addHoverState = function() {
+          $(this).addClass("hover");
+        };
+        
+        // remove hover class from an element
+        removeHoverState = function() {
+          $(this).removeClass("hover");
+        };
+        
+        // add active class to the display
+        addActiveState = function() {
+          $display.addClass("active");
+          $(document).bind("mouseup", removeActiveState);
+        };
+        
+        // remove active class from an element
+        removeActiveState = function() {
+          $display.removeClass("active");
+          $(document).unbind("mouseup", removeActiveState);
+        };
+        
+        // constructor
+        this.init = function( opts ) {
+            
+            // this plugin is not compatible with IE6 and below;
+            // a normal <select> will be displayed for old browsers
+            if($.browser.msie && $.browser.version < 7) {
+              return;
+            }
+        
+            // get the original <select> and <label>
+            $orig = $(this.elem);
+            if($orig.attr("id")) {
+                $label = $("label[for='" + $orig.attr("id") + "']:first");
+            }
+            if(!$label || $label.size() === 0) {
+                $label = $orig.closest("label");
+            }
+            
+            // don't create duplicate SBs
+            if($orig.hasClass("has_sb")) {
+                return;
+            }
+            
+            // set the various options
+            o = $.extend({
+                acTimeout: 800,               // time between each keyup for the user to create a search string
+                animDuration: 200,            // time to open/close dropdown in ms
+                ddCtx: 'body',                // body | self | any selector | a function that returns a selector (the original select is the context)
+                dropupThreshold: 150,         // the minimum amount of extra space required above the selectbox for it to display a dropup
+                fixedWidth: false,            // if false, dropdown expands to widest and display conforms to whatever is selected
+                maxHeight: false,             // if an integer, show scrollbars if the dropdown is too tall
+                maxWidth: false,              // if an integer, prevent the display/dropdown from growing past this width; longer items will be clipped
+                selectboxClass: 'selectbox',  // class to apply our markup
+                useTie: false,                // if jquery.tie is included and this is true, the selectbox will update dynamically
+                
+                // markup appended to the display, typically for styling an arrow
+                arrowMarkup: "<div class='arrow_btn'><span class='arrow'></span></div>",
+                
+                // use optionFormat by default
+                displayFormat: undefined,
+                
+                // formatting for the display; note that it will be wrapped with <a href='#'><span class='text'></span></a>
+                optionFormat: function( ogIndex, optIndex ) {
+                    if($(this).size() > 0) {
+                        var label = $(this).attr("label");
+                        if(label && label.length > 0) {
+                          return label;
+                        }
+                        return $(this).text();
+                    } else {
+                        return "";
+                    }
+                },
+                
+                // the function to produce optgroup markup
+                optgroupFormat: function( ogIndex ) {
+                    return "<span class='label'>" + $(this).attr("label") + "</span>";
+                }
+            }, opts);
+            o.displayFormat = o.displayFormat || o.optionFormat;
+            
+            // generate the new sb
+            loadSB();
+        };
+        
+        // public method interface
+        this.open = openSB;
+        this.close = closeSB;
+        this.refresh = reloadSB;
+        this.destroy = destroySB;
+        this.options = function( opts ) {
+            o = $.extend(o, opts);
+            reloadSB();
+        };
+    };
+
+    $.proto("sb", SelectBox);
+
+}(jQuery, window));
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1922937f/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/GemFireDistributedSystem.java
----------------------------------------------------------------------
diff --git a/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/GemFireDistributedSystem.java b/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/GemFireDistributedSystem.java
new file mode 100644
index 0000000..70a1d99
--- /dev/null
+++ b/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/GemFireDistributedSystem.java
@@ -0,0 +1,312 @@
+/*=========================================================================
+ * Copyright (c) 2012-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.vmware.gemfire.tools.pulse.testbed;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+
+/**
+ * 
+ * TODO
+ * 0. SystemAlerts
+ * 1. Operations like member-up/down/crash, region create/destroy [7.5 scope]
+ * 2. Read events like member-up/down/crash, region create/destroy [7.5 scope]
+ * 3. PropFile Writing
+ * 4. Link to other remote systems, topology - multi-cluster [7.5] 
+ * 
+ * @author tushark
+ *
+ */
+public class GemFireDistributedSystem {
+  
+  private static final String SERVERS = "servers";
+  private static final String LOCATORS = "locators";
+  private static final String PEERS = "peers";
+  private static final String HOSTS = "hosts";
+  private static final String REGIONS = "regions";
+  private static final String CLIENTS = "clients";
+  private static final String SEP = ".";
+  private static final String FUNCTIONS = null;
+  private static final String CQS = null;
+  
+  
+  List<Server> servers = new ArrayList<Server>();
+  List<Client> clients = new ArrayList<Client>();
+  List<Locator> locators = new ArrayList<Locator>();
+  List<Peer> peers = new ArrayList<Peer>();
+  List<Host> hosts = new ArrayList<Host>();
+  List<Region> regions = new ArrayList<Region>();
+  List<Function> functions = new ArrayList<Function>();
+  List<CQ> cqs = new ArrayList<CQ>();
+  String dsName = null;
+  
+  public GemFireDistributedSystem(String name,Properties pr){
+    PropFileHelper propertiesFile = new PropFileHelper(pr);
+    this.dsName = name;
+    readGemfireDS(propertiesFile);
+  }
+  
+  public GemFireDistributedSystem(String name,String fileName) throws IOException{
+    PropFileHelper propertiesFile = new PropFileHelper(fileName);
+    this.dsName = name;
+    readGemfireDS(propertiesFile);
+  }
+  
+  private void readGemfireDS(PropFileHelper propertiesFile) {
+    String serverStrings[] = propertiesFile.readValues(dsName + SEP + SERVERS);
+    System.out.println("Servers = " + serverStrings.length);
+    for(String serverName : serverStrings){
+      Server server = new Server();
+      server.init(propertiesFile,dsName,serverName);
+      servers.add(server);
+    }  
+    
+    String clientStrings[] = propertiesFile.readValues(dsName + SEP + CLIENTS);
+    System.out.println("Clients = " + clientStrings.length);
+    for(String clientName : clientStrings){
+      Client client = new Client();
+      client.init(propertiesFile,dsName,clientName);
+      clients.add(client);
+    }  
+    
+    String locatorStrings[] = propertiesFile.readValues(dsName + SEP + LOCATORS);
+    System.out.println("Locators = " + locatorStrings.length);
+    for(String locatorName : locatorStrings){
+      Locator locator = new Locator();
+      locator.init(propertiesFile,dsName,locatorName);
+      locators.add(locator);
+    }
+    
+    String peerStrings[] = propertiesFile.readValues(dsName + SEP + PEERS);
+    System.out.println("Peers = " + peerStrings.length);
+    for(String peerName : peerStrings){
+      Peer peer = new Peer();
+      peer.init(propertiesFile,dsName,peerName);
+      peers.add(peer);
+    }
+    
+    String hostsStrings[] = propertiesFile.readValues(dsName + SEP + HOSTS);
+    for(String hostName : hostsStrings){
+      Host host = new Host();
+      host.init(propertiesFile,dsName,hostName);
+      hosts.add(host);
+    }
+    
+    String regionsStrings[] = propertiesFile.readValues(dsName + SEP + REGIONS);
+    for(String regionName : regionsStrings){
+      Region region = new Region();
+      region.init(propertiesFile,dsName,regionName);
+      regions.add(region);
+    }
+    
+    String functionStrings[] = propertiesFile.readValues(dsName + SEP + FUNCTIONS);
+    for(String functionName : functionStrings){
+      Function function = new Function();
+      function.init(propertiesFile,dsName,functionName);
+      functions.add(function);
+    }    
+    
+    String cqStrings[] = propertiesFile.readValues(dsName + SEP + CQS);
+    for(String cqName : cqStrings){
+      CQ cq = new CQ();
+      cq.init(propertiesFile,dsName,cqName);
+      cqs.add(cq);
+    }
+    
+  }
+  
+  public List<Region> getRegions(String memberName) {    
+    List<Region> list = new ArrayList<Region>();
+    for(Region r : regions){
+      if(r.getMembers().contains(memberName))
+          list.add(r);
+    }
+    return list;
+   }
+  
+  public Region getRegion(String regionName) {
+    Region r = null;
+    for (Region rn : getRegions()) {
+      if (rn.getName().equals(regionName)) {
+        r = rn;
+        break;
+      }
+    }
+    return r;
+  }
+
+  public List<Region> getRegions() {
+   return regions;
+  }
+  
+  public List<Function> getFunction() {
+    return functions;
+  }
+  
+  public List<CQ> getCQs() {
+    return cqs;
+  }
+  
+  public List<Server> getServers(){
+    return servers;    
+  }
+  
+  public List<Client> getClients(){
+    return clients;
+  }
+  
+  public List<Peer> getPeers(){
+    return peers;    
+  }
+  
+  public List<Locator> getLocators(){
+    return locators;    
+  }
+  
+  public List<Host> getPhysicalHosts(){
+    return hosts;    
+  }
+  
+  public static class Base{
+    protected Map<String,String> properties=null;
+    protected String name;
+    
+    public void init(PropFileHelper propertiesFile, String dsName, String name) {
+      this.name = name;      
+      String leadingkey = dsName + SEP + name;
+      Map<String,String> map = propertiesFile.readObject(leadingkey);
+      map.put("name",name);
+      this.properties = map;
+    }
+    
+    public String getName(){
+      return properties.get("name");
+    }
+    
+    public String key(String string) {
+      return properties.get(string);
+    }
+    
+    public int keyInt(String string) {
+      String str = properties.get(string);
+      try{
+        int index = Integer.parseInt(str);
+        return index;
+      }catch(Exception e){
+        return -1;
+      }
+    }
+    
+    public List<String> values(String string) {
+      String values= properties.get(string);
+      String array[] = values.split(",");
+      List<String> list = new ArrayList<String>();
+      for(String s:array)
+        list.add(s);
+      return list;
+    }
+    
+  }
+  
+  public static class Host extends Base{
+    
+  }
+  
+  public static class Server extends Base{
+    public String toString(){
+      return properties.get("name") + "[on host=" + properties.get("host");
+    }
+    
+    public String getHost(){
+      return properties.get("host");
+    }
+  }
+  
+  public static class Client extends Base{
+    public String toString(){
+      return properties.get("name") ;//+ "[on host=" + properties.get("host");
+    }
+    
+    public String getHost(){
+      return properties.get("host");
+    }
+  }
+  
+  public static class Locator extends Base{
+    public String getHost(){
+      return properties.get("host");
+    }
+  }
+  
+  public static class Peer extends Base{
+
+    public String getHost(){
+      return properties.get("host");
+    }
+  }
+  
+  public static class Region extends Base{
+    public String toString(){
+      return properties.get("name") + "[type=" + properties.get("type");
+    }
+    
+    public String getType(){
+      return key("type");
+    }
+    
+    public int getEntryCount(){
+      return keyInt("entryCount");
+    }
+    
+    public List<String> getWanSenders(){
+      return values("wanSenders");
+    }
+    
+    public List<String> getMembers(){
+      return values("members");
+    }
+    
+  }
+  
+  public static class WanSender extends Base{
+    
+  }
+
+  public static class Function extends Base{
+    public String getMemberId(){
+      return key("memberId");
+    }    
+  }
+  
+  public static class CQ extends Base{
+    public String getQuery(){
+      return key("query");
+    }    
+    
+    public String getClient(){
+      return key("client");
+    }
+  }
+  
+  public static class SystemAlert extends Base{
+    //TODO
+  }
+  
+  public static void main(String[] args) throws IOException {
+    
+    GemFireDistributedSystem ds = new GemFireDistributedSystem("t1", "config/testbed.properties");
+    System.out.println("Servers = " + ds.getServers());    
+    System.out.println("Regions = " + ds.getRegions());
+    System.out.println("Clients = " + ds.getClients());
+  } 
+  
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1922937f/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/GemfireTopology.java
----------------------------------------------------------------------
diff --git a/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/GemfireTopology.java b/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/GemfireTopology.java
new file mode 100644
index 0000000..d463248
--- /dev/null
+++ b/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/GemfireTopology.java
@@ -0,0 +1,5 @@
+package com.vmware.gemfire.tools.pulse.testbed;
+
+public class GemfireTopology {
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1922937f/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/PropFileHelper.java
----------------------------------------------------------------------
diff --git a/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/PropFileHelper.java b/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/PropFileHelper.java
new file mode 100644
index 0000000..84d7b1a
--- /dev/null
+++ b/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/PropFileHelper.java
@@ -0,0 +1,104 @@
+/*=========================================================================
+ * Copyright (c) 2012-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.vmware.gemfire.tools.pulse.testbed;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+public class PropFileHelper {
+  
+  private String filePath=null;
+  private Properties pr=null;
+  
+  public PropFileHelper(String filePath) throws FileNotFoundException, IOException{
+    this.filePath = filePath;
+    pr = new Properties();
+    pr.load(new FileInputStream(new File(this.filePath)));
+  }
+  
+  public PropFileHelper(Properties pr2) {
+    this.pr =pr2;
+  }
+
+  public String[] readValues(String property){
+    return readValues(property,",");
+  }
+  
+  public String[] readValues(String property, String separator){
+    String value = readKey(property);
+    if(value!=null){
+      String[] array = value.split(separator);
+      return array;
+    }else{
+      return new String[0];
+    }
+  }
+  
+  public String readKey(String key){
+    String value = pr.getProperty(key);
+    if(value!=null)
+      return value.trim();
+    else return value;
+  }
+  
+  public Map<String,String> readObject(String leadingkey){
+    Map<String,String> map = new HashMap<String,String>();
+    String leadingKeyString = leadingkey+"."; 
+    for(Object keyObject : pr.keySet()){
+      String key = (String)keyObject;
+      String value = readKey(key);
+      if(key.startsWith(leadingKeyString)){
+        String innerProp = key.substring(leadingKeyString.length());
+        /* inner object stuff
+        if(checkForMultipleValues){
+          if(innerProp.contains(separator)){
+            String array[] = readValues(key);
+          }
+        }else*/
+        {
+          //System.out.println("Adding prop with key " + innerProp + " k=" + leadingkey);
+          map.put(innerProp, value);
+        }      
+      }
+    }    
+    return map;
+  }
+  
+  public static void main(String[] args) {
+    
+    Properties pr = new Properties();
+    pr.put("topologies", "t1,t2");
+    pr.put("t1.id", "1");
+    pr.put("t2.id", "2");
+    
+    pr.put("t1.prop1", "prop11");
+    pr.put("t1.prop2", "prop12");
+    pr.put("t1.prop3", "prop13");
+    pr.put("t2.prop1", "1");
+    pr.put("t2.prop2", "2");
+    pr.put("t2.prop3", "3");
+    
+    PropFileHelper helper = new PropFileHelper(pr);
+    String topologies[] = helper.readValues("topologies");
+    for(String topology : topologies){
+      Map<String,String> topologyMap = helper.readObject(topology);
+      System.out.println(topologyMap);
+    }
+    
+  }
+
+  public Properties getProperties() {
+    return pr;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1922937f/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/PropMockDataUpdater.java
----------------------------------------------------------------------
diff --git a/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/PropMockDataUpdater.java b/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/PropMockDataUpdater.java
new file mode 100644
index 0000000..d22e33d
--- /dev/null
+++ b/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/PropMockDataUpdater.java
@@ -0,0 +1,504 @@
+/*=========================================================================
+ * Copyright (c) 2012-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.vmware.gemfire.tools.pulse.testbed;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Random;
+import java.util.ResourceBundle;
+
+import com.vmware.gemfire.tools.pulse.internal.data.Cluster;
+import com.vmware.gemfire.tools.pulse.internal.data.Cluster.Alert;
+import com.vmware.gemfire.tools.pulse.internal.data.Cluster.Client;
+import com.vmware.gemfire.tools.pulse.internal.data.Cluster.GatewayReceiver;
+import com.vmware.gemfire.tools.pulse.internal.data.Cluster.GatewaySender;
+import com.vmware.gemfire.tools.pulse.internal.data.Cluster.Member;
+import com.vmware.gemfire.tools.pulse.internal.data.Cluster.Region;
+import com.vmware.gemfire.tools.pulse.internal.data.IClusterUpdater;
+import com.vmware.gemfire.tools.pulse.internal.data.PulseConstants;
+import com.vmware.gemfire.tools.pulse.internal.data.Repository;
+import com.vmware.gemfire.tools.pulse.internal.json.JSONException;
+import com.vmware.gemfire.tools.pulse.internal.json.JSONObject;
+import com.vmware.gemfire.tools.pulse.internal.log.PulseLogWriter;
+import com.vmware.gemfire.tools.pulse.testbed.GemFireDistributedSystem.Locator;
+import com.vmware.gemfire.tools.pulse.testbed.GemFireDistributedSystem.Peer;
+import com.vmware.gemfire.tools.pulse.testbed.GemFireDistributedSystem.Server;
+
+
+public class PropMockDataUpdater implements IClusterUpdater {
+  private static final int MAX_HOSTS = 40;
+  private static final PulseLogWriter LOGGER = PulseLogWriter.getLogger();
+  private final ResourceBundle resourceBundle = Repository.get().getResourceBundle();
+  private static final int POLL_INTERVAL = 5000;
+  public static final int MAX_SAMPLE_SIZE = 180;
+  public static final int ALERTS_MAX_SIZE = 1000;
+  public static final int PAGE_ALERTS_MAX_SIZE = 100;
+
+  private Cluster cluster= null;
+  private TestBed testbed;
+  private final String testbedFile = System.getProperty("pulse.propMockDataUpdaterFile");;
+
+  public PropMockDataUpdater(Cluster cluster) {
+    this.cluster = cluster;
+    try {
+      loadPropertiesFile();
+    } catch (FileNotFoundException e) {
+      throw new RuntimeException(e);
+    } catch (IOException e) {
+      throw new RuntimeException(e);
+    }
+  }
+
+  private void loadPropertiesFile() throws FileNotFoundException, IOException{
+    this.testbed = new TestBed(testbedFile,true);
+  }
+
+  /**
+   * function used for updating Cluster data
+   * for Mock
+   */
+  @Override
+  public boolean updateData() {
+    cluster.setConnectedFlag(true);
+    Random r = new Random(System.currentTimeMillis());
+    long totalHeapSize = Math.abs(r.nextInt(3200 - 2048) + 2048);
+    cluster.setTotalHeapSize(totalHeapSize);
+    long usedHeapSize  = Math.abs(r.nextInt(2048));
+    cluster.setUsedHeapSize(usedHeapSize);
+    float writePerSec = Math.abs(r.nextInt(100));
+    cluster.setWritePerSec(writePerSec);
+
+    //propfile
+    cluster.setSubscriptionCount(testbed.getRootDs().getClients().size());
+    cluster.setRegisteredCQCount((long) testbed.getRootDs().getCQs().size());
+    cluster.setRunningFunctionCount(testbed.getRootDs().getFunction().size());
+
+
+    cluster.setClusterId( Math.abs(r.nextInt(100)));
+    cluster.getWritePerSecTrend().add(writePerSec);
+    cluster.setDiskWritesRate(writePerSec);
+
+    long garbageCollectionCount = Math.abs(r.nextInt(100));
+    cluster.setGarbageCollectionCount(garbageCollectionCount);
+    cluster.getGarbageCollectionTrend().add(garbageCollectionCount);
+
+    long readPerSec = Math.abs(r.nextInt(100));
+    cluster.setReadPerSec(readPerSec);
+    cluster.getReadPerSecTrend().add(readPerSec);
+
+    long diskReadsRate = readPerSec;cluster.setDiskReadsRate(diskReadsRate);
+    cluster.setDiskReadsRate(readPerSec);
+    long queriesPerSec = Math.abs(r.nextInt(100));
+    cluster.setQueriesPerSec(queriesPerSec);
+    cluster.getQueriesPerSecTrend().add(queriesPerSec);
+
+    long loadPerSec = Math.abs(r.nextInt(100));
+    cluster.setLoadPerSec(loadPerSec);
+    cluster.setTotalHeapSize(totalHeapSize);
+    long totalBytesOnDisk = totalHeapSize;
+    cluster.setTotalBytesOnDisk(totalBytesOnDisk);
+
+    cluster.getTotalBytesOnDiskTrend().add(totalBytesOnDisk);
+
+    cluster.getMemoryUsageTrend().add(usedHeapSize);
+    cluster.getThroughoutWritesTrend().add(writePerSec);
+
+    cluster.setMemberCount(0);
+
+    Map<String,Cluster.Member>  membersHMap = cluster.getMembersHMap();
+    List<Cluster.Region> regionsList = (List<Cluster.Region>)cluster.getClusterRegions().values();
+    Map<String, Boolean> wanInformation = cluster.getWanInformation();
+
+    // Create 3 members first time around
+    int locatorCount=0;
+    if (membersHMap.size() == 0) {
+      for(Locator locator : testbed.getRootDs().getLocators()){
+        String id = "(Launcher_Locator-1099-13-40-24-5368)-"+locatorCount++;
+        String name = locator.getName();
+        membersHMap.put(id+name, initializeMember(id,name, true, true, true, false, locator.getHost()));
+      }
+      cluster.setLocatorCount(testbed.getRootDs().getLocators().size());
+
+      int serverCount=0;
+      for(Server server : testbed.getRootDs().getServers()){
+        String id = "(Launcher_Server-1099-13-40-24-5368)-"+serverCount++;
+        String name = server.getName();
+        membersHMap.put(id+name, initializeMember(id,name, false, true, false, true, server.getHost()));
+      }
+      cluster.setServerCount(testbed.getRootDs().getServers().size());
+
+      int peerCount=0;
+      for(Peer peer : testbed.getRootDs().getPeers()){
+        String id = "(Launcher_Peer-1099-13-40-24-5368)-"+peerCount++;
+        String name = peer.getName();
+        membersHMap.put( id+name, initializeMember(id,name, false, true, false, false, peer.getHost()));
+      }
+
+      for(Entry<String, Member> memberSet : membersHMap.entrySet())
+      {
+        HashMap<String,Cluster.Region> memberRegions = new HashMap<String,Cluster.Region>();
+        HashMap<String,Cluster.Client> memberClientsHM = new HashMap<String,Cluster.Client>();
+
+        Random randomGenerator = new Random();
+
+        //Read from property file
+        int randomInt = (randomGenerator.nextInt(5)) + 1;
+        List<com.vmware.gemfire.tools.pulse.testbed.GemFireDistributedSystem.Region> thisMemberRegions = testbed.getRootDs().getRegions(memberSet.getValue().getName());
+
+        int regionExists = 0;
+        int index=0;
+        for (com.vmware.gemfire.tools.pulse.testbed.GemFireDistributedSystem.Region thisMemberRegion : thisMemberRegions) {
+          Region region = initMemberRegion(index++,thisMemberRegion.getName(),memberSet.getValue().getName(),
+              thisMemberRegion.getEntryCount(),thisMemberRegion.getType(), thisMemberRegion.getMembers().size()); //read from property file
+          if (regionsList.size() > 0) {
+            for (Region clusterRegion : regionsList) {
+              if ((region.getName()).equals(clusterRegion.getName())) {
+                clusterRegion.getMemberName().add(memberSet.getValue().getName());
+                //clusterRegion.memberCount = clusterRegion.memberCount + 1;
+                //int mcount = clusterRegion.getMemberCount() + 1;
+                //clusterRegion.setMemberCount(mcount);
+                regionExists = 1;
+                break;
+              }
+            }
+            if (regionExists == 0){
+              regionsList.add(region);
+            }
+          } else{
+            regionsList.add(region);
+          }
+          memberRegions.put(region.getFullPath(),region);
+          //totalRegionCount = regionsList.size();
+          cluster.setTotalRegionCount(regionsList.size());
+        }
+        membersHMap.get(memberSet.getKey()).setMemberRegions(memberRegions);
+
+        if (memberSet.getValue().isCache()) {
+          Client client = initMemberClient(0, memberSet.getValue().getHost()); //read from prop File
+          memberClientsHM.put(client.getId(), client);
+          randomInt = randomGenerator.nextInt(10);
+          for (int y = 1; y < randomInt; y++) {
+            Client newClient = initMemberClient(y, memberSet.getValue()
+                .getHost());
+            memberClientsHM.put(newClient.getId(), newClient);
+          }
+          membersHMap.get(memberSet.getKey()).updateMemberClientsHMap(memberClientsHM);
+          /*clientConnectionCount = clientConnectionCount
+              + membersHMap.get(memberSet.getKey()).getMemberClientsHMap().size();*/
+          long clientConnectionCount = cluster.getClientConnectionCount() + membersHMap.get(memberSet.getKey()).getMemberClientsHMap().size();
+          cluster.setClientConnectionCount(clientConnectionCount);
+        }
+
+      }
+    }
+    wanInformation.clear(); //read from property file
+    int wanInfoSize = Math.abs(r.nextInt(10));
+    wanInfoSize++;
+    for (int i = 0; i < wanInfoSize; i++) {
+      String name = "Mock Cluster" + i;
+      Boolean value = false;
+      if (i % 2 == 0){
+        value = true;
+      }
+      wanInformation.put(name, value);
+    }
+    //memberCount = membersHMap.size();
+    cluster.setMemberCount(membersHMap.size());
+
+    totalHeapSize = 0;
+    for(Entry<String, Member> memberSet : membersHMap.entrySet())
+    {
+      refresh(membersHMap.get(memberSet.getKey()));
+      Member member = membersHMap.get(memberSet.getKey());
+      totalHeapSize += member.getCurrentHeapSize();
+    }
+
+    for (Region region : regionsList) {
+      region.setGetsRate((Math.abs(r.nextInt(100))) + 1);
+      region.setPutsRate((Math.abs(r.nextInt(100))) +1);
+      region.getGetsPerSecTrend().add(region.getGetsRate());
+      region.getPutsPerSecTrend().add(region.getPutsRate());
+    }
+
+    return true;
+  }
+
+
+  private Region initMemberRegion(int count, String regionName, String memName, int entryCount, String type, int memberCount) {
+    Region memberRegion = new Region();
+    memberRegion.setName(regionName);
+    memberRegion.setFullPath("/"+regionName);
+    Random randomGenerator = new Random();
+    memberRegion.setSystemRegionEntryCount(entryCount);
+    // memberRegion.setEntrySize("N/A");
+    memberRegion.setEntrySize(Math.abs(randomGenerator.nextInt(10)));
+    memberRegion.setDiskStoreName("ABC");
+    memberRegion.setScope("DISTRIBUTED_NO_ACK");
+    memberRegion.setDiskSynchronous(true);
+    memberRegion.setRegionType(type);
+    if(type.contains("PERSISTENT"))
+      memberRegion.setPersistentEnabled(true);
+    else
+      memberRegion.setPersistentEnabled(false);
+    if (count % 2 == 0){
+      memberRegion.setWanEnabled(true);
+    }
+    else{
+      memberRegion.setWanEnabled(false);
+    }
+    memberRegion.setWanEnabled(true);
+    /*memberRegion.setSystemRegionEntryCount(Long.valueOf(String.valueOf(Math
+        .abs(randomGenerator.nextInt(100)))));*/
+    memberRegion.getMemberName().add(memName);
+    memberRegion.setMemberCount(memberCount);
+    return memberRegion;
+  }
+
+
+  private Client initMemberClient(int count, String host) {
+
+    Client memberClient = new Client();
+    Random r = new Random(System.currentTimeMillis());
+    memberClient.setName("Name_" + count);
+    long processCpuTime = (long) (r.nextDouble() * 100);
+    memberClient.setProcessCpuTime(processCpuTime);
+    memberClient.setCpuUsage(0);
+    memberClient.setGets(Math.abs(r.nextInt(100)));
+    memberClient.setHost(host);
+    memberClient.setId(String.valueOf(1000 + count));
+    memberClient.setPuts(Math.abs(r.nextInt(100)));
+    memberClient.setCpus(Math.abs(r.nextInt(20)));
+    memberClient.setQueueSize(Math.abs(r.nextInt(100)));
+    if ((count % 2) == 0){
+      memberClient.setStatus("up");
+    }
+    else{
+      memberClient.setStatus("down");
+    }
+    memberClient.setThreads(Math.abs(r.nextInt(100)));
+    memberClient
+        .setUptime(Math.abs(System.currentTimeMillis() - r.nextLong()));
+
+    return memberClient;
+  }
+
+  private Member initializeMember(String id, String name, boolean manager,
+      boolean isCache, boolean isLocator, boolean isServer, String host) {
+    Member m = new Member();
+
+    m.setId(id);
+    m.setName(name);
+
+    //m.setHost(getHostName(System.currentTimeMillis()));
+    m.setHost(host);
+
+    m.setMaxHeapSize(247);
+
+    Random r = new Random(System.currentTimeMillis());
+
+    m.setCache(isCache);
+    m.setLocator(isLocator);
+    m.setServer(isServer);
+    m.setManager(manager);
+
+    m.setLoadAverage((double) Math.abs(r.nextInt(100)));
+    m.setNumThreads(Math.abs(r.nextInt(100)));
+    m.setGarbageCollectionCount((long) Math.abs(r.nextInt(100)));
+    m.getGarbageCollectionSamples().add(m.getGarbageCollectionCount());
+
+    m.setTotalFileDescriptorOpen((long) Math.abs(r.nextInt(100)));
+    m.setTotalDiskUsage(Math.abs(r.nextInt(100)));
+
+
+    m.setThroughputWrites(Math.abs(r.nextInt(10)));
+    m.getThroughputWritesTrend().add(m.getThroughputWrites());
+
+    GatewayReceiver gatewayReceiver = m.getGatewayReceiver();
+    String port  = cluster.getPort();
+    if(port==null || "".equals(port))
+      port = "1099";
+    gatewayReceiver.setListeningPort(Integer.parseInt(port));
+    gatewayReceiver.setLinkThroughput((float) Math.abs(r.nextInt(10)));
+    gatewayReceiver.setAvgBatchProcessingTime((long) Math.abs(r.nextInt(10)));
+    gatewayReceiver.setId(String.valueOf(Math.abs(r.nextInt(10))));
+    gatewayReceiver.setQueueSize(Math.abs(r.nextInt(10)));
+    gatewayReceiver.setStatus(true);
+    gatewayReceiver.setBatchSize(Math.abs(r.nextInt(10)));
+
+
+    int gatewaySenderCount = Math.abs(r.nextInt(10));
+
+    List<GatewaySender> list = m.getGatewaySenderList();
+
+    for (int i = 0; i < gatewaySenderCount; i++) {
+      list.add(createGatewaySenderCount(r));
+    }
+
+
+    Map<String, List<Member>> physicalToMember = cluster.getPhysicalToMember();
+
+    List<Cluster.Member> memberArrList = physicalToMember.get(m.getHost());
+    if (memberArrList != null){
+      memberArrList.add(m);
+    }
+    else {
+      ArrayList<Cluster.Member> memberList = new ArrayList<Cluster.Member>();
+      memberList.add(m);
+      physicalToMember.put(m.getHost(), memberList);
+    }
+    int memberCount = cluster.getMemberCount();memberCount++;cluster.setMemberCount(memberCount);
+    return m;
+  }
+
+  private GatewaySender createGatewaySenderCount(Random r) {
+
+    GatewaySender gatewaySender = new GatewaySender();
+
+    gatewaySender.setBatchSize(Math.abs(r.nextInt(10)));
+    gatewaySender.setId(String.valueOf(Math.abs(r.nextInt(10))));
+    gatewaySender.setLinkThroughput((float) Math.abs(r.nextInt(10)));
+    gatewaySender.setPersistenceEnabled(true);
+    gatewaySender.setPrimary(true);
+    gatewaySender.setQueueSize(Math.abs(r.nextInt(10)));
+    gatewaySender.setSenderType(false);
+    gatewaySender.setStatus(true);
+
+    return gatewaySender;
+  }
+
+  /*
+  private String getHostName(long rndSeed) {
+    Random rnd = new Random(rndSeed);
+    String hName = null;
+
+    int index = Math.abs(rnd.nextInt(MAX_HOSTS));
+
+    ArrayList<String> hostNames = cluster.getHostNames();
+
+    if (hostNames.size() <= index) {
+      hName = "host" + hostNames.size();
+      hostNames.add(hName);
+    } else {
+      hName = hostNames.get(index);
+    }
+
+    Map<String, ArrayList<Member>> physicalToMember = cluster.getPhysicalToMember();
+
+    ArrayList<Member> memberArrList = physicalToMember.get(hName);
+    if (memberArrList != null) {
+      if (memberArrList.size() > 4){
+        hName = getHostName(rndSeed + rnd.nextLong());
+      }
+    }
+    return hName;
+  }*/
+
+  private void refresh(Member m) {
+    if(LOGGER.infoEnabled()){
+      LOGGER.info(resourceBundle.getString("LOG_MSG_REFRESHING_MEMBER_DATA")+" : " + m.getName());
+    }
+
+    Random r = new Random(System.currentTimeMillis());
+
+    m.setUptime(System.currentTimeMillis());
+    m.setQueueBacklog("" + Math.abs(r.nextInt(500)));
+    m.setCurrentHeapSize(Math.abs(r.nextInt(Math.abs((int) m.getMaxHeapSize()))));
+    m.setTotalDiskUsage(Math.abs(r.nextInt(100)));
+
+    Float cpuUsage = r.nextFloat() * 100;
+    m.getCpuUsageSamples().add(cpuUsage);
+    m.setCpuUsage(cpuUsage);
+
+    m.getHeapUsageSamples().add(m.getCurrentHeapSize());
+    m.setLoadAverage((double) Math.abs(r.nextInt(100)));
+    m.setNumThreads(Math.abs(r.nextInt(100)));
+    m.setGarbageCollectionCount((long) Math.abs(r.nextInt(100)));
+    m.getGarbageCollectionSamples().add(m.getGarbageCollectionCount());
+
+    m.setTotalFileDescriptorOpen((long) Math.abs(r.nextInt(100)));
+
+    m.setThroughputWrites(Math.abs(r.nextInt(10)));
+    m.getThroughputWritesTrend().add(m.getThroughputWrites());
+
+    m.setGetsRate(Math.abs(r.nextInt(5000)));
+    m.getGetsPerSecond().add(m.getGetsRate());
+
+    m.setPutsRate(Math.abs(r.nextInt(5000)));
+    m.getPutsPerSecond().add(m.getPutsRate());
+
+    Alert[] alerts = cluster.getAlertsList();
+    List<Alert> alertsList = Arrays.asList(alerts);
+
+    if (r.nextBoolean()) {
+      // Generate alerts
+      if (r.nextBoolean()) {
+        if (r.nextInt(10) > 5) {
+          alertsList.add(createAlert(Alert.SEVERE, m.getName(), alertsList.size()));
+          if(alertsList.size() > ALERTS_MAX_SIZE){
+            alertsList.remove(0);
+          }
+        }
+      }
+
+      if (r.nextBoolean()) {
+        if (r.nextInt(10) > 5) {
+          alertsList.add(createAlert(Alert.ERROR, m.getName(), alertsList.size()));
+          if(alertsList.size() > ALERTS_MAX_SIZE){
+            alertsList.remove(0);
+          }
+        }
+      }
+
+      if (r.nextBoolean()) {
+        if (r.nextInt(10) > 5) {
+          alertsList.add(createAlert(Alert.WARNING, m.getName(), alertsList.size()));
+          if(alertsList.size() > ALERTS_MAX_SIZE){
+            alertsList.remove(0);
+          }
+        }
+      }
+    }
+  }
+
+  private Alert createAlert(int sev, String memberName, int index) {
+
+    Alert alert = new Alert();
+    alert.setSeverity(sev);
+    alert.setId(index);
+    alert.setMemberName(memberName);
+    alert.setTimestamp(new Date());
+
+    switch (sev) {
+    case Alert.SEVERE:
+      alert.setDescription(PulseConstants.ALERT_DESC_SEVERE);
+      break;
+    case Alert.ERROR:
+      alert.setDescription(PulseConstants.ALERT_DESC_ERROR);
+      break;
+    case Alert.WARNING:
+      alert.setDescription(PulseConstants.ALERT_DESC_WARNING);
+      break;
+    }
+    return alert;
+  }
+
+  @Override
+  public JSONObject executeQuery(String queryText, String members, int limit)
+      throws JSONException {
+    // TODO for Sushant/Sachin - Add implementation for MockUpdater for Automation
+    return null;
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1922937f/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/TestBed.java
----------------------------------------------------------------------
diff --git a/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/TestBed.java b/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/TestBed.java
new file mode 100644
index 0000000..b68e0da
--- /dev/null
+++ b/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/TestBed.java
@@ -0,0 +1,57 @@
+/*=========================================================================
+ * Copyright (c) 2012-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.vmware.gemfire.tools.pulse.testbed;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+public class TestBed {
+  
+  private String fileName=null;
+  PropFileHelper propertiesFile =null;
+  GemFireDistributedSystem ds = null;
+  
+  public TestBed(String fileName) throws FileNotFoundException, IOException{
+    this.fileName = fileName;
+    propertiesFile = new PropFileHelper(fileName);
+    ds = new GemFireDistributedSystem("t1", propertiesFile.getProperties());
+  }
+  
+  
+  public TestBed(String fileName,boolean flag) throws FileNotFoundException, IOException{    
+    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
+    InputStream inputStream = classLoader.getResourceAsStream("testbed.properties");
+    System.out.println("Inputstream : " + inputStream);
+    Properties properties = new Properties();
+    try {
+      properties.load(inputStream);
+    } catch (IOException e) {
+      e.printStackTrace();
+      throw new RuntimeException(e);
+    }    
+    this.fileName = fileName;
+    propertiesFile = new PropFileHelper(properties);
+    ds = new GemFireDistributedSystem("t1", propertiesFile.getProperties());
+  }
+  
+  
+  public String getBrowserForDriver(){
+    return propertiesFile.readKey("browser");
+  }
+  
+  public String getBrowserVersionForDriver(String browser){
+    return propertiesFile.readKey("browserVersion");
+  }
+  
+  public GemFireDistributedSystem getRootDs(){
+    return ds;
+  }  
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1922937f/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/driver/PulseUITest.java
----------------------------------------------------------------------
diff --git a/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/driver/PulseUITest.java b/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/driver/PulseUITest.java
new file mode 100644
index 0000000..127ddf8
--- /dev/null
+++ b/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/driver/PulseUITest.java
@@ -0,0 +1,311 @@
+/*=========================================================================
+ * Copyright (c) 2012-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.vmware.gemfire.tools.pulse.testbed.driver;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.util.List;
+
+import junit.framework.Assert;
+
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.startup.Tomcat;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openqa.selenium.By;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.firefox.FirefoxDriver;
+import org.openqa.selenium.support.ui.ExpectedCondition;
+import org.openqa.selenium.support.ui.WebDriverWait;
+
+import com.vmware.gemfire.tools.pulse.testbed.GemFireDistributedSystem.Locator;
+import com.vmware.gemfire.tools.pulse.testbed.GemFireDistributedSystem.Peer;
+import com.vmware.gemfire.tools.pulse.testbed.GemFireDistributedSystem.Region;
+import com.vmware.gemfire.tools.pulse.testbed.GemFireDistributedSystem.Server;
+import com.vmware.gemfire.tools.pulse.testbed.TestBed;
+
+/**
+ * @author Sushant Rawal
+ * @author tushark
+ *
+ */
+public class PulseUITest {
+
+  private WebDriver driver;
+  private TestBed testBed;
+  private final String testBedPropertyfile = System.getProperty("pulse.propMockDataUpdaterFile");  
+  private static String pulseURL = System.getProperty("pulse.url");
+  private static String path =System.getProperty("pulse.war");;
+  
+  private static final String userName = "admin";
+  private static final String pasword = "admin";
+  
+  private static final String DATA_VIEW_LABEL = "Data View";
+  private static final String CLUSTER_VIEW_MEMBERS_ID = "clusterTotalMembersText";
+  private static final String CLUSTER_VIEW_SERVERS_ID = "clusterServersText";
+  private static final String CLUSTER_VIEW_LOCATORS_ID = "clusterLocatorsText";
+  private static final String CLUSTER_VIEW_REGIONS_ID = "clusterTotalRegionsText";
+  
+  private static Tomcat tomcat = null;
+  private static WebDriver initdriver = null;
+  
+  @BeforeClass
+  public static void setUpTomcat(){
+    try {      
+      String host = InetAddress.getLocalHost().getHostAddress();
+      int port = 8080;      
+      String context = "/pulse";      
+      //System.setProperty("pulse.propMockDataUpdaterClass", "com.vmware.gemfire.tools.pulse.testbed.PropMockDataUpdater");      
+      tomcat = TomcatHelper.startTomcat(host, port, context, path);   
+      pulseURL = "http://" + host  + ":" + port + context;
+      Thread.sleep(1000); //wait till tomcat settles down
+      initdriver = new FirefoxDriver();
+      loginToPulse(initdriver, userName, pasword);
+      Thread.sleep(5000); //wait till pulse starts polling threads...
+      initdriver.close();
+    } catch (FileNotFoundException e) {      
+      e.printStackTrace();
+      Assert.fail("Error " +e.getMessage());
+    } catch (IOException e) {
+      e.printStackTrace();
+      Assert.fail("Error " +e.getMessage());
+    } catch (Exception e) {
+      e.printStackTrace();
+      Assert.fail("Error " +e.getMessage());
+    }        
+  }
+  
+
+  @Before  
+  public void setUp() {
+    try {
+      testBed = new TestBed(testBedPropertyfile,true);
+    } catch (FileNotFoundException e) {      
+      e.printStackTrace();
+      Assert.fail("Error " +e.getMessage());
+    } catch (IOException e) {
+      e.printStackTrace();
+      Assert.fail("Error " +e.getMessage());
+    } catch (Exception e) {
+      e.printStackTrace();
+      Assert.fail("Error " +e.getMessage());
+    }    
+        
+    driver = new FirefoxDriver();
+    driver.manage().window().maximize();//required to make all elements visible
+    loginToPulse();    
+  }
+  
+  private void loginToPulse() {    
+    loginToPulse(driver, userName, pasword);
+  }
+
+  private static void loginToPulse(WebDriver driver, String userName,String password){
+    driver.get(pulseURL);    
+    WebElement userNameElement = driver.findElement(By.id("user_name"));
+    WebElement passwordElement = driver.findElement(By.id("user_password"));
+    userNameElement.sendKeys(userName);
+    passwordElement.sendKeys(password);
+    passwordElement.submit();
+    WebElement userNameOnPulsePage = (new WebDriverWait(driver, 10))
+        .until(new ExpectedCondition<WebElement>() {
+          @Override
+          public WebElement apply(WebDriver d) {
+            return d.findElement(By.id("userName"));
+          }
+        });
+    Assert.assertNotNull(userNameOnPulsePage);
+  }
+  
+  
+  private void searchByLinkAndClick(String linkText){
+    WebElement  dataViewButton= By.linkText(linkText).findElement(driver);
+    Assert.assertNotNull(dataViewButton);   
+    dataViewButton.click();
+  }
+  
+  private void searchByIdAndClick(String id){
+    WebElement  element = driver.findElement(By.id(id));
+    Assert.assertNotNull(element);
+    element.click();    
+  }
+  
+  private void searchByXPathAndClick(String xpath){    
+    WebElement  element = driver.findElement(By.xpath(xpath));
+    Assert.assertNotNull(element);
+    element.click();    
+  }
+  
+  private void waitForElementByClassName(final String className, int seconds){
+    WebElement linkTextOnPulsePage1 = (new WebDriverWait(driver, seconds))
+    .until(new ExpectedCondition<WebElement>() {
+      @Override
+      public WebElement apply(WebDriver d) {
+        return d.findElement(By.className(className));
+      }
+    });
+    Assert.assertNotNull(linkTextOnPulsePage1);
+  }
+  
+  private void waitForElementById(final String id, int seconds){
+    WebElement element = (new WebDriverWait(driver, 10))
+    .until(new ExpectedCondition<WebElement>() {
+      @Override
+      public WebElement apply(WebDriver d) {
+        return d.findElement(By.id(id));
+      }
+    });
+    Assert.assertNotNull(element);
+  }
+  
+  @Test
+  public void testClusterViewTopRibbon() {
+    List<Server> servers = testBed.getRootDs().getServers();
+    List<Locator> locators = testBed.getRootDs().getLocators();
+    List<Peer> peers = testBed.getRootDs().getPeers();
+    List<Region> regions = testBed.getRootDs().getRegions();
+    int totalMembers = servers.size() + locators.size() + peers.size();
+    int clusterMembers = Integer.parseInt(driver.findElement(
+        By.id(CLUSTER_VIEW_MEMBERS_ID)).getText());
+    int clusterServers = Integer.parseInt(driver.findElement(
+        By.id(CLUSTER_VIEW_SERVERS_ID)).getText());
+    int clusterLocators = Integer.parseInt(driver.findElement(
+        By.id(CLUSTER_VIEW_LOCATORS_ID)).getText());
+    int clusterRegions = Integer.parseInt(driver.findElement(
+        By.id(CLUSTER_VIEW_REGIONS_ID)).getText());
+    Assert.assertEquals(totalMembers, clusterMembers);
+    Assert.assertEquals(servers.size(), clusterServers);
+    Assert.assertEquals(locators.size(), clusterLocators);
+    Assert.assertEquals(regions.size(), clusterRegions);
+  }  
+
+
+  @Test
+  public void testDataViewRegionProperties() {
+    searchByLinkAndClick(DATA_VIEW_LABEL);
+    waitForElementByClassName("pointDetailsPadding",10);    
+    searchByIdAndClick("btngridIcon");
+    
+    for(int i=1;i<testBed.getRootDs().getRegions().size();i++){
+      searchByIdAndClick(""+i);
+      String regionName1 = driver.findElement(By.id("regionName")).getText();
+      @SuppressWarnings("rawtypes")
+      List regionMemberscount1 = testBed.getRootDs().getRegion(regionName1)
+          .getMembers();
+      int regionEntCount1 = testBed.getRootDs().getRegion(regionName1)
+          .getEntryCount();
+      int regionMembers1 = Integer.parseInt(driver.findElement(
+          By.id("regionMembers")).getText());
+      int regionEntryCount1 = Integer.parseInt(driver.findElement(
+          By.id("regionEntryCount")).getText());
+      Assert.assertEquals(regionMemberscount1.size(), regionMembers1);
+      Assert.assertEquals(regionEntCount1, regionEntryCount1);
+    }
+  }
+
+  
+  @Test
+  public void testMemberViewRegions() {
+    
+    searchByLinkAndClick(DATA_VIEW_LABEL);
+    waitForElementByClassName("pointDetailsPadding",10);    
+    searchByXPathAndClick("//div[@title='peer1']");    
+    waitForElementById("memberRegionsCount",10);    
+    
+    List<Server> servers = testBed.getRootDs().getServers();
+    List<Locator> locators = testBed.getRootDs().getLocators();
+    List<Peer> peers = testBed.getRootDs().getPeers();    
+
+    String prevSelectedMember = "peer1";
+    
+    for (Peer p : peers) {
+      String peer = p.getName();
+      System.out.println("Checking regions mapping for member " + peer);
+      WebElement comboBox = driver.findElement(By.linkText(prevSelectedMember));
+      comboBox.click();                 
+      WebElement comboList = driver.findElement(By.id("clusterMembersContainer"));     
+      WebElement selectedMember = comboList.findElement(By.linkText(peer));
+      selectedMember.click();
+      timeout();
+      String peername = driver.findElement(By.id("memberName")).getText();      
+      List<Region> peerRegionscount = testBed.getRootDs().getRegions(peer);
+      int peerRegions = Integer.parseInt(driver.findElement(
+          By.id("memberRegionsCount")).getText());
+      Assert.assertEquals(peerRegionscount.size(), peerRegions);
+      prevSelectedMember = peername;
+    }
+    
+    for (Server s : servers) {
+      String server = s.getName();
+      System.out.println("Checking regions mapping for server " + server);
+      WebElement comboBox = driver.findElement(By.linkText(prevSelectedMember));
+      comboBox.click();                 
+      WebElement comboList = driver.findElement(By.id("clusterMembersContainer"));     
+      WebElement selectedMember = comboList.findElement(By.linkText(server));
+      selectedMember.click();
+      timeout();
+      String peername = driver.findElement(By.id("memberName")).getText();      
+      List<Region> serverRegionscount = testBed.getRootDs().getRegions(server);
+      int serverRegions = Integer.parseInt(driver.findElement(
+          By.id("memberRegionsCount")).getText());
+      Assert.assertEquals(serverRegionscount.size(), serverRegions);
+      prevSelectedMember = peername;            
+    }
+    /*
+    for (Locator l : locators) {      
+      String locator = l.getName();
+      System.out.println("Checking regions mapping for locator " + locator);
+      WebElement comboBox = driver.findElement(By.linkText(prevSelectedMember));
+      comboBox.click();                 
+      WebElement comboList = driver.findElement(By.id("clusterMembersContainer"));     
+      WebElement selectedMember = comboList.findElement(By.linkText(locator));
+      selectedMember.click();
+      timeout();
+      String peername = driver.findElement(By.id("memberName")).getText();      
+      List<Region> locatorRegionscount = testBed.getRootDs().getRegions(locator);
+      int locatorRegions = Integer.parseInt(driver.findElement(
+          By.id("memberRegionsCount")).getText());
+      Assert.assertEquals(locatorRegionscount.size(), locatorRegions);
+      prevSelectedMember = peername;
+    }*/
+  }
+
+  public void timeout() {
+    WebElement memberNameOnPulsePage = (new WebDriverWait(driver, 10))
+        .until(new ExpectedCondition<WebElement>() {
+          @Override
+          public WebElement apply(WebDriver d) {
+            return d.findElement(By.id("memberName"));
+          }
+        });
+    Assert.assertNotNull(memberNameOnPulsePage);    
+  }  
+
+  @After
+  public void closeSession() {      
+    driver.close();
+  }
+  
+  @AfterClass
+  public static void stopTomcat(){
+    try {
+      if(tomcat!=null){
+        tomcat.stop();
+        tomcat.destroy();
+      }
+    } catch (LifecycleException e) {     
+      e.printStackTrace();
+    }
+  }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/1922937f/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/driver/TomcatHelper.java
----------------------------------------------------------------------
diff --git a/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/driver/TomcatHelper.java b/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/driver/TomcatHelper.java
new file mode 100644
index 0000000..4a3f318
--- /dev/null
+++ b/pulse/src/test/java/com/vmware/gemfire/tools/pulse/testbed/driver/TomcatHelper.java
@@ -0,0 +1,80 @@
+/*=========================================================================
+ * Copyright (c) 2012-2014 Pivotal Software, Inc. All Rights Reserved.
+ * This product is protected by U.S. and international copyright
+ * and intellectual property laws. Pivotal products are covered by
+ * one or more patents listed at http://www.pivotal.io/patents.
+ *=========================================================================
+ */
+package com.vmware.gemfire.tools.pulse.testbed.driver;
+
+import java.net.InetAddress;
+
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.core.StandardHost;
+import org.apache.catalina.startup.Tomcat;
+import org.apache.tomcat.util.IntrospectionUtils;
+
+public class TomcatHelper {
+  public static Tomcat startTomcat(String bindAddress, int port, String context, String path) throws Exception {
+
+    Tomcat tomcat = new Tomcat();
+
+    // Set up logging - first we're going to remove all existing handlers. Don't do this before Tomcat is
+    // instantiated otherwise there isn't anything to remove.
+    /*
+
+    Logger globalLogger = Logger.getLogger("");
+    for (Handler handler : globalLogger.getHandlers()) {
+      globalLogger.removeHandler(handler);
+    }
+
+    // Now let's add our handler
+    Handler gfHandler = new GemFireHandler((LogWriterImpl) log);
+    Logger logger = Logger.getLogger("");
+    logger.addHandler(gfHandler);
+    
+    */
+
+    // Set up for commons-logging which is used by Spring.
+    // This forces JCL to use the JDK logger otherwise it defaults to trying to use Log4J.
+    if (System.getProperty("org.apache.commons.logging.Log") == null) {
+      System.setProperty("org.apache.commons.logging.Log", "org.apache.commons.logging.impl.Jdk14Logger");
+    }
+
+    if (bindAddress != null && bindAddress.length() > 0) {
+      Connector c = tomcat.getConnector();
+      IntrospectionUtils.setProperty(c, "address", bindAddress);
+    }
+    tomcat.setPort(port);
+
+    // Working (scratch) dir
+    String scratch = System.getProperty("java.io.tmpdir") + System.getProperty("file.separator") + "Pulse_"
+        + ((bindAddress == null || bindAddress.length() == 0) ? "0.0.0.0" : bindAddress) + "_" + port + "_"
+        + String.format("%x", path.hashCode());
+    
+    
+    tomcat.setBaseDir(scratch);
+    StandardHost stdHost = (StandardHost) tomcat.getHost();
+    //stdHost.setUnpackWARs(false);   
+    //tomcat.addContext(context, path);
+    tomcat.addWebapp(stdHost, context, path);
+    stdHost.setDeployOnStartup(true);    
+    tomcat.start();
+
+    return tomcat;
+  }
+  
+  public static void main(String[] args) throws Exception {    
+    String host = InetAddress.getLocalHost().getHostAddress();
+    int port = 8080;
+    String path = "/tushark1/code-checkout/tools/Pulse/trunk/build-artifacts/linux/dist/pulse-7.0.1.RC1.war";
+    String context = "/pulse";      
+    System.setProperty("pulse.propMockDataUpdaterClass", "com.vmware.gemfire.tools.pulse.testbed.PropMockDataUpdater");      
+    Tomcat tomcat = TomcatHelper.startTomcat("localhost", port, context, path);   
+    Thread.sleep(30000);
+    System.out.println("Sleep completed");
+    System.out.println("Exiting ....");
+    tomcat.stop();
+    tomcat.destroy();
+  }
+}


Mime
View raw message