[rhq] Branch 'release/jon3.1.x' - modules/enterprise
by lkrejci
modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
New commits:
commit cad84fc36fb033a3147f160c686d6b90dad4fc45
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Aug 21 14:25:22 2012 +0200
[BZ 849779] - Fixing the cherry-pick of the fix of bug 830841 from master
(fd52d4706ff9f6d9b0048cc171168fc2018a96f7) that introduced an API call
not present in the release/jon3.1.x codebase.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
index 27d58c1..6dd241b 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
@@ -570,7 +570,7 @@ public class ResourceClientProxy {
File file = new File(fileName);
- byte[] data = remoteClient.getProxy(ContentManagerRemote.class).getPackageBytes(
+ byte[] data = remoteClient.getContentManager().getPackageBytes(
remoteClient.getSubject(), resourceClientProxy.resourceId, installedPackage.getId());
FileOutputStream fos = new FileOutputStream(file);
11 years, 9 months
[rhq] modules/enterprise pom.xml
by lkrejci
modules/enterprise/remoting/cli/pom.xml | 27 ++++++++++
modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml | 9 +++
modules/enterprise/scripting/javascript/pom.xml | 2
modules/enterprise/scripting/pom.xml | 5 +
modules/enterprise/scripting/python/pom.xml | 2
modules/enterprise/server/ear/pom.xml | 20 +++++++
pom.xml | 19 +++++++
7 files changed, 82 insertions(+), 2 deletions(-)
New commits:
commit 2f1ce1944b3307fa790225f91889fc642abfcc0e
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Aug 21 10:57:28 2012 +0200
[BZ 840662] - Python scripting is now bundled by default with RHQ.
It can be excluded by explicitely switching off the "bundle-additional-script-languages" profile.
E.g. mvn clean install -P '!bundle-additional-script-languages'
diff --git a/modules/enterprise/remoting/cli/pom.xml b/modules/enterprise/remoting/cli/pom.xml
index 3924ff0..e0e4243 100644
--- a/modules/enterprise/remoting/cli/pom.xml
+++ b/modules/enterprise/remoting/cli/pom.xml
@@ -34,6 +34,13 @@
</dependency>
<dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-scripting-javascript</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
<groupId>${project.groupId}</groupId>
<artifactId>rhq-core-domain</artifactId>
<version>${project.version}</version>
@@ -131,6 +138,7 @@
<property name="persistence-api.version" value="${persistence-api.version}" />
<property name="rhq.client.build.exclude.cli.jar" value="${rhq.client.build.exclude.cli.jar}" />
<property name="rhq.client.build.include.client.jar" value="${rhq.client.build.include.client.jar}" />
+ <property name="rhq.bundle-additional-script-languages" value="${rhq.bundle-additional-script-languages}"/>
</ant>
</target>
</configuration>
@@ -220,6 +228,25 @@
<profiles>
+ <!-- NOTE: this profile HAS TO have the same activation policy as the profile with the same name in the root pom.xml of RHQ -->
+ <profile>
+ <id>bundle-additional-script-languages</id>
+ <activation>
+ <property>
+ <name>java.home</name>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-scripting-python</artifactId>
+ <version>${project.version}</version>
+ <scope>runtime</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
<!-- Unlike most of RHQ, this module requires JDK6, so replace the Java 5 bootclasspath that was added to the compiler args by the root POM with a bootclasspath based on the java.home sysprop (which should be Java 6 or later if the enforcer plugin did its job). -->
<profile>
<id>check-java-api</id>
diff --git a/modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml b/modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml
index 808bd82..715bd9b 100644
--- a/modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml
+++ b/modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml
@@ -70,6 +70,15 @@
<copy file="${settings.localRepository}/org/rhq/rhq-scripting-api/${project.version}/rhq-scripting-api-${project.version}.jar" tofile="${lib.home}/rhq-scripting-api-${project.version}.jar" verbose="true" />
<copy file="${settings.localRepository}/org/rhq/rhq-scripting-javascript/${project.version}/rhq-scripting-javascript-${project.version}.jar" tofile="${lib.home}/rhq-scripting-javascript-${project.version}.jar" verbose="true" />
+
+ <echo>*** Including additional script languages: ${rhq.bundle-additional-script-languages}</echo>
+ <!-- Copy all the additional script language support jars if we are told to do so -->
+ <copy todir="${lib.home}" verbose="true">
+ <fileset dir="${settings.localRepository}/org/rhq">
+ <include if="${rhq.bundle-additional-script-languages}" name="**/rhq-scripting-python-${project.version}.jar"/>
+ </fileset>
+ <mapper type="flatten" />
+ </copy>
</target>
<target name="prepare-samples-dir">
diff --git a/modules/enterprise/scripting/javascript/pom.xml b/modules/enterprise/scripting/javascript/pom.xml
index 38ead44..adbe85a 100644
--- a/modules/enterprise/scripting/javascript/pom.xml
+++ b/modules/enterprise/scripting/javascript/pom.xml
@@ -22,6 +22,8 @@
<groupId>org.mozilla</groupId>
<artifactId>rhino</artifactId>
<version>1.7R4</version>
+ <!-- we actually repackage Rhino inside our jar -->
+ <scope>provided</scope>
</dependency>
</dependencies>
diff --git a/modules/enterprise/scripting/pom.xml b/modules/enterprise/scripting/pom.xml
index c786cdc..f439f11 100644
--- a/modules/enterprise/scripting/pom.xml
+++ b/modules/enterprise/scripting/pom.xml
@@ -17,11 +17,12 @@
</modules>
<profiles>
+ <!-- NOTE: this profile HAS TO have the same activation policy as the profile with the same name in the root pom.xml of RHQ -->
<profile>
- <id>experimental</id>
+ <id>bundle-additional-script-languages</id>
<activation>
<property>
- <name>experimental-script-languages</name>
+ <name>java.home</name>
</property>
</activation>
diff --git a/modules/enterprise/scripting/python/pom.xml b/modules/enterprise/scripting/python/pom.xml
index 39d3895..4b34699 100644
--- a/modules/enterprise/scripting/python/pom.xml
+++ b/modules/enterprise/scripting/python/pom.xml
@@ -21,6 +21,8 @@
<groupId>org.python</groupId>
<artifactId>jython-standalone</artifactId>
<version>2.5.2</version>
+ <!-- we actually repackage jython inside our jar -->
+ <scope>provided</scope>
</dependency>
</dependencies>
diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml
index 10b613e..0bed079 100644
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@ -447,6 +447,26 @@
<profiles>
+ <!-- NOTE: this profile HAS TO have the same activation policy as the profile with the same name in the root pom.xml of RHQ -->
+ <profile>
+ <id>bundle-additional-script-languages</id>
+ <activation>
+ <property>
+ <!-- we want this always active but activeByDefault doesn't work -->
+ <!-- see http://maven.apache.org/guides/introduction/introduction-to-profiles.html -->
+ <name>java.home</name>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-scripting-python</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ </profile>
+
<profile>
<id>bundle-plugins</id>
<activation>
diff --git a/pom.xml b/pom.xml
index 36b9c62..f6bd80d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1171,6 +1171,25 @@
<profiles>
+ <!-- NOTE: This profile is extended upon in several other submodules.
+ If you need to change its activation policy, make sure to do that in
+ *ALL* the modules that define this profile. -->
+ <profile>
+ <id>bundle-additional-script-languages</id>
+ <activation>
+ <property>
+ <!-- we want this always active but activeByDefault doesn't work -->
+ <!-- see http://maven.apache.org/guides/introduction/introduction-to-profiles.html -->
+ <name>java.home</name>
+ </property>
+ </activation>
+
+ <!-- Can be used to pass a flag down to deployment composing ANT scripts and somesuch -->
+ <properties>
+ <rhq.bundle-additional-script-languages>true</rhq.bundle-additional-script-languages>
+ </properties>
+ </profile>
+
<profile>
<id>ojdbc-driver</id>
<activation>
11 years, 9 months
[rhq] Branch 'release/jon3.1.x' - 3 commits - modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImplIE8.java | 50 ++++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java | 23 ++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java | 1
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml | 6 +
4 files changed, 77 insertions(+), 3 deletions(-)
New commits:
commit 22971e4a703cf3b2d75142eb5d3926ab902a6b52
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Mon Aug 20 09:31:13 2012 -0700
[BZ 848529 - Creating a domain deployment spins and never uploads the WAR on IE8]. IE8 had issues registering the listener when the upload was complete. This was a regression caused by smartgwt3.0 upgrade.
(cherry picked from commit 155c66f5fa5ac816de6ce8693875cc746f80096d)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImplIE8.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImplIE8.java
new file mode 100644
index 0000000..89c1615
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImplIE8.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.upload;
+
+import com.google.gwt.dom.client.Element;
+
+/**
+ * Implementation class used by {@link com.google.gwt.user.client.ui.FormPanel}.
+ */
+public class DynamicCallbackFormImplIE8 extends DynamicCallbackFormImpl {
+
+ @Override
+ public native void hookEvents(Element iframe,
+ DynamicCallbackFormImplHost listener) /*-{
+ if (iframe) {
+ iframe.onreadystatechange = function() {
+ // If there is no __formAction yet, this is a spurious onreadystatechange
+ // generated when the iframe is first added to the DOM.
+ if (!iframe.__formAction)
+ return;
+
+ if (iframe.readyState == 'complete') {
+ // If the iframe's contentWindow has not navigated to the expected action
+ // url, then it must be an error, so we ignore it.
+ listener.@org.rhq.enterprise.gui.coregui.client.components.upload.DynamicCallbackFormImplHost::onFrameLoad()();
+ }
+ };
+ }
+ }-*/;
+
+ @Override
+ public native void unhookEvents(Element iframe) /*-{
+ if (iframe)
+ iframe.onreadystatechange = null;
+ }-*/;
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index 644c893..f79924b 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -50,6 +50,12 @@
<when-type-is class="org.rhq.enterprise.gui.coregui.client.components.upload.DynamicCallbackFormImpl"/>
</replace-with>
+ <!-- Special case for IE8 where upload onsubmit handlers need special registration code from other browsers -->
+ <replace-with class="org.rhq.enterprise.gui.coregui.client.components.upload.DynamicCallbackFormImplIE8">
+ <when-type-is class="org.rhq.enterprise.gui.coregui.client.components.upload.DynamicCallbackFormImpl"/>
+ <when-property-is name="user.agent" value="ie8"/>
+ </replace-with>
+
<generate-with class="org.rhq.enterprise.gui.coregui.user.rebind.rpc.TrackingServiceInterfaceProxyGenerator">
<when-type-assignable class="com.google.gwt.user.client.rpc.RemoteService"/>
commit 30359bc2f6254ab3ecaa0595a0fee3cfaf8c6bec
Author: mtho11 <mikecthompson(a)gmail.com>
Date: Wed Aug 8 11:45:51 2012 -0700
[BZ 845389 - Group without members with unknown status appears in every availability search result] Get rid of superfluous empty groups that show up as unknown availability.
(cherry picked from commit 15552573391da403073ea1c27a8a9a5ffc969e65)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
index 2abefa1..45c5103 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupCompositeDataSource.java
@@ -26,6 +26,7 @@ import static org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGro
import static org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.PLUGIN;
import static org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.TYPE;
+import java.util.ArrayList;
import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
@@ -49,6 +50,7 @@ import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ImageManager;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGroupGWTServiceAsync;
+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;
@@ -107,7 +109,7 @@ public class ResourceGroupCompositeDataSource extends RPCDataSource<ResourceGrou
}
@Override
- public void executeFetch(final DSRequest request, final DSResponse response, ResourceGroupCriteria criteria) {
+ public void executeFetch(final DSRequest request, final DSResponse response, final ResourceGroupCriteria criteria ) {
groupService.findResourceGroupCompositesByCriteria(criteria,
new AsyncCallback<PageList<ResourceGroupComposite>>() {
public void onFailure(Throwable caught) {
@@ -120,10 +122,25 @@ public class ResourceGroupCompositeDataSource extends RPCDataSource<ResourceGrou
response.setStatus(RPCResponse.STATUS_FAILURE);
processResponse(request.getRequestId(), response);
}
+
+ private PageList<ResourceGroupComposite> filterEmptyMemberGroups(ResourceGroupCriteria groupCriteria,
+ PageList<ResourceGroupComposite> result){
+
+ PageList<ResourceGroupComposite> pageList = new PageList<ResourceGroupComposite>(result.getPageControl());
+
+ for (ResourceGroupComposite rgc : result) {
+ if (rgc.getExplicitCount() > 0 ){
+ pageList.add(rgc);
+ }
+ }
+
+ return pageList;
+ }
public void onSuccess(PageList<ResourceGroupComposite> result) {
- response.setData(buildRecords(result));
- response.setTotalRows(result.getTotalSize()); // for paging to work we have to specify size of full result set
+ PageList<ResourceGroupComposite> filteredResult = filterEmptyMemberGroups(criteria,result);
+ response.setData(buildRecords(filteredResult));
+ response.setTotalRows(filteredResult.getTotalSize()); // for paging to work we have to specify size of full result set
processResponse(request.getRequestId(), response);
}
});
commit ce91771299eeccaf599bae77559e633ad68987f8
Author: mtho11 <mikecthompson(a)gmail.com>
Date: Fri Aug 3 15:02:56 2012 -0700
[BZ 826224 Creation of Compatible Group fails with value too long for type character when a description is entered which is longer then 100 characters] Group names limited now to 100 chars to match DB.
(cherry picked from commit 0aeaf8e9f71ea154e2421e67e29269eea33b762c)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
index c4969bd..0fb1785 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/wizard/GroupCreateStep.java
@@ -75,6 +75,7 @@ public class GroupCreateStep extends AbstractWizardStep {
TextItem name = new TextItem("name", MSG.common_title_name());
name.setRequired(true);
name.setWidth(300);
+ name.setLength(100);
name.addChangedHandler(new ChangedHandler() {
@Override
public void onChanged(ChangedEvent changedEvent) {
11 years, 9 months
[rhq] Changes to 'jon3.1.x'
by mike thompson
New branch 'jon3.1.x' available with the following commits:
commit 22971e4a703cf3b2d75142eb5d3926ab902a6b52
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Mon Aug 20 09:31:13 2012 -0700
[BZ 848529 - Creating a domain deployment spins and never uploads the WAR on IE8]. IE8 had issues registering the listener when the upload was complete. This was a regression caused by smartgwt3.0 upgrade.
(cherry picked from commit 155c66f5fa5ac816de6ce8693875cc746f80096d)
commit 30359bc2f6254ab3ecaa0595a0fee3cfaf8c6bec
Author: mtho11 <mikecthompson(a)gmail.com>
Date: Wed Aug 8 11:45:51 2012 -0700
[BZ 845389 - Group without members with unknown status appears in every availability search result] Get rid of superfluous empty groups that show up as unknown availability.
(cherry picked from commit 15552573391da403073ea1c27a8a9a5ffc969e65)
commit ce91771299eeccaf599bae77559e633ad68987f8
Author: mtho11 <mikecthompson(a)gmail.com>
Date: Fri Aug 3 15:02:56 2012 -0700
[BZ 826224 Creation of Compatible Group fails with value too long for type character when a description is entered which is longer then 100 characters] Group names limited now to 100 chars to match DB.
(cherry picked from commit 0aeaf8e9f71ea154e2421e67e29269eea33b762c)
11 years, 9 months
[rhq] Branch 'release/jon3.1.x' - modules/enterprise
by snegrea
modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java | 29 +++++-----
1 file changed, 17 insertions(+), 12 deletions(-)
New commits:
commit fd52d4706ff9f6d9b0048cc171168fc2018a96f7
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Aug 20 15:13:31 2012 -0500
[BZ 830841] Added a descriptive error message for cases where content is not available for a resource. The user is asked to try again in a few minutes if content was deployed recently since the deploy and discovery process might still be running.
(cherry picked from commit 851461ab89dac1da41b9c85ae1d87eac54de2ef3)
Conflicts:
modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
index f1393f9..27d58c1 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
@@ -563,20 +563,25 @@ public class ResourceClientProxy {
InstalledPackage installedPackage = getBackingContent();
- if (fileName == null )
- fileName = installedPackage.getPackageVersion().getFileName();
-
- File file = new File(fileName);
+ if (installedPackage != null) {
+ if (fileName == null) {
+ fileName = installedPackage.getPackageVersion().getFileName();
+ }
- byte[] data =
- remoteClient.getContentManager().getPackageBytes(
- remoteClient.getSubject(), resourceClientProxy.resourceId, installedPackage.getId());
+ File file = new File(fileName);
- FileOutputStream fos = new FileOutputStream(file);
- try {
- fos.write(data);
- } finally {
- fos.close();
+ byte[] data = remoteClient.getProxy(ContentManagerRemote.class).getPackageBytes(
+ remoteClient.getSubject(), resourceClientProxy.resourceId, installedPackage.getId());
+
+ FileOutputStream fos = new FileOutputStream(file);
+ try {
+ fos.write(data);
+ } finally {
+ fos.close();
+ }
+ } else {
+ throw new RuntimeException(
+ "Content not available in the content repository. If you recently deployed content to this resource, then the content repository has not yet received the content or content information. The content for a resource is available only after the deployment and discovery process completes. Please try again in a few minutes.");
}
}
11 years, 9 months
[rhq] modules/enterprise
by snegrea
modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java | 28 ++++++----
1 file changed, 17 insertions(+), 11 deletions(-)
New commits:
commit 851461ab89dac1da41b9c85ae1d87eac54de2ef3
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Aug 20 14:42:06 2012 -0500
[BZ 830841] Added a descriptive error message for cases where content is not available for a resource. The user is asked to try again in a few minutes if content was deployed recently since the deploy and discovery process might still be running.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
index 0199c77..7361fe8 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
@@ -576,19 +576,25 @@ public class ResourceClientProxy {
InstalledPackage installedPackage = getBackingContent();
- if (fileName == null )
- fileName = installedPackage.getPackageVersion().getFileName();
-
- File file = new File(fileName);
+ if (installedPackage != null) {
+ if (fileName == null) {
+ fileName = installedPackage.getPackageVersion().getFileName();
+ }
- byte[] data = remoteClient.getProxy(ContentManagerRemote.class).getPackageBytes(
- remoteClient.getSubject(), resourceClientProxy.resourceId, installedPackage.getId());
+ File file = new File(fileName);
- FileOutputStream fos = new FileOutputStream(file);
- try {
- fos.write(data);
- } finally {
- fos.close();
+ byte[] data = remoteClient.getProxy(ContentManagerRemote.class).getPackageBytes(
+ remoteClient.getSubject(), resourceClientProxy.resourceId, installedPackage.getId());
+
+ FileOutputStream fos = new FileOutputStream(file);
+ try {
+ fos.write(data);
+ } finally {
+ fos.close();
+ }
+ } else {
+ throw new RuntimeException(
+ "Content not available in the content repository. If you recently deployed content to this resource, then the content repository has not yet received the content or content information. The content for a resource is available only after the deployment and discovery process completes. Please try again in a few minutes.");
}
}
11 years, 9 months
[rhq] modules/enterprise
by Jay Shaughnessy
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java | 13 ++++++----
1 file changed, 8 insertions(+), 5 deletions(-)
New commits:
commit 414ccdf3fd964dc6d64abe511ec02f4e9170aa40
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Aug 20 14:59:13 2012 -0400
[Bug 849751 - RFE: protect resource tree from direct navigation to a resource with many siblings]
Apply the new ResourceManager.findResourcesByCriteriaBounded() method
to getResourceLineageAndSiblings() in order to similarly bound the initial
tree building fetch. Currently getResourceLineageAndSiblings() will use
the defaults applied to findResourcesByCriteriaBounded(), although we may
find that providing separate overrides will be useful.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 0fe906a..a016f8e 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -113,6 +113,7 @@ import org.rhq.core.domain.resource.group.composite.AutoGroupComposite;
import org.rhq.core.domain.server.PersistenceUtility;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.util.PageOrdering;
import org.rhq.core.util.IntExtractor;
import org.rhq.core.util.collection.ArrayUtils;
import org.rhq.enterprise.server.RHQConstants;
@@ -796,14 +797,16 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
// If the ancestor is not locked, include viewable children.
if (!ancestor.isLocked() || ancestor.getResource() == parent) {
- // Get all viewable committed children.
- PageList<Resource> children = findChildResourcesByCategoryAndInventoryStatus(subject,
- ancestor.getResource(), null, InventoryStatus.COMMITTED, PageControl.getUnlimitedInstance());
+ // Get viewable committed children, but bounded to ensure it's not an overwhelming return set
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterParentResourceId(ancestor.getResource().getId());
+ criteria.addSortName(PageOrdering.ASC);
+ List<Resource> children = findResourcesByCriteriaBounded(subject, criteria, 0, 0);
// Remove any that are in the lineage to avoid repeated handling.
children.removeAll(rawResourceLineage);
for (Resource child : children) {
- // Ensure the parentResource field is fetched.
- //noinspection ConstantConditions
+ // Ensure the parentResource field is fetched. (do this here and not via criteria.fetchParentResource
+ // because that option would require inventory manager perm)
child.getParentResource().getId();
// The query only returned viewable children, so the composite should not be locked.
boolean isLocked = false;
11 years, 9 months
[rhq] modules/core
by Jay Shaughnessy
modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 722b5c83eac64fd145863a154147f9bb0e1cf67a
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Aug 20 14:24:29 2012 -0400
trivial - fix some DriftManager logging
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
index 0924288..8b54320 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/drift/DriftManager.java
@@ -479,7 +479,7 @@ public class DriftManager extends AgentService implements DriftAgentService, Dri
@Override
public void updateDriftDetection(int resourceId, DriftDefinition driftDefinition) {
- log.info("Recived request to update schedule for " + toString(resourceId, driftDefinition));
+ log.info("Received request to update schedule for " + toString(resourceId, driftDefinition));
DriftDetectionSchedule updatedSchedule = schedulesQueue.update(resourceId, driftDefinition);
if (updatedSchedule == null) {
@@ -696,7 +696,7 @@ public class DriftManager extends AgentService implements DriftAgentService, Dri
case pluginConfiguration: {
baseLocation = resource.getPluginConfiguration().getSimpleValue(baseDirValueName, null);
if (baseLocation == null) {
- throw new IllegalArgumentException("Cannot determine the bundle base deployment location - "
+ throw new IllegalArgumentException("Cannot determine the base directory - "
+ "there is no plugin configuration setting for [" + baseDirValueName + "]");
}
break;
@@ -704,7 +704,7 @@ public class DriftManager extends AgentService implements DriftAgentService, Dri
case resourceConfiguration: {
baseLocation = resource.getResourceConfiguration().getSimpleValue(baseDirValueName, null);
if (baseLocation == null) {
- throw new IllegalArgumentException("Cannot determine the bundle base deployment location - "
+ throw new IllegalArgumentException("Cannot determine the base directory - "
+ "there is no resource configuration setting for [" + baseDirValueName + "]");
}
break;
11 years, 9 months
[rhq] 2 commits - modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java | 33 ------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImplIE8.java | 50 ++++++++++
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml | 6 +
3 files changed, 56 insertions(+), 33 deletions(-)
New commits:
commit 155c66f5fa5ac816de6ce8693875cc746f80096d
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Mon Aug 20 09:31:13 2012 -0700
[BZ 848529 - Creating a domain deployment spins and never uploads the WAR on IE8]. IE8 had issues registering the listener when the upload was complete. This was a regression caused by smartgwt3.0 upgrade.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImplIE8.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImplIE8.java
new file mode 100644
index 0000000..89c1615
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/upload/DynamicCallbackFormImplIE8.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.rhq.enterprise.gui.coregui.client.components.upload;
+
+import com.google.gwt.dom.client.Element;
+
+/**
+ * Implementation class used by {@link com.google.gwt.user.client.ui.FormPanel}.
+ */
+public class DynamicCallbackFormImplIE8 extends DynamicCallbackFormImpl {
+
+ @Override
+ public native void hookEvents(Element iframe,
+ DynamicCallbackFormImplHost listener) /*-{
+ if (iframe) {
+ iframe.onreadystatechange = function() {
+ // If there is no __formAction yet, this is a spurious onreadystatechange
+ // generated when the iframe is first added to the DOM.
+ if (!iframe.__formAction)
+ return;
+
+ if (iframe.readyState == 'complete') {
+ // If the iframe's contentWindow has not navigated to the expected action
+ // url, then it must be an error, so we ignore it.
+ listener.@org.rhq.enterprise.gui.coregui.client.components.upload.DynamicCallbackFormImplHost::onFrameLoad()();
+ }
+ };
+ }
+ }-*/;
+
+ @Override
+ public native void unhookEvents(Element iframe) /*-{
+ if (iframe)
+ iframe.onreadystatechange = null;
+ }-*/;
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
index 78db5af..c5c4391 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/CoreGUI.gwt.xml
@@ -39,6 +39,12 @@
<when-type-is class="org.rhq.enterprise.gui.coregui.client.components.upload.DynamicCallbackFormImpl"/>
</replace-with>
+ <!-- Special case for IE8 where upload onsubmit handlers need special registration code from other browsers -->
+ <replace-with class="org.rhq.enterprise.gui.coregui.client.components.upload.DynamicCallbackFormImplIE8">
+ <when-type-is class="org.rhq.enterprise.gui.coregui.client.components.upload.DynamicCallbackFormImpl"/>
+ <when-property-is name="user.agent" value="ie8"/>
+ </replace-with>
+
<generate-with class="org.rhq.enterprise.gui.coregui.user.rebind.rpc.TrackingServiceInterfaceProxyGenerator">
<when-type-assignable class="com.google.gwt.user.client.rpc.RemoteService"/>
commit dc966bdbe0ef18915cba3a1cdd69c4167f5bd4c1
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Fri Aug 10 15:29:53 2012 -0700
Removed unused methods from ImageManager.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
index e50fe14..a15857e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/ImageManager.java
@@ -403,9 +403,6 @@ public class ImageManager {
return "subsystems/availability/availability_yellow_16.png";
}
- public static String getAvailabilityYellowLargeIcon() {
- return "subsystems/availability/availability_yellow_24.png";
- }
public static String getAvailBarImagePath(AvailabilityType availType) {
@@ -437,13 +434,6 @@ public class ImageManager {
return "subsystems/alert/Flag_blue_16.png";
}
- public static String getAlertLargeIcon() {
- return "subsystems/alert/Flag_blue_24.png";
- }
-
- public static String getAlertEditIcon() {
- return "subsystems/alert/Edit_Alert.png";
- }
public static String getMetricEditIcon() {
return "subsystems/monitor/Edit_Metric.png";
@@ -551,9 +541,6 @@ public class ImageManager {
return "subsystems/event/" + severity.name() + "_16.png";
}
- public static String getEventLargeIcon() {
- return "subsystems/event/Events_24.png";
- }
public static String getEventIcon() {
return "subsystems/event/Events_16.png";
@@ -563,45 +550,25 @@ public class ImageManager {
return "subsystems/monitor/Monitor_16.png";
}
- public static String getMonitorLargeIcon() {
- return "subsystems/monitor/Monitor_24.png";
- }
public static String getMonitorFailedIcon() {
return "subsystems/monitor/Monitor_failed_16.png";
}
- public static String getMonitorFailedLargeIcon() {
- return "subsystems/monitor/Monitor_failed_24.png";
- }
-
- public static String getOperationLargeIcon() {
- return "subsystems/control/Operation_24.png";
- }
-
public static String getOperationIcon() {
return "subsystems/control/Operation_16.png";
}
- public static String getActivityPackageLargeIcon() {
- return "subsystems/content/Package_24.png";
- }
public static String getActivityPackageIcon() {
return "subsystems/content/Package_16.png";
}
- public static String getBundleLargeIcon() {
- return "subsystems/content/Content_24.png";
- }
public static String getBundleIcon() {
return "subsystems/content/Content_16.png";
}
- public static String getConfigureLargeIcon() {
- return "subsystems/configure/Configure_24.png";
- }
public static String getConfigureIcon() {
return "subsystems/configure/Configure_16.png";
11 years, 9 months
[rhq] 2 commits - modules/enterprise
by Jay Shaughnessy
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/LargeGroupCriteriaTest.java | 55 +++
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceManagerBeanTest.java | 139 ++++------
2 files changed, 118 insertions(+), 76 deletions(-)
New commits:
commit 8732f82745b97897372ce0d00a9b3ac0773fedea
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Aug 20 11:46:10 2012 -0400
Add unit test for new ResourceManager.findResourcesByCriteriaBounded().
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/LargeGroupCriteriaTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/LargeGroupCriteriaTest.java
index 93bb887..323cf5c 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/LargeGroupCriteriaTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/group/test/LargeGroupCriteriaTest.java
@@ -21,17 +21,21 @@ package org.rhq.enterprise.server.resource.group.test;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
+import java.util.List;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
+import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.test.LargeGroupTestBase;
import org.rhq.enterprise.server.test.TestServerCommunicationsService;
@@ -189,6 +193,57 @@ public class LargeGroupCriteriaTest extends LargeGroupTestBase {
testGroupQueries(gacs);
}
+ // test findResourcesByCriteriaBounded here instead of ResourceGroupManagerBeanTest because we want
+ // to work with a decent # or resources.
+ @Test(enabled = TEST_ENABLED)
+ public void testResourceCriteriaBounded() throws Exception {
+ ArrayList<GroupAvailCounts> gacs = new ArrayList<LargeGroupCriteriaTest.GroupAvailCounts>();
+ gacs.add(new GroupAvailCounts(1100, 0, 0, 0)); // purposefully over 1,000, avails don't really matter
+
+ ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
+ AuthorizationManagerLocal authManager = LookupUtil.getAuthorizationManager();
+
+ env = new ArrayList<LargeGroupEnvironment>(gacs.size());
+
+ LargeGroupEnvironment lgeWithTypes = null;
+ for (GroupAvailCounts gac : gacs) {
+ env.add(createLargeGroupWithNormalUserRoleAccessWithInventoryStatus(lgeWithTypes, gac.total, gac.down,
+ gac.unknown, gac.disabled, gac.uncommitted, Permission.CONFIGURE_READ));
+ lgeWithTypes = env.get(0);
+ }
+
+ ResourceCriteria criteria = new ResourceCriteria();
+ List<Resource> result;
+
+ SessionTestHelper.simulateLogin(env.get(0).normalSubject);
+
+ criteria.addFilterParentResourceId(lgeWithTypes.platformResource.getId());
+ criteria.setPageControl(PageControl.getUnlimitedInstance());
+ result = resourceManager.findResourcesByCriteria(env.get(0).normalSubject, criteria);
+ assert null != result;
+ assert result.size() == 1100 : "Expected unbounded query to return all 1100 resources";
+
+ result = resourceManager.findResourcesByCriteriaBounded(env.get(0).normalSubject, criteria, 2000, 100);
+ assert null != result;
+ assert result.size() == 1100 : "Expected 2000/100 bounded query to return all 1100 resources";
+
+ result = resourceManager.findResourcesByCriteriaBounded(env.get(0).normalSubject, criteria, 1100, 100);
+ assert null != result;
+ assert result.size() == 1100 : "Expected 1100/100 bounded query to return all 1100 resources";
+
+ result = resourceManager.findResourcesByCriteriaBounded(env.get(0).normalSubject, criteria, 0, 0);
+ assert null != result;
+ assert result.size() == 200 : "Expected default (1000/200) bounded query to return 200 resources";
+
+ result = resourceManager.findResourcesByCriteriaBounded(env.get(0).normalSubject, criteria, 0, 500);
+ assert null != result;
+ assert result.size() == 500 : "Expected default (1000)/500) bounded query to return 500 resources";
+
+ result = resourceManager.findResourcesByCriteriaBounded(env.get(0).normalSubject, criteria, 100, 200);
+ assert null != result;
+ assert result.size() == 100 : "Expected 100/200 bounded query to return 100 resources";
+ }
+
private PageList<ResourceGroupComposite> testGroupQueriesWithSearchBar(GroupAvailCounts gac, String searchExpression)
throws Exception {
ResourceGroupManagerLocal groupManager = LookupUtil.getResourceGroupManager();
commit 8cd529eb7b04e785ded5c7a3fb6e633e6bc90cc4
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Aug 20 10:25:47 2012 -0400
Reformat only!
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceManagerBeanTest.java
index f0fe5b7..deac357 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/resource/test/ResourceManagerBeanTest.java
@@ -113,102 +113,89 @@ public class ResourceManagerBeanTest extends UpdatePluginMetadataTestBase {
assert errors.size() == 0;
}
-
public void testResourceLineage() throws Exception {
- // given a resource id for the leaf resource in a resource hierarchy
- int leafResourceId = givenASampleResourceHierarchy();
+ // given a resource id for the leaf resource in a resource hierarchy
+ int leafResourceId = givenASampleResourceHierarchy();
- // when
- List<Resource> resourceLineage = resourceManager.getResourceLineage(leafResourceId);
+ // when
+ List<Resource> resourceLineage = resourceManager.getResourceLineage(leafResourceId);
assertEquals(resourceLineage.size(), 4);
-
- // then
- StringBuilder stringBuilder = new StringBuilder();
- for (Resource resource : resourceLineage) {
- stringBuilder.append(resource.getName());
- if (resourceLineage.indexOf(resource) != resourceLineage.size() - 1) {
- stringBuilder.append("::");
- }
- }
- System.err.println(stringBuilder.toString());
+
+ // then
+ StringBuilder stringBuilder = new StringBuilder();
+ for (Resource resource : resourceLineage) {
+ stringBuilder.append(resource.getName());
+ if (resourceLineage.indexOf(resource) != resourceLineage.size() - 1) {
+ stringBuilder.append("::");
+ }
+ }
+ System.err.println(stringBuilder.toString());
// cleanup the DB
- for (int i = resourceLineage.size() - 1; i >=0; i--) {
+ for (int i = resourceLineage.size() - 1; i >= 0; i--) {
deleteNewResourceAgentResourceType(resourceLineage.get(i));
}
}
- private int givenASampleResourceHierarchy() throws NotSupportedException,
- SystemException {
- getTransactionManager().begin();
- EntityManager em = getEntityManager();
- int leafResourceId = 0;
- try {
- ResourceType platformType = createResourceType(em, "platform"
- + System.currentTimeMillis(), "test", null,
- ResourceCategory.PLATFORM);
- ResourceType appserverType = createResourceType(em, "jboss AS 5"
- + System.currentTimeMillis(), "jbossas5", platformType,
- ResourceCategory.SERVER);
- ResourceType jvmType = createResourceType(em,
- "JVM" + System.currentTimeMillis(), "jbossas5",
- appserverType, ResourceCategory.SERVICE);
- ResourceType memType = createResourceType(em, "Memory Subsystem"
- + System.currentTimeMillis(), "jbossas5", jvmType,
- ResourceCategory.SERVICE);
- Agent agent = new Agent("agent" + System.currentTimeMillis(), "host" + System.currentTimeMillis(), 1, "",
+ private int givenASampleResourceHierarchy() throws NotSupportedException, SystemException {
+ getTransactionManager().begin();
+ EntityManager em = getEntityManager();
+ int leafResourceId = 0;
+ try {
+ ResourceType platformType = createResourceType(em, "platform" + System.currentTimeMillis(), "test", null,
+ ResourceCategory.PLATFORM);
+ ResourceType appserverType = createResourceType(em, "jboss AS 5" + System.currentTimeMillis(), "jbossas5",
+ platformType, ResourceCategory.SERVER);
+ ResourceType jvmType = createResourceType(em, "JVM" + System.currentTimeMillis(), "jbossas5",
+ appserverType, ResourceCategory.SERVICE);
+ ResourceType memType = createResourceType(em, "Memory Subsystem" + System.currentTimeMillis(), "jbossas5",
+ jvmType, ResourceCategory.SERVICE);
+ Agent agent = new Agent("agent" + System.currentTimeMillis(), "host" + System.currentTimeMillis(), 1, "",
"token" + System.currentTimeMillis());
- em.persist(agent);
- em.flush();
-
- Resource platform = createResource(em, platformType, agent,
- "platformKey" + System.currentTimeMillis(),
- "host.dev.corp", null);
- Resource appserver = createResource(em, appserverType, agent,
- "JEAP" + System.currentTimeMillis(), "JBOSS EAP 5.1.1",
- platform);
- Resource jvm = createResource(em, jvmType, agent, "jvm"
- + System.currentTimeMillis(), "JBoss AS JVM", appserver);
- Resource memSubystem = createResource(em, memType, agent,
- "mem" + System.currentTimeMillis(), "Memory Subsystem", jvm);
- leafResourceId = memSubystem.getId();
-
- getTransactionManager().commit();
- } catch (Exception e) {
- try {
+ em.persist(agent);
+ em.flush();
+
+ Resource platform = createResource(em, platformType, agent, "platformKey" + System.currentTimeMillis(),
+ "host.dev.corp", null);
+ Resource appserver = createResource(em, appserverType, agent, "JEAP" + System.currentTimeMillis(),
+ "JBOSS EAP 5.1.1", platform);
+ Resource jvm = createResource(em, jvmType, agent, "jvm" + System.currentTimeMillis(), "JBoss AS JVM",
+ appserver);
+ Resource memSubystem = createResource(em, memType, agent, "mem" + System.currentTimeMillis(),
+ "Memory Subsystem", jvm);
+ leafResourceId = memSubystem.getId();
+
+ getTransactionManager().commit();
+ } catch (Exception e) {
+ try {
System.out.println("CANNOT Prepare TEST: Cause: " + e);
getTransactionManager().rollback();
} catch (Exception ignore) {
}
- } finally {
- em.close();
- }
- return leafResourceId;
- }
-
- private Resource createResource(EntityManager em, ResourceType platformType,
- Agent agent, String resourceKey, String resourceName,
- Resource parent) {
- Resource resource = new Resource(resourceKey, resourceName, platformType);
+ } finally {
+ em.close();
+ }
+ return leafResourceId;
+ }
+
+ private Resource createResource(EntityManager em, ResourceType platformType, Agent agent, String resourceKey,
+ String resourceName, Resource parent) {
+ Resource resource = new Resource(resourceKey, resourceName, platformType);
resource.setUuid(UUID.randomUUID().toString());
resource.setAgent(agent);
resource.setParentResource(parent);
em.persist(resource);
return resource;
- }
-
-
- private ResourceType createResourceType(EntityManager em, String name,
- String pluginName, ResourceType parentResourceType,
- ResourceCategory resourceCategory) {
- ResourceType platformType = new ResourceType(name, pluginName,
- resourceCategory, parentResourceType);
- ResourceType resourceType = platformType;
- em.persist(resourceType);
- return resourceType;
- }
+ }
+ private ResourceType createResourceType(EntityManager em, String name, String pluginName,
+ ResourceType parentResourceType, ResourceCategory resourceCategory) {
+ ResourceType platformType = new ResourceType(name, pluginName, resourceCategory, parentResourceType);
+ ResourceType resourceType = platformType;
+ em.persist(resourceType);
+ return resourceType;
+ }
private Resource createNewResourceWithNewType() throws Exception {
getTransactionManager().begin();
@@ -257,7 +244,7 @@ public class ResourceManagerBeanTest extends UpdatePluginMetadataTestBase {
resourceManager.uninventoryResourceAsyncWork(superuser, deletedResourceId);
}
em.flush();
-
+
ResourceType type = em.find(ResourceType.class, resource.getResourceType().getId());
System.out.println("Removing " + type + "...");
em.remove(type);
11 years, 9 months