[rhq] modules/plugins
by Simeon Pinder
modules/plugins/jboss-as-7/pom.xml | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
New commits:
commit 93eafb3a0f72c469935a1d35da310826b9037eb5
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Fri Jun 22 14:08:09 2012 -0400
Revert " Adding ability to disable deletion of as7 artifacts after an integration test run. Ex. -Ditest.deleteRoot=false" This is not consistently working.
This reverts commit 37ba7b7ad179000571944b602a2cf6d0993632f2.
diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml
index 7230b59..16eb982 100644
--- a/modules/plugins/jboss-as-7/pom.xml
+++ b/modules/plugins/jboss-as-7/pom.xml
@@ -331,22 +331,10 @@
<goal>run</goal>
</goals>
<configuration>
- <tasks>
- <taskdef resource="net/sf/antcontrib/antcontrib.properties"
- classpathref="maven.plugin.classpath" />
- <if>
- <equals arg1="${itest.deleteRoot}" arg2="false" />
- <then>
- <echo message="*** By request not deleting the AS7 instances after 'integration-test' run." />
- </then>
- <else>
<target>
<delete dir="${jboss7.home}"/>
</target>
- </else>
- </if>
- </tasks>
- </configuration>
+ </configuration>
</execution>
</executions>
</plugin>
11 years, 10 months
[rhq] modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java | 3 +++
1 file changed, 3 insertions(+)
New commits:
commit 5f8827fef9f40546edae97fc2747bd6f1cbf75df
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Fri Jun 22 09:51:49 2012 -0700
[BZ 825230] Some measure names are not readable in JON EPP plugin. This is actually a global layout issue in the resource measurements portlet.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
index a625edf..8fb8f80 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
@@ -100,6 +100,7 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
//display container
final VLayout column = new VLayout();
column.setHeight(10);//pack
+ column.setWidth100();
//initialize to defaults
end = System.currentTimeMillis();
@@ -267,6 +268,7 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
destination);
link.setTitleVAlign(VerticalAlignment.TOP);
link.setAlign(Alignment.LEFT);
+ link.setClipValue(false);
link.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
@@ -291,6 +293,7 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
value.setVAlign(VerticalAlignment.TOP);
row.setItems(graphContainer, link, value);
+ row.setWidth100();
//if graph content returned
if ((md.getName().trim().indexOf("Trait.") == -1)
11 years, 10 months
[rhq] modules/core
by Jay Shaughnessy
modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java | 3 ++-
modules/core/plugin-container/src/test/java/org/rhq/core/pc/drift/FilterFileVisitorTest.java | 9 ++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
New commits:
commit e27fe0d95627f061e9c9c9253d656f20662234cf
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Jun 22 12:01:04 2012 -0400
Fix test that was failingon Linux because it wasn't properly normalizing
the include filter's basedir path. This was a test-only problem and does
not affect production code.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java
index 1c9e50c..92042e7 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftDetector.java
@@ -404,7 +404,8 @@ public class DriftDetector implements Runnable {
}
}
- private Set<File> getScanDirectories(final File basedir, List<Filter> includes) {
+ // package-private for test accessibility
+ static Set<File> getScanDirectories(final File basedir, List<Filter> includes) {
Set<File> directories = new HashSet<File>();
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/drift/FilterFileVisitorTest.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/drift/FilterFileVisitorTest.java
index a654607..8d31a82 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/drift/FilterFileVisitorTest.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/drift/FilterFileVisitorTest.java
@@ -31,8 +31,10 @@ import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import org.apache.commons.io.FileUtils;
+import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -71,6 +73,7 @@ public class FilterFileVisitorTest {
visitor.visitedFiles, "Visitor should be called for every file when no filters specified");
}
+ // This could be a DriftDetectorTest but fits well here.
@Test
public void visitBaseDirFilesThatMatchFilters() throws Exception {
File fooJar = touch(basedir, "foo.jar");
@@ -78,11 +81,15 @@ public class FilterFileVisitorTest {
File myapp = touch(basedir, "myapp.war");
touch(basedir, "bar.jar");
+ // These filter paths should all normalize to the same directory
List<Filter> includes = asList(new Filter(".", "foo*"), new Filter("./", "*.war"), new Filter("/", "goo*"));
List<Filter> excludes = emptyList();
TestVisitor visitor = new TestVisitor();
- forEachFile(basedir, new FilterFileVisitor(basedir, includes, excludes, visitor));
+ // This call normalizes the basedir.
+ Set<File> dirs = DriftDetector.getScanDirectories(basedir, includes);
+ Assert.assertEquals(dirs.size(), 1, "Should just be the basedir");
+ forEachFile(dirs.iterator().next(), new FilterFileVisitor(basedir, includes, excludes, visitor));
assertCollectionEqualsNoOrder(asList(fooJar, gooJar, myapp), visitor.visitedFiles,
"Filtering failed with multiple includes and no excludes");
11 years, 10 months
[rhq] modules/jopr
by ips
modules/jopr/tools/jbas5-plugin-descriptor-gen/pom.xml | 46 +++-------
modules/jopr/tools/jbas5-plugin-descriptor-gen/src/main/java/org/jboss/jopr/tool/jbas5/PluginDescriptorGenerator.java | 6 -
2 files changed, 22 insertions(+), 30 deletions(-)
New commits:
commit b5ab75a28ec1a0bd62b914de1e52869f1bf6a9f1
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Jun 22 11:41:22 2012 -0400
get the as5 plugin descriptor generator compiling again
diff --git a/modules/jopr/tools/jbas5-plugin-descriptor-gen/pom.xml b/modules/jopr/tools/jbas5-plugin-descriptor-gen/pom.xml
index 965002a..dbeec8f 100644
--- a/modules/jopr/tools/jbas5-plugin-descriptor-gen/pom.xml
+++ b/modules/jopr/tools/jbas5-plugin-descriptor-gen/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.3.0-SNAPSHOT</version>
+ <version>4.5.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
@@ -313,43 +313,33 @@ t section. -->
<build>
<plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- </configuration>
- </plugin>
<plugin>
- <artifactId>maven-dependency-plugin</artifactId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.3</version>
+ <configuration>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ <archive>
+ <manifest>
+ <mainClass>org.jboss.jopr.tool.jbas5.PluginDescriptorGenerator</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
<executions>
<execution>
- <id>copy-dependencies</id>
+ <id>make-assembly</id>
+ <!-- this is used for inheritance merges -->
<phase>package</phase>
+ <!-- bind to the packaging phase -->
<goals>
- <goal>copy-dependencies</goal>
+ <goal>single</goal>
</goals>
- <configuration>
- <includeScope>runtime</includeScope>
- <excludeTransitive>true</excludeTransitive>
- <outputDirectory>target/lib</outputDirectory>
- </configuration>
</execution>
</executions>
</plugin>
-
- <plugin>
- <artifactId>maven-jar-plugin</artifactId>
- <configuration>
- <archive>
- <manifest>
- <mainClass>org.jboss.jopr.tool.jbas5.PluginDescriptorGenerator</mainClass>
- <addClasspath>true</addClasspath>
- <classpathPrefix>lib</classpathPrefix>
- </manifest>
- </archive>
- </configuration>
- </plugin>
+
</plugins>
</build>
diff --git a/modules/jopr/tools/jbas5-plugin-descriptor-gen/src/main/java/org/jboss/jopr/tool/jbas5/PluginDescriptorGenerator.java b/modules/jopr/tools/jbas5-plugin-descriptor-gen/src/main/java/org/jboss/jopr/tool/jbas5/PluginDescriptorGenerator.java
index 5019fea..31de2a8 100644
--- a/modules/jopr/tools/jbas5-plugin-descriptor-gen/src/main/java/org/jboss/jopr/tool/jbas5/PluginDescriptorGenerator.java
+++ b/modules/jopr/tools/jbas5-plugin-descriptor-gen/src/main/java/org/jboss/jopr/tool/jbas5/PluginDescriptorGenerator.java
@@ -26,6 +26,8 @@ import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
+import java.lang.String;
+import java.math.BigInteger;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -232,7 +234,7 @@ public class PluginDescriptorGenerator
if (metricDef.getCategory() != null)
metricDescriptor.setCategory(metricDef.getCategory().name().toLowerCase());
metricDescriptor.setDataType(metricDef.getDataType().name().toLowerCase());
- metricDescriptor.setDefaultInterval((int)metricDef.getDefaultInterval());
+ metricDescriptor.setDefaultInterval(new BigInteger(String.valueOf(metricDef.getDefaultInterval())));
metricDescriptor.setDefaultOn(metricDef.isDefaultOn());
metricDescriptor.setDescription(metricDef.getDescription());
metricDescriptor.setDestinationType(metricDef.getDestinationType());
@@ -312,7 +314,7 @@ public class PluginDescriptorGenerator
{
PropertyDefinitionMap propDefMap = (PropertyDefinitionMap)propDef;
MapProperty mapProp = new MapProperty();
- for (PropertyDefinition itemPropDef : propDefMap.getPropertyDefinitions().values())
+ for (PropertyDefinition itemPropDef : propDefMap.getPropertyDefinitions())
{
ConfigurationProperty itemConfigProp = convertPropertyDefinitionToConfigurationProperty(itemPropDef);
JAXBElement propElement = getJAXBElement(itemConfigProp);
11 years, 10 months
[rhq] modules/enterprise
by Jiri Kremser
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java | 16 +++-------
1 file changed, 6 insertions(+), 10 deletions(-)
New commits:
commit 6b1069c1b97337b69b3e9951e4b6df7a2c692646
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri Jun 22 15:23:24 2012 +0200
[BZ 815421 - Discovery Q: even with no entry, "select all" is active] If there are no enties, "select all" button is disabled
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
index 0e473a7..a7f20c0 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
@@ -18,17 +18,18 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery;
+import java.util.ArrayList;
+import java.util.EnumSet;
+import java.util.List;
+
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.DataSource;
import com.smartgwt.client.types.Autofit;
import com.smartgwt.client.types.SelectionAppearance;
-import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.util.BooleanCallback;
import com.smartgwt.client.util.SC;
-import com.smartgwt.client.widgets.HTMLFlow;
import com.smartgwt.client.widgets.IButton;
-import com.smartgwt.client.widgets.Img;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.form.DynamicForm;
@@ -40,17 +41,16 @@ import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionChangedHandler;
import com.smartgwt.client.widgets.grid.events.SelectionEvent;
-import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.toolbar.ToolStrip;
import com.smartgwt.client.widgets.tree.TreeGrid;
import com.smartgwt.client.widgets.tree.TreeGridField;
import com.smartgwt.client.widgets.tree.TreeNode;
+
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.IconEnum;
import org.rhq.enterprise.gui.coregui.client.RefreshableView;
-import org.rhq.enterprise.gui.coregui.client.components.TitleBar;
import org.rhq.enterprise.gui.coregui.client.components.table.TimestampCellFormatter;
import org.rhq.enterprise.gui.coregui.client.components.view.HasViewName;
import org.rhq.enterprise.gui.coregui.client.components.view.ViewName;
@@ -63,10 +63,6 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableTreeGrid;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-
/**
* @author Greg Hinkle
*/
@@ -372,7 +368,7 @@ public class ResourceAutodiscoveryView extends LocatableVLayout implements Refre
private void updateButtonEnablement(IButton selectAllButton, IButton deselectAllButton, IButton importButton,
IButton ignoreButton, IButton unignoreButton) {
if (treeGrid.getSelectedRecords().length == 0) {
- selectAllButton.setDisabled(false);
+ selectAllButton.setDisabled(treeGrid.getRecords().length == 0);
deselectAllButton.setDisabled(true);
importButton.setDisabled(true);
ignoreButton.setDisabled(true);
11 years, 10 months
[rhq] 2 commits - modules/plugins
by Simeon Pinder
modules/plugins/jboss-as-7/pom.xml | 14
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java | 319 ------
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SecurityModuleOptionsTest.java | 525 ++++++++++
3 files changed, 538 insertions(+), 320 deletions(-)
New commits:
commit 7b77b38e5bdaa2b87f05be70bea8c1cdb08d14d8
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Fri Jun 22 08:46:14 2012 -0400
[BZ 826542] add a few tests to exercise crud of Security Domain and some of Module Option framework.
- only added one of this type as discovery needs to complete in between creates and slows down process significantly.
- we need to come up with another way of prepopulating the other SecurityDomain types before full discovery.
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
deleted file mode 100644
index e80ddec..0000000
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/SecurityModuleOptionsTest.java
+++ /dev/null
@@ -1,319 +0,0 @@
-///*
-// * 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;
-// }
-//}
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SecurityModuleOptionsTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SecurityModuleOptionsTest.java
new file mode 100644
index 0000000..7f9464a
--- /dev/null
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/SecurityModuleOptionsTest.java
@@ -0,0 +1,525 @@
+/*
+ * 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.itest.standalone;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+import java.util.HashMap;
+import java.util.Set;
+
+import org.codehaus.jackson.map.ObjectMapper;
+import org.testng.annotations.Test;
+
+import org.rhq.core.clientapi.agent.inventory.CreateResourceRequest;
+import org.rhq.core.clientapi.agent.inventory.CreateResourceResponse;
+import org.rhq.core.clientapi.agent.inventory.DeleteResourceRequest;
+import org.rhq.core.clientapi.agent.inventory.DeleteResourceResponse;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.resource.CreateResourceStatus;
+import org.rhq.core.domain.resource.DeleteResourceStatus;
+import org.rhq.core.domain.resource.InventoryStatus;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceCategory;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pc.inventory.InventoryManager;
+import org.rhq.modules.plugins.jbossas7.ASConnection;
+import org.rhq.modules.plugins.jbossas7.ModuleOptionsComponent;
+import org.rhq.modules.plugins.jbossas7.itest.AbstractJBossAS7PluginTest;
+import org.rhq.test.arquillian.RunDiscovery;
+
+/**
+ * Test exercising the subsystem=security/SecurityDomain/[Authentication(Classic|Jaspi),
+ * Authorization, Mapping, Audit, Acl,
+ * Identity-Trust]
+ * @author Simeon Pinder
+ */
+@Test(groups = { "integration", "pc", "standalone" }, singleThreaded = true)
+public class SecurityModuleOptionsTest extends AbstractJBossAS7PluginTest {
+
+ 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;
+
+ private static String TEST_DOMAIN = "testDomain";
+ private static Resource securityResource = null;
+ private static String SECURITY_RESOURCE_TYPE = "Security";
+ private static String SECURITY_RESOURCE_KEY = "subsystem=security";
+ private static String SECURITY_DOMAIN_RESOURCE_TYPE = "Security Domain";
+ private static String SECURITY_DOMAIN_RESOURCE_KEY = "security-domain";
+ private static String AUTH_CLASSIC_RESOURCE_TYPE = "Authentication (Classic)";
+ private static String AUTH_CLASSIC_RESOURCE_KEY = "authentication=classic";
+
+ protected static final String DC_HOST = System.getProperty("jboss.domain.bindAddress");
+ protected static final int DC_HTTP_PORT = Integer.valueOf(System.getProperty("jboss.domain.httpManagementPort"));
+ protected static final String DC_USER = AbstractJBossAS7PluginTest.MANAGEMENT_USERNAME;
+ protected static final String DC_PASS = AbstractJBossAS7PluginTest.MANAGEMENT_PASSWORD;
+
+ ASConnection getASConnection() {
+ ASConnection connection = new ASConnection(DC_HOST, DC_HTTP_PORT, DC_USER, DC_PASS);
+ return connection;
+ }
+
+ public static final ResourceType RESOURCE_TYPE = new ResourceType(SECURITY_RESOURCE_TYPE, PLUGIN_NAME,
+ ResourceCategory.SERVICE, null);
+ private static final String RESOURCE_KEY = SECURITY_RESOURCE_KEY;
+
+ //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\"}}]");
+ 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\"}}]");
+ }
+
+ @Test(priority = 10, groups = "discovery")
+ @RunDiscovery(discoverServices = true, discoverServers = true)
+ public void initialDiscovery() throws Exception {
+ Resource platform = this.pluginContainer.getInventoryManager().getPlatform();
+ assertNotNull(platform);
+ assertEquals(platform.getInventoryStatus(), InventoryStatus.COMMITTED);
+
+ Thread.sleep(20 * 1000L); // delay so that PC gets a chance to scan for resources
+ }
+
+ @Test(priority = 12)
+ public void testCreateSecurityDomain() throws Exception {
+ //get the root security resource
+ securityResource = getResource();
+
+ //plugin config
+ Configuration createPlugConfig = new Configuration();
+ createPlugConfig.put(new PropertySimple("path", SECURITY_DOMAIN_RESOURCE_KEY += "=" + TEST_DOMAIN));
+
+ //resource config
+ Configuration createResConfig = new Configuration();
+ createResConfig.put(new PropertySimple("name", TEST_DOMAIN));
+
+ CreateResourceRequest request = new CreateResourceRequest();
+ request.setParentResourceId(securityResource.getId());
+ request.setPluginConfiguration(createPlugConfig);
+ request.setPluginName(PLUGIN_NAME);
+ request.setResourceConfiguration(createResConfig);
+ request.setResourceName(TEST_DOMAIN);
+ request.setResourceTypeName(SECURITY_DOMAIN_RESOURCE_TYPE);
+
+ CreateResourceResponse response = pluginContainer.getResourceFactoryManager().executeCreateResourceImmediately(
+ request);
+
+ assert response.getStatus() == CreateResourceStatus.SUCCESS : "The Security Domain creation failed with an error mesasge: "
+ + response.getErrorMessage();
+ }
+
+ @Test(priority = 13)
+ public void testAuthenticationClassic() throws Exception {
+ //get the root security resource
+ securityResource = getResource();
+
+ //find TEST_DOMAIN 'security-domain'
+ Resource securityDomain = null;
+ Set<Resource> childResources = securityResource.getChildResources();
+ for (Resource r : childResources) {
+ if (r.getName().indexOf(TEST_DOMAIN) > -1) {
+ securityDomain = r;
+ }
+ }
+
+ //plugin config
+ Configuration createPlugConfig = new Configuration();
+ createPlugConfig.put(new PropertySimple("path", AUTH_CLASSIC_RESOURCE_KEY));
+
+ //resource config
+ Configuration createResConfig = new Configuration();
+ createResConfig.put(new PropertySimple("code", "Ldap"));
+ createResConfig.put(new PropertySimple("flag", "requisite"));
+
+ CreateResourceRequest request = new CreateResourceRequest();
+ request.setParentResourceId(securityDomain.getId());
+ request.setPluginConfiguration(createPlugConfig);
+ request.setPluginName(PLUGIN_NAME);
+ request.setResourceConfiguration(createResConfig);
+ request.setResourceName("Test - notUsed.");
+
+ request.setResourceTypeName(AUTH_CLASSIC_RESOURCE_TYPE);
+
+ CreateResourceResponse response = pluginContainer.getResourceFactoryManager().executeCreateResourceImmediately(
+ request);
+
+ assert response.getStatus() == CreateResourceStatus.SUCCESS : "The 'Authentication (Classic)' node creation failed with an error mesasge: "
+ + response.getErrorMessage();
+ }
+
+ @Test(priority = 14)
+ public void testDeleteSecurityDomain() throws Exception {
+ //get the root security resource
+ securityResource = getResource();
+ Resource found = null;
+ Set<Resource> childResources = securityResource.getChildResources();
+ for (Resource r : childResources) {
+ if (r.getName().indexOf(TEST_DOMAIN) > -1) {
+ found = r;
+ }
+ }
+
+ //plugin config
+ Configuration deletePlugConfig = new Configuration();
+ deletePlugConfig.put(new PropertySimple("path", SECURITY_DOMAIN_RESOURCE_KEY += "=" + TEST_DOMAIN));
+
+ //resource config
+ Configuration deleteResConfig = new Configuration();
+ deleteResConfig.put(new PropertySimple("name", TEST_DOMAIN));
+
+ DeleteResourceRequest request = new DeleteResourceRequest();
+ if (found != null) {
+ request.setResourceId(found.getId());
+ }
+ DeleteResourceResponse response = pluginContainer.getResourceFactoryManager().executeDeleteResourceImmediately(
+ request);
+
+ assert response.getStatus() == DeleteResourceStatus.SUCCESS : "The Security Domain deletion failed with an error mesasge: "
+ + response.getErrorMessage();
+ }
+
+ private Resource getResource() {
+
+ InventoryManager im = pluginContainer.getInventoryManager();
+ Resource platform = im.getPlatform();
+ Resource server = getResourceByTypeAndKey(platform, StandaloneServerComponentTest.RESOURCE_TYPE,
+ StandaloneServerComponentTest.RESOURCE_KEY);
+ Resource bindings = getResourceByTypeAndKey(server, RESOURCE_TYPE, RESOURCE_KEY);
+ return bindings;
+ }
+
+ private Resource getResource(Resource parentResource, String pluginDescriptorTypeName, String resourceKey) {
+ Resource resource = null;
+ if (((parentResource != null) & (pluginDescriptorTypeName != null) & (resourceKey != null))
+ & (((!pluginDescriptorTypeName.isEmpty()) & (!resourceKey.isEmpty())))) {
+ ResourceType resourceType = buildResourceType(pluginDescriptorTypeName);
+ resource = getResourceByTypeAndKey(parentResource, resourceType, resourceKey);
+ }
+ return resource;
+ }
+
+ private ResourceType buildResourceType(String pluginTypeName) {
+ ResourceType created = null;
+ if ((pluginTypeName != null) && (!pluginTypeName.isEmpty())) {
+ created = new ResourceType(pluginTypeName, PLUGIN_NAME, ResourceCategory.SERVICE, null);
+ }
+ return created;
+ }
+
+ //##################################################################
+ // /**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.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;
+ // }
+ //
+ // @Test(priority = 10, groups = "discovery")
+ // public void initialSetup() throws Exception {
+ // String securityDomainId = TEST_DOMAIN + "1";
+ // Result result = null;
+ // Operation op = null;
+ //
+ // //create the initial securityDomain
+ // op = new Operation("add", new Address("subsystem=security,security-domain=" + securityDomainId));
+ // ASConnection connection = getASConnection();
+ // con = connection;
+ // mapper = new ObjectMapper();
+ // mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
+ //
+ // moc = new ModuleOptionsComponent();
+ // result = connection.execute(op);
+ // System.out.println("#### Op is:" + op);
+ // System.out.println("#### Result is:" + result);
+ //
+ // //iterate over jsonMap
+ // for (String key : jsonMap.keySet()) {
+ // String attribute = key;
+ // String address = "";
+ // 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?";
+ // }
+ // //#### 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, true, true);
+ // assert ((result.isSuccess() == true) || (result.getOutcome() == null)) : "The operation '" + op
+ // + "' failed to write the resource.." + result.getFailureDescription();
+ // }
+ // }
+}
commit 37ba7b7ad179000571944b602a2cf6d0993632f2
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Fri Jun 22 02:51:27 2012 -0400
Adding ability to disable deletion of as7 artifacts after an integration test run. Ex. -Ditest.deleteRoot=false
diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml
index 16eb982..7230b59 100644
--- a/modules/plugins/jboss-as-7/pom.xml
+++ b/modules/plugins/jboss-as-7/pom.xml
@@ -331,10 +331,22 @@
<goal>run</goal>
</goals>
<configuration>
+ <tasks>
+ <taskdef resource="net/sf/antcontrib/antcontrib.properties"
+ classpathref="maven.plugin.classpath" />
+ <if>
+ <equals arg1="${itest.deleteRoot}" arg2="false" />
+ <then>
+ <echo message="*** By request not deleting the AS7 instances after 'integration-test' run." />
+ </then>
+ <else>
<target>
<delete dir="${jboss7.home}"/>
</target>
- </configuration>
+ </else>
+ </if>
+ </tasks>
+ </configuration>
</execution>
</executions>
</plugin>
11 years, 10 months
[rhq] modules/enterprise
by ips
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 12 ++++++++++
1 file changed, 12 insertions(+)
New commits:
commit 251a17e5a6f972a57c53431b02b6f16867cf463c
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Thu Jun 21 17:46:45 2012 -0400
[BZ 834434] add tooltips to STRING and LONG_STRING simple props that show full property values (https://bugzilla.redhat.com/show_bug.cgi?id=834434)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index 5748811..dc32e91 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -1401,6 +1401,8 @@ public class ConfigurationEditor extends LocatableVLayout {
}
valueItem.setValue(value);
+ setValueAsTooltipIfAppropriate(valueItem, value);
+
valueItem.setRequired(propertyDefinitionSimple.isRequired());
valueItem.setWidth(220);
@@ -1419,6 +1421,13 @@ public class ConfigurationEditor extends LocatableVLayout {
return valueItem;
}
+ private void setValueAsTooltipIfAppropriate(FormItem formItem, String value) {
+ if (((formItem instanceof TextItem) && !(formItem instanceof PasswordItem)) ||
+ (formItem instanceof TextAreaItem)) {
+ formItem.setTooltip(value);
+ }
+ }
+
protected boolean shouldFireEventOnPropertyValueChange(FormItem formItem,
PropertyDefinitionSimple propertyDefinitionSimple, PropertySimple propertySimple) {
PropertyMap parentMap = propertySimple.getParentMap();
@@ -1429,6 +1438,9 @@ public class ConfigurationEditor extends LocatableVLayout {
PropertyDefinitionSimple propertyDefinitionSimple) {
propertySimple.setErrorMessage(null);
propertySimple.setValue(value);
+
+ String stringValue = (value != null) ? value.toString() : null;
+ setValueAsTooltipIfAppropriate(formItem, stringValue);
}
protected static PropertyDefinition getTopLevelPropertyDefinition(PropertyDefinition propertyDefinition) {
11 years, 10 months
[rhq] Branch 'searchbar' - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/BasicSearchStrategy.java | 18 +++++++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/EnhancedSearchBar.java | 4 +-
2 files changed, 19 insertions(+), 3 deletions(-)
New commits:
commit cd526ab09455a06b8b17c46fbd8597f42f3206e2
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Jun 21 17:36:49 2012 -0400
- Add protection against duplicate search
- Add protecttion against obsolete search results
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 1e61737..cf40099 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
@@ -48,6 +48,8 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
*/
public class BasicSearchStrategy extends AbstractSearchStrategy {
+ private String lastExpression;
+
public BasicSearchStrategy(EnhancedSearchBar searchBar) {
super(searchBar);
}
@@ -169,7 +171,14 @@ public class BasicSearchStrategy extends AbstractSearchStrategy {
return 25;
}
- private void getTabAwareSearchSuggestions(SearchSubsystem searchSubsystem, String expression, int caretPosition) {
+ private void getTabAwareSearchSuggestions(SearchSubsystem searchSubsystem, final String expression,
+ int caretPosition) {
+
+ if (expression.equals(lastExpression)) {
+ Log.debug("search tab aware Suggestions: ignoring duplicate search for: " + expression);
+ return;
+ }
+ lastExpression = expression;
final long suggestStart = System.currentTimeMillis();
@@ -178,6 +187,13 @@ public class BasicSearchStrategy extends AbstractSearchStrategy {
public void onSuccess(List<SearchSuggestion> results) {
ComboBoxItem comboBox = searchBar.getSearchComboboxItem();
+
+ // If the value has already changed assume a subsequent search is what they want
+ if (!expression.equals(comboBox.getValueAsString())) {
+ Log.debug("search tab aware Suggestions: ignoring obsolete results for: " + expression);
+ return;
+ }
+
DataSource ds = comboBox.getOptionDataSource();
if (null == ds) {
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 7303857..e793f9f 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
@@ -116,9 +116,9 @@ public class EnhancedSearchBar extends ToolStrip {
searchComboboxItem.setWidth(670);
searchComboboxItem.setBrowserSpellCheck(false);
- //we manually fetch each time we update the picklist values
+ //we manually fetch each time we update the picklist values. That makes the delay setting meaningless.
searchComboboxItem.setAutoFetchData(false);
- searchComboboxItem.setFetchDelay(300);
+ searchComboboxItem.setFetchDelay(300); // I'm not sure if this has an affect with no autoFetch
pickListGrid = new ListGrid();
configureCommonHandlers();
11 years, 10 months
[rhq] Branch 'searchbar' - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java | 50 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/EnhancedSearchBar.java | 18 +++
2 files changed, 48 insertions(+), 20 deletions(-)
New commits:
commit 89dfcbe1aa23a4bb9a00a92fd4f681a96ffda196
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Jun 21 16:18:08 2012 -0400
Update the handling of the hidden item when using the search bar. Make
sure to rename the top level filter item, and also to set the hidden value
in the keypress handler.
Also, start ignoring certain keys that are used for navigation but should
not affect/repopulate the picklist. Similarly, only invoke the returnKeyHandler
for "Enter".
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
index bfae537..2eea340 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/table/Table.java
@@ -49,6 +49,7 @@ import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.events.DoubleClickEvent;
import com.smartgwt.client.widgets.events.DoubleClickHandler;
+import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
import com.smartgwt.client.widgets.form.fields.FormItem;
import com.smartgwt.client.widgets.form.fields.HiddenItem;
import com.smartgwt.client.widgets.form.fields.SelectItem;
@@ -68,6 +69,7 @@ import com.smartgwt.client.widgets.layout.LayoutSpacer;
import com.smartgwt.client.widgets.menu.IMenuButton;
import com.smartgwt.client.widgets.menu.MenuItem;
import com.smartgwt.client.widgets.menu.events.MenuItemClickEvent;
+
import org.rhq.core.domain.search.SearchSubsystem;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.InitializableView;
@@ -79,8 +81,15 @@ import org.rhq.enterprise.gui.coregui.client.util.CriteriaUtility;
import org.rhq.enterprise.gui.coregui.client.util.Log;
import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
import org.rhq.enterprise.gui.coregui.client.util.message.Message;
-import org.rhq.enterprise.gui.coregui.client.util.selenium.*;
-
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableIMenuButton;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableMenu;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableToolStrip;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.SeleniumUtility;
/**
* A tabular view of set of data records from an {@link RPCDataSource}.
@@ -301,8 +310,8 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
configureTableFilters();
} else {
if (!this.hideSearchBar) {
- final EnhancedSearchBarItem searchFilter = new EnhancedSearchBarItem("search",
- getSearchSubsystem(), getInitialSearchBarSearchText());
+ final EnhancedSearchBarItem searchFilter = new EnhancedSearchBarItem("search", getSearchSubsystem(),
+ getInitialSearchBarSearchText());
setFilterFormItems(searchFilter);
}
}
@@ -762,8 +771,7 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
final ListGrid listGrid = getListGrid();
Criteria criteria = getCurrentCriteria();
- Log.debug(getClass().getName() + ".refresh() using criteria [" + CriteriaUtility.toString(criteria)
- + "]...");
+ Log.debug(getClass().getName() + ".refresh() using criteria [" + CriteriaUtility.toString(criteria) + "]...");
listGrid.setCriteria(criteria);
if (resetPaging) {
@@ -1165,22 +1173,14 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
nextFormItem.addChangedHandler(this);
} else if (nextFormItem instanceof EnhancedSearchBarItem) {
searchBarItem = (EnhancedSearchBarItem) nextFormItem;
- //searchBarItem.getSearchBar().addKeyPressHandler(this);
searchBarItem.getSearchBar().getSearchComboboxItem().addKeyPressHandler(this);
- String name = searchBarItem.getSearchBar().getSearchComboboxItem().getName();
- //@todo:FIXME!!
- ///////////////////////////////////////////////////////////
- // PROBLEM: searchBarItem.getSearchBar().getSearchComboboxItem().getValueAsString()
- // is always null
- ///////////////////////////////////////////////////////////
- Log.debug(" ***** Found SearchBar2 with: "+name+":"+searchBarItem.getSearchBar().getSearchComboboxItem().getValue());
+ String name = searchBarItem.getName();
// postfix the name of the item so it is not processed by the filters and that the
// hidden item is used instead.
- searchBarItem.getSearchBar().getSearchComboboxItem().setName(name + "_hidden");
+ searchBarItem.setName(name + "_hidden");
hiddenItem = new HiddenItem(name);
hiddenItem.setValue(searchBarItem.getSearchBar().getSearchComboboxItem().getValueAsString());
}
-
}
if (hiddenItem != null) {
@@ -1206,7 +1206,22 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
public void onKeyPress(KeyPressEvent event) {
if (event.getKeyName().equals("Enter")) {
Log.debug("Table.TableFilter Pressed Enter key");
- fetchFilteredTableData();
+
+ if (null != searchBarItem) {
+ ComboBoxItem comboBoxItem = searchBarItem.getSearchBar().getSearchComboboxItem();
+ String searchBarValue = comboBoxItem.getValueAsString();
+ String hiddenValue = (String) hiddenItem.getValue();
+ Log.debug("Table.TableFilter searchBarValue :" + searchBarValue + ", hiddenValue" + hiddenValue);
+
+ // Only send a fetch request if the user actually changed the search expression.
+ if (!equals(searchBarValue, hiddenValue)) {
+ hiddenItem.setValue(searchBarValue);
+ Log.debug("Table.TableFilter fetchFilteredTableData");
+ fetchFilteredTableData();
+ }
+ } else {
+ fetchFilteredTableData();
+ }
}
}
@@ -1219,7 +1234,6 @@ public class Table<DS extends RPCDataSource> extends LocatableHLayout implements
return super.getFields().length != 0;
}
-
private static boolean equals(String string1, String string2) {
if (string1 == null) {
return (string2 == null);
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 b4852d6..7303857 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
@@ -18,7 +18,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.searchbar;
+import java.util.ArrayList;
import java.util.EnumMap;
+import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.TextMatchStyle;
@@ -69,6 +71,14 @@ public class EnhancedSearchBar extends ToolStrip {
private final SearchGWTServiceAsync searchService = GWTServiceLookup.getSearchService();
+ private static final List IGNORED_KEYS;
+
+ static {
+ IGNORED_KEYS = new ArrayList(2);
+ IGNORED_KEYS.add("Arrow_Down");
+ IGNORED_KEYS.add("Arrow_Up");
+ }
+
enum SearchMode {
BASIC_SEARCH_MODE, SAVED_SEARCH_MODE
}
@@ -109,7 +119,6 @@ public class EnhancedSearchBar extends ToolStrip {
//we manually fetch each time we update the picklist values
searchComboboxItem.setAutoFetchData(false);
searchComboboxItem.setFetchDelay(300);
- searchComboboxItem.setCompleteOnTab(true);
pickListGrid = new ListGrid();
configureCommonHandlers();
@@ -124,10 +133,15 @@ public class EnhancedSearchBar extends ToolStrip {
public void onKeyUp(KeyUpEvent keyUpEvent) {
Log.debug("onKeyUp search Mode: " + searchMode);
- getSearchStrategy().searchKeyUpHandler(keyUpEvent);
+ if (IGNORED_KEYS.contains(keyUpEvent.getKeyName())) {
+ return;
+ }
+
if (keyUpEvent.getKeyName().equals("Enter")) {
getSearchStrategy().searchReturnKeyHandler(keyUpEvent);
searchComboboxItem.focusInItem();
+ } else {
+ getSearchStrategy().searchKeyUpHandler(keyUpEvent);
}
}
});
11 years, 10 months
[rhq] Branch 'AdminConsole_EAP_5_1' - 2 commits - modules/plugins
by snegrea
modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/StandaloneManagedDeploymentComponent.java | 53 +++++++++-
1 file changed, 50 insertions(+), 3 deletions(-)
New commits:
commit 8a9c9cbdb14665c4a98dc2c74275a91fe4a9cf0b
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Jun 21 15:09:25 2012 -0500
[BZ 646631 - EMBJOPR-366] Switch to the farmed deployment manager prior to stopping and removing the existing application.
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/StandaloneManagedDeploymentComponent.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/StandaloneManagedDeploymentComponent.java
index 8aa69c8..3750721 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/StandaloneManagedDeploymentComponent.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/StandaloneManagedDeploymentComponent.java
@@ -262,26 +262,7 @@ public class StandaloneManagedDeploymentComponent extends AbstractManagedDeploym
+ "' to '" + backupOfOriginalFile + "'.");
}
- // Now stop the original app.
- try {
- DeploymentManager deploymentManager = getConnection().getDeploymentManager();
- DeploymentProgress progress = deploymentManager.stop(this.deploymentName);
- DeploymentUtils.run(progress);
- } catch (Exception e) {
- throw new RuntimeException("Failed to stop deployment [" + this.deploymentName + "].", e);
- }
-
- // And then remove it (this will delete the physical file/dir from the deploy dir).
- try {
- DeploymentManager deploymentManager = getConnection().getDeploymentManager();
- DeploymentProgress progress = deploymentManager.remove(this.deploymentName);
- DeploymentUtils.run(progress);
- } catch (Exception e) {
- throw new RuntimeException("Failed to remove deployment [" + this.deploymentName + "].", e);
- }
- // Deploy away!
- log.debug("Deploying '" + tempFile + "'...");
DeploymentManager deploymentManager = getConnection().getDeploymentManager();
// as crazy as it might sound, there is apparently no way for you to ask the profile service
@@ -316,6 +297,25 @@ public class StandaloneManagedDeploymentComponent extends AbstractManagedDeploym
}
}
+ // Now stop the original app.
+ try {
+ DeploymentProgress progress = deploymentManager.stop(this.deploymentName);
+ DeploymentUtils.run(progress);
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to stop deployment [" + this.deploymentName + "].", e);
+ }
+
+ // And then remove it (this will delete the physical file/dir from the deploy dir).
+ try {
+ DeploymentProgress progress = deploymentManager.remove(this.deploymentName);
+ DeploymentUtils.run(progress);
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to remove deployment [" + this.deploymentName + "].", e);
+ }
+
+ // Deploy away!
+ log.debug("Deploying '" + tempFile + "'...");
+
try {
DeploymentUtils.deployArchive(deploymentManager, tempFile, deployExploded);
} catch (Exception e) {
commit 83656e08b3fec3ffbc877e2603641af59ff24d7f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Apr 18 15:17:57 2012 -0400
[BZ 646631] when updating ear content in farm deployments, make sure they go into the farm/ directory, not deploy/ directory
(cherry picked from commit 951ddcea098b6b116c392cde98186aca92987e14)
diff --git a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/StandaloneManagedDeploymentComponent.java b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/StandaloneManagedDeploymentComponent.java
index 9336c25..8aa69c8 100644
--- a/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/StandaloneManagedDeploymentComponent.java
+++ b/modules/plugins/jboss-as-5/src/main/java/org/rhq/plugins/jbossas5/StandaloneManagedDeploymentComponent.java
@@ -30,6 +30,7 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -42,6 +43,7 @@ import org.jboss.deployers.spi.management.ManagementView;
import org.jboss.deployers.spi.management.deploy.DeploymentManager;
import org.jboss.deployers.spi.management.deploy.DeploymentProgress;
import org.jboss.deployers.spi.management.deploy.DeploymentStatus;
+import org.jboss.profileservice.spi.ProfileKey;
import org.rhq.core.domain.content.PackageDetailsKey;
import org.rhq.core.domain.content.PackageType;
@@ -90,6 +92,9 @@ public class StandaloneManagedDeploymentComponent extends AbstractManagedDeploym
private final Log log = LogFactory.getLog(this.getClass());
+ private static final ProfileKey FARM_PROFILE_KEY = new ProfileKey("farm");
+ private static final ProfileKey APPLICATIONS_PROFILE_KEY = new ProfileKey("applications");
+
// ------------ MeasurementFacet Implementation ------------
@Override
@@ -278,6 +283,39 @@ public class StandaloneManagedDeploymentComponent extends AbstractManagedDeploym
// Deploy away!
log.debug("Deploying '" + tempFile + "'...");
DeploymentManager deploymentManager = getConnection().getDeploymentManager();
+
+ // as crazy as it might sound, there is apparently no way for you to ask the profile service
+ // if a deployment was deployed to the farm profile. Thus, we must resort to a poor man's solution:
+ // if the deployment name has the "farm/" directory in it, assume it needs to be deployed to the farm
+ boolean deployFarmed = this.deploymentName.contains("/farm/");
+ if (deployFarmed) {
+ Collection<ProfileKey> profileKeys = deploymentManager.getProfiles();
+ boolean farmSupported = false;
+ for (ProfileKey profileKey : profileKeys) {
+ if (profileKey.getName().equals(FARM_PROFILE_KEY.getName())) {
+ farmSupported = true;
+ break;
+ }
+ }
+ if (!farmSupported) {
+ throw new IllegalStateException("This application server instance is not a node in a cluster, "
+ + "so it does not support farmed deployments. Supported deployment profiles are " + profileKeys
+ + ".");
+ }
+ if (deployExploded) {
+ throw new IllegalArgumentException(
+ "Deploying farmed applications in exploded form is not supported by the Profile Service.");
+ }
+ try {
+ deploymentManager.loadProfile(FARM_PROFILE_KEY);
+ } catch (Exception e) {
+ log.info("Failed to switch to farm profile - could not update " + resourceTypeName + " file '"
+ + this.deploymentFile + "' using [" + packageDetails + "].");
+ String errorMessage = ThrowableUtil.getAllMessages(e);
+ return failApplicationDeployment(errorMessage, packageDetails);
+ }
+ }
+
try {
DeploymentUtils.deployArchive(deploymentManager, tempFile, deployExploded);
} catch (Exception e) {
@@ -305,6 +343,15 @@ public class StandaloneManagedDeploymentComponent extends AbstractManagedDeploym
log.info("Failed to update " + resourceTypeName + " file '" + this.deploymentFile + "' using ["
+ packageDetails + "].");
return failApplicationDeployment(errorMessage, packageDetails);
+ } finally {
+ // Make sure to switch back to the 'applications' profile if we switched to the 'farm' profile above.
+ if (deployFarmed) {
+ try {
+ deploymentManager.loadProfile(APPLICATIONS_PROFILE_KEY);
+ } catch (Exception e) {
+ log.debug("Failed to switch back to applications profile from farm profile", e);
+ }
+ }
}
// Deploy was successful!
11 years, 10 months