[rhq] modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestConfigurationView.java | 36 +++++++++-
1 file changed, 34 insertions(+), 2 deletions(-)
New commits:
commit 4482e902d123cc6881fe5b4308bbcf0ee9ff4846
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Jun 20 12:31:33 2012 -0400
add the ability to inspect the changed configuration in the test page that tests the config editor
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestConfigurationView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestConfigurationView.java
index 3f3e154..31d17a3 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestConfigurationView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/configuration/TestConfigurationView.java
@@ -28,6 +28,10 @@ import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertyMap;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.configuration.ConfigurationEditor;
@@ -133,9 +137,37 @@ public class TestConfigurationView
}
private void save() {
- CoreGUI.getMessageCenter().notify(
- new Message("Configuration updated.", "Test configuration updated."));
+ StringBuilder str = new StringBuilder("=~pre~=");
+ Configuration c = editor.getConfiguration();
+ Map<String, Property> allProps = c.getAllProperties();
+ for (Property prop : allProps.values()) {
+ getPropertyStrings(prop, str, "");
+ }
+ str.append("=~/pre~=");
+ CoreGUI.getMessageCenter().notify(new Message("Configuration updated.", str.toString()));
reloadConfiguration();
}
+ private void getPropertyStrings(Property prop, StringBuilder str, String indent) {
+ if (prop instanceof PropertySimple) {
+ String value = ((PropertySimple) prop).getStringValue();
+ str.append(indent + prop.getName() + "=" + ((value != null) ? value : "~~VALUE WAS NULL~~"));
+ str.append("\n");
+ } else if (prop instanceof PropertyMap) {
+ str.append(indent + prop.getName() + " MAP:\n");
+ PropertyMap propMap = (PropertyMap) prop;
+ Map<String, Property> map = propMap.getMap();
+ for (Property val : map.values()) {
+ getPropertyStrings(val, str, indent + " ");
+ }
+ } else if (prop instanceof PropertyList) {
+ str.append(indent + prop.getName() + " LIST:\n");
+ PropertyList propList = (PropertyList) prop;
+ for (Property val : propList.getList()) {
+ getPropertyStrings(val, str, indent + " ");
+ }
+ } else {
+ str.append("unknown prop type: " + prop);
+ }
+ }
}
11 years, 11 months
[rhq] etc/eclipse-tools
by mazz
etc/eclipse-tools/maven/RHQ | 11 +++++++++++
1 file changed, 11 insertions(+)
New commits:
commit 953419eaa4392cb2826b76351e72ef30789d6b92
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Jun 20 11:35:52 2012 -0400
provide an eclipse external tool to allow eclipse developer to easily purge their RHQ dev-container server from extra plugins. this leaves intact a small subset of plugins. this allows for faster rhq server startup.
diff --git a/etc/eclipse-tools/maven/RHQ Delete Extra Plugins From Dev Container.launch b/etc/eclipse-tools/maven/RHQ Delete Extra Plugins From Dev Container.launch
new file mode 100644
index 0000000..1fa6810
--- /dev/null
+++ b/etc/eclipse-tools/maven/RHQ Delete Extra Plugins From Dev Container.launch
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.ui.externaltools.ProgramLaunchConfigurationType">
+<stringAttribute key="bad_container_name" value="\rhq\etc\eclipse-tools\maven"/>
+<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.ui.externaltools.launchGroup"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_LOCATION" value="${system_path:sh}"/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS" value="-c "rm hadoop* jopr-jboss-as-5* jopr-jboss-cache* jopr-tomcat* modcluster* pattern* rhq-augeas* rhq-aliases* rhq-apache* rhq-byteman* rhq-cobbler* rhq-cron* rhq-database* rhq-grub* rhq-hosts* rhq-hudson* rhq-iis* rhq-irc* rhq-jboss-as-7* rhq-kickstart* rhq-mysql* rhq-netservices* rhq-oracle* rhq-postgres* rhq-postfix* rhq-samba* rhq-script2* rhq-snmp* rhq-sshd* rhq-sudoers* rhq-twitter* rhq-virt*""/>
+<stringAttribute key="org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY" value="${workspace_loc:/rhq/dev-container/jbossas/server/default/deploy/rhq.ear/rhq-downloads/rhq-plugins}"/>
+</launchConfiguration>
11 years, 11 months
[rhq] modules/plugins
by Simeon Pinder
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java | 638 +++++-----
1 file changed, 319 insertions(+), 319 deletions(-)
New commits:
commit 51d5d2537e1dc159f7c1a71302be9f810ba63613
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Wed Jun 20 08:56:40 2012 -0400
[BZ 826542] disable incorrect unit tests. More work necessary to get this to pass with Arquillian properly.
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java
index 49d8040..e80ddec 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java
@@ -1,319 +1,319 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2011 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-package org.rhq.modules.plugins.jbossas7;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-
-import org.codehaus.jackson.JsonGenerationException;
-import org.codehaus.jackson.JsonNode;
-import org.codehaus.jackson.JsonProcessingException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.SerializationConfig;
-import org.testng.annotations.BeforeSuite;
-import org.testng.annotations.Test;
-
-import org.rhq.modules.plugins.jbossas7.ModuleOptionsComponent.ModuleOptionType;
-import org.rhq.modules.plugins.jbossas7.ModuleOptionsComponent.Value;
-import org.rhq.modules.plugins.jbossas7.json.Address;
-import org.rhq.modules.plugins.jbossas7.json.Operation;
-import org.rhq.modules.plugins.jbossas7.json.ReadAttribute;
-import org.rhq.modules.plugins.jbossas7.json.Remove;
-import org.rhq.modules.plugins.jbossas7.json.Result;
-import org.rhq.modules.plugins.jbossas7.json.WriteAttribute;
-
-/**
- * Test exercising the subsystem=security/SecurityDomain/[Authentication, Authorization, Mapping, Audit, Acl,
- * Identity-Trust]
- * @author Simeon Pinder
- */
-@Test(groups = "unit")
-public class SecurityModuleOptionsTest extends AbstractConfigurationHandlingTest {
-
- private static String user = "rhqadmin";
- private static String pass = "as7";
- private static String host = "localhost";
- private static ASConnection con = null;
- private static ObjectMapper mapper = null;
- private ModuleOptionsComponent moc = null;
-
- //Define some shared and reusable content
- static HashMap<String, String> jsonMap = new HashMap<String, String>();
- static {
- jsonMap
- .put(
- "login-modules",
- "[{\"flag\":\"required\", \"code\":\"Ldap\", \"module-options\":{\"bindDn\":\"uid=ldapSecureUser,ou=People,dc=redat,dc=com\", \"bindPw\":\"test126\", \"allowEmptyPasswords\":\"true\"}}]");
- // "[{\"flag\":\"required\", \"code\":\"Ldap\"}]");
- jsonMap
- .put(
- "policy-modules",
- "[{\"flag\":\"requisite\", \"code\":\"LdapExtended\", \"module-options\":{\"policy\":\"module\", \"policy1\":\"module1\"}}]");
- jsonMap
- .put("mapping-modules",
- "[{\"code\":\"Test\", \"type\":\"attribute\", \"module-options\":{\"mapping\":\"module\", \"mapping1\":\"module1\"}}]");
- jsonMap.put("provider-modules",
- "[{\"code\":\"Providers\", \"module-options\":{\"provider\":\"module\", \"provider1\":\"module1\"}}]");
- }
-
- @BeforeSuite
- private void initializeConnectionDetails() {
- con = new ASConnection(host, 9990, user, pass);
- mapper = new ObjectMapper();
- mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
-
- moc = new ModuleOptionsComponent();
- }
-
- public static void main(String[] args) {
- SecurityModuleOptionsTest test = new SecurityModuleOptionsTest();
- try {
- test.initializeConnectionDetails();
- test.testPopulateModuleOptionsAndTypes();
- } catch (Exception e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
-
- }
-
- /**The test reads the existing property values, deserializes them and writes the same
- * contents back out to a running instance for all known ModuleOptionTypes.
- *
- * @throws Exception
- */
- public void testPopulateModuleOptionsAndTypes() throws Exception {
-
- //as7 node details.
- String securityDomainId = "testDomain";
- //TODO: spinder 6-6-12: this cannot run as a standalone itest until JIRA https://issues.jboss.org/browse/AS7-4951
- // is addressed as there is no way to automate setup of the information being tested.
- String address = "subsystem=security,security-domain=" + securityDomainId + ",authentication=classic";
- boolean verboseOutput = true;
- boolean executeOperation = true;
- for (ModuleOptionType t : ModuleOptionType.values()) {
- String attribute = t.getAttribute();
- if (verboseOutput) {
- System.out.println("======= Running with ModuleOptionType:" + t + " attribute:" + attribute + ":");
- }
- if (attribute.equals("policy-modules")) {
- address = "subsystem=security,security-domain=" + securityDomainId + ",authorization=classic";
- } else if (attribute.equals("acl-modules")) {
- address = "subsystem=security,security-domain=" + securityDomainId + ",acl=classic";
- } else if (attribute.equals("mapping-modules")) {
- address = "subsystem=security,security-domain=" + securityDomainId + ",mapping=classic";
- } else if (attribute.equals("trust-modules")) {
- address = "subsystem=security,security-domain=" + securityDomainId + ",identity-trust=classic";
- } else if (attribute.equals("provider-modules")) {
- address = "subsystem=security,security-domain=" + securityDomainId + ",audit=classic";
- } else if (attribute.equals("login-modules")) {
- address = "subsystem=security,security-domain=" + securityDomainId + ",authentication=classic";
- } else {
- assert false : "An unknown attribute '" + attribute
- + "' was found. Is there a new type to be supported?";
- }
-
- //test operation- read property always available.
- Operation op = null;
-
- //read the login-modules attribute
- op = new ReadAttribute(new Address(address), attribute);
- Result result = exerciseOperation(op, true, verboseOutput);
- assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
- + result.getFailureDescription();
- //extract current results
- Object rawResult = result.getResult();
- assert rawResult != null : "Read of attribute'" + attribute + "' from address '" + address
- + "' has returned no value. Are those values in the model?";
-
- List<Value> list2 = new ArrayList<Value>();
- //populate the Value component complete with module Options.
- list2 = moc.populateSecurityDomainModuleOptions(result,
- ModuleOptionsComponent.loadModuleOptionType(attribute));
- if (verboseOutput) {
- if (rawResult != null) {
- System.out.println("Raw Result is:" + rawResult + " and of type:" + rawResult.getClass());
- } else {
- System.out.println("Read of attribute'" + attribute + "' from address '" + address
- + "' has returned no value. Are those values in the model?");
- }
- }
- //write the login-modules attribute
- op = new WriteAttribute(new Address(address));
- op.addAdditionalProperty("name", attribute);//attribute to execute on
- op.addAdditionalProperty("value", list2);
-
- //Now test the operation
- result = exerciseOperation(op, executeOperation, verboseOutput);
- assert ((result.isSuccess() == true) || (result.getOutcome() == null)) : "The operation '" + op
- + "' failed to write the resource.." + result.getFailureDescription();
-
- //read the login-modules attribute
- op = new ReadAttribute(new Address(address), attribute);
- result = exerciseOperation(op, true, verboseOutput);
- assert (result.isSuccess() == true) : "The operation '" + op + "' failed to read the resource."
- + result.getFailureDescription();
- }
- if (verboseOutput) {
- System.out.println("Successfully detected,read and wrote out attribute values for:");
- for (ModuleOptionType type : ModuleOptionType.values()) {
- System.out.println("\n" + type.ordinal() + " " + type.name());
- }
- }
- }
-
- /**Attempts to create a new Authentication node(authentication=classic) with a
- * 'login-modules' attribute complete with 'code':'Ldap' and 'flag':'required'
- * and some sample 'module-options' values.
- *
- */
- @Test(enabled = true)
- public void testCreateSecurityDomainChildLoginModules() {
- boolean execute = true;
- boolean verboseOutput = false;
- String address = "subsystem=security,security-domain=testDomain3,authentication=classic";
- String attribute = ModuleOptionType.Authentication.getAttribute();
-
- //test operation- read property always available.
- Operation op = null;
-
- //read the login-modules attribute
- op = new ReadAttribute(new Address(address), attribute);
- Result result = exerciseOperation(op, execute, verboseOutput);
- assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
- + result.getFailureDescription();
-
- //extract current results
- Object rawResult = result.getResult();
-
- //#### Have to create new content for the new node.
- List<Value> moduleTypeValue = new ArrayList<Value>();
- try {
- // loading 'login-module'
- JsonNode node = mapper.readTree(jsonMap.get(attribute));
- result.setResult(mapper.treeToValue(node, Object.class));
- } catch (JsonProcessingException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
-
- //populate the Value component complete with module Options.
- moduleTypeValue = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
- ModuleOptionsComponent.loadModuleOptionType(attribute));
-
- //add the login-modules attribute
- op = ModuleOptionsComponent
- .createAddModuleOptionTypeOperation(new Address(address), attribute, moduleTypeValue);
-
- result = exerciseOperation(op, execute, verboseOutput);
- assert ((result.isSuccess() == true) || (result.getOutcome() == null)) : "The operation '" + op
- + "' failed to write the resource.." + result.getFailureDescription();
-
- //read the login-modules attribute
- op = new ReadAttribute(new Address(address), attribute);
- result = exerciseOperation(op, execute, verboseOutput);
- assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
- + result.getFailureDescription();
-
- //exercise values retrieved from read
- List<Value> serverResponse = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
- ModuleOptionsComponent.loadModuleOptionType(attribute));
- Value serverState = serverResponse.get(0);
- assert serverState.getFlag().equals("required") : "Incorrect state retrieved for 'flag'. Expected 'required'.";
- assert serverState.getCode().equals("Ldap") : "Incorrect state retrieved for 'code'. Expected 'Ldap'.";
- LinkedHashMap<String, Object> options = serverState.getOptions();
- assert options.size() == 3 : "Invalid number of module options returned. Expected 3.";
- int found = 0;
- for (String key : options.keySet()) {
- if (key.equals("bindPw")) {
- assert "test126".equals(options.get(key)) : "Module option value not correct for key '" + key + "'.";
- found++;
- } else if (key.equals("bindDn")) {
- assert "uid=ldapSecureUser,ou=People,dc=redat,dc=com".equals(options.get(key)) : "Module option value not correct for key '"
- + key + "'.";
- found++;
- } else if (key.equals("allowEmptyPasswords")) {
- assert "true".equals(options.get(key)) : "Module option value not correct for key '" + key + "'.";
- found++;
- }
- }
- assert found == 3 : "All module options were not loaded.";
-
- //remove the original node to reset for next run.
- op = new Remove(new Address(address));
- result = exerciseOperation(op, execute, verboseOutput);
- assert result.isSuccess() == true : "The operation '" + op + "' failed to remove the resource."
- + result.getFailureDescription();
- }
-
- /** For each operation
- * - will write verbose json and operation details to system.out if verboseOutput = true;
- * - will execute the operation against running server if execute = true.
- *
- * @param op
- * @param execute
- * @param verboseOutput
- * @return
- */
- public static Result exerciseOperation(Operation op, boolean execute, boolean verboseOutput) {
- //display operation as AS7 plugin will build it
- if (verboseOutput) {
- System.out.println("\tOperation is:" + op);
- }
-
- String jsonToSend = "";
- try {
- // jsonToSend = mapper.writeValueAsString(op);
- jsonToSend = mapper.defaultPrettyPrintingWriter().writeValueAsString(op);
- } catch (JsonGenerationException e) {
- e.printStackTrace();
- } catch (JsonMappingException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- //As generated by jackson mapper
- if (verboseOutput) {
- System.out.println("@@@@ OUTBOUND JSON#\n" + jsonToSend + "#");
- }
-
- //Execute the operation
- Result result = new Result();
- if (execute) {
- result = con.execute(op);
- } else {
- if (verboseOutput) {
- System.out.println("**** NOTE: Execution disabled . NOT exercising write-attribute operation. **** ");
- }
- }
- if (verboseOutput) {
- //result wrapper details
- System.out.println("\tResult:" + result);
- //detailed results
- System.out.println("\tValue:" + result.getResult());
- System.out.println("-----------------------------------------------------\n");
- }
- return result;
- }
-}
+///*
+// * RHQ Management Platform
+// * Copyright (C) 2005-2011 Red Hat, Inc.
+// * All rights reserved.
+// *
+// * This program is free software; you can redistribute it and/or modify
+// * it under the terms of the GNU General Public License as published by
+// * the Free Software Foundation version 2 of the License.
+// *
+// * This program is distributed in the hope that it will be useful,
+// * but WITHOUT ANY WARRANTY; without even the implied warranty of
+// * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// * GNU General Public License for more details.
+// *
+// * You should have received a copy of the GNU General Public License
+// * along with this program; if not, write to the Free Software
+// * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// */
+//package org.rhq.modules.plugins.jbossas7;
+//
+//import java.io.IOException;
+//import java.util.ArrayList;
+//import java.util.HashMap;
+//import java.util.LinkedHashMap;
+//import java.util.List;
+//
+//import org.codehaus.jackson.JsonGenerationException;
+//import org.codehaus.jackson.JsonNode;
+//import org.codehaus.jackson.JsonProcessingException;
+//import org.codehaus.jackson.map.JsonMappingException;
+//import org.codehaus.jackson.map.ObjectMapper;
+//import org.codehaus.jackson.map.SerializationConfig;
+//import org.testng.annotations.BeforeSuite;
+//import org.testng.annotations.Test;
+//
+//import org.rhq.modules.plugins.jbossas7.ModuleOptionsComponent.ModuleOptionType;
+//import org.rhq.modules.plugins.jbossas7.ModuleOptionsComponent.Value;
+//import org.rhq.modules.plugins.jbossas7.json.Address;
+//import org.rhq.modules.plugins.jbossas7.json.Operation;
+//import org.rhq.modules.plugins.jbossas7.json.ReadAttribute;
+//import org.rhq.modules.plugins.jbossas7.json.Remove;
+//import org.rhq.modules.plugins.jbossas7.json.Result;
+//import org.rhq.modules.plugins.jbossas7.json.WriteAttribute;
+//
+///**
+// * Test exercising the subsystem=security/SecurityDomain/[Authentication, Authorization, Mapping, Audit, Acl,
+// * Identity-Trust]
+// * @author Simeon Pinder
+// */
+//@Test(groups = "unit")
+//public class SecurityModuleOptionsTest extends AbstractConfigurationHandlingTest {
+//
+// private static String user = "rhqadmin";
+// private static String pass = "as7";
+// private static String host = "localhost";
+// private static ASConnection con = null;
+// private static ObjectMapper mapper = null;
+// private ModuleOptionsComponent moc = null;
+//
+// //Define some shared and reusable content
+// static HashMap<String, String> jsonMap = new HashMap<String, String>();
+// static {
+// jsonMap
+// .put(
+// "login-modules",
+// "[{\"flag\":\"required\", \"code\":\"Ldap\", \"module-options\":{\"bindDn\":\"uid=ldapSecureUser,ou=People,dc=redat,dc=com\", \"bindPw\":\"test126\", \"allowEmptyPasswords\":\"true\"}}]");
+// // "[{\"flag\":\"required\", \"code\":\"Ldap\"}]");
+// jsonMap
+// .put(
+// "policy-modules",
+// "[{\"flag\":\"requisite\", \"code\":\"LdapExtended\", \"module-options\":{\"policy\":\"module\", \"policy1\":\"module1\"}}]");
+// jsonMap
+// .put("mapping-modules",
+// "[{\"code\":\"Test\", \"type\":\"attribute\", \"module-options\":{\"mapping\":\"module\", \"mapping1\":\"module1\"}}]");
+// jsonMap.put("provider-modules",
+// "[{\"code\":\"Providers\", \"module-options\":{\"provider\":\"module\", \"provider1\":\"module1\"}}]");
+// }
+//
+// @BeforeSuite
+// private void initializeConnectionDetails() {
+// con = new ASConnection(host, 9990, user, pass);
+// mapper = new ObjectMapper();
+// mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
+//
+// moc = new ModuleOptionsComponent();
+// }
+//
+// public static void main(String[] args) {
+// SecurityModuleOptionsTest test = new SecurityModuleOptionsTest();
+// try {
+// test.initializeConnectionDetails();
+// test.testPopulateModuleOptionsAndTypes();
+// } catch (Exception e) {
+// // TODO Auto-generated catch block
+// e.printStackTrace();
+// }
+//
+// }
+//
+// /**The test reads the existing property values, deserializes them and writes the same
+// * contents back out to a running instance for all known ModuleOptionTypes.
+// *
+// * @throws Exception
+// */
+// public void testPopulateModuleOptionsAndTypes() throws Exception {
+//
+// //as7 node details.
+// String securityDomainId = "testDomain";
+// //TODO: spinder 6-6-12: this cannot run as a standalone itest until JIRA https://issues.jboss.org/browse/AS7-4951
+// // is addressed as there is no way to automate setup of the information being tested.
+// String address = "subsystem=security,security-domain=" + securityDomainId + ",authentication=classic";
+// boolean verboseOutput = true;
+// boolean executeOperation = true;
+// for (ModuleOptionType t : ModuleOptionType.values()) {
+// String attribute = t.getAttribute();
+// if (verboseOutput) {
+// System.out.println("======= Running with ModuleOptionType:" + t + " attribute:" + attribute + ":");
+// }
+// if (attribute.equals("policy-modules")) {
+// address = "subsystem=security,security-domain=" + securityDomainId + ",authorization=classic";
+// } else if (attribute.equals("acl-modules")) {
+// address = "subsystem=security,security-domain=" + securityDomainId + ",acl=classic";
+// } else if (attribute.equals("mapping-modules")) {
+// address = "subsystem=security,security-domain=" + securityDomainId + ",mapping=classic";
+// } else if (attribute.equals("trust-modules")) {
+// address = "subsystem=security,security-domain=" + securityDomainId + ",identity-trust=classic";
+// } else if (attribute.equals("provider-modules")) {
+// address = "subsystem=security,security-domain=" + securityDomainId + ",audit=classic";
+// } else if (attribute.equals("login-modules")) {
+// address = "subsystem=security,security-domain=" + securityDomainId + ",authentication=classic";
+// } else {
+// assert false : "An unknown attribute '" + attribute
+// + "' was found. Is there a new type to be supported?";
+// }
+//
+// //test operation- read property always available.
+// Operation op = null;
+//
+// //read the login-modules attribute
+// op = new ReadAttribute(new Address(address), attribute);
+// Result result = exerciseOperation(op, true, verboseOutput);
+// assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
+// + result.getFailureDescription();
+// //extract current results
+// Object rawResult = result.getResult();
+// assert rawResult != null : "Read of attribute'" + attribute + "' from address '" + address
+// + "' has returned no value. Are those values in the model?";
+//
+// List<Value> list2 = new ArrayList<Value>();
+// //populate the Value component complete with module Options.
+// list2 = moc.populateSecurityDomainModuleOptions(result,
+// ModuleOptionsComponent.loadModuleOptionType(attribute));
+// if (verboseOutput) {
+// if (rawResult != null) {
+// System.out.println("Raw Result is:" + rawResult + " and of type:" + rawResult.getClass());
+// } else {
+// System.out.println("Read of attribute'" + attribute + "' from address '" + address
+// + "' has returned no value. Are those values in the model?");
+// }
+// }
+// //write the login-modules attribute
+// op = new WriteAttribute(new Address(address));
+// op.addAdditionalProperty("name", attribute);//attribute to execute on
+// op.addAdditionalProperty("value", list2);
+//
+// //Now test the operation
+// result = exerciseOperation(op, executeOperation, verboseOutput);
+// assert ((result.isSuccess() == true) || (result.getOutcome() == null)) : "The operation '" + op
+// + "' failed to write the resource.." + result.getFailureDescription();
+//
+// //read the login-modules attribute
+// op = new ReadAttribute(new Address(address), attribute);
+// result = exerciseOperation(op, true, verboseOutput);
+// assert (result.isSuccess() == true) : "The operation '" + op + "' failed to read the resource."
+// + result.getFailureDescription();
+// }
+// if (verboseOutput) {
+// System.out.println("Successfully detected,read and wrote out attribute values for:");
+// for (ModuleOptionType type : ModuleOptionType.values()) {
+// System.out.println("\n" + type.ordinal() + " " + type.name());
+// }
+// }
+// }
+//
+// /**Attempts to create a new Authentication node(authentication=classic) with a
+// * 'login-modules' attribute complete with 'code':'Ldap' and 'flag':'required'
+// * and some sample 'module-options' values.
+// *
+// */
+// @Test(enabled = true)
+// public void testCreateSecurityDomainChildLoginModules() {
+// boolean execute = true;
+// boolean verboseOutput = false;
+// String address = "subsystem=security,security-domain=testDomain3,authentication=classic";
+// String attribute = ModuleOptionType.Authentication.getAttribute();
+//
+// //test operation- read property always available.
+// Operation op = null;
+//
+// //read the login-modules attribute
+// op = new ReadAttribute(new Address(address), attribute);
+// Result result = exerciseOperation(op, execute, verboseOutput);
+// assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
+// + result.getFailureDescription();
+//
+// //extract current results
+// Object rawResult = result.getResult();
+//
+// //#### Have to create new content for the new node.
+// List<Value> moduleTypeValue = new ArrayList<Value>();
+// try {
+// // loading 'login-module'
+// JsonNode node = mapper.readTree(jsonMap.get(attribute));
+// result.setResult(mapper.treeToValue(node, Object.class));
+// } catch (JsonProcessingException e) {
+// e.printStackTrace();
+// } catch (IOException e) {
+// e.printStackTrace();
+// }
+//
+// //populate the Value component complete with module Options.
+// moduleTypeValue = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
+// ModuleOptionsComponent.loadModuleOptionType(attribute));
+//
+// //add the login-modules attribute
+// op = ModuleOptionsComponent
+// .createAddModuleOptionTypeOperation(new Address(address), attribute, moduleTypeValue);
+//
+// result = exerciseOperation(op, execute, verboseOutput);
+// assert ((result.isSuccess() == true) || (result.getOutcome() == null)) : "The operation '" + op
+// + "' failed to write the resource.." + result.getFailureDescription();
+//
+// //read the login-modules attribute
+// op = new ReadAttribute(new Address(address), attribute);
+// result = exerciseOperation(op, execute, verboseOutput);
+// assert result.isSuccess() == true : "The operation '" + op + "' failed to read the resource."
+// + result.getFailureDescription();
+//
+// //exercise values retrieved from read
+// List<Value> serverResponse = ModuleOptionsComponent.populateSecurityDomainModuleOptions(result,
+// ModuleOptionsComponent.loadModuleOptionType(attribute));
+// Value serverState = serverResponse.get(0);
+// assert serverState.getFlag().equals("required") : "Incorrect state retrieved for 'flag'. Expected 'required'.";
+// assert serverState.getCode().equals("Ldap") : "Incorrect state retrieved for 'code'. Expected 'Ldap'.";
+// LinkedHashMap<String, Object> options = serverState.getOptions();
+// assert options.size() == 3 : "Invalid number of module options returned. Expected 3.";
+// int found = 0;
+// for (String key : options.keySet()) {
+// if (key.equals("bindPw")) {
+// assert "test126".equals(options.get(key)) : "Module option value not correct for key '" + key + "'.";
+// found++;
+// } else if (key.equals("bindDn")) {
+// assert "uid=ldapSecureUser,ou=People,dc=redat,dc=com".equals(options.get(key)) : "Module option value not correct for key '"
+// + key + "'.";
+// found++;
+// } else if (key.equals("allowEmptyPasswords")) {
+// assert "true".equals(options.get(key)) : "Module option value not correct for key '" + key + "'.";
+// found++;
+// }
+// }
+// assert found == 3 : "All module options were not loaded.";
+//
+// //remove the original node to reset for next run.
+// op = new Remove(new Address(address));
+// result = exerciseOperation(op, execute, verboseOutput);
+// assert result.isSuccess() == true : "The operation '" + op + "' failed to remove the resource."
+// + result.getFailureDescription();
+// }
+//
+// /** For each operation
+// * - will write verbose json and operation details to system.out if verboseOutput = true;
+// * - will execute the operation against running server if execute = true.
+// *
+// * @param op
+// * @param execute
+// * @param verboseOutput
+// * @return
+// */
+// public static Result exerciseOperation(Operation op, boolean execute, boolean verboseOutput) {
+// //display operation as AS7 plugin will build it
+// if (verboseOutput) {
+// System.out.println("\tOperation is:" + op);
+// }
+//
+// String jsonToSend = "";
+// try {
+// // jsonToSend = mapper.writeValueAsString(op);
+// jsonToSend = mapper.defaultPrettyPrintingWriter().writeValueAsString(op);
+// } catch (JsonGenerationException e) {
+// e.printStackTrace();
+// } catch (JsonMappingException e) {
+// e.printStackTrace();
+// } catch (IOException e) {
+// e.printStackTrace();
+// }
+// //As generated by jackson mapper
+// if (verboseOutput) {
+// System.out.println("@@@@ OUTBOUND JSON#\n" + jsonToSend + "#");
+// }
+//
+// //Execute the operation
+// Result result = new Result();
+// if (execute) {
+// result = con.execute(op);
+// } else {
+// if (verboseOutput) {
+// System.out.println("**** NOTE: Execution disabled . NOT exercising write-attribute operation. **** ");
+// }
+// }
+// if (verboseOutput) {
+// //result wrapper details
+// System.out.println("\tResult:" + result);
+// //detailed results
+// System.out.println("\tValue:" + result.getResult());
+// System.out.println("-----------------------------------------------------\n");
+// }
+// return result;
+// }
+//}
11 years, 11 months
[rhq] 3 commits - modules/enterprise
by Heiko W. Rupp
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java | 9 ++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java | 14 ++---
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java | 7 +-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/GroupRest.java | 27 ++++++++++
modules/enterprise/server/jar/src/main/resources/rest_templates/group.ftl | 11 ++++
5 files changed, 56 insertions(+), 12 deletions(-)
New commits:
commit c9b69bbf92000a6cee0773eb51a34aaf41e57fff
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Jun 20 11:28:09 2012 +0200
Expose more group properties.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
index 7f13618..5fa0089 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
@@ -249,13 +249,9 @@ public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLo
*/
private ResourceGroup fetchGroup(int groupId) {
ResourceGroup resourceGroup;
- resourceGroup = getFromCache(groupId,ResourceGroup.class);
- if (resourceGroup==null) {
- resourceGroup = resourceGroupManager.getResourceGroup(caller, groupId);
- if (resourceGroup==null)
- throw new StuffNotFoundException("Group with id " + groupId);
- putToCache(groupId,ResourceGroup.class,resourceGroup);
- }
+ resourceGroup = resourceGroupManager.getResourceGroup(caller, groupId);
+ if (resourceGroup==null)
+ throw new StuffNotFoundException("Group with id " + groupId);
return resourceGroup;
}
@@ -267,6 +263,10 @@ public class GroupHandlerBean extends AbstractRestBean implements GroupHandlerLo
gr.setId(group.getId());
gr.setCategory(group.getGroupCategory());
gr.setRecursive(group.isRecursive());
+ if (group.getGroupDefinition()!=null)
+ gr.setDynaGroupDefinitionId(group.getGroupDefinition().getId());
+ gr.setExplicitCount(group.getExplicitResources().size());
+ gr.setImplicitCount(group.getImplicitResources().size());
UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
uriBuilder.path("/group/{id}");
URI uri = uriBuilder.build(group.getId());
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/GroupRest.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/GroupRest.java
index 4c9079b..c43f911 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/GroupRest.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/GroupRest.java
@@ -21,6 +21,9 @@ public class GroupRest {
private Integer resourceTypeId;
private boolean recursive;
private GroupCategory category;
+ private int dynaGroupDefinitionId;
+ private int explicitCount;
+ private int implicitCount;
List<Link> links = new ArrayList<Link>();
@@ -79,4 +82,28 @@ public class GroupRest {
public void setLinks(List<Link> links) {
this.links = links;
}
+
+ public int getDynaGroupDefinitionId() {
+ return dynaGroupDefinitionId;
+ }
+
+ public void setDynaGroupDefinitionId(int dynaGroupDefinitionId) {
+ this.dynaGroupDefinitionId = dynaGroupDefinitionId;
+ }
+
+ public int getExplicitCount() {
+ return explicitCount;
+ }
+
+ public void setExplicitCount(int explicitCount) {
+ this.explicitCount = explicitCount;
+ }
+
+ public int getImplicitCount() {
+ return implicitCount;
+ }
+
+ public void setImplicitCount(int implicitCount) {
+ this.implicitCount = implicitCount;
+ }
}
diff --git a/modules/enterprise/server/jar/src/main/resources/rest_templates/group.ftl b/modules/enterprise/server/jar/src/main/resources/rest_templates/group.ftl
index 6edaf99..03a69bb 100644
--- a/modules/enterprise/server/jar/src/main/resources/rest_templates/group.ftl
+++ b/modules/enterprise/server/jar/src/main/resources/rest_templates/group.ftl
@@ -44,6 +44,17 @@
<tr>
<td>Recursive</td><td>${var.recursive?string("Yes","No")}</td>
</tr>
+ <tr>
+ <td>DynaGroup</td><td>${(var.dynaGroupDefinitionId > 0)?string("Yes","No")}</td>
+ </tr>
+ <tr>
+ <td>Resource Count</td>
+ <td>${var.explicitCount}
+ <#if var.recursive>
+ ( Implicit: ${var.implicitCount} )
+ </#if>
+ </td>
+ </tr>
</table>
<a href="/rest/1/group/${var.id?c}/resources.html">Resources</a><br/>
</html>
commit 76dee23a84b0a14362f8ed22be6f5e8b6e4ba707
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 19 21:10:16 2012 +0200
Use the same job id over the place to prevent IndexOutOfBoundExceptions later.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
index cb233f8..d8b9851 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
@@ -296,13 +296,14 @@ public class OperationsHandlerBean extends AbstractRestBean implements Operation
MediaType mediaType = httpHeaders.getAcceptableMediaTypes().get(0);
ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
- criteria.addFilterJobId(new JobId(jobName));
+ JobId jobId = new JobId(jobName);
+ criteria.addFilterJobId(jobId);
ResourceOperationHistory history ;//= opsManager.getOperationHistoryByJobId(caller,jobName);
List<ResourceOperationHistory> list = opsManager.findResourceOperationHistoriesByCriteria(caller,criteria);
if (list==null || list.isEmpty()) {
- log.info("No history with id " + new HistoryJobId(jobName) + " found");
- throw new StuffNotFoundException("OperationHistory with id " + new HistoryJobId(jobName));
+ log.info("No history with id " + jobId + " found");
+ throw new StuffNotFoundException("OperationHistory with id " + jobId);
}
history = list.get(0);
commit 6528df9ea4eb462faed0504089faa21b55671a79
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Jun 19 18:07:05 2012 +0200
Prevent a possible "No session exception"
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java
index a4bc84e..79012a1 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java
@@ -327,13 +327,13 @@ public class AbstractRestBean {
return true;
}
- public ResourceWithType fillRWT(org.rhq.core.domain.resource.Resource res, UriInfo uriInfo) {
+ public ResourceWithType fillRWT(Resource res, UriInfo uriInfo) {
ResourceType resourceType = res.getResourceType();
ResourceWithType rwt = new ResourceWithType(res.getName(),res.getId());
rwt.setTypeName(resourceType.getName());
rwt.setTypeId(resourceType.getId());
rwt.setPluginName(resourceType.getPlugin());
- org.rhq.core.domain.resource.Resource parent = res.getParentResource();
+ Resource parent = res.getParentResource();
if (parent!=null) {
rwt.setParentId(parent.getId());
}
@@ -382,6 +382,10 @@ public class AbstractRestBean {
protected Resource fetchResource(int resourceId) {
Resource res;
+ res = resMgr.getResource(caller, resourceId);
+ if (res==null)
+ throw new StuffNotFoundException("Resource with id " + resourceId);
+/*
res = getFromCache(resourceId, Resource.class);
if (res == null) {
res = resMgr.getResource(caller, resourceId);
@@ -390,6 +394,7 @@ public class AbstractRestBean {
else
throw new StuffNotFoundException("Resource with id " + resourceId);
}
+*/
return res;
}
}
11 years, 11 months
[rhq] Branch 'searchbar' - modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/AbstractSearchStrategy.java | 36 ----------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/EnhancedSearchBar.java | 12 ---
2 files changed, 48 deletions(-)
New commits:
commit 6d4a02a77d73f2f279b2795c1cc50c61dac4aa2d
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Jun 19 18:48:43 2012 -0700
Remove unused code.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/AbstractSearchStrategy.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/AbstractSearchStrategy.java
index 0ffe71e..b1946d5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/AbstractSearchStrategy.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/AbstractSearchStrategy.java
@@ -86,40 +86,4 @@ public abstract class AbstractSearchStrategy implements RecordClickHandler, Cel
}
- protected void activateSavedSearch(Integer savedSearchId) {
- activeSavedSearchByIdOrName(savedSearchId, null);
- }
-
- protected void activateSavedSearch(String savedSearchName) {
- activeSavedSearchByIdOrName(null, savedSearchName);
- }
-
- private void activeSavedSearchByIdOrName(Integer savedSearchId, final String savedSearchName) {
- SavedSearchCriteria criteria = new SavedSearchCriteria();
- criteria.addFilterSubjectId(subject.getId());
- criteria.addFilterId(savedSearchId); // null OK
- criteria.addFilterName(savedSearchName); // null OK
- criteria.setStrict(true);
-
- GWTServiceLookup.getSearchService().findSavedSearchesByCriteria(criteria,
- new AsyncCallback<List<SavedSearch>>() {
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_searchBar_savedSearch_failFind(savedSearchName),
- caught);
- }
-
- @Override
- public void onSuccess(List<SavedSearch> results) {
- if (results.size() == 0) {
- CoreGUI.getMessageCenter().notify(
- new Message(MSG.view_searchBar_savedSearch_failFind(savedSearchName), Message.Severity.Error));
- } else {
- SavedSearch savedSearch = results.get(0);
- //activateSavedSearch(savedSearch);
- }
- }
- });
- }
-
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/EnhancedSearchBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/EnhancedSearchBar.java
index f19d9f6..7379e52 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/EnhancedSearchBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/EnhancedSearchBar.java
@@ -242,18 +242,6 @@ public class EnhancedSearchBar extends ToolStrip {
});
}
- private void updateSavedSearchName(final int savedSearchId, final String newName) {
- searchService.updateSavedSearchName(savedSearchId, newName, new AsyncCallback<Boolean>() {
- @Override
- public void onSuccess(Boolean hadUpdates) {
- // no message bar to send update message to if hadUpdates
- }
-
- @Override
- public void onFailure(Throwable caught) {
- }
- });
- }
public AbstractSearchStrategy getSearchStrategy() {
return searchStrategies.get(searchMode);
11 years, 11 months
[rhq] Branch 'searchbar' - modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/AbstractSearchStrategy.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/BasicSearchStrategy.java | 60 +++++++---
2 files changed, 48 insertions(+), 14 deletions(-)
New commits:
commit 5cb504cb3cec8a3dc7df5f48a8057495a92bca4a
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Jun 19 16:34:37 2012 -0700
Fix clicks on saved searches for basic search to show search expressions.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/AbstractSearchStrategy.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/AbstractSearchStrategy.java
index 394a164..0ffe71e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/AbstractSearchStrategy.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/AbstractSearchStrategy.java
@@ -49,6 +49,7 @@ public abstract class AbstractSearchStrategy implements RecordClickHandler, Cel
public static final String ATTR_DESCRIPTION = "description";
public static final String ATTR_RESULT_COUNT = "resultCount";
public static final String ATTR_PATTERN = "pattern";
+ public static final String ATTR_VALUE = "value";
protected final SearchGWTServiceAsync searchService = GWTServiceLookup.getSearchService();
@@ -94,7 +95,6 @@ public abstract class AbstractSearchStrategy implements RecordClickHandler, Cel
}
private void activeSavedSearchByIdOrName(Integer savedSearchId, final String savedSearchName) {
- Subject subject = UserSessionManager.getSessionSubject();
SavedSearchCriteria criteria = new SavedSearchCriteria();
criteria.addFilterSubjectId(subject.getId());
criteria.addFilterId(savedSearchId); // null OK
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/BasicSearchStrategy.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/BasicSearchStrategy.java
index c3d09e1..4625ef5 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/BasicSearchStrategy.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/BasicSearchStrategy.java
@@ -21,13 +21,18 @@ package org.rhq.enterprise.gui.coregui.client.searchbar;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.data.fields.DataSourceTextField;
+import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
import com.smartgwt.client.widgets.form.fields.events.KeyUpEvent;
import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.smartgwt.client.widgets.grid.events.RecordClickEvent;
+import org.rhq.core.domain.criteria.SavedSearchCriteria;
+import org.rhq.core.domain.search.SavedSearch;
import org.rhq.core.domain.search.SearchSubsystem;
import org.rhq.core.domain.search.SearchSuggestion;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.Log;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import java.util.List;
@@ -83,16 +88,13 @@ public class BasicSearchStrategy extends AbstractSearchStrategy {
Log.debug("BasicSearchStrategy click");
String kind = event.getRecord().getAttribute(ATTR_KIND);
if(kind.equals("SAVED") || kind.equals("GLOBAL")){
- searchBar.getSearchComboboxItem().setValue(event.getRecord().getAttribute(ATTR_ID));
- // do I have to go get the expr from DB
- //@todo: add saveSearchTextItem and star
searchBar.switchToSavedSearchMode();
- searchBar.getSaveSearchTextItem().setValue(event.getRecord().getAttribute(ATTR_ID));
- searchBar.getSearchComboboxItem().setValue(event.getRecord().getAttribute(ATTR_NAME));
-// searchService.updateSavedSearchPattern();
+ String savedSearchName = event.getRecord().getAttribute(ATTR_VALUE);
+ searchBar.getSaveSearchTextItem().setValue(savedSearchName);
+ assignSavedSearchExpression(savedSearchName, searchBar.getSearchComboboxItem());
}else {
- String clickedExpression = event.getRecord().getAttribute("name");
+ String clickedExpression = event.getRecord().getAttribute(ATTR_NAME);
searchBar.getSearchComboboxItem().setValue(clickedExpression);
if(null != clickedExpression && clickedExpression.length() > 0){
getSearchSuggestions(SearchSubsystem.RESOURCE, clickedExpression, clickedExpression.length());
@@ -107,6 +109,34 @@ public class BasicSearchStrategy extends AbstractSearchStrategy {
}
}
+ private void assignSavedSearchExpression(final String savedSearchName, final ComboBoxItem searchComboBoxItem) {
+ SavedSearchCriteria criteria = new SavedSearchCriteria();
+ criteria.addFilterSubjectId(subject.getId());
+ criteria.addFilterName(savedSearchName); // null OK
+ criteria.setStrict(true);
+
+ GWTServiceLookup.getSearchService().findSavedSearchesByCriteria(criteria,
+ new AsyncCallback<List<SavedSearch>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_searchBar_savedSearch_failFind(savedSearchName),
+ caught);
+ }
+
+ @Override
+ public void onSuccess(List<SavedSearch> results) {
+ if (results.size() == 0) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_searchBar_savedSearch_failFind(savedSearchName), Message.Severity.Error));
+ } else {
+ SavedSearch savedSearch = results.get(0);
+ searchComboBoxItem.setValue(savedSearch.getPattern());
+ }
+ }
+ });
+
+ }
+
@Override
public void searchKeyUpHandler(KeyUpEvent keyUpEvent) {
Log.debug("Keyup in BasicSearchStrategy: "+keyUpEvent.getKeyName());
@@ -140,20 +170,22 @@ public class BasicSearchStrategy extends AbstractSearchStrategy {
public void onSuccess(List<SearchSuggestion> results) {
DataSource ds = new DataSource();
ds.setClientOnly(true);
- DataSourceTextField valueField = new DataSourceTextField(ATTR_ID, "Id");
- valueField.setPrimaryKey(true);
+ DataSourceTextField idField = new DataSourceTextField(ATTR_ID, "Id");
+ idField.setPrimaryKey(true);
+ DataSourceTextField valueField = new DataSourceTextField(ATTR_VALUE, "Value");
DataSourceTextField kindField = new DataSourceTextField(ATTR_KIND, "Kind");
DataSourceTextField nameField = new DataSourceTextField(ATTR_NAME, "Name");
- ds.setFields(valueField, kindField, nameField );
+ ds.setFields(idField,valueField, kindField, nameField );
for (SearchSuggestion searchSuggestion : results) {
- Log.debug("search Suggestions: " + searchSuggestion.getKind() + ", " + searchSuggestion.getValue() + ", " + searchSuggestion.getLabel());
+ Log.debug("search tab aware Suggestions: " + searchSuggestion.getKind() + ", " + searchSuggestion.getValue() + ", " + searchSuggestion.getLabel());
ListGridRecord record = new ListGridRecord();
record.setAttribute(ATTR_ID, searchSuggestion.getValue());
if(null != searchSuggestion.getKind()){
record.setAttribute(ATTR_KIND, searchSuggestion.getKind().getDisplayName());
}
record.setAttribute(ATTR_NAME, searchSuggestion.getLabel());
+ record.setAttribute(ATTR_VALUE, searchSuggestion.getValue());
ds.addData(record);
}
searchBar.getSearchComboboxItem().setOptionDataSource(ds);
@@ -179,8 +211,9 @@ public class BasicSearchStrategy extends AbstractSearchStrategy {
public void onSuccess(List<SearchSuggestion> results) {
DataSource ds = new DataSource();
ds.setClientOnly(true);
- DataSourceTextField valueField = new DataSourceTextField(ATTR_ID, "Id");
- valueField.setPrimaryKey(true);
+ DataSourceTextField idField = new DataSourceTextField(ATTR_ID, "Id");
+ idField.setPrimaryKey(true);
+ DataSourceTextField valueField = new DataSourceTextField(ATTR_VALUE, "Value");
DataSourceTextField kindField = new DataSourceTextField(ATTR_KIND, "Kind");
DataSourceTextField nameField = new DataSourceTextField(ATTR_NAME, "Name");
ds.setFields(valueField, kindField, nameField );
@@ -193,6 +226,7 @@ public class BasicSearchStrategy extends AbstractSearchStrategy {
record.setAttribute(ATTR_KIND, searchSuggestion.getKind().getDisplayName());
}
record.setAttribute(ATTR_NAME, searchSuggestion.getLabel());
+ record.setAttribute(ATTR_VALUE, searchSuggestion.getValue());
ds.addData(record);
}
searchBar.getSearchComboboxItem().setOptionDataSource(ds);
11 years, 11 months
[rhq] Branch 'searchbar' - modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/AbstractSearchStrategy.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/BasicSearchStrategy.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/FavoritesSearchStrategy.java | 14 ++++++----
3 files changed, 11 insertions(+), 5 deletions(-)
New commits:
commit a5614244d65f15922b59958c5350c9cd6bde6a8e
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Jun 19 15:47:08 2012 -0700
Make Saved Search Clicks work
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/AbstractSearchStrategy.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/AbstractSearchStrategy.java
index 17832b5..394a164 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/AbstractSearchStrategy.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/AbstractSearchStrategy.java
@@ -48,6 +48,7 @@ public abstract class AbstractSearchStrategy implements RecordClickHandler, Cel
public static final String ATTR_NAME = "name";
public static final String ATTR_DESCRIPTION = "description";
public static final String ATTR_RESULT_COUNT = "resultCount";
+ public static final String ATTR_PATTERN = "pattern";
protected final SearchGWTServiceAsync searchService = GWTServiceLookup.getSearchService();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/BasicSearchStrategy.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/BasicSearchStrategy.java
index 43baefc..c3d09e1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/BasicSearchStrategy.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/BasicSearchStrategy.java
@@ -102,6 +102,7 @@ public class BasicSearchStrategy extends AbstractSearchStrategy {
/////////////////////////////////////////////////////
//@todo: how refresh the pickList properties grid now to reflect new search
//searchComboBox.focusInItem();
+
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/FavoritesSearchStrategy.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/FavoritesSearchStrategy.java
index e902195..8fe5bf4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/FavoritesSearchStrategy.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/FavoritesSearchStrategy.java
@@ -53,16 +53,16 @@ public class FavoritesSearchStrategy extends AbstractSearchStrategy {
Log.debug("Using Favorites Formatter");
String name = record.getAttribute(ATTR_NAME);
- String description = record.getAttribute(ATTR_DESCRIPTION);
Integer resultCount = record.getAttributeAsInt(ATTR_RESULT_COUNT);
- String id = record.getAttribute(ATTR_ID);
+ String pattern = record.getAttribute(ATTR_PATTERN);
String resultAsString = (resultCount != null) ? "("+String.valueOf(resultCount)+")" : "";
final String styleStr = "font-family:arial;font-size:11px;white-space:nowrap;overflow:hidden;";
String formatString = "<table>" +
"<tr><td ><span style='" + styleStr + "width:170px;color:green;float:left'>" + name + "</span></td>" +
"<td align='right'><span style='" + styleStr + "width:50px;float:right;font-weight:bold'>" + resultAsString+ "</span></td></tr>" +
- "<tr><td colSpan=2><span style='" + styleStr + "width:220px;float:left'>" + id + "</span></td></tr></table>";
+ "<tr><td colSpan=2><span style='" + styleStr + "width:220px;float:left'>" + pattern + "</span></td></tr></table>";
+
return formatString;
}
@@ -78,7 +78,9 @@ public class FavoritesSearchStrategy extends AbstractSearchStrategy {
@Override
public void onRecordClick(RecordClickEvent event) {
// do nothing here; just here if we need to do something
- Log.debug("Favorties Search Strategy Click: " + event.getRecord().getAttribute("name"));
+ searchBar.getSaveSearchTextItem().setValue(event.getRecord().getAttribute(ATTR_NAME));
+ searchBar.getSearchComboboxItem().setValue(event.getRecord().getAttribute(ATTR_PATTERN));
+
}
@Override
@@ -111,9 +113,10 @@ public class FavoritesSearchStrategy extends AbstractSearchStrategy {
valueField.setPrimaryKey(true);
DataSourceTextField kindField = new DataSourceTextField(ATTR_KIND, "Kind");
DataSourceTextField nameField = new DataSourceTextField(ATTR_NAME, "Name");
+ DataSourceTextField patternField = new DataSourceTextField(ATTR_PATTERN, "Pattern");
DataSourceTextField descriptionField = new DataSourceTextField(ATTR_DESCRIPTION, "Description");
DataSourceIntegerField recordCount = new DataSourceIntegerField(ATTR_RESULT_COUNT, "Result Count");
- dataSource.setFields(valueField, kindField,nameField,descriptionField,recordCount);
+ dataSource.setFields(valueField, kindField,nameField,patternField,descriptionField,recordCount);
for (SavedSearch savedSearch : result) {
Log.debug("savedSearch: " + savedSearch.getName());
@@ -122,6 +125,7 @@ public class FavoritesSearchStrategy extends AbstractSearchStrategy {
record.setAttribute(ATTR_KIND, "Saved");
record.setAttribute(ATTR_NAME, savedSearch.getName());
record.setAttribute(ATTR_DESCRIPTION, savedSearch.getDescription());
+ record.setAttribute(ATTR_PATTERN, savedSearch.getPattern());
if (savedSearch.getResultCount() != null)
record.setAttribute(ATTR_RESULT_COUNT, savedSearch.getResultCount());
dataSource.addData(record);
11 years, 11 months
[rhq] Changes to 'searchbar'
by mike thompson
New branch 'searchbar' available with the following commits:
commit d162c5ecacfecd12736b1595fea27d05a014c887
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Jun 19 13:39:42 2012 -0700
[BZ 733487] Search bar saved searches menu ignores clicks
11 years, 11 months
[rhq] 2 commits - modules/plugins pom.xml
by ips
modules/plugins/jboss-as-7/pom.xml | 84 ----------
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java | 8
pom.xml | 2
3 files changed, 4 insertions(+), 90 deletions(-)
New commits:
commit 3b1e22ae89819d89a64c7d319099f53df85bfca3
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Jun 19 15:20:09 2012 -0400
add support for EAP 6.0.0 (GA) and remove support for all the EAP 6.0 ER's
diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml
index e9f877a..16eb982 100644
--- a/modules/plugins/jboss-as-7/pom.xml
+++ b/modules/plugins/jboss-as-7/pom.xml
@@ -240,92 +240,12 @@
</profile>
<profile>
- <id>eap600Beta1.itest.setup</id>
+ <id>eap600.itest.setup</id>
<activation>
<property>
<name>as7.version</name>
- <value>6.0.0.Beta1</value>
- </property>
- </activation>
-
- <properties>
- <as7.url>Please set the as7.url system property to the location of the EAP ${as7.version} distribution zipfile.</as7.url>
- <jboss-as-arquillian-container-managed.version>7.1.1.Final</jboss-as-arquillian-container-managed.version>
- </properties>
- </profile>
-
- <profile>
- <id>eap600ER4.itest.setup</id>
-
- <activation>
- <property>
- <name>as7.version</name>
- <value>6.0.0.ER4</value>
- </property>
- </activation>
-
- <properties>
- <as7.url>Please set the as7.url system property to the location of the EAP ${as7.version} distribution zipfile.</as7.url>
- <jboss-as-arquillian-container-managed.version>7.1.1.Final</jboss-as-arquillian-container-managed.version>
- </properties>
- </profile>
-
- <profile>
- <id>eap600ER5.itest.setup</id>
-
- <activation>
- <property>
- <name>as7.version</name>
- <value>6.0.0.ER5</value>
- </property>
- </activation>
-
- <properties>
- <as7.url>Please set the as7.url system property to the location of the EAP ${as7.version} distribution zipfile.</as7.url>
- <jboss-as-arquillian-container-managed.version>7.1.1.Final</jboss-as-arquillian-container-managed.version>
- </properties>
- </profile>
-
- <profile>
- <id>eap600ER7.itest.setup</id>
-
- <activation>
- <property>
- <name>as7.version</name>
- <value>6.0.0.ER7</value>
- </property>
- </activation>
-
- <properties>
- <as7.url>Please set the as7.url system property to the location of the EAP ${as7.version} distribution zipfile.</as7.url>
- <jboss-as-arquillian-container-managed.version>7.1.1.Final</jboss-as-arquillian-container-managed.version>
- </properties>
- </profile>
-
- <profile>
- <id>eap600ER8.itest.setup</id>
-
- <activation>
- <property>
- <name>as7.version</name>
- <value>6.0.0.ER8</value>
- </property>
- </activation>
-
- <properties>
- <as7.url>Please set the as7.url system property to the location of the EAP ${as7.version} distribution zipfile.</as7.url>
- <jboss-as-arquillian-container-managed.version>7.1.1.Final</jboss-as-arquillian-container-managed.version>
- </properties>
- </profile>
-
- <profile>
- <id>eap600CR1.itest.setup</id>
-
- <activation>
- <property>
- <name>as7.version</name>
- <value>6.0.0.CR1</value>
+ <value>6.0.0</value>
</property>
</activation>
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
index a1e26e2..f6f1502 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
@@ -61,13 +61,7 @@ public abstract class AbstractServerComponentTest extends AbstractJBossAS7Plugin
private static final Map<String, String> EAP6_VERSION_TO_AS7_VERSION_MAP = new HashMap<String, String>();
static {
- EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.Beta1", "7.1.0.Final-redhat-1");
- EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.ER4", "7.1.1.Final-redhat-1");
- EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.ER5", "7.1.1.Final-redhat-1");
- EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.ER6", "7.1.1.Final-redhat-1");
- EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.ER7", "7.1.1.Final-redhat-1");
- EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.ER8", "7.1.2.Final-redhat-1");
- EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0.CR1", "7.1.2.Final-redhat-1");
+ EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0", "7.1.2.Final-redhat-1");
}
private static final String RELEASE_VERSION_TRAIT_NAME = "_skm:release-version";
commit 970df9f180e9de788b8e85d6a3f9ae6a01e3ec25
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Tue Jun 19 15:19:12 2012 -0400
upgrade Arquillian bom from 1.0.0.Final to 1.0.1.Final
diff --git a/pom.xml b/pom.xml
index 4799e55..210b697 100644
--- a/pom.xml
+++ b/pom.xml
@@ -110,7 +110,7 @@
<resteasy.version>2.3.3.Final</resteasy.version>
<freemarker.version>2.3.18</freemarker.version>
<powermock.version>1.4.11</powermock.version>
- <arquillian.version>1.0.0.Final</arquillian.version>
+ <arquillian.version>1.0.1.Final</arquillian.version>
<animal.sniffer.version>1.7</animal.sniffer.version>
<xercesImpl.version>2.9.1-jbossas-2</xercesImpl.version> <!-- see BZ-820629 and CVE-2009-2625 -->
11 years, 11 months
[rhq] modules/enterprise
by Jiri Kremser
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/ListPackageHistoryUIBean.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit f2ab06c2f62a77655d37ddcdce82eb16fe06fd91
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Tue Jun 19 10:50:45 2012 +0200
[BZ 588507 - WAR file deployed against Tomcat shows an incorrect installation date] Instalation date is now taken from InstalledPackage instance instead of PackageVersion instance
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/ListPackageHistoryUIBean.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/ListPackageHistoryUIBean.java
index 845c60d..da049a5 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/ListPackageHistoryUIBean.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/content/ListPackageHistoryUIBean.java
@@ -124,8 +124,8 @@ public class ListPackageHistoryUIBean extends PagedDataTableUIBean {
results.add(new PackageTableDataValue("SHA256", current.getPackageVersion().getSHA256(), ((old != null) ? old
.getPackageVersion().getSHA256() : null)));
- results.add(new PackageTableDataValue("Installation Date", dateToString(current.getPackageVersion()
- .getFileCreatedDate()), dateToString((old != null) ? old.getPackageVersion().getFileCreatedDate() : null)));
+ results.add(new PackageTableDataValue("Installation Date", dateToString(current.getInstallationDate()),
+ dateToString((old != null) ? old.getInstallationDate() : null)));
//Comment for now. This field is not even in the list of InstalledPackage fields
//results.add(new PackageTableDataValue("Owner", (current.getUser() != null) ? current.getUser().toString()
// : null, (old != null) ? ((old.getUser() != null) ? old.getUser().toString() : null) : null));
11 years, 11 months