modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
| 15 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TestGWTService.java
| 34 ++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesDataSource.java
| 8 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
| 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
| 8 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/ResourceAutodiscoveryView.java
| 14 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestRpcView.java
| 52 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
| 9 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TestGWTServiceImpl.java
| 43 ++++++++
modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
| 8 +
10 files changed, 184 insertions(+), 11 deletions(-)
New commits:
commit f4fdec760496263f02cba9e1e713f124e597a83b
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Wed Aug 31 17:18:11 2011 -0400
[BZ 722548] add new #Test/Rpc view that can be used to invoke a new sleep() RPC
method that sleeps for a specified number of seconds; increase default RPC
timeout from 10s to 30s; use custom timeouts for autodiscovery queue,
config history list, group schedules list views, which may exceed even the new
default timeout (
https://bugzilla.redhat.com/show_bug.cgi?id=722548)
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
index 8f5dbc1..c516592 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/GWTServiceLookup.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -58,6 +58,10 @@ public class GWTServiceLookup {
return secure(ConfigurationGWTServiceAsync.Util.getInstance());
}
+ public static ConfigurationGWTServiceAsync getConfigurationService(int timeout) {
+ return secure(ConfigurationGWTServiceAsync.Util.getInstance(), timeout);
+ }
+
public static DriftGWTServiceAsync getDriftService() {
return secure(DriftGWTServiceAsync.Util.getInstance());
}
@@ -190,6 +194,10 @@ public class GWTServiceLookup {
return secure(AgentGWTServiceAsync.Util.getInstance());
}
+ public static TestGWTServiceAsync getTestService() {
+ return secure(TestGWTServiceAsync.Util.getInstance());
+ }
+
@SuppressWarnings("unchecked")
private static <T> T secure(Object sdt) {
return (T) secure(sdt, -1);
@@ -208,7 +216,8 @@ public class GWTServiceLookup {
public static class SessionRpcRequestBuilder extends RpcRequestBuilder {
private static int DEBUG_TIMEOUT_FUDGE_FACTOR = 30000;
- private static int DEFAULT_RPC_TIMEOUT = 10000;
+ private static int DEFAULT_RPC_TIMEOUT = 30000;
+
private int timeout;
public SessionRpcRequestBuilder(int timeout) {
@@ -221,7 +230,7 @@ public class GWTServiceLookup {
this.timeout = (timeout <= 0) ? DEFAULT_RPC_TIMEOUT : timeout;
}
- if (CoreGUI.isDebugMode()) {
+ if (CoreGUI.isDebugMode() && (this.timeout != 0)) {
// debug mode is slow, so give requests more time to complete otherwise
you'll get
// weird exceptions whose messages are extremely unhelpful in finding
root cause
this.timeout += DEBUG_TIMEOUT_FUDGE_FACTOR;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TestGWTService.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TestGWTService.java
new file mode 100644
index 0000000..168edfa
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/TestGWTService.java
@@ -0,0 +1,34 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.client.gwt;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+
+/**
+ * @author Ian Springer
+ */
+public interface TestGWTService extends RemoteService {
+
+ void sleep(int seconds) throws RuntimeException;
+
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesDataSource.java
index 1f4d491..c21484d 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/monitoring/schedules/SchedulesDataSource.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2010 Red Hat, Inc.
+ * Copyright (C) 2010-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -43,7 +43,10 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
* @author Ian Springer
*/
public class SchedulesDataSource extends AbstractMeasurementScheduleCompositeDataSource
{
- private MeasurementDataGWTServiceAsync measurementService =
GWTServiceLookup.getMeasurementDataService();
+
+ // Specify 60s timeout to compensate for schedule updates taking a long time for
large groups.
+ // TODO (ips, 08/31/11): Remove this once updating of group schedules has been
optimized.
+ private MeasurementDataGWTServiceAsync measurementService =
GWTServiceLookup.getMeasurementDataService(60 * 1000);
private int resourceGroupId;
public SchedulesDataSource(int resourceGroupId) {
@@ -157,4 +160,5 @@ public class SchedulesDataSource extends
AbstractMeasurementScheduleCompositeDat
}
});
}
+
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
index b92fb94..9991f9c 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
@@ -78,7 +78,9 @@ public abstract class AbstractConfigurationHistoryDataSource<T
extends AbstractR
public static final String RESOURCE_ID = "resourceId";
}
- private ConfigurationGWTServiceAsync configurationService =
GWTServiceLookup.getConfigurationService();
+ // Specify 60s timeout to compensate for Configurations being fetched for all of the
config updates.
+ // TODO (ips, 08/31/11): Remove this once fetching of Configurations has been
disabled.
+ private ConfigurationGWTServiceAsync configurationService =
GWTServiceLookup.getConfigurationService(60 * 1000);
protected ConfigurationGWTServiceAsync getConfigurationService() {
return this.configurationService;
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
index 6769b9c..cccc08a 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2010 Red Hat, Inc.
+ * Copyright (C) 2005-2011 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -65,7 +65,11 @@ public class AutodiscoveryQueueDataSource extends DataSource {
private int unlimited = -1;
private int maximumPlatformsToDisplay = -1;
- private ResourceGWTServiceAsync resourceService =
GWTServiceLookup.getResourceService(1000000);
+
+ // Specify 60s timeout to compensate for slow loading of this view due to lack of
paging of results.
+ // TODO (ips, 08/31/11): Remove this once paging has been implemented.
+ private ResourceGWTServiceAsync resourceService =
GWTServiceLookup.getResourceService(60 * 1000);
+
private PermissionsLoader permissionsLoader = new PermissionsLoader();
private TreeGrid dataContainerReference = null;
private static final Permission MANAGE_INVENTORY = Permission.MANAGE_INVENTORY;
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 4daa3c6..9b0cfe3 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
@@ -79,7 +79,14 @@ public class ResourceAutodiscoveryView extends LocatableVLayout
implements Refre
// This allows the selection handler to ignore selection changes initiated by us, as
opposed to by the user.
private boolean selectionChangedHandlerDisabled;
- private ResourceGWTServiceAsync resourceService =
GWTServiceLookup.getResourceService(1000000);
+ private ResourceGWTServiceAsync resourceService =
GWTServiceLookup.getResourceService();
+
+ // Specify 3m timeout to compensate for import taking a long time for a large number
of Resources.
+ // TODO (ips, 08/31/11): Remove this once import has been refactored to be partially
asynchronous, i.e. where the
+ // call to importResources() flips all the Resources to a new
COMMITTING inventory status
+ // and then kicks off a background job to do the actual work of
committing (syncing to
+ // Agents, etc.).
+ private ResourceGWTServiceAsync importResourceService =
GWTServiceLookup.getResourceService(3 * 60 * 1000);
public ResourceAutodiscoveryView(String locatorId) {
super(locatorId);
@@ -317,11 +324,14 @@ public class ResourceAutodiscoveryView extends LocatableVLayout
implements Refre
importButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
disableButtons(selectAllButton, deselectAllButton, importButton,
ignoreButton, unignoreButton);
+ // TODO (ips): Make the below message sticky, but add a new ClearSticky
Message option that the
+ // below callback methods can use to clear it once the
importResources() call has
+ // completed.
CoreGUI.getMessageCenter().notify(
new Message(MSG.view_autoDiscoveryQ_importInProgress(),
Message.Severity.Info, EnumSet
.of(Message.Option.Transient)));
- resourceService.importResources(getSelectedIds(), new
AsyncCallback<Void>() {
+ importResourceService.importResources(getSelectedIds(), new
AsyncCallback<Void>() {
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.view_autoDiscoveryQ_importFailure(), caught);
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestRpcView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestRpcView.java
new file mode 100644
index 0000000..b3c333f
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestRpcView.java
@@ -0,0 +1,52 @@
+package org.rhq.enterprise.gui.coregui.client.test;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.fields.ButtonItem;
+import com.smartgwt.client.widgets.form.fields.FormItem;
+import com.smartgwt.client.widgets.form.fields.events.ClickEvent;
+import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
+import org.rhq.enterprise.gui.coregui.client.gwt.TestGWTServiceAsync;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
+
+/**
+ * @author Ian Springer
+ */
+public class TestRpcView extends LocatableVLayout {
+
+ public TestRpcView(String locatorId) {
+ super(locatorId);
+ setMargin(10);
+
+ DynamicForm form = new DynamicForm();
+ form.setWidth(400);
+
+ final FormItem item = new FormItem("seconds");
+ item.setTitle("Seconds to sleep");
+ item.setRequired(true);
+
+ ButtonItem button = new ButtonItem("execute", "Execute");
+ button.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent event) {
+ TestGWTServiceAsync testService = GWTServiceLookup.getTestService();
+ final int seconds = Integer.valueOf((String)item.getValue());
+ testService.sleep(seconds, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("sleep(" +
seconds + ") RPC call failed.", caught);
+ }
+
+ public void onSuccess(Void result) {
+ CoreGUI.getMessageCenter().notify(new Message("sleep("
+ seconds + ") RPC completed."));
+ }
+ });
+ }
+ });
+ form.setItems(item, button);
+
+ addMember(form);
+ }
+
+}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
index 58a6cd6..a9e131b 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/test/TestTopView.java
@@ -79,6 +79,7 @@ public class TestTopView extends AbstractSectionedLeftNavigationView {
private static final ViewName MISC_SECTION_VIEW_ID = new ViewName("Misc");
private static final ViewName PAGE_PLURALIZATION_TEST = new
ViewName("PluralizationTest");
private static final ViewName PAGE_ASYNC = new ViewName("Async");
+ private static final ViewName PAGE_RPC = new ViewName("Rpc");
public TestTopView() {
// This is a top level view, so our locator id can simply be our view id.
@@ -235,7 +236,13 @@ public class TestTopView extends AbstractSectionedLeftNavigationView
{
}
});
- return new NavigationSection(MISC_SECTION_VIEW_ID, pluralizationItem,
asyncItem);
+ NavigationItem rpcItem = new NavigationItem(PAGE_RPC, null, new ViewFactory() {
+ public Canvas createView() {
+ return new TestRpcView(extendLocatorId(PAGE_RPC.getName()));
+ }
+ });
+
+ return new NavigationSection(MISC_SECTION_VIEW_ID, pluralizationItem, asyncItem,
rpcItem);
}
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TestGWTServiceImpl.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TestGWTServiceImpl.java
new file mode 100644
index 0000000..8f9a518
--- /dev/null
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/TestGWTServiceImpl.java
@@ -0,0 +1,43 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser General Public License along with this program;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+package org.rhq.enterprise.gui.coregui.server.gwt;
+
+import org.rhq.enterprise.gui.coregui.client.gwt.TestGWTService;
+
+/**
+ * @author Ian Springer
+ */
+public class TestGWTServiceImpl extends AbstractGWTServiceImpl implements TestGWTService
{
+
+ private static final long serialVersionUID = 1L;
+
+ public void sleep(int seconds) throws RuntimeException {
+ try {
+ Thread.sleep(seconds * 1000);
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw getExceptionToThrowToClient(e);
+ }
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
index c4943ed..ebc12f5 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
+++ b/modules/enterprise/gui/coregui/src/main/webapp/WEB-INF/web.xml
@@ -161,6 +161,10 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI
DriftGWTService</servlet-name>
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.DriftGWTServiceImpl</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI
TestGWTService</servlet-name>
+
<servlet-class>org.rhq.enterprise.gui.coregui.server.gwt.TestGWTServiceImpl</servlet-class>
+ </servlet>
<servlet-mapping>
@@ -311,6 +315,10 @@
<servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI
DriftGWTService</servlet-name>
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/DriftGWTService</url-pattern>
</servlet-mapping>
+ <servlet-mapping>
+ <servlet-name>org.rhq.enterprise.gui.coregui.CoreGUI
TestGWTService</servlet-name>
+
<url-pattern>/org.rhq.enterprise.gui.coregui.CoreGUI/TestGWTService</url-pattern>
+ </servlet-mapping>
<welcome-file-list>