Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Frost2012-12-05 12:07:40 -0500
committerChristopher Frost2012-12-05 12:07:40 -0500
commit7c7177245bc3f834d5d07887894f6c611a5c8c73 (patch)
tree5ca54be128d99be99f95a80394659e81b26e2eb6 /org.eclipse.virgo.management.console
parentcbcacd061b6af746aa90e0bd5c8257d343d6d33b (diff)
parentd290f52e6b12e1c0c39463e71720899a5338611f (diff)
downloadorg.eclipse.virgo.kernel-7c7177245bc3f834d5d07887894f6c611a5c8c73.tar.gz
org.eclipse.virgo.kernel-7c7177245bc3f834d5d07887894f6c611a5c8c73.tar.xz
org.eclipse.virgo.kernel-7c7177245bc3f834d5d07887894f6c611a5c8c73.zip
Merge branch '391637-WebAdminLogging'
Diffstat (limited to 'org.eclipse.virgo.management.console')
-rw-r--r--org.eclipse.virgo.management.console/src/main/java/org/eclipse/virgo/management/console/ContentServlet.java2
-rw-r--r--org.eclipse.virgo.management.console/src/main/webapp/WEB-INF/layouts/logging.html4
-rw-r--r--org.eclipse.virgo.management.console/src/main/webapp/js/artifacts.js282
-rw-r--r--org.eclipse.virgo.management.console/src/main/webapp/js/configurations.js2
-rw-r--r--org.eclipse.virgo.management.console/src/main/webapp/js/logging.js76
-rw-r--r--org.eclipse.virgo.management.console/src/main/webapp/js/overview.js2
-rw-r--r--org.eclipse.virgo.management.console/src/main/webapp/styles/logging.css12
-rw-r--r--org.eclipse.virgo.management.console/src/test/java/org/eclipse/virgo/management/console/ConfigurationsJSTests.java14
-rw-r--r--org.eclipse.virgo.management.console/src/test/java/org/eclipse/virgo/management/console/LoggingJSTests.java20
9 files changed, 250 insertions, 164 deletions
diff --git a/org.eclipse.virgo.management.console/src/main/java/org/eclipse/virgo/management/console/ContentServlet.java b/org.eclipse.virgo.management.console/src/main/java/org/eclipse/virgo/management/console/ContentServlet.java
index 223504fe..204ef0e0 100644
--- a/org.eclipse.virgo.management.console/src/main/java/org/eclipse/virgo/management/console/ContentServlet.java
+++ b/org.eclipse.virgo.management.console/src/main/java/org/eclipse/virgo/management/console/ContentServlet.java
@@ -189,7 +189,7 @@ public class ContentServlet extends HttpServlet {
this.addIfMbeanPresent(menuItems, "wirings", "osgi.core:version=1.0,type=wiringState,region=*");
this.addIfMbeanPresent(menuItems, "dumps", "org.eclipse.virgo.kernel:type=Medic,name=DumpInspector");
this.addIfMbeanPresent(menuItems, "configurations", "osgi.compendium:service=cm,version=1.3,region=*");
- //this.addIfMbeanPresent(menuItems, "logging", "ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator");
+ this.addIfMbeanPresent(menuItems, "logging", "ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator");
String stringArray = Arrays.toString(menuItems.toArray(new String[menuItems.size()]));
pageContext.put("menuNames", stringArray.substring(1, stringArray.length() - 1));
diff --git a/org.eclipse.virgo.management.console/src/main/webapp/WEB-INF/layouts/logging.html b/org.eclipse.virgo.management.console/src/main/webapp/WEB-INF/layouts/logging.html
index 3fc2182b..19c65bba 100644
--- a/org.eclipse.virgo.management.console/src/main/webapp/WEB-INF/layouts/logging.html
+++ b/org.eclipse.virgo.management.console/src/main/webapp/WEB-INF/layouts/logging.html
@@ -2,5 +2,9 @@
<!--@&header@-->
<h1>Logging</h1>
+
+ <div class="consoleFootnote">Note: Changes to logging levels will not be persisted between restarts.</div>
+
+ <div id='logging-display'></div>
<!--@&footer@-->
diff --git a/org.eclipse.virgo.management.console/src/main/webapp/js/artifacts.js b/org.eclipse.virgo.management.console/src/main/webapp/js/artifacts.js
index d67ed137..24ae4e2c 100644
--- a/org.eclipse.virgo.management.console/src/main/webapp/js/artifacts.js
+++ b/org.eclipse.virgo.management.console/src/main/webapp/js/artifacts.js
@@ -57,7 +57,9 @@ var Tree = function() {
} else {
node = self.getNodeContainer(filterMatch, 'default', filterMatch, filter);
}
- $('.artifact-label', node).click({'node': node, 'filter': filter}, tree.renderTopLevel);
+ node.addClass('top-level');
+ node.data('queryData', filter);
+ $('.artifact-label', node).click({'node': node, 'queryData': filter}, tree.nodeTwistyClicked);
$('#artifacts-tree').append(node);
});
};
@@ -81,49 +83,47 @@ var Tree = function() {
}
};
-
- /**
- * Called when one of the top level node is clicked
- *
- * @param filter - the artifact property to sort by
- * @param parent - the unique key of the parent node
- */
- this.renderTopLevel = function(eventData){
- var node = eventData.data.node;
- self.setIconElement(node.children('.artifact-label').children('.twisty'), 'loader-small.gif');
- if(node.children().length == 1){//It's closed
- util.doQuery('search/org.eclipse.virgo.kernel:type=ArtifactModel,*', function (response){
- self.renderTopLevelRequest(response, node, eventData.data.filter);
- self.setIconElement(node.children('.artifact-label').children('.twisty'), 'tree-icons/minus.png');
- });
- } else {//It's open
- node.children('.fx-container').slideToggle(util.fxTime, function(){
- $(this).remove();
- });
- self.setIconElement(node.children('.artifact-label').children('.twisty'), 'tree-icons/plus.png');
- }
- };
/**
- * Called when any artifact in the tree is expanded
+ * Called when any node in the tree is expanded
*
* @param objectName - the unique key of the artifact to render
- * @param parent - id of the element to render the artifact under
+ * @param filter - sort by
*/
- this.renderArtifact = function (eventData){
+ this.nodeTwistyClicked = function (eventData, openCallBack, openCallBackArg){
var node = eventData.data.node;
self.setIconElement(node.children('.artifact-label').children('.twisty'), 'loader-small.gif');
- if(node.children().length == 1){//It's closed
- util.doQuery('read/' + eventData.data.objectName.toString, function(response){
- self.renderArtifactRequest(response, eventData.data.objectName, node);
+ if(node.hasClass('open-container')){
+ self.closeNode(node);
+ } else {
+ var query;
+ if(node.hasClass('top-level')){
+ query = 'search/org.eclipse.virgo.kernel:type=ArtifactModel,*';
+ } else {
+ query = 'read/' + eventData.data.queryData.toString;
+ }
+ util.doQuery(query, function (response){
+ self.renderNodeExpansion(response, node, eventData.data.queryData);
self.setIconElement(node.children('.artifact-label').children('.twisty'), 'tree-icons/minus.png');
+ if(openCallBack){
+ openCallBack(openCallBackArg);
+ }
});
- } else {//It's open
- node.children('.fx-container').slideToggle(util.fxTime, function(){
+ }
+ };
+
+ this.closeNode = function(rawNode, now){
+ var node = $(rawNode);
+ var container = node.children('.fx-container');
+ if(now){
+ container.remove();
+ }else{
+ container.slideToggle(util.fxTime, function(){
$(this).remove();
});
- self.setIconElement(node.children('.artifact-label').children('.twisty'), 'tree-icons/plus.png');
}
+ node.removeClass('open-container');
+ self.setIconElement(node.children('.artifact-label').children('.twisty'), 'tree-icons/plus.png');
};
/**
@@ -132,142 +132,125 @@ var Tree = function() {
*/
this.doArtifactOperation = function(event){
util.doQuery('exec/' + event.data.objectName.toString + '/' + event.data.action, function(response){
- util.doQuery('read/' + event.data.objectName.toString, function(response){
- self.renderOperationResult(response, event.data.objectName);
- });
+ self.reloadTree();
});
};
- this.renderOperationResult = function(responseJSON, objectName){
-
+ this.reloadTree = function(){
+ //Record the open nodes and unmark
+ var openNodes = new Array();
+ $.each($('.open-container'), function(index, openNode){
+ openNodes.push($(openNode).prop('id'));
+ });
+
+ //Close the entire tree down
$.each($('#artifacts-tree').children('.artifact-container'), function(index, node){
- $(node).children('.fx-container').slideToggle(util.fxTime, function(){
- $(this).remove();
- });
- self.setIconElement($(node).children('.artifact-label').children('.twisty'), 'tree-icons/plus.png');
+ self.closeNode(node, true);
});
-
-// var artifact = new Artifact(objectName);
-// $.each($('.' + artifact.key), function(index, nodeToUpdate){
-// var fxContainer = $(nodeToUpdate).children('.fx-container');
-// if(fxContainer){
-// $.each(fxContainer.children('.artifact-container'), function(index, childNodeToUpdate){
-//
-// var classes = $(childNodeToUpdate).prop('class').split(' ');
-// $.each(classes, function(index, seperateClass){
-// if(seperateClass != 'artifact-container'){
-// $.each($('.' + seperateClass), function(index, otherChildNodeToUpdate){
-//
-// if(responseJSON.value){//Just close the otherChildNode
-// self.setIconElement($(otherChildNodeToUpdate).children('.artifact-label').children('.twisty'), 'tree-icons/plus.png');
-// var otherChildFxContaienr = $(otherChildNodeToUpdate).children('.fxContainer');
-// if(otherChildFxContaienr){
-// otherChildFxContaienr.remove();
-// }
-// }else{//Close the otherChildNodes parent as the state of the child is unknown.
-// $(otherChildNodeToUpdate).parent().remove();
-// }
-//
-// });
-// }
-// });
-//
-// });
-// fxContainer.remove();
-// self.renderArtifactRequest(responseJSON, objectName, $(nodeToUpdate));
-// }
-// });
+ //Re-open the tree
+ var nodeOpener = function(nodesToOpen){
+ var breakOut = false;
+ $.each($('.artifact-container'), function(index, rawNode){
+ if(breakOut){
+ return false;
+ }
+ var node = $(rawNode);
+ if(!node.hasClass('open-container')){
+ $.each(nodesToOpen, function(index, nodeToOpen){
+ if(nodeToOpen == node.prop('id')){
+ var remainingNodesToOpen = $.grep(nodesToOpen, function(value) {
+ return value != nodeToOpen;
+ });
+ self.nodeTwistyClicked({data: {node: node, queryData: node.data('queryData')}}, nodeOpener, remainingNodesToOpen);
+ breakOut = true;
+ return false;
+ }
+ });
+ }
+ });
+ };
+ nodeOpener(openNodes);
};
-
+
/* **************** START PRIVATE METHODS **************** */
/**
- * When the server responds to an artifact type request this method
- * takes care of rendering the top level results
- *
- * @param json - the raw json returned form the server
- * @param parent - element to put the artifact under
- */
- this.renderTopLevelRequest = function(json, parent, filter){
- var fxContainer = $('<div />', {'class': 'fx-container'});
- var mbeans = json.value.sort();
- $.each(mbeans, function(index, mbean){
- var artifact = new Artifact(util.readObjectName(mbean));
- if(artifact[filter] == parent.attr('id')){
- fxContainer.append(self.getArtifactLabel(artifact, parent.attr('id')));
- }
- });
- parent.append(fxContainer);
- fxContainer.slideToggle(util.fxTime);
- };
-
- /**
- * When the server responds to an artifact request this method takes care
- * of rendering the artifact and all its attributes and dependents
+ * When the server responds to an node request this method takes care
+ * of rendering the artifact/tree and all its attributes and dependents
*
* @param json - the raw json returned form the server
- * @param objectName - of the artifact
* @param parent - element to put the artifact under
+ * @param nodeData - of the artifact
*/
- this.renderArtifactRequest = function(json, objectName, parent){
+ this.renderNodeExpansion = function(json, parent, nodeData){
var fxContainer = $('<div />', {'class': 'fx-container'});
- if(json.value == undefined){
- parent.remove();
- }else{
- var fullArtifact = new FullArtifact(json.value, objectName);
-
- var artifactControlBar = self.getArtifactControlBar(fullArtifact);
- if(fullArtifact.type == 'configuration'){
- var configControl = $('<a />', {'class': 'artifact-control'});
- configControl.attr('href', util.getCurrentHost() + '/content/configurations#' + fullArtifact.name);
- configControl.text('VIEW');
- artifactControlBar.append(configControl);
- }
-
- fxContainer.append(artifactControlBar);
- fxContainer.append(self.getArtifactAttribute('SymbolicName: ' + fullArtifact.name));
- fxContainer.append(self.getArtifactAttribute('Version: ' + fullArtifact.version));
- fxContainer.append(self.getArtifactAttribute('Region: ' + fullArtifact.region));
- fxContainer.append(self.getArtifactAttribute('Type: ' + fullArtifact.type));
- fxContainer.append(self.getArtifactAttribute(fullArtifact.state, 'state-' + fullArtifact.state));
-
- var spring = false;
- $.each(fullArtifact.properties, function(key, value){
- if(value == 'true' || value == true){
- if(key == 'Spring'){
- spring = true;
- fxContainer.append(self.getArtifactAttribute('Spring Powered', key));
- } else if(key == 'Scoped' || key == 'Atomic' || key == 'Scoped-Atomic'){
- fxContainer.append(self.getArtifactAttribute(key, key));
- } else {
- fxContainer.append(self.getArtifactAttribute(key + ': ' + value));
- }
- } else {
- if(key == 'Bundle Id'){
- fxContainer.append(self.getArtifactAttribute(key + ': ' + value, undefined, util.getCurrentHost() + '/content/wirings#' + value));
+ if(parent.hasClass('top-level')){
+ var mbeans = json.value.sort();
+ $.each(mbeans, function(index, mbean){
+ var artifact = new Artifact(util.readObjectName(mbean));
+ if(artifact[nodeData] == parent.prop('id')){
+ fxContainer.append(self.getArtifactLabel(artifact, parent.prop('id')));
+ }
+ });
+ } else {
+ if(json.value == undefined){
+ parent.remove();
+ } else {
+ var fullArtifact = new FullArtifact(json.value, nodeData);
+
+ var artifactControlBar = self.getArtifactControlBar(fullArtifact);
+ if(fullArtifact.type == 'configuration'){
+ var configControl = $('<a />', {'class': 'artifact-control'});
+ configControl.attr('href', util.getCurrentHost() + '/content/configurations#' + fullArtifact.name);
+ configControl.text('VIEW');
+ artifactControlBar.append(configControl);
+ }
+
+ fxContainer.append(artifactControlBar);
+ fxContainer.append(self.getArtifactAttribute('SymbolicName: ' + fullArtifact.name));
+ fxContainer.append(self.getArtifactAttribute('Version: ' + fullArtifact.version));
+ fxContainer.append(self.getArtifactAttribute('Region: ' + fullArtifact.region));
+ fxContainer.append(self.getArtifactAttribute('Type: ' + fullArtifact.type));
+ fxContainer.append(self.getArtifactAttribute(fullArtifact.state, 'state-' + fullArtifact.state));
+
+ var spring = false;
+ $.each(fullArtifact.properties, function(key, value){
+ if(value == 'true' || value == true){
+ if(key == 'Spring'){
+ spring = true;
+ fxContainer.append(self.getArtifactAttribute('Spring Powered', key));
+ } else if(key == 'Scoped' || key == 'Atomic' || key == 'Scoped-Atomic'){
+ fxContainer.append(self.getArtifactAttribute(key, key));
+ } else {
+ fxContainer.append(self.getArtifactAttribute(key + ': ' + value));
+ }
} else {
- fxContainer.append(self.getArtifactAttribute(key + ': ' + value));
+ if(key == 'Bundle Id'){
+ fxContainer.append(self.getArtifactAttribute(key + ': ' + value, undefined, util.getCurrentHost() + '/content/wirings#' + value));
+ } else {
+ fxContainer.append(self.getArtifactAttribute(key + ': ' + value));
+ }
}
+ });
+
+ if(spring == false && fullArtifact.type == 'bundle'){
+ fxContainer.append(self.getArtifactAttribute('No Spring', 'Spring'));
}
- });
-
- if(spring == false && fullArtifact.type == 'bundle'){
- fxContainer.append(self.getArtifactAttribute('No Spring', 'Spring'));
+
+ var dependents = fullArtifact.dependents.sort(function(a, b){
+ return a.compare(b);
+ });
+
+ $.each(dependents, function(index, objectName){
+ var dependentArtifact = new Artifact(objectName);
+ fxContainer.append(self.getArtifactLabel(dependentArtifact, parent.attr('id')));
+ });
}
-
- var dependents = fullArtifact.dependents.sort(function(a, b){
- return a.compare(b);
- });
-
- $.each(dependents, function(index, objectName){
- var dependentArtifact = new Artifact(objectName);
- fxContainer.append(self.getArtifactLabel(dependentArtifact, parent.attr('id')));
- });
-
- parent.append(fxContainer);
- fxContainer.slideToggle(util.fxTime);
}
+ parent.append(fxContainer);
+ parent.addClass('open-container');
+ fxContainer.slideToggle(util.fxTime);
};
/**
@@ -278,7 +261,8 @@ var Tree = function() {
*/
this.getArtifactLabel = function(artifact, parent){
var node = self.getNodeContainer(artifact.name + ': ' + artifact.version, artifact.type, parent + artifact.key, artifact.key);
- $('.artifact-label', node).click({'objectName': artifact.objectName, 'node': node}, tree.renderArtifact);
+ $('.artifact-label', node).click({'queryData': artifact.objectName, 'node': node}, tree.nodeTwistyClicked);
+ node.data('queryData', artifact.objectName);
return node;
};
diff --git a/org.eclipse.virgo.management.console/src/main/webapp/js/configurations.js b/org.eclipse.virgo.management.console/src/main/webapp/js/configurations.js
index e835d880..80b07034 100644
--- a/org.eclipse.virgo.management.console/src/main/webapp/js/configurations.js
+++ b/org.eclipse.virgo.management.console/src/main/webapp/js/configurations.js
@@ -20,6 +20,7 @@ function pageinit(){
ConfigurationInit.addConfigurationSection(regionName, response.value);
});
});
+ util.pageReady();
});
}
@@ -40,7 +41,6 @@ ConfigurationInit = {
event.data.toggle();
});
});
- util.pageReady();
},
getConfigurationLabel : function(labelText){
diff --git a/org.eclipse.virgo.management.console/src/main/webapp/js/logging.js b/org.eclipse.virgo.management.console/src/main/webapp/js/logging.js
index 2e0fa0da..7193d583 100644
--- a/org.eclipse.virgo.management.console/src/main/webapp/js/logging.js
+++ b/org.eclipse.virgo.management.console/src/main/webapp/js/logging.js
@@ -13,9 +13,79 @@
* Scripts to be loaded in to the head of the logging view
*/
function pageinit(){
+
+ $.ajax({
+ url: util.getCurrentHost() + '/jolokia/read/ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator/LoggerList',
+ dataType: 'json',
+ success: function (response) {
+ loggingHandler = new LoggerList(response.value);
+ util.pageReady();
+ }
+ });
- util.pageReady();
+}
+
+
+var LoggerList = function(loggerList){
- //ch.qos.logback.classic:Name=default,Type=ch.qos.logback.classic.jmx.JMXConfigurator
+ var self = this;
-}
+ self.loggerList = loggerList;
+
+ self.rows = new Array();
+
+ $.each(loggerList, function(index, loggerName){
+ var row = new Array(loggerName, '', '');
+
+ var td = $('<td />', {'class' : 'logger-update','onClick': 'loggingHandler.update("' + loggerName + '")'});
+ row.push(td.text('update'));
+ self.rows.push(row);
+ });
+
+ self.loggerTable = util.makeTable({
+ clazz: 'logger-table',
+ headers: [{title: 'Name', type: 'alpha'}, {title: 'Level', type: 'alpha'}, {title: 'Effective Level', type: 'alpha'}, {title: 'Update', type: 'alpha'}],
+ rows: self.rows,
+ hoverable: true,
+ sortable: true,
+ sortIndex: 0
+ });
+
+ $('#logging-display').append(self.loggerTable);
+
+ self.displayLoggerList = function(){
+
+ };
+
+ self.displayLoggerListResult = function(loggerList){
+ self.loggerList = loggerList;
+
+ };
+
+ self.update = function(loggerName){
+ var name = 'updatelevel' + loggerName;
+ var title = 'Update a Logging level';
+ var content = $('<div />');
+ content.append($('<div />').text('New level for: ' + loggerName));
+ content.append($('<input />', {type: 'text'}).text('New level for: ' + loggerName));
+
+ var link = $('<div />', {'class': 'button-container'});
+
+ var linkButton = $('<div />', {'class': 'button'});
+
+ linkButton.append($('<div />', {'class': 'button-cap-left-blue'}));
+ linkButton.append($('<div />', {'class': 'button-text'}).text('Submit'));
+ linkButton.append($('<div />', {'class': 'button-cap-right-blue'}));
+ link.append(linkButton);
+ content.append(link);
+
+ var infoBox = new InfoBox({name: name, title: title, content: content, closeable: true}).show();
+
+ link.click(function(event){
+ event.stopPropagation();
+ infoBox.hide();
+ });
+
+ };
+
+};
diff --git a/org.eclipse.virgo.management.console/src/main/webapp/js/overview.js b/org.eclipse.virgo.management.console/src/main/webapp/js/overview.js
index ab9bf43a..4de12c4a 100644
--- a/org.eclipse.virgo.management.console/src/main/webapp/js/overview.js
+++ b/org.eclipse.virgo.management.console/src/main/webapp/js/overview.js
@@ -19,7 +19,7 @@ function pageinit() {
dataType: 'json',
success: function (response) {
var text = $('#osgi-runtime').text();
- $('#osgi-runtime').text(response.value.info.vendor + ' ' + response.value.info.product + ' ' + response.value.info.version + ' (' + text + ')');
+ $('#osgi-runtime').text(text + ' on ' + response.value.info.vendor + ' ' + response.value.info.product + ' ' + response.value.info.version);
util.pageReady();
}
});
diff --git a/org.eclipse.virgo.management.console/src/main/webapp/styles/logging.css b/org.eclipse.virgo.management.console/src/main/webapp/styles/logging.css
index df688652..f9478288 100644
--- a/org.eclipse.virgo.management.console/src/main/webapp/styles/logging.css
+++ b/org.eclipse.virgo.management.console/src/main/webapp/styles/logging.css
@@ -6,4 +6,14 @@
* Styles for the logging page
*
* Christopher Frost - 2011
- */ \ No newline at end of file
+ */
+
+
+.logger-table .logger-update {
+ color: transparent;
+}
+
+.table-tr-hovered .logger-update {
+ color: #666666;
+ cursor: pointer;
+} \ No newline at end of file
diff --git a/org.eclipse.virgo.management.console/src/test/java/org/eclipse/virgo/management/console/ConfigurationsJSTests.java b/org.eclipse.virgo.management.console/src/test/java/org/eclipse/virgo/management/console/ConfigurationsJSTests.java
index 6d7bedac..002eddb2 100644
--- a/org.eclipse.virgo.management.console/src/test/java/org/eclipse/virgo/management/console/ConfigurationsJSTests.java
+++ b/org.eclipse.virgo.management.console/src/test/java/org/eclipse/virgo/management/console/ConfigurationsJSTests.java
@@ -21,8 +21,8 @@ import javax.script.ScriptException;
import org.eclipse.virgo.management.console.stubs.objects.ObjectName;
import org.eclipse.virgo.management.console.stubs.types.Element;
-import org.junit.Ignore;
import org.junit.Test;
+
import sun.org.mozilla.javascript.internal.Context;
import sun.org.mozilla.javascript.internal.Function;
import sun.org.mozilla.javascript.internal.Scriptable;
@@ -41,7 +41,6 @@ public class ConfigurationsJSTests extends AbstractJSTests {
* @throws NoSuchMethodException
*/
@Test
- @Ignore
public void testPageinit() throws ScriptException, IOException, NoSuchMethodException{
addCommonObjects();
readFile("src/main/webapp/js/configurations.js");
@@ -59,7 +58,6 @@ public class ConfigurationsJSTests extends AbstractJSTests {
*
*/
@Test
- @Ignore
public void testConfigToggle() throws IOException {
Function configurationConstructor = (Function) scope.get("Configuration", scope);
@@ -81,12 +79,14 @@ public class ConfigurationsJSTests extends AbstractJSTests {
assertFalse("Icon not toggled", ((Element)configuration.get("icon", scope)).jsFunction_hasClass("spinnerIcon"));
toggleFunction.call(context, scope, configuration, Context.emptyArgs); //Open it
+ assertFalse("Icon not toggled", ((Element)configuration.get("icon", scope)).jsFunction_hasClass("plus"));
+ assertFalse("Icon not toggled", ((Element)configuration.get("icon", scope)).jsFunction_hasClass("minus"));
assertTrue("Icon not toggled", ((Element)configuration.get("icon", scope)).jsFunction_hasClass("spinnerIcon"));
- commonUtil.getLastQueryCallBack().call(context, scope, configuration, new Object[]{getTestData()});
- assertFalse("Icon not toggled", ((Element)configuration.get("icon", scope)).jsFunction_hasClass("plus"));
- assertTrue("Icon not toggled", ((Element)configuration.get("icon", scope)).jsFunction_hasClass("minus"));
- assertFalse("Icon not toggled", ((Element)configuration.get("icon", scope)).jsFunction_hasClass("spinnerIcon"));
+ //commonUtil.getLastQueryCallBack().call(context, scope, configuration, new Object[]{getTestData()});
+ //assertFalse("Icon not toggled", ((Element)configuration.get("icon", scope)).jsFunction_hasClass("plus"));
+ //assertTrue("Icon not toggled", ((Element)configuration.get("icon", scope)).jsFunction_hasClass("minus"));
+ //assertFalse("Icon not toggled", ((Element)configuration.get("icon", scope)).jsFunction_hasClass("spinnerIcon"));
}
private Scriptable getTestData() throws IOException{
diff --git a/org.eclipse.virgo.management.console/src/test/java/org/eclipse/virgo/management/console/LoggingJSTests.java b/org.eclipse.virgo.management.console/src/test/java/org/eclipse/virgo/management/console/LoggingJSTests.java
index cd3967dc..0ef05f41 100644
--- a/org.eclipse.virgo.management.console/src/test/java/org/eclipse/virgo/management/console/LoggingJSTests.java
+++ b/org.eclipse.virgo.management.console/src/test/java/org/eclipse/virgo/management/console/LoggingJSTests.java
@@ -16,8 +16,13 @@ import java.io.IOException;
import javax.script.ScriptException;
+import org.eclipse.virgo.management.console.stubs.objects.Dollar;
import org.junit.Test;
+import sun.org.mozilla.javascript.internal.Context;
+import sun.org.mozilla.javascript.internal.Function;
+import sun.org.mozilla.javascript.internal.Scriptable;
+
/**
*
*
@@ -31,7 +36,20 @@ public class LoggingJSTests extends AbstractJSTests {
invokePageInit();
+ assertTrue(Dollar.getAjaxUrl().contains("LoggerList"));
+
+ Dollar.getAjaxSuccess().call(context, scope, scope, new Object[] { getTestLoggers() });
+
assertTrue("Page ready has not been called", commonUtil.isPageReady());
}
-
+
+ private Scriptable getTestLoggers() throws IOException {
+
+ readString("var Data = function() {" +
+ " this.value = ['logger1','logger2'];" +
+ "};");
+
+ Function testData = (Function) scope.get("Data", scope);
+ return testData.construct(context, scope, Context.emptyArgs);
+ }
}

Back to the top