[rhq] Branch 'perftest' - 5 commits - modules/enterprise
by Heiko W. Rupp
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java | 198 +++++++++-
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java | 37 +
2 files changed, 213 insertions(+), 22 deletions(-)
New commits:
commit 96201db9e777c39a138d507c311e7c6cc8e9cf44
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Sep 24 11:56:10 2010 +0200
Print test name in front of the timings to better identify them.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
index f9a6dd1..8f8c6ff 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
@@ -86,6 +86,7 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
@DatabaseState(url = "perftest/AvailabilityInsertPurgeTest-testOne-data.xml.zip", dbVersion="2.94")
public void testAlternating() throws Exception {
+ System.out.println("=== testAlternating ===");
EntityManager em = getEntityManager();
Query q = em.createQuery("SELECT r FROM Resource r");
List<Resource> resources = q.getResultList();
@@ -162,6 +163,7 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
@DatabaseState(url = "perftest/AvailabilityInsertPurgeTest-testOne-data.xml.zip", dbVersion="2.94")
public void testRandom() throws Exception {
+ System.out.println("=== testRandom ===");
EntityManager em = getEntityManager();
Query q = em.createQuery("SELECT r FROM Resource r");
List<Resource> resources = q.getResultList();
@@ -233,6 +235,7 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
@DatabaseState(url = "perftest/AvailabilityInsertPurgeTest-testOne-data.xml.zip", dbVersion="2.94")
public void testAlwaysUp() throws Exception {
+ System.out.println("=== testAlwaysUp ===");
EntityManager em = getEntityManager();
Query q = em.createQuery("SELECT r FROM Resource r");
List<Resource> resources = q.getResultList();
@@ -247,7 +250,6 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
AvailabilityReport report = new AvailabilityReport(agent.getName());
for (Resource r : resources) {
- int rand = (int) (Math.random()*2);
AvailabilityType at = AvailabilityType.UP;
Availability a = new Availability(r, new Date(t1 + i * MILLIS_APART), at);
report.addAvailability(a);
commit 672e488c37cc428056354a07dc2bf66689e42c8a
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Sep 24 11:40:40 2010 +0200
Add a test with constant UP availabilities per resource and report.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
index 56efe81..f9a6dd1 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
@@ -168,14 +168,6 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
Resource res = resources.get(0);
Agent agent = agentManager.getAgentByResourceId(res.getId());
- q = em.createQuery("SELECT COUNT(a) FROM Availability a ");
- Object o = q.getSingleResult();
- Long l = (Long)o;
- if (l!=0) {
- throw new IllegalStateException("Availabilities table is not empty");
- }
- systemManager.vacuum(LookupUtil.getSubjectManager().getOverlord(),new String[]{"rhq_availability"});
-
for (int MULTI : ROUNDS) {
String round = String.format(ROUND__FORMAT, MULTI);
@@ -247,15 +239,6 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
Resource res = resources.get(0);
Agent agent = agentManager.getAgentByResourceId(res.getId());
- q = em.createQuery("SELECT COUNT(a) FROM Availability a ");
- Object o = q.getSingleResult();
- Long l = (Long)o;
- if (l!=0) {
- throw new IllegalStateException("Availabilities table is not empty");
- }
- systemManager.vacuum(LookupUtil.getSubjectManager().getOverlord(),new String[]{"rhq_availability"});
-
-
for (int MULTI : ROUNDS) {
String round = String.format(ROUND__FORMAT, MULTI);
commit cc5d0d802248f6f285fe70b472d67bbf4f1cca7f
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Sep 24 11:36:14 2010 +0200
Add a test with constant UP availabilities per resource and report.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
index 2b6953f..56efe81 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
@@ -84,7 +84,7 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
* @see #ROUNDS for the number of availability reports per round
*/
@DatabaseState(url = "perftest/AvailabilityInsertPurgeTest-testOne-data.xml.zip", dbVersion="2.94")
- public void testOne() throws Exception {
+ public void testAlternating() throws Exception {
EntityManager em = getEntityManager();
Query q = em.createQuery("SELECT r FROM Resource r");
@@ -98,6 +98,7 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
if (l!=0) {
throw new IllegalStateException("Availabilities table is not empty");
}
+ systemManager.vacuum(LookupUtil.getSubjectManager().getOverlord(),new String[]{"rhq_availability"});
for (int MULTI : ROUNDS) {
String round = String.format(ROUND__FORMAT, MULTI);
@@ -154,12 +155,12 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
}
/**
- * Like {@link #testOne}, but availabilities are now random per resource and report.
+ * Like {@link #testAlternating}, but availabilities are now random per resource and report.
* @throws Exception If anything goes wrong
* @see #ROUNDS for the number of availability reports per round
*/
@DatabaseState(url = "perftest/AvailabilityInsertPurgeTest-testOne-data.xml.zip", dbVersion="2.94")
- public void testTwo() throws Exception {
+ public void testRandom() throws Exception {
EntityManager em = getEntityManager();
Query q = em.createQuery("SELECT r FROM Resource r");
@@ -173,6 +174,7 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
if (l!=0) {
throw new IllegalStateException("Availabilities table is not empty");
}
+ systemManager.vacuum(LookupUtil.getSubjectManager().getOverlord(),new String[]{"rhq_availability"});
for (int MULTI : ROUNDS) {
String round = String.format(ROUND__FORMAT, MULTI);
@@ -230,4 +232,84 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
commitTimings(false);
}
+
+ /**
+ * Like {@link #testAlternating}, but availabilities are always up per resource and report.
+ * @throws Exception If anything goes wrong
+ * @see #ROUNDS for the number of availability reports per round
+ */
+ @DatabaseState(url = "perftest/AvailabilityInsertPurgeTest-testOne-data.xml.zip", dbVersion="2.94")
+ public void testAlwaysUp() throws Exception {
+
+ EntityManager em = getEntityManager();
+ Query q = em.createQuery("SELECT r FROM Resource r");
+ List<Resource> resources = q.getResultList();
+ Resource res = resources.get(0);
+ Agent agent = agentManager.getAgentByResourceId(res.getId());
+
+ q = em.createQuery("SELECT COUNT(a) FROM Availability a ");
+ Object o = q.getSingleResult();
+ Long l = (Long)o;
+ if (l!=0) {
+ throw new IllegalStateException("Availabilities table is not empty");
+ }
+ systemManager.vacuum(LookupUtil.getSubjectManager().getOverlord(),new String[]{"rhq_availability"});
+
+
+ for (int MULTI : ROUNDS) {
+ String round = String.format(ROUND__FORMAT, MULTI);
+
+ long t1 = System.currentTimeMillis() - (MULTI * MILLIS_APART);
+ for (int i = 0; i < MULTI; i++) {
+
+ AvailabilityReport report = new AvailabilityReport(agent.getName());
+ for (Resource r : resources) {
+ int rand = (int) (Math.random()*2);
+ AvailabilityType at = AvailabilityType.UP;
+ Availability a = new Availability(r, new Date(t1 + i * MILLIS_APART), at);
+ report.addAvailability(a);
+ }
+ startTiming(round);
+ availabilityManager.mergeAvailabilityReport(report);
+ endTiming(round);
+ }
+
+ // merge is over. Now lets purge in two steps
+ startTiming(String.format(PURGE__FORMAT,MULTI));
+ availabilityManager.purgeAvailabilities(t1 + (MULTI/2)*MILLIS_APART);
+ endTiming(String.format(PURGE__FORMAT,MULTI));
+ startTiming(String.format(PURGE__FORMAT,MULTI));
+ availabilityManager.purgeAvailabilities(t1);
+ endTiming(String.format(PURGE__FORMAT,MULTI));
+ // Vacuum the db
+ systemManager.vacuum(LookupUtil.getSubjectManager().getOverlord(),new String[]{"rhq_availability"});
+
+ }
+
+ printTimings();
+
+ long timing1000 = getTiming(String.format(ROUND__FORMAT,1000));
+ long timing2000 = getTiming(String.format(ROUND__FORMAT,2000));
+ long timing3000 = getTiming(String.format(ROUND__FORMAT,3000));
+ long timing5000 = getTiming(String.format(ROUND__FORMAT,5000));
+ long timing10000 = getTiming(String.format(ROUND__FORMAT,10000));
+
+
+ assertLinear(timing1000,timing2000,2,"Merge2");
+ assertLinear(timing1000,timing3000,3,"Merge3");
+ assertLinear(timing1000,timing5000,5,"Merge5");
+ assertLinear(timing1000,timing10000,10,"Merge10");
+
+
+ long purge1000 = getTiming(String.format(PURGE__FORMAT,1000));
+ long purge2000 = getTiming(String.format(PURGE__FORMAT,2000));
+ long purge3000 = getTiming(String.format(PURGE__FORMAT,3000));
+ long purge5000 = getTiming(String.format(PURGE__FORMAT,5000));
+
+ assertLinear(purge1000,purge2000,2,"Purge2");
+ assertLinear(purge1000,purge3000,3,"Purge3");
+ assertLinear(purge1000,purge5000,5,"Purge3");
+
+ commitTimings(false);
+ }
}
commit f8806d19550dc26a33c9a13191152f137357506b
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Sep 24 11:05:38 2010 +0200
Add a test with random availabilities per resource and report.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
index cffb0f6..2b6953f 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
@@ -32,6 +32,7 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.enterprise.server.core.AgentManagerLocal;
import org.rhq.enterprise.server.measurement.AvailabilityManagerLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
+import org.rhq.enterprise.server.system.SystemManagerLocal;
import org.rhq.enterprise.server.test.AbstractEJB3PerformanceTest;
import org.rhq.enterprise.server.util.LookupUtil;
import org.rhq.helpers.perftest.support.testng.DatabaseSetupInterceptor;
@@ -54,9 +55,11 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
ResourceManagerLocal resourceManager;
AvailabilityManagerLocal availabilityManager;
AgentManagerLocal agentManager;
+ SystemManagerLocal systemManager;
private static final int MILLIS_APART = 2000;
private static final String ROUND__FORMAT = "Round %6d";
private static final String PURGE__FORMAT = "Purge %6d";
+ private static final int[] ROUNDS = new int[]{1000,2000,3000,5000,10000};
@BeforeMethod
public void beforeMethod() {
@@ -64,6 +67,7 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
this.availabilityManager = LookupUtil.getAvailabilityManager();
this.resourceManager = LookupUtil.getResourceManager();
this.agentManager = LookupUtil.getAgentManager();
+ this.systemManager = LookupUtil.getSystemManager();
} catch (Throwable t) {
// Catch RuntimeExceptions and Errors and dump their stack trace, because Surefire will completely swallow them
// and throw a cryptic NPE (see http://jira.codehaus.org/browse/SUREFIRE-157)!
@@ -72,11 +76,16 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
}
}
+ /**
+ * Send availability reports to the server and measure timing.
+ * For each resource, availability alternates for each report.
+ * There are multiple rounds of sending with higher numbers of reports.
+ * @throws Exception If anything goes wrong
+ * @see #ROUNDS for the number of availability reports per round
+ */
@DatabaseState(url = "perftest/AvailabilityInsertPurgeTest-testOne-data.xml.zip", dbVersion="2.94")
public void testOne() throws Exception {
- final int[] ROUNDS = {1000,2000,3000,5000};
-
EntityManager em = getEntityManager();
Query q = em.createQuery("SELECT r FROM Resource r");
List<Resource> resources = q.getResultList();
@@ -111,10 +120,11 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
startTiming(String.format(PURGE__FORMAT,MULTI));
availabilityManager.purgeAvailabilities(t1 + (MULTI/2)*MILLIS_APART);
endTiming(String.format(PURGE__FORMAT,MULTI));
- // TODO analyze / vacuum in between?
startTiming(String.format(PURGE__FORMAT,MULTI));
availabilityManager.purgeAvailabilities(t1);
endTiming(String.format(PURGE__FORMAT,MULTI));
+ // Vacuum the db
+ systemManager.vacuum(LookupUtil.getSubjectManager().getOverlord(),new String[]{"rhq_availability"});
}
@@ -124,10 +134,90 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
long timing2000 = getTiming(String.format(ROUND__FORMAT,2000));
long timing3000 = getTiming(String.format(ROUND__FORMAT,3000));
long timing5000 = getTiming(String.format(ROUND__FORMAT,5000));
+ long timing10000 = getTiming(String.format(ROUND__FORMAT,10000));
assertLinear(timing1000,timing2000,2,"Merge2");
assertLinear(timing1000,timing3000,3,"Merge3");
assertLinear(timing1000,timing5000,5,"Merge5");
+ assertLinear(timing1000,timing10000,10,"Merge10");
+
+ long purge1000 = getTiming(String.format(PURGE__FORMAT,1000));
+ long purge2000 = getTiming(String.format(PURGE__FORMAT,2000));
+ long purge3000 = getTiming(String.format(PURGE__FORMAT,3000));
+ long purge5000 = getTiming(String.format(PURGE__FORMAT,5000));
+
+ assertLinear(purge1000,purge2000,2,"Purge2");
+ assertLinear(purge1000,purge3000,3,"Purge3");
+ assertLinear(purge1000,purge5000,5,"Purge3");
+
+ commitTimings(false);
+ }
+
+ /**
+ * Like {@link #testOne}, but availabilities are now random per resource and report.
+ * @throws Exception If anything goes wrong
+ * @see #ROUNDS for the number of availability reports per round
+ */
+ @DatabaseState(url = "perftest/AvailabilityInsertPurgeTest-testOne-data.xml.zip", dbVersion="2.94")
+ public void testTwo() throws Exception {
+
+ EntityManager em = getEntityManager();
+ Query q = em.createQuery("SELECT r FROM Resource r");
+ List<Resource> resources = q.getResultList();
+ Resource res = resources.get(0);
+ Agent agent = agentManager.getAgentByResourceId(res.getId());
+
+ q = em.createQuery("SELECT COUNT(a) FROM Availability a ");
+ Object o = q.getSingleResult();
+ Long l = (Long)o;
+ if (l!=0) {
+ throw new IllegalStateException("Availabilities table is not empty");
+ }
+
+ for (int MULTI : ROUNDS) {
+ String round = String.format(ROUND__FORMAT, MULTI);
+
+ long t1 = System.currentTimeMillis() - (MULTI * MILLIS_APART);
+ for (int i = 0; i < MULTI; i++) {
+
+ AvailabilityReport report = new AvailabilityReport(agent.getName());
+ for (Resource r : resources) {
+ int rand = (int) (Math.random()*2);
+ AvailabilityType at = (rand == 1) ? AvailabilityType.UP : AvailabilityType.DOWN;
+ Availability a = new Availability(r, new Date(t1 + i * MILLIS_APART), at);
+ report.addAvailability(a);
+ }
+ startTiming(round);
+ availabilityManager.mergeAvailabilityReport(report);
+ endTiming(round);
+ }
+
+ // merge is over. Now lets purge in two steps
+ startTiming(String.format(PURGE__FORMAT,MULTI));
+ availabilityManager.purgeAvailabilities(t1 + (MULTI/2)*MILLIS_APART);
+ endTiming(String.format(PURGE__FORMAT,MULTI));
+ startTiming(String.format(PURGE__FORMAT,MULTI));
+ availabilityManager.purgeAvailabilities(t1);
+ endTiming(String.format(PURGE__FORMAT,MULTI));
+ // Vacuum the db
+ systemManager.vacuum(LookupUtil.getSubjectManager().getOverlord(),new String[]{"rhq_availability"});
+
+ }
+
+ printTimings();
+
+ long timing1000 = getTiming(String.format(ROUND__FORMAT,1000));
+ long timing2000 = getTiming(String.format(ROUND__FORMAT,2000));
+ long timing3000 = getTiming(String.format(ROUND__FORMAT,3000));
+ long timing5000 = getTiming(String.format(ROUND__FORMAT,5000));
+ long timing10000 = getTiming(String.format(ROUND__FORMAT,10000));
+
+
+ assertLinear(timing1000,timing2000,2,"Merge2");
+ assertLinear(timing1000,timing3000,3,"Merge3");
+ assertLinear(timing1000,timing5000,5,"Merge5");
+ assertLinear(timing1000,timing10000,10,"Merge10");
+
long purge1000 = getTiming(String.format(PURGE__FORMAT,1000));
long purge2000 = getTiming(String.format(PURGE__FORMAT,2000));
commit e2bf292d11f9d851114ee51ee10e5f7279fe00a1
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Sep 23 14:21:56 2010 +0200
Check that the timing is linear.
Printe timinings in sorted order to make it easier for humans.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
index aecb6f2..cffb0f6 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/performance/test/AvailabilityInsertPurgeTest.java
@@ -56,6 +56,7 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
AgentManagerLocal agentManager;
private static final int MILLIS_APART = 2000;
private static final String ROUND__FORMAT = "Round %6d";
+ private static final String PURGE__FORMAT = "Purge %6d";
@BeforeMethod
public void beforeMethod() {
@@ -74,7 +75,7 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
@DatabaseState(url = "perftest/AvailabilityInsertPurgeTest-testOne-data.xml.zip", dbVersion="2.94")
public void testOne() throws Exception {
- final int[] ROUNDS = {500,1000,1500,2000,2500,3000};
+ final int[] ROUNDS = {1000,2000,3000,5000};
EntityManager em = getEntityManager();
Query q = em.createQuery("SELECT r FROM Resource r");
@@ -89,17 +90,16 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
throw new IllegalStateException("Availabilities table is not empty");
}
- for ( int j = 0; j < ROUNDS.length; j++) {
- int MULTI = ROUNDS[j];
- String round = String.format(ROUND__FORMAT,MULTI);
+ for (int MULTI : ROUNDS) {
+ String round = String.format(ROUND__FORMAT, MULTI);
long t1 = System.currentTimeMillis() - (MULTI * MILLIS_APART);
- for ( int i = 0 ; i < MULTI ; i++ ) {
+ for (int i = 0; i < MULTI; i++) {
AvailabilityReport report = new AvailabilityReport(agent.getName());
for (Resource r : resources) {
- AvailabilityType at = (i%2==0) ? AvailabilityType.UP : AvailabilityType.DOWN;
- Availability a = new Availability(r,new Date(t1 + i * MILLIS_APART), at);
+ AvailabilityType at = (i % 2 == 0) ? AvailabilityType.UP : AvailabilityType.DOWN;
+ Availability a = new Availability(r, new Date(t1 + i * MILLIS_APART), at);
report.addAvailability(a);
}
startTiming(round);
@@ -107,20 +107,37 @@ public class AvailabilityInsertPurgeTest extends AbstractEJB3PerformanceTest {
endTiming(round);
}
-
-
+ // merge is over. Now lets purge in two steps
+ startTiming(String.format(PURGE__FORMAT,MULTI));
+ availabilityManager.purgeAvailabilities(t1 + (MULTI/2)*MILLIS_APART);
+ endTiming(String.format(PURGE__FORMAT,MULTI));
+ // TODO analyze / vacuum in between?
+ startTiming(String.format(PURGE__FORMAT,MULTI));
+ availabilityManager.purgeAvailabilities(t1);
+ endTiming(String.format(PURGE__FORMAT,MULTI));
}
+ printTimings();
+
long timing1000 = getTiming(String.format(ROUND__FORMAT,1000));
long timing2000 = getTiming(String.format(ROUND__FORMAT,2000));
long timing3000 = getTiming(String.format(ROUND__FORMAT,3000));
+ long timing5000 = getTiming(String.format(ROUND__FORMAT,5000));
- assertCirca(timing1000,timing2000,2);
- assertCirca(timing1000,timing3000,3);
+ assertLinear(timing1000,timing2000,2,"Merge2");
+ assertLinear(timing1000,timing3000,3,"Merge3");
+ assertLinear(timing1000,timing5000,5,"Merge5");
+ long purge1000 = getTiming(String.format(PURGE__FORMAT,1000));
+ long purge2000 = getTiming(String.format(PURGE__FORMAT,2000));
+ long purge3000 = getTiming(String.format(PURGE__FORMAT,3000));
+ long purge5000 = getTiming(String.format(PURGE__FORMAT,5000));
- commitTimings();
+ assertLinear(purge1000,purge2000,2,"Purge2");
+ assertLinear(purge1000,purge3000,3,"Purge3");
+ assertLinear(purge1000,purge5000,5,"Purge3");
+ commitTimings(false);
}
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java
index 96ecf27..2ebb35e 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3PerformanceTest.java
@@ -21,9 +21,12 @@ package org.rhq.enterprise.server.test;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
/**
* Helper that introduces timing functionality on top of the Abstract EJB tests.
@@ -86,16 +89,28 @@ public class AbstractEJB3PerformanceTest extends AbstractEJB3Test {
}
- protected void commitTimings() {
+ protected void commitTimings(boolean alsoPrint) {
+ if (alsoPrint)
+ printTimings();
+ timings.clear();
+ startTime.clear();
+ }
+ protected void printTimings() {
Set<Map.Entry<String,Long>> data = timings.entrySet();
- for (Map.Entry<String,Long> item : data) {
+ SortedSet <Map.Entry<String,Long>> sorted = new TreeSet<Map.Entry<String,Long>>(new Comparator<Map.Entry<String,Long>>() {
+
+ public int compare(Map.Entry<String,Long> item1, Map.Entry<String,Long> item2) {
+
+ return item1.getKey().compareTo(item2.getKey());
+ }
+ });
+ sorted.addAll(data);
+ for (Map.Entry<String,Long> item : sorted) {
log.info(":| " + item.getKey() + " => " + item.getValue());
System.out.println(":| " + item.getKey() + " => " + item.getValue());
}
- timings.clear();
- startTime.clear();
}
protected void assertTiming(String name, long maxDuration) {
@@ -114,18 +129,20 @@ public class AbstractEJB3PerformanceTest extends AbstractEJB3Test {
}
/**
- * Make sure the passed value is within a band of <code>[0.9* x, 1.1*x]</code> with
+ * Make sure the passed value is within a band of <code>[0.80* x, 1.2*x]</code> with
* <code>x = ( ref * multiplier )</code>.
* @param ref base value to calculate the reference from
* @param value value to compare to the band
* @param multiplier multiplier for the base value of the band.
+ * @param text text to prepend to a line if check fails.
*/
- protected void assertCirca(long ref,long value, double multiplier ) {
- long low = (long) (ref * multiplier * 0.9);
- long hi = (long) (ref * multiplier * 1.1);
+ protected void assertLinear(long ref,long value, double multiplier, String text ) {
+ long low = (long) (ref * multiplier * 0.80);
+ long hi = (long) (ref * multiplier * 1.2);
- assert value >= low : "[low] Val2 (" + value + ") is not > " + low;
- assert value <= hi : "[hi] Val2 (" + value + ") is not < " + hi;
+ // comment out the low check for now
+// assert value >= low : text + " [low] Val2 (" + value + ") is not > " + low;
+ assert value <= hi : text + " [hi] Val2 (" + value + ") is not < " + hi;
}
}
13 years, 8 months
[rhq] 2 commits - modules/enterprise
by Joseph Marques
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeDetailsView.java | 29 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 5
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/events/EventDetailsAction.java | 58 +-
modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/events/data-plain.xhtml | 180 +++++++++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/graphs-plain.xhtml | 123 ++++++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/measurement/data-plain.xhtml | 197 ++++++++++
modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/monitor/graphs-plain.xhtml | 2
modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/graphs-plain.xhtml | 19
9 files changed, 565 insertions(+), 50 deletions(-)
New commits:
commit 03c0fa915be672fe82c8afd01c00e5ac1a5e6605
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Sep 23 20:57:46 2010 -0400
convert EventCompositeDetailsView into a singleton, update callers appropriately
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeDetailsView.java
index 343947b..3581a59 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeDetailsView.java
@@ -45,31 +45,16 @@ import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
public class EventCompositeDetailsView extends VLayout implements BookmarkableView {
private int eventId;
- private EventComposite composite;
-
private ViewId viewId;
- public EventCompositeDetailsView(int eventId) {
- this.eventId = eventId;
- }
+ private static EventCompositeDetailsView INSTANCE = new EventCompositeDetailsView();
- public EventCompositeDetailsView(EventComposite composite) {
- this.composite = composite;
+ public static EventCompositeDetailsView getInstance() {
+ return INSTANCE;
}
- @Override
- protected void onDraw() {
- super.onDraw();
-
- for (Canvas child : getMembers()) {
- child.destroy();
- }
-
- if (this.composite != null) {
- show(composite);
- } else {
- show(eventId);
- }
+ private EventCompositeDetailsView() {
+ // access through the static singleton only
}
private void show(int eventId) {
@@ -96,12 +81,10 @@ public class EventCompositeDetailsView extends VLayout implements BookmarkableVi
}
if (this.viewId != null) {
- viewId.getBreadcrumbs().get(0).setDisplayName("Event Details");
+ viewId.getBreadcrumbs().get(0).setDisplayName("Details");
CoreGUI.refreshBreadCrumbTrail();
}
- this.composite = composite;
-
DynamicForm form = new DynamicForm();
form.setWidth100();
form.setHeight100();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java
index b9434f0..d185f40 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/event/EventCompositeHistoryView.java
@@ -173,6 +173,6 @@ public class EventCompositeHistoryView extends TableSection {
@Override
public Canvas getDetailsView(int eventId) {
- return new EventCompositeDetailsView(eventId);
+ return EventCompositeDetailsView.getInstance();
}
}
commit e17220ef6827775b472f95e1d81417d12d61f5f9
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Sep 23 20:57:41 2010 -0400
revert to old monitor>graphs page until new charting library chosen
* update embedded resource/group links
* disabled embedded links to full-screen graph
* update embedded links to event details
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 7236d4b..030eb2b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -53,7 +53,6 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configura
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.configuration.ResourceConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.PluginConfigurationEditView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.inventory.ResourceResourceGroupsView;
-import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.GraphListView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.schedules.SchedulesView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.traits.TraitsView;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.operation.OperationHistoryView;
@@ -213,7 +212,8 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
"/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId()), true, true);
visible = hasMetricsOfType(this.resourceComposite, DataType.MEASUREMENT);
- canvas = (visible) ? new GraphListView(this.monitoringTab.extendLocatorId("GraphListView"), resource) : null;
+ //canvas = (visible) ? new GraphListView(this.monitoringTab.extendLocatorId("GraphListView"), resource) : null;
+ canvas = (visible) ? new FullHTMLPane("/rhq/resource/monitor/graphs-plain.xhtml?id=" + resource.getId()) : null;
updateSubTab(this.monitoringTab, this.monitorGraphs, canvas, visible, true);
// visible = same test as above
canvas = (visible) ? new FullHTMLPane("/rhq/common/monitor/tables-plain.xhtml?id=" + resource.getId()) : null;
@@ -221,6 +221,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
visible = hasMetricsOfType(this.resourceComposite, DataType.TRAIT);
canvas = (visible) ? new TraitsView(this.monitoringTab.extendLocatorId("TraitsView"), resource.getId()) : null;
updateSubTab(this.monitoringTab, this.monitorTraits, canvas, visible, true);
+
updateSubTab(this.monitoringTab, this.monitorAvail, new FullHTMLPane(
"/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId()), true, true);
updateSubTab(this.monitoringTab, this.monitorSched, new SchedulesView(monitoringTab
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/events/EventDetailsAction.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/events/EventDetailsAction.java
index 8403297..df45f52 100755
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/events/EventDetailsAction.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/legacy/action/resource/common/events/EventDetailsAction.java
@@ -86,6 +86,7 @@ public class EventDetailsAction extends BaseAction {
int groupId = WebUtility.getOptionalIntRequestParameter(request, ParamConstants.GROUP_ID_PARAM, -1);
int parent = WebUtility.getOptionalIntRequestParameter(request, "parent", -1);
int type = WebUtility.getOptionalIntRequestParameter(request, "type", -1);
+ String mode = WebUtility.getOptionalRequestParameter(request, "mode", "normal");
EventManagerLocal eventManager = LookupUtil.getEventManager();
@@ -124,7 +125,7 @@ public class EventDetailsAction extends BaseAction {
}
html.append(" ");
- createLinkForResource(resourceId, groupId, parent, type, html, event, ridBadChars(event
+ createLinkForResource(mode, resourceId, groupId, parent, type, html, event, ridBadChars(event
.getEventDetail()));
html.append("</li>");
}
@@ -133,7 +134,7 @@ public class EventDetailsAction extends BaseAction {
if (events.getTotalSize() > MAX_EVENTS_PER_DOT) {
EventComposite event = events.get(events.size() - 1); // take the last one to initialize the list
html.append("<p/>");
- createLinkForResource(resourceId, groupId, parent, type, html, event, res
+ createLinkForResource(mode, resourceId, groupId, parent, type, html, event, res
.getMessage("resource.common.monitor.text.events.MoreEvents"));
html.append("<p/>");
}
@@ -149,30 +150,41 @@ public class EventDetailsAction extends BaseAction {
return mapping.findForward(RetCodeConstants.SUCCESS_URL);
}
- private void createLinkForResource(int resourceId, int groupId, int parent, int type, StringBuffer html,
- EventComposite event, String text) {
+ private void createLinkForResource(String mode, int resourceId, int groupId, int parent, int type,
+ StringBuffer html, EventComposite event, String text) {
- //html.append("<a href=\"/resource/common/Events.do?mode=events&eventId=");
- html.append("<a href=\"/rhq/resource/events/history.xhtml?eventId=");
- html.append(event.getEventId());
- if (resourceId > -1) {
- html.append("&id=").append(event.getResourceId());
- } else if (groupId > -1) {
- html.append("&groupId=").append(groupId);
+ log.info("mode = " + mode);
+ if (mode.equals("plain")) {
+ String context = (resourceId > -1) ? "Resource/" : "ResourceGroup/";
+ int contextId = (resourceId > -1) ? resourceId : groupId;
+
+ html.append("<a target=\"_top\" href=\"/coregui/CoreGUI.html#").append(context).append(contextId);
+ html.append("/Events/History/").append(event.getEventId()).append("\">");
+ html.append(text);
+ html.append("</a> ");
} else {
- html.append("&parent=").append(parent).append("&type=").append(type);
- }
- html.append("\">");
- //html.append(event.getEventId());
- if (text.contains("\n")) {
- text = text.substring(0, text.indexOf("\n"));
- }
- if (text.length() > DETAIL_MAX_LEN) {
- text = text.substring(0, DETAIL_MAX_LEN - 1);
+ //html.append("<a href=\"/resource/common/Events.do?mode=events&eventId=");
+ html.append("<a href=\"/rhq/resource/events/history.xhtml?eventId=");
+ html.append(event.getEventId());
+ if (resourceId > -1) {
+ html.append("&id=").append(event.getResourceId());
+ } else if (groupId > -1) {
+ html.append("&groupId=").append(groupId);
+ } else {
+ html.append("&parent=").append(parent).append("&type=").append(type);
+ }
+ html.append("\">");
+ //html.append(event.getEventId());
+ if (text.contains("\n")) {
+ text = text.substring(0, text.indexOf("\n"));
+ }
+ if (text.length() > DETAIL_MAX_LEN) {
+ text = text.substring(0, DETAIL_MAX_LEN - 1);
+ }
+ html.append(text);
+ html.append("</a>");
+ html.append(" ");
}
- html.append(text);
- html.append("</a>");
- html.append(" ");
}
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/events/data-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/events/data-plain.xhtml
new file mode 100644
index 0000000..068f97b
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/events/data-plain.xhtml
@@ -0,0 +1,180 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function">
+
+<ui:composition>
+
+<script type="text/javascript" src="/js/monitorGraphs.js" />
+<!-- need to include this function directly in the facelet so that parameter resolution happens at render-time -->
+<script type="text/javascript">
+ function showEventsDetails(time, status) {
+ initEventDetails();
+ eventsTime = time;
+ var detail = $('eventsSummary');
+ detail.innerHTML = "";
+
+ if (status != null)
+ ajaxEngine.sendRequest( 'getEventDetails',
+ 'id=#{param.id}',
+ 'groupId=#{param.groupId}',
+ 'parent=#{param.parent}',
+ 'type=#{param.type}',
+ 'mode=plain',
+ 'begin=' + time,
+ 'status=' + status);
+ else
+ ajaxEngine.sendRequest( 'getEventDetails',
+ 'id=#{param.id}',
+ 'groupId=#{param.groupId}',
+ 'parent=#{param.parent}',
+ 'type=#{param.type}',
+ 'mode=plain',
+ 'begin=' + time);
+
+ showEventsCallback();
+ }
+</script>
+
+<div id="overlay" class="overlay"></div>
+
+<table cellpadding="0" cellspacing="0" border="0" width="100%">
+
+ <c:if test="#{not empty EventsTimelineUIBean.data}">
+ <tr>
+ <td colspan="62" style="height: 2px;"></td>
+ </tr>
+
+ <tr style="height: 12px;">
+ <td></td>
+ <c:forEach var="timeTick" items="#{EventsTimelineUIBean.data}" varStatus="status">
+ <c:set var="count" value="#{status.index}"/>
+ <c:set var="icon" value="/images/no_event.gif"/>
+ <c:if test="#{not empty timeTick.severity}">
+ <c:set var="sev" value="#{timeTick.severity.ordinal}"/>
+ <c:choose>
+ <c:when test="#{sev == 0 }">
+ <c:set var="icon" value="/images/event_debug.gif"/>
+ </c:when>
+ <c:when test="#{sev == 1 }">
+ <c:set var="icon" value="/images/event_info.gif"/>
+ </c:when>
+ <c:when test="#{sev == 2 }">
+ <c:set var="icon" value="/images/event_warn.gif"/>
+ </c:when>
+ <c:when test="#{sev == 3 }">
+ <c:set var="icon" value="/images/event_error.gif"/>
+ </c:when>
+ <c:when test="#{sev == 4 }">
+ <c:set var="icon" value="/images/event_fatal.gif"/>
+ </c:when>
+ <c:otherwise>
+ <c:set var="icon" value="/images/no_event.gif"/>
+ </c:otherwise>
+ </c:choose>
+ </c:if>
+
+ <!-- put onmousedown in table data element not the div, which gives the user a larger clickable area -->
+ <c:if test="#{empty timeTick.severity}">
+ <td style="background-image: url(#{icon}); background-repeat:no-repeat;" align="center" valign="middle">
+ </td>
+ </c:if>
+
+ <c:if test="#{not empty timeTick.severity}">
+ <ui:param name="formattedTimeTick" value="#{onf:formatTimestamp(timeTick.time)}"/>
+ <td style="background-image: url(#{icon}); background-repeat:no-repeat;" align="center" valign="middle"
+ onmousedown="detailsShowing=true;overlay.moveOverlay(this);overlay.showTimePopup('#{count}','#{formattedTimeTick}');showEventsDetails(#{timeTick.time});">
+ </td>
+ </c:if>
+
+ </c:forEach>
+ <td style="margin: 0 0 0 5;">
+ <h:outputFormat value="#{msg['resource.common.monitor.label.elc']}" />
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="62" valign="top">
+ <a name="eventDetail"></a>
+ <div id="eventDetailTable"
+ style="position: relative; height: 230px; display: none; ">
+ <div class="eventDetails">
+ <table cellspacing="0" width="100%">
+ <tr>
+ <td class="eventsTabOn" nowrap="nowrap">
+ <h:outputFormat value="#{msg['resource.common.monitor.events.ListOfEvents']}" />
+ </td>
+ <td valign="top" style="text-align: right; border-bottom: solid; border-width: 1px; border-color: #000000;">
+ <img src="/images/dash-icon_delete.gif"
+ onclick="detailsShowing=false;new Effect.Fade($('eventDetailTable'), {afterFinish: function (obj) { maxIndicatorDivHeight(); overlay.moveOverlay(this); }})"/>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="8">
+ <div id="eventsSummary" style="height:200px; overflow:auto;"></div>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="62" style="height: 3px;"></td>
+ </tr>
+ </c:if>
+
+ <tr>
+ <td width="10">
+ <div id="timetop"></div>
+ <img src="/images/timeline_ll.gif" height="10"/>
+ </td>
+ <c:forEach var="timeTick" items="#{EventsTimelineUIBean.data}" varStatus="status">
+ <c:set var="count" value="#{status.index}"/>
+ <ui:param name="formattedTimeTick" value="#{onf:formatTimestamp(timeTick.time)}"/>
+ <td width="12">
+ <div id="timePopup_#{count}"
+ onmouseover="overlay.moveOverlay(this);overlay.showTimePopup('#{count}','#{formattedTimeTick}')" >
+ <img src="/images/timeline_off.gif" height="10" width="9"
+ onmouseover="imageSwap(this, imagePath + 'timeline', '_on')"
+ onmouseout="imageSwap(this, imagePath + 'timeline', '_off');"
+ onmousedown="imageSwap(this, imagePath + 'timeline', '_down')" />
+ </div>
+ </td>
+ </c:forEach>
+ <td width="100%">
+ <img src="/images/timeline_lr.gif" height="10"/>
+ </td>
+ </tr>
+
+ <tr>
+ <td></td>
+ <td colspan="30" valign="top">
+ <h:outputText value="#{EventsTimelineUIBean.data[0].time}">
+ <f:converter converterId="UserDateTimeConverter" />
+ </h:outputText>
+ <div id="timePopup" class="timepopup" onmousedown="overlay.hideTimePopup()"></div>
+ </td>
+ <td colspan="30" align="right" valign="top">
+ <h:outputText value="#{EventsTimelineUIBean.data[59].time}">
+ <f:converter converterId="UserDateTimeConverter" />
+ </h:outputText>
+ </td>
+ <td></td>
+ </tr>
+</table>
+
+</ui:composition>
+
+</html>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/graphs-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/graphs-plain.xhtml
new file mode 100644
index 0000000..acb697e
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/graphs-plain.xhtml
@@ -0,0 +1,123 @@
+<ui:composition
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+ <!-- chart actions -->
+ <tr class="BlockContent">
+ <td align="right">
+ <ui:include src="measurement/views.xhtml"/>
+ </td>
+ </tr>
+
+ <tr class="BlockContent">
+ <td>
+ <ui:include src="availability/data.xhtml"/>
+ </td>
+ </tr>
+
+ <tr class="BlockContent">
+ <td>
+ <div id="indicatorDiv" style="width: 750px; height: 400px; border: 1; overflow-x: hidden; overflow-y: scroll;">
+ <ui:include src="measurement/data-plain.xhtml"/>
+ </div>
+ </td>
+ </tr>
+
+<tr class="BlockContent">
+ <td width="550px">
+ <div id="eventsDiv">
+ <ui:include src="events/data-plain.xhtml"/>
+ </div>
+ </td>
+</tr>
+
+<!-- spacer for date/time overlay, so it doesn't overlap metric display range -->
+<tr class="BlockContent">
+ <td>
+ <br />
+ <br />
+ </td>
+</tr>
+
+<tr class="BlockContent">
+ <td>
+ <h:form id="MetricComponentForm">
+ <c:if test="#{IndicatorChartsUIBean.context.resourceId != -1}">
+ <input type="hidden" name="id" value="#{IndicatorChartsUIBean.context.resourceId}" />
+ </c:if>
+ <c:if test="#{IndicatorChartsUIBean.context.groupId != -1}">
+ <input type="hidden" name="groupId" value="#{IndicatorChartsUIBean.context.groupId}" />
+ </c:if>
+ <c:if test="#{IndicatorChartsUIBean.context.parentResourceId != -1}">
+ <input type="hidden" name="parent" value="#{IndicatorChartsUIBean.context.parentResourceId}" />
+ </c:if>
+ <c:if test="#{IndicatorChartsUIBean.context.resourceTypeId != -1}">
+ <input type="hidden" name="type" value="#{IndicatorChartsUIBean.context.resourceTypeId}" />
+ </c:if>
+ <table>
+ <tr>
+ <td><onc:metric optionList="m,h,d" /></td>
+ <td>
+ <h:commandLink rendered="#{not MetricComponentUtilityUIBean.readOnly}"
+ action="#{MetricComponentUtilityUIBean.update}" >
+ <img src="/images/dash-button_go-arrow.gif" alt="Apply Metric Settings "/>
+ </h:commandLink>
+ <h:commandLink rendered="#{MetricComponentUtilityUIBean.readOnly}"
+ action="#{MetricComponentUtilityUIBean.switchToSimpleMode}">
+ <h:outputText value="Switch to Simple Mode" />
+ </h:commandLink>
+ </td>
+ </tr>
+ </table>
+ </h:form>
+ </td>
+</tr>
+
+<!-- footerDiv used purely for calculating the height for the overlay -->
+<tr class="BlockContent">
+ <td>
+ <div id="footerDiv"></div>
+ </td>
+</tr>
+</table>
+
+<script type="text/javascript">
+ function maxIndicatorDivHeight() {
+ var indicatorDiv = getElementCrossBrowser("indicatorDiv");
+ var eventsDiv = getElementCrossBrowser("eventsDiv");
+ var footerDiv = getElementCrossBrowser("footerDiv");
+
+ //IE6 returns 0 for document.documentElement.clientHeight
+ var browserHeight = document.documentElement.clientHeight || document.body.clientHeight;
+ var indicatorTopPos = getElementTopPos(indicatorDiv);
+ var eventsTopPos = getElementTopPos(eventsDiv);
+ var footerTopPos = getElementTopPos(footerDiv) ;
+ var eventsDivHeight = footerTopPos - eventsTopPos;
+
+ var newIndicatorDivHeight = browserHeight - indicatorTopPos - eventsDivHeight - 2;
+
+ //accomodating for the IE measurement difficulties
+ if (Prototype.Browser.IE) {
+ newIndicatorDivHeight -= 4;
+ }
+
+ //if the inidicator div would be too small, let the whole content pane scroll instead
+ if (newIndicatorDivHeight > 50) {
+ indicatorDiv.style.height = newIndicatorDivHeight + "px";
+ }
+ }
+
+ addWindowOnLoadEvent(maxIndicatorDivHeight);
+ addWindowOnResizeEvent(maxIndicatorDivHeight);
+</script>
+
+</ui:composition>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/measurement/data-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/measurement/data-plain.xhtml
new file mode 100644
index 0000000..d944499
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/common/monitor/measurement/data-plain.xhtml
@@ -0,0 +1,197 @@
+<?xml version="1.0"?>
+
+<!DOCTYPE html
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function">
+
+<ui:composition>
+
+<!-- NOTE: rico.js is used for the AJAX stuff below (i.e. the ajaxEngine object). -->
+<a4j:loadScript src="/js/rico.js"/>
+
+<script language="JavaScript">
+
+ var baseUrl = "/resource/common/monitor/visibility/IndicatorCharts.do";
+ baseUrl += '?';
+ baseUrl += "#{onf:contextFragmentURLForIndicatorsChart()}"
+ baseUrl += '&view=';
+ baseUrl += "#{IndicatorChartsUIBean.view}";
+
+ // Register the remove metric chart method
+ ajaxEngine.registerRequest( 'indicatorCharts', baseUrl );
+
+ function addMetric(token) {
+ ajaxEngine.sendRequest(
+ 'indicatorCharts',
+ 'metric=' + token,
+ 'action=addChart',
+ 'view=' + '#{IndicatorChartsUIBean.view}');
+ }
+
+ function removeMetric(token) {
+ ajaxEngine.sendRequest(
+ 'indicatorCharts',
+ 'metric=' + token,
+ 'action=remove',
+ 'view=' + '#{IndicatorChartsUIBean.view}');
+ new Effect.Fade(token);
+ }
+
+ function moveMetricUp(token) {
+ ajaxEngine.sendRequest(
+ 'indicatorCharts',
+ 'metric=' + token,
+ 'action=moveUp',
+ 'view=' + '#{IndicatorChartsUIBean.view}');
+ var root = $('root');
+ var elem = $(token);
+ moveElementUp(elem, root);
+ }
+
+ function moveMetricDown(token) {
+ ajaxEngine.sendRequest(
+ 'indicatorCharts',
+ 'metric=' + token,
+ 'action=moveDown',
+ 'view=' + '#{IndicatorChartsUIBean.view}');
+
+ var root = $('root');
+ var elem = $(token);
+ moveElementDown(elem, root);
+ }
+
+</script>
+
+<form id="metricViewsForm">
+
+<ul id="root" class="boxy">
+
+<ui:param name="tableBorder" value="0" /> <!-- used for quick debugging -->
+<ui:param name="context" value="#{IndicatorChartsUIBean.context}" />
+<c:forEach var="metric" varStatus="status" items="#{IndicatorChartsUIBean.data}">
+
+ <li id="#{metric.metricToken}">
+ <table width="100%" border="#{tableBorder}" cellpadding="0" cellspacing="0">
+ <tr>
+ <td>
+ <rich:panel bodyClass="BlockContent" style="border: 0px; margin: 0; padding: 0;">
+ <font class="BoldText">
+ <ui:remove>
+ <h:outputLink value="/resource/common/monitor/Visibility.do">
+ <f:param name="m" value="#{metric.definitionId}"/>
+ <c:choose>
+ <c:when test="#{context.resourceTypeId > 0}">
+ <f:param name="mode" value="chartSingleMetricMultiResource"/>
+ <f:param name="type" value="#{context.resourceTypeId}"/>
+ <f:param name="parent" value="#{context.parentResourceId}"/>
+ </c:when>
+ <c:when test="#{context.groupId > 0}">
+ <f:param name="mode" value="chartSingleMetricMultiResource"/>
+ <f:param name="groupId" value="#{context.groupId}"/>
+ </c:when>
+ <c:otherwise>
+ <f:param name="mode" value="chartSingleMetricSingleResource"/>
+ <f:param name="id" value="#{context.resourceId}"/>
+ </c:otherwise>
+ </c:choose>
+ <h:outputText value="#{metric.label} " />
+ </h:outputLink>
+ </ui:remove>
+ <h:outputText value="#{metric.label} " />
+
+ <c:choose>
+ <c:when test="#{context.groupId > 0}">
+ <h:outputLink target="_top" value="/coregui/CoreGUI.html#ResourceGroup/#{metric.groupId}">
+ <h:outputFormat value="#{msg['common.value.parenthesis']}">
+ <f:param value="#{metric.metricSource}" />
+ </h:outputFormat>
+ </h:outputLink>
+ </c:when>
+ <c:otherwise>
+ <h:outputLink target="_top" value="/coregui/CoreGUI.html#Resource/#{metric.metricSourceId}">
+ <h:outputFormat value="#{msg['common.value.parenthesis']}">
+ <f:param value="#{metric.metricSource}" />
+ </h:outputFormat>
+ </h:outputLink>
+ </c:otherwise>
+ </c:choose>
+ </font>
+ <rich:toolTip followMouse="true" showDelay="500">
+ <h:outputText value="#{metric.description}" rendered="#{not empty metric.description}" />
+ <h:outputText value="No description of this metric available" rendered="#{empty metric.description}" />
+ </rich:toolTip>
+ </rich:panel>
+ </td>
+
+ <td width="400">
+ <table cellpadding="0" cellspacing="0" border="#{tableBorder}" width="100%">
+ <tr>
+ <td width="33%" nowrap="nowrap">
+ <h:outputFormat style="font-weight: bold;" value="#{msg['resource.common.monitor.visibility.LowTH']}" />:
+ <h:outputText value="#{metric.minMetric.valueFmt}"/>
+ </td>
+ <td width="34%" nowrap="nowrap">
+ <h:outputFormat style="font-weight: bold;" value="#{msg['resource.common.monitor.visibility.AvgTH']}" />:
+ <h:outputText value="#{metric.avgMetric.valueFmt}"/>
+ </td>
+ <td width="33%" nowrap="nowrap">
+ <h:outputFormat style="font-weight: bold;" value="#{msg['resource.common.monitor.visibility.PeakTH']}" />:
+ <h:outputText value="#{metric.maxMetric.valueFmt}"/>
+ </td>
+ </tr>
+ </table>
+ </td>
+
+ <td width="1">
+ <table cellpadding="0" cellspacing="0" border="#{tableBorder}" width="100%" style="margin-right: 2px;">
+ <tr>
+ <td width="33%">
+ <a href="javascript:moveMetricUp('#{metric.metricToken}')">
+ <img src="/images/dash_icon_up.gif" border="0"/>
+ </a>
+ </td>
+ <td width="33%">
+ <a href="javascript:moveMetricDown('#{metric.metricToken}')">
+ <img src="/images/dash_icon_down.gif" border="0"/>
+ </a>
+ </td>
+ <td width="34%">
+ <a href="javascript:removeMetric('#{metric.metricToken}')">
+ <img src="/images/dash-icon_delete.gif" border="0"/>
+ </a>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+
+ <tr>
+ <td colspan="3">
+ <h:graphicImage value="/resource/HighLowChart?#{onf:getChartURLParams(metric)}"
+ width="647" height="100" />
+ </td>
+ </tr>
+ </table>
+
+ </li>
+
+</c:forEach>
+
+</ul>
+
+</form>
+
+</ui:composition>
+
+</html>
\ No newline at end of file
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/monitor/graphs-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/monitor/graphs-plain.xhtml
index 14f6b68..c2c594f 100644
--- a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/monitor/graphs-plain.xhtml
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/group/monitor/graphs-plain.xhtml
@@ -12,7 +12,7 @@
<ui:define name="content">
- <ui:include src="/rhq/common/monitor/graphs.xhtml" />
+ <ui:include src="/rhq/common/monitor/graphs-plain.xhtml" />
</ui:define>
diff --git a/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/graphs-plain.xhtml b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/graphs-plain.xhtml
new file mode 100644
index 0000000..9aabd00
--- /dev/null
+++ b/modules/enterprise/gui/portal-war/src/main/webapp/rhq/resource/monitor/graphs-plain.xhtml
@@ -0,0 +1,19 @@
+<ui:composition template="/rhq/resource/layout/main-plain.xhtml"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:c="http://java.sun.com/jstl/core"
+ xmlns:onc="http://jboss.org/on/component"
+ xmlns:onf="http://jboss.org/on/function"
+ xmlns:s="http://jboss.com/products/seam/taglib"
+ xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
+ xmlns:rich="http://richfaces.ajax4jsf.org/rich">
+
+ <ui:define name="content">
+
+ <ui:include src="/rhq/common/monitor/graphs-plain.xhtml" />
+
+ </ui:define>
+
+</ui:composition>
\ No newline at end of file
13 years, 8 months
[rhq] Branch 'ec2' - 3 commits - modules/enterprise pom.xml
by John Sanda
modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java | 8 +
modules/enterprise/server/container/pom.xml | 2
modules/enterprise/server/container/src/main/scripts/rhq-container.build.xml | 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java | 15 ++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerLocal.java | 9 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/SyncEndpointAddressException.java | 20 +++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/AbstractJobWrapper.java | 11 --
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/AbstractTypeServerPluginContainer.java | 1
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ScheduledJobInvocationContext.java | 54 +++++++++-
modules/enterprise/server/plugins/cloud/src/main/java/org/rhq/enterprise/server/plugins/cloud/CloudServerPluginComponent.java | 50 ++++++++-
modules/enterprise/server/plugins/cloud/src/main/resources/META-INF/rhq-serverplugin.xml | 6 -
pom.xml | 12 ++
12 files changed, 169 insertions(+), 22 deletions(-)
New commits:
commit 050a2b0c70167cf3e029e92220f3aa2098fff4a7
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Sep 22 20:50:38 2010 -0400
Updating plugin descriptor to make cloud plugin clustered
Also refactoring plugin to work with new methods in
ScheduledJobInvocationContext
diff --git a/modules/enterprise/server/plugins/cloud/src/main/java/org/rhq/enterprise/server/plugins/cloud/CloudServerPluginComponent.java b/modules/enterprise/server/plugins/cloud/src/main/java/org/rhq/enterprise/server/plugins/cloud/CloudServerPluginComponent.java
index e2aac5a..2577b48 100644
--- a/modules/enterprise/server/plugins/cloud/src/main/java/org/rhq/enterprise/server/plugins/cloud/CloudServerPluginComponent.java
+++ b/modules/enterprise/server/plugins/cloud/src/main/java/org/rhq/enterprise/server/plugins/cloud/CloudServerPluginComponent.java
@@ -1,11 +1,20 @@
package org.rhq.enterprise.server.plugins.cloud;
import java.io.Serializable;
+import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+import javax.persistence.EntityManager;
+
+import org.rhq.core.domain.cloud.Server;
+import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.resource.Agent;
+import org.rhq.enterprise.server.cloud.CloudManagerLocal;
import org.rhq.enterprise.server.plugin.pc.ScheduledJobInvocationContext;
import org.rhq.enterprise.server.plugin.pc.ServerPluginComponent;
import org.rhq.enterprise.server.plugin.pc.ServerPluginContext;
+import org.rhq.enterprise.server.util.LookupUtil;
public class CloudServerPluginComponent implements ServerPluginComponent {
@@ -22,15 +31,44 @@ public class CloudServerPluginComponent implements ServerPluginComponent {
}
public void syncServerEndpoints(ScheduledJobInvocationContext context) {
- Map<String, Serializable> jobProperties = context.getProperties();
-
- if (!jobProperties.containsKey("counter")) {
- jobProperties.put("counter", 1);
+// CloudManagerLocal cloudMgr = LookupUtil.getCloudManager();
+// List<Server> servers = cloudMgr.getAllServers();
+// Map<String, String> addresses = getAddresses(context);
+
+// for (Server server : servers) {
+// if (!addresses.containsKey(server.getName())) {
+// addresses.put(server.getName(), server.getAddress());
+// } else if (addressChanged(addresses, server)) {
+// addresses.put(server.getName(), server.getAddress());
+// notifyAgents(server);
+// }
+// }
+
+ if (!context.containsKey("counter")) {
+ context.put("counter", "1");
return;
}
- Integer counter = (Integer)jobProperties.get("counter");
+ Integer counter = Integer.parseInt(context.get("counter"));
System.out.println("CURRENT COUNT: " + counter);
- jobProperties.put("counter", counter + 1);
+ context.put("counter", Integer.toString(counter + 1));
}
+
+// @SuppressWarnings("unchecked")
+// private Map<String, String> getAddresses(ScheduledJobInvocationContext context) {
+// Map<String, Serializable> jobData = context.getProperties();
+// if (!jobData.containsKey("serverAddresses")) {
+// jobData.put("serverAddresses", new HashMap<String, String>());
+// }
+// return (Map<String, String>) jobData.get("serverAddresses");
+// }
+//
+// private boolean addressChanged(Map<String, String> addresses, Server server) {
+// String lastKnownAddr = addresses.get(server.getName());
+// return !server.getAddress().endsWith(lastKnownAddr);
+// }
+//
+// private void notifyAgents(Server server) {
+// EntityManager entityMgr = LookupUtil.getEntityManager();
+// }
}
diff --git a/modules/enterprise/server/plugins/cloud/src/main/resources/META-INF/rhq-serverplugin.xml b/modules/enterprise/server/plugins/cloud/src/main/resources/META-INF/rhq-serverplugin.xml
index fd3b2f9..de9f94a 100644
--- a/modules/enterprise/server/plugins/cloud/src/main/resources/META-INF/rhq-serverplugin.xml
+++ b/modules/enterprise/server/plugins/cloud/src/main/resources/META-INF/rhq-serverplugin.xml
@@ -14,7 +14,7 @@
<c:simple-property name="scheduleType"
type="string"
required="true"
- default="cron"
+ default="periodic"
summary="true"
description="Indicates the type of trigger this synchronize job will use">
<c:property-options>
@@ -33,10 +33,10 @@
<c:simple-property name="clustered"
type="boolean"
required="true"
- default="false"
+ default="true"
summary="false"
readOnly="true"
- description="This must always be false"/>
+ description="This must always be true"/>
</c:map-property>
</serverplugin:scheduled-jobs>
</generic-plugin>
\ No newline at end of file
commit 41a7ba13b51f4a29474f308f662151b22fa24292
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Sep 22 17:26:23 2010 -0400
Restricting plugins to storing only string in the job data
Quartz is already configured to only allow strings to be stored in the job data
map when a job is scheduled for concurrent execution. Restricting entries in
the map to strings is recommended to avoid class versioning errors that are
common during deserialization. ScheduledInvocationContext has been refactored
a bit so that the underlying map is no longer directly exposed. To edit values
in the map it now exposes get/put methods that help enforce and ensure only
strings are stored in the map. There is still a getProperties() method; however,
it returns a read-only view of the data map.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/AbstractJobWrapper.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/AbstractJobWrapper.java
index 974cc4d..78058b3 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/AbstractJobWrapper.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/AbstractJobWrapper.java
@@ -22,6 +22,7 @@ package org.rhq.enterprise.server.plugin.pc;
import java.io.Serializable;
import java.lang.reflect.Method;
import java.util.Date;
+import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
@@ -113,12 +114,6 @@ abstract class AbstractJobWrapper implements Job {
public static final String DATAMAP_IS_CLUSTERED = DATAMAP_LEADER + "isClustered";
/**
- * Key to the data map to a map where the plugin job can store data that it wants
- * to persist across invocations of the job.
- */
- public static final String DATAMAP_PLUGIN_JOB_DATA = DATAMAP_LEADER + "pluginJobData";
-
- /**
* This is the method that quartz calls when the schedule has triggered. This method will
* delegate to the plugin component that is responsible to do work for the plugin.
*
@@ -239,8 +234,8 @@ abstract class AbstractJobWrapper implements Job {
ScheduledJobDefinition jobDefinition = new ScheduledJobDefinition(jobId, true, jobClass, jobMethodName,
scheduleType, callbackData);
ServerPluginContext pluginContext = pluginManager.getServerPluginContext(pluginEnv);
- params[0] = new ScheduledJobInvocationContext(jobDefinition, pluginContext, pluginComponent,
- (Map<String, Serializable>)dataMap.get(DATAMAP_PLUGIN_JOB_DATA));
+ Map<String, String> properties = new HashMap<String, String>();
+ params[0] = new ScheduledJobInvocationContext(jobDefinition, pluginContext, pluginComponent, dataMap);
} catch (NoSuchMethodException e) {
try {
// see if there is a no-arg method of the given name
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/AbstractTypeServerPluginContainer.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/AbstractTypeServerPluginContainer.java
index bfaae58..c7fc556 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/AbstractTypeServerPluginContainer.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/AbstractTypeServerPluginContainer.java
@@ -458,7 +458,6 @@ public abstract class AbstractTypeServerPluginContainer {
jobData.putAsString(AbstractJobWrapper.DATAMAP_IS_CONCURRENT, schedule.getScheduleType().isConcurrent());
jobData.putAsString(AbstractJobWrapper.DATAMAP_IS_CLUSTERED, schedule.getScheduleType().isClustered());
jobData.put(AbstractJobWrapper.DATAMAP_JOB_METHOD_NAME, schedule.getMethodName());
- jobData.put(AbstractJobWrapper.DATAMAP_PLUGIN_JOB_DATA, new HashMap<String, Serializable>());
if (schedule.getClassName() != null) {
jobData.put(AbstractJobWrapper.DATAMAP_JOB_CLASS, schedule.getClassName());
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ScheduledJobInvocationContext.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ScheduledJobInvocationContext.java
index 81cd7c5..1cf48a5 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ScheduledJobInvocationContext.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/plugin/pc/ScheduledJobInvocationContext.java
@@ -20,7 +20,9 @@
package org.rhq.enterprise.server.plugin.pc;
import java.io.Serializable;
+import java.util.Collections;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import org.rhq.enterprise.server.xmlschema.ScheduledJobDefinition;
@@ -36,10 +38,10 @@ public class ScheduledJobInvocationContext {
private final ScheduledJobDefinition jobDefinition;
private final ServerPluginContext serverPluginContext;
private final ServerPluginComponent serverPluginComponent;
- private Map<String, Serializable> properties;
+ private Map<String, String> properties;
public ScheduledJobInvocationContext(ScheduledJobDefinition jobDefinition, ServerPluginContext pluginContext,
- ServerPluginComponent serverPluginComponent, Map<String, Serializable> properties) {
+ ServerPluginComponent serverPluginComponent, Map<String, String> properties) {
this.jobDefinition = jobDefinition;
this.serverPluginContext = pluginContext;
this.serverPluginComponent = serverPluginComponent;
@@ -75,7 +77,51 @@ public class ScheduledJobInvocationContext {
return serverPluginComponent;
}
- public Map<String, Serializable> getProperties() {
- return properties;
+ /**
+ * Adds a property to the context that is persisted across invocations of the job.
+ *
+ * @param key The property name
+ * @param value The property value
+ */
+ public void put(String key, String value) {
+ properties.put(key, value);
+ }
+
+ /**
+ * Retrieves a property value from the context.
+ *
+ * @param key The property key
+ * @return The property value or <code>null<code> if the key is not found
+ */
+ public String get(String key) {
+ return properties.get(key);
+ }
+
+ /**
+ * Removes the property value associated with the specified key
+ *
+ * @param key The property key
+ * @return The value previously associated with the key or <code>null</code> if the key is present in the context
+ */
+ public String remove(String key) {
+ return properties.remove(key);
+ }
+
+ /**
+ * Checks to see whether or not the property key is stored in the context.
+ * @param key The property key
+ * @return <code>true</code> if the key is found, <code>false</code> otherwise.
+ */
+ public boolean containsKey(String key) {
+ return properties.containsKey(key);
+ }
+
+ /**
+ * Returns a <strong>read-only</strong> view of the properties stored in the context.
+ *
+ * @return A <strong>read-only</strong> view of the properties stored in the context.
+ */
+ public Map<String, String> getProperties() {
+ return Collections.unmodifiableMap(properties);
}
}
commit e850432834bb07537ef4f3d61da7ee5b946566e1
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Sep 22 11:21:50 2010 -0400
Adding support for syncing the server endpoint url at start up.
The behavior is turned off by default. It can be enabled by setting
rhq.sync.endpoint-address=true
in rhq-server.properties. When this is enabled, the server at start up will
compare its endpoint address to the host name/address found on the host machine.
If they differ, the server endpoint address will be updated to the value found
on the host machine. This addresses the (first part of the problem of)
address/host name changes that will occur in EC2 when a server machine is
restarted.
diff --git a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java
index e69e1ff..90a534a 100644
--- a/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java
+++ b/modules/enterprise/gui/portal-war/src/main/java/org/rhq/enterprise/gui/startup/StartupServlet.java
@@ -51,6 +51,7 @@ import org.rhq.enterprise.server.alert.engine.internal.AlertConditionCacheCoordi
import org.rhq.enterprise.server.auth.SessionManager;
import org.rhq.enterprise.server.auth.prefs.SubjectPreferencesCache;
import org.rhq.enterprise.server.cloud.instance.ServerManagerLocal;
+import org.rhq.enterprise.server.cloud.instance.SyncEndpointAddressException;
import org.rhq.enterprise.server.core.AgentManagerLocal;
import org.rhq.enterprise.server.core.CustomJaasDeploymentServiceMBean;
import org.rhq.enterprise.server.core.comm.ServerCommunicationsServiceUtil;
@@ -164,6 +165,13 @@ public class StartupServlet extends HttpServlet {
// Establish the current server mode for the server. This will move the server to NORMAL
// mode from DOWN if necessary. This can also affect comm layer behavior.
serverManager.establishCurrentServerMode();
+ if ("true".equals(System.getProperty("rhq.sync.endpoint-address", "false"))) {
+ try {
+ serverManager.syncEndpointAddress();
+ } catch (SyncEndpointAddressException e) {
+ log("Failed to sync server endpoint address.", e);
+ }
+ }
}
/**
diff --git a/modules/enterprise/server/container/pom.xml b/modules/enterprise/server/container/pom.xml
index 0f02b39..e14135c 100644
--- a/modules/enterprise/server/container/pom.xml
+++ b/modules/enterprise/server/container/pom.xml
@@ -199,6 +199,8 @@
<property name="rhq.server.enable.ws" value="${rhq.server.enable.ws}" />
<property name="jbossws-native-dist.version" value="${jbossws-native-dist.version}" />
+
+ <property name="rhq.sync.endpoint-address" value="${rhq.sync.endpoint-address}"/>
</ant>
</tasks>
</configuration>
diff --git a/modules/enterprise/server/container/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/container/src/main/scripts/rhq-container.build.xml
index 477f62f..50ecea0 100644
--- a/modules/enterprise/server/container/src/main/scripts/rhq-container.build.xml
+++ b/modules/enterprise/server/container/src/main/scripts/rhq-container.build.xml
@@ -20,6 +20,8 @@
<property name="default.rhq.server.quartz.selectWithLockSQL" value="SELECT * FROM {0}LOCKS WHERE LOCK_NAME = ? FOR UPDATE" />
<property name="default.rhq.server.quartz.lockHandlerClass" value="org.quartz.impl.jdbcjobstore.StdRowLockSemaphore" />
+ <property name="rhq.sync.endpoint-address" value="false"/>
+
<target name="set-predeploy-prop">
<condition property="predeploy" value="true">
<or>
@@ -604,6 +606,7 @@ rhq.server.plugin-scan-period-ms=${rhq.server.plugin-scan-period-ms}
rhq.autoinstall.enabled=false
rhq.autoinstall.database=auto
rhq.autoinstall.public-endpoint-address=
+rhq.sync.endpoint-address=${rhq.sync.endpoint-address}
</echo>
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java
index cc2c565..be91c65 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerBean.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.server.cloud.instance;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
import java.util.Collection;
import java.util.List;
@@ -284,6 +286,19 @@ public class ServerManagerBean implements ServerManagerLocal {
Server.OperationMode.MAINTENANCE.name());
}
+ public void syncEndpointAddress() throws SyncEndpointAddressException {
+ Server server = getServer();
+ try {
+ String hostName = InetAddress.getLocalHost().getHostName();
+
+ if (!hostName.equals(server.getAddress())) {
+ server.setAddress(hostName);
+ }
+ } catch (UnknownHostException e) {
+ throw new SyncEndpointAddressException("Failed to sync endpoint address for " + server, e);
+ }
+ }
+
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void beat() {
Server server = getServer();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerLocal.java
index 135db97..04e244c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/ServerManagerLocal.java
@@ -102,6 +102,15 @@ public interface ServerManagerLocal {
void establishCurrentServerMode();
/**
+ * Synchronizes the endpoint address of this server with the host name or address found on the host machine. If the
+ * host name or address of this machine differs from {@link Server#getAddress()} then this server will be updated
+ * with the value of this machine's host name/address.
+ *
+ * @throws SyncEndpointAddressException
+ */
+ void syncEndpointAddress() throws SyncEndpointAddressException;
+
+ /**
* Updates server mtime to register active heart beat
*/
void beat();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/SyncEndpointAddressException.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/SyncEndpointAddressException.java
new file mode 100644
index 0000000..a3924d7
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/instance/SyncEndpointAddressException.java
@@ -0,0 +1,20 @@
+package org.rhq.enterprise.server.cloud.instance;
+
+public class SyncEndpointAddressException extends Exception {
+
+ public SyncEndpointAddressException() {
+ super();
+ }
+
+ public SyncEndpointAddressException(String message) {
+ super(message);
+ }
+
+ public SyncEndpointAddressException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public SyncEndpointAddressException(Throwable cause) {
+ super(cause);
+ }
+}
diff --git a/pom.xml b/pom.xml
index 6c332d3..2b8888b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -142,6 +142,18 @@
<rhq.server.enable.ws>false</rhq.server.enable.ws>
+ <!--
+ When this property is set to true will compare its endpoint address
+ that is stored in the database against the actual host name/IP address
+ returned by the host system. If they differ, the address stored in the
+ datbase will be updated to the value found on the host machine. While
+ host name changes are/should be uncommon in a typical deployment, they
+ are more common in a cloud deployment such as EC2. And in a cloud
+ deployment like EC2, we want to turn this behavior on to ensure that
+ the server endpoint accurately reflects the current machine address.
+ -->
+ <rhq.sync.endpoint-address>false</rhq.sync.endpoint-address>
+
<!-- NOTE: The below line is a workaround for a Maven bug, where it does not expand settings.* properties
used in the distributionManagement section of the POM. -->
<localRepository>${user.home}/.m2/repository</localRepository>
13 years, 8 months
[rhq] 10 commits - modules/enterprise
by Simeon Pinder
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java | 16 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java | 15 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java | 73 +++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java | 77 ++++------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java | 17 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java | 7
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java | 20 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/discovery/AutodiscoveryQueueDataSource.java | 24 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java | 20 ++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/WidgetsField.java | 63 ++++++++
modules/enterprise/server/jar/pom.xml | 9 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/ServerVersion.java | 6
13 files changed, 245 insertions(+), 104 deletions(-)
New commits:
commit 3cbc6823b6c9592c227b18018bfad6cd75caa927
Merge: e84012c... 6eea739...
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Sep 23 19:23:02 2010 -0400
Merge branch 'master' of ssh://spinder@git.fedorahosted.org/git/rhq/rhq into track-master
commit e84012cf010751c9eb71439d954f56170c060306
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Sep 23 19:01:52 2010 -0400
various locatable selenium fixes, cleanup refactoring, refresh fix for InventorySummary portlet.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
index 11ce54c..3a09d44 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletFactory.java
@@ -75,13 +75,26 @@ public class PortletFactory {
// TODO: Note, we're using a sequence generated ID here as a locatorId. This is not optimal for repeatable
// tests as a change in the number of default portlets, or a change in test order could make a test
// non-repeatable. But, at the moment we lack the infrastructure to generate a unique, predictable id.
- Portlet view = viewFactory.getInstance(storedPortlet.getPortletKey() + "-"
+ Portlet view = viewFactory.getInstance(replaceSpaces(storedPortlet.getPortletKey()) + "-"
+ Integer.toString(storedPortlet.getId()));
view.configure(portletWindow, storedPortlet);
return view;
}
+ /** Translated spaces to underscore. Spaces not allowed in locator ids.
+ *
+ * @param portletKey
+ * @return
+ */
+ private static String replaceSpaces(String portletKey) {
+ String translated = portletKey;
+ if (portletKey != null) {
+ translated = portletKey.replaceAll(" ", "_");
+ }
+ return translated;
+ }
+
@SuppressWarnings("unchecked")
public static List<String> getRegisteredPortlets() {
@@ -89,4 +102,5 @@ public class PortletFactory {
Collections.sort(portlets);
return portlets;
}
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java
index 8159d23..062b882 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/inventory/queue/AutodiscoveryPortlet.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.queue;
+import static org.rhq.enterprise.gui.coregui.client.util.WidgetsField.UNLIMITED;
+
import com.smartgwt.client.types.VerticalAlignment;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
@@ -37,6 +39,7 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.AutodiscoveryQueueDataSource;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.discovery.ResourceAutodiscoveryView;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
/**
@@ -44,12 +47,14 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
*/
public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements CustomSettingsPortlet {
+ //ui attributes/properties/indentifiers
public static final String KEY = "Discovery Queue";
private static final String AUTODISCOVERY_PLATFORM_MAX = "auto-discovery-platform-max";
- private String unlimited = "unlimited";
+ private String unlimited = UNLIMITED.propertyName();
private String defaultValue = unlimited;
+ //portlet settings and datasource elements
private DashboardPortlet storedPortlet;
- private int maximumPlatformsToDisplay = -1;
+ private AutodiscoveryQueueDataSource dataSource;
public AutodiscoveryPortlet(String locatorId) {
super(locatorId, true);
@@ -59,26 +64,35 @@ public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements C
protected void onInit() {
super.onInit();
//initialize the datasource to include Portlet instance
- if (getTreeGrid() != null) {
- getTreeGrid().setDataSource(new AutodiscoveryQueueDataSource(this));
+ this.dataSource = new AutodiscoveryQueueDataSource();
+ if ((getTreeGrid() != null) && (getDataSource() != null)) {
+ getTreeGrid().setDataSource(getDataSource());
}
}
- /** Implement configure action.
+ /** Implements configure action. Stores reference to the initiating DashboardPortlet.
+ * Method loads i)initial portlet settings OR ii)retrieves previous settings and adds to
+ * the datasource.
*/
@Override
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
this.storedPortlet = storedPortlet;
+ String retrieved = null;
+ //if settings already exist for this portlet
if (storedPortlet.getConfiguration().getSimple(AUTODISCOVERY_PLATFORM_MAX) != null) {
//retrieve and translate to int
- String retrieved = storedPortlet.getConfiguration().getSimple(AUTODISCOVERY_PLATFORM_MAX).getStringValue();
+ retrieved = storedPortlet.getConfiguration().getSimple(AUTODISCOVERY_PLATFORM_MAX).getStringValue();
+ } else {//create setting
+ storedPortlet.getConfiguration().put(new PropertySimple(AUTODISCOVERY_PLATFORM_MAX, defaultValue));
+ retrieved = defaultValue;
+ }
+
+ if (getDataSource() != null) {
if (retrieved.equals(unlimited)) {
- setMaximumPlatformsToDisplay(-1);
+ getDataSource().setMaximumPlatformsToDisplay(-1);
} else {
- setMaximumPlatformsToDisplay(Integer.parseInt(retrieved));
+ getDataSource().setMaximumPlatformsToDisplay(Integer.parseInt(retrieved));
}
- } else {//create setting
- storedPortlet.getConfiguration().put(new PropertySimple(AUTODISCOVERY_PLATFORM_MAX, defaultValue));
}
}
@@ -91,29 +105,28 @@ public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements C
*
*/
public DynamicForm getCustomSettingsForm() {
-
- final DynamicForm form = new DynamicForm();
+ final LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("Settings"));
form.setLayoutAlign(VerticalAlignment.CENTER);
//horizontal display component
- LocatableHLayout row = new LocatableHLayout("auto-discovery.configuration");
- BlurbItem label = new BlurbItem("discovery-platform-count-label");
+ LocatableHLayout row = new LocatableHLayout(extendLocatorId("auto-discovery.configuration"));
+ BlurbItem label = new BlurbItem(form.extendLocatorId("discovery-platform-count-label"));
label.setValue("Number of platforms to display");
+ label.setWrap(false);
//-------------combobox for number of platforms to display on the dashboard
- final SelectItem maximumPlatformsComboBox = new SelectItem(AUTODISCOVERY_PLATFORM_MAX);
- maximumPlatformsComboBox.setTitle("");
+ final SelectItem maximumPlatformsComboBox = new SelectItem(form.extendLocatorId(AUTODISCOVERY_PLATFORM_MAX), "");
//spinder 9/3/10: the following is required workaround to disable editability of combobox.
maximumPlatformsComboBox.setType("selection");
//define acceptable values for display amount
- String[] acceptableDisplayValues = { "1", "2", "5", "10", unlimited };
- maximumPlatformsComboBox.setValueMap(acceptableDisplayValues);
+ String[] displayValues = { "1", "2", "5", "10", unlimited };
+ maximumPlatformsComboBox.setValueMap(displayValues);
//set width of dropdown display region
maximumPlatformsComboBox.setWidth(100);
maximumPlatformsComboBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
String selectedItem = "" + event.getValue();
- //stuff into the master form for retrieval
+ //store in master form for retrieval
form.setValue(AUTODISCOVERY_PLATFORM_MAX, selectedItem);
}
});
@@ -129,12 +142,11 @@ public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements C
//default selected value to 'unlimited'(live lists) and check both combobox settings here.
String selectedValue = defaultValue;
- if (storedPortlet != null) {
- //if property exists retrieve it
- if (storedPortlet.getConfiguration().getSimple(AUTODISCOVERY_PLATFORM_MAX) != null) {
- selectedValue = storedPortlet.getConfiguration().getSimple(AUTODISCOVERY_PLATFORM_MAX).getStringValue();
- } else {//insert default value
- storedPortlet.getConfiguration().put(new PropertySimple(AUTODISCOVERY_PLATFORM_MAX, defaultValue));
+ if (getDataSource() != null) {
+ if (getDataSource().getMaximumPlatformsToDisplay() == -1) {
+ selectedValue = unlimited;
+ } else {
+ selectedValue = String.valueOf(getDataSource().getMaximumPlatformsToDisplay());
}
}
//prepopulate the combobox with the previously stored selection
@@ -144,9 +156,10 @@ public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements C
//submit handler
form.addSubmitValuesHandler(new SubmitValuesHandler() {
- @Override
+ //specify submit action.
public void onSubmitValues(SubmitValuesEvent event) {
if (form.getValue(AUTODISCOVERY_PLATFORM_MAX) != null) {
+ //persist this value to configuration
storedPortlet.getConfiguration().put(
new PropertySimple(AUTODISCOVERY_PLATFORM_MAX, form.getValue(AUTODISCOVERY_PLATFORM_MAX)));
}
@@ -164,11 +177,7 @@ public class AutodiscoveryPortlet extends ResourceAutodiscoveryView implements C
}
}
- public int getMaximumPlatformsToDisplay() {
- return maximumPlatformsToDisplay;
- }
-
- public void setMaximumPlatformsToDisplay(int maximumPlatformsToDisplay) {
- this.maximumPlatformsToDisplay = maximumPlatformsToDisplay;
+ public AutodiscoveryQueueDataSource getDataSource() {
+ return dataSource;
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
index f318cf4..18d262c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
@@ -36,7 +36,6 @@ import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
import com.smartgwt.client.widgets.grid.ListGridField;
import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
-import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.alert.AlertPriority;
@@ -50,9 +49,9 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
-import org.rhq.enterprise.gui.coregui.client.inventory.groups.wizard.GroupMembersStep;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceSelector;
import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
+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.LocatableLabel;
@@ -98,8 +97,9 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
private AlertResourceSelectorRegion resourceSelector;
private DashboardPortlet storedPortlet = null;
private AlertPortletDataSource dataSource;
+ //instance ui widgets
private Canvas containerCanvas;
- private HLayout resourceSelectionLabelRow;
+ private LocatableHLayout resourceSelectionLabelRow;
public RecentAlertsPortlet(String locatorId) {
this(locatorId, null, null);
@@ -264,7 +264,7 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
public DynamicForm getCustomSettingsForm() {
//root dynamic form instance
- final DynamicForm form = new DynamicForm();
+ final LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("custom-settings"));
form.setWidth(RecentAlertsPortlet.ALERT_RESOURCE_SELECTION_WIDTH + 40);//largest widget display + 40 for buttons
form.setHeight(450);
form.setMargin(5);
@@ -276,7 +276,7 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
LocatableLabel alertRangeLabel = new LocatableLabel("DynamicForm_Label_Alert_Range", "<b>Alert Range</b>");
//horizontal layout
- LocatableHLayout row = new LocatableHLayout("alert-range-settings-row-1");
+ LocatableHLayout row = new LocatableHLayout(extendLocatorId("alert-range-settings-row-1"));
row.setMembersMargin(10);
//-------------combobox for number of completed scheduled ops to display on the dashboard
@@ -352,9 +352,10 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
row.addMember(wrappedPriority);
//horizontal layout
- LocatableHLayout row2 = new LocatableHLayout("alert-range-settings-row-2");
+ LocatableHLayout row2 = new LocatableHLayout(extendLocatorId("alert-range-settings-row-2"));
- Label alertRangeSpanLabel = new Label("<b>within the past<b>");
+ LocatableLabel alertRangeSpanLabel = new LocatableLabel(extendLocatorId("range-span-label"),
+ "<b>within the past<b>");
//------------- Build second combobox for timeframe for problem resources search.
final SelectItem alertRangeTimeComboBox = new SelectItem(ALERT_RANGE_TIME_VALUE);
alertRangeTimeComboBox.setTitle("");
@@ -444,49 +445,53 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
row2.addMember(resourceSelectionWrapper);
//Row 3 of labels for the alert selected resources area
- resourceSelectionLabelRow = new HLayout();
+ resourceSelectionLabelRow = new LocatableHLayout(extendLocatorId("resource-selection-label"));
resourceSelectionLabelRow.setHeight(30);
resourceSelectionLabelRow.setMembersMargin(5);
resourceSelectionLabelRow.setWidth(RecentAlertsPortlet.ALERT_RESOURCE_SELECTION_WIDTH);//ui size + fixed button widths
- Label availableResourcesLabel = new Label("<b>" + ALERT_LABEL_AVAILABLE_RESOURCES + "</b>");
+ LocatableLabel availableResourcesLabel = new LocatableLabel(extendLocatorId("available-resources"), "<b>"
+ + ALERT_LABEL_AVAILABLE_RESOURCES + "</b>");
availableResourcesLabel.setHeight(20);
availableResourcesLabel.setWrap(false);
resourceSelectionLabelRow.addMember(availableResourcesLabel);
Label spacer = new Label("");
spacer.setWidth(400);
- Label selectedResourcesLabel = new Label("<b>" + ALERT_LABEL_SELECTED_RESOURCES + "</b>");
+ LocatableLabel selectedResourcesLabel = new LocatableLabel(extendLocatorId("selected-resources"), "<b>"
+ + ALERT_LABEL_SELECTED_RESOURCES + "</b>");
selectedResourcesLabel.setHeight(20);
selectedResourcesLabel.setWrap(false);
resourceSelectionLabelRow.addMember(spacer);
resourceSelectionLabelRow.addMember(selectedResourcesLabel);
- //##### if portlet config setting exist, then retrieve#############
+ //if portlet config setting exist, then retrieve
Integer[] alertFilterResourceIds = null;
alertFilterResourceIds = getDataSource().extractFilterResourceIds(storedPortlet, alertFilterResourceIds);
if (alertFilterResourceIds != null) {
getDataSource().setAlertFilterResourceId(alertFilterResourceIds);
}
- HLayout row4 = new HLayout();
- row4.setID("row4");
- // resourceSelector = new MemberSelect();
+ LocatableHLayout resourceSelectionRegion = new LocatableHLayout(extendLocatorId("selection-canvas"));
resourceSelector = new AlertResourceSelectorRegion(alertFilterResourceIds);
- row4.setWidth100();
+ resourceSelectionRegion.setWidth100();
+
+ //instantiate canvas area to display empty or rich resource selection based on dropdown selection
containerCanvas = new Canvas();
- String retProp = storedPortlet.getConfiguration().getSimple(ALERT_RANGE_RESOURCES_VALUE).getStringValue();
+ String previousAlertFilterChoice = storedPortlet.getConfiguration().getSimple(ALERT_RANGE_RESOURCES_VALUE)
+ .getStringValue();
//reload the ResourceSelectionRegion if user has chosen to focus on specific resources with alerts
- if (retProp.equals(RESOURCES_SELECTED)) {
+ if (previousAlertFilterChoice.equals(RESOURCES_SELECTED)) {
containerCanvas.addChild(resourceSelector.getCanvas());
- } else {
+ } else {// define empty canvas
containerCanvas.addChild(new Canvas());
//iterate over children of row3 and make invisible
for (Canvas c : resourceSelectionLabelRow.getMembers()) {
c.setVisible(false);
}
}
+
//add contain resource selection region.
- row4.addMember(containerCanvas);
+ resourceSelectionRegion.addMember(containerCanvas);
//finish construction of the layout
column.addMember(row);
@@ -497,7 +502,7 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
spacerWrapper.setItems(verticalSpace);
column.addMember(spacerWrapper);
column.addMember(resourceSelectionLabelRow);
- column.addMember(row4);
+ column.addMember(resourceSelectionRegion);
form.addChild(column);
//submit handler
@@ -525,7 +530,7 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
storedPortlet.getConfiguration().put(new PropertyList(ALERT_RANGE_RESOURCE_IDS, list));
getDataSource().setAlertFilterResourceId(resourceSelector.getCurrentlyAssignedIds());
}
- refresh();//
+ refresh();//reload form with new data selections
markForRedraw();
}
});
@@ -564,25 +569,13 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
}
}
-class CustomizedResourceSelector extends ResourceSelector {
- public CustomizedResourceSelector(String locatorId) {
- super(locatorId);
- }
-
- public CustomizedResourceSelector(String locatorId, ResourceType rtFilter, boolean forceRtFilter) {
- super(locatorId, rtFilter, forceRtFilter);
- }
+/** Bundles a ResourceSelector instance with labelling in Canvas for display.
+ * Also modifies the AssignedGrid to listen for AvailbleGrid completion and act accordingly.
+ */
+class AlertResourceSelectorRegion {
- public void addAvailableGridSelectionsToAssignedGrid() {
- assignedGrid.transferSelectedData(availableGrid);
- select(assignedGrid.getSelection());
- updateButtons();
- }
-}
+ private ResourceSelector selector = null;
-class AlertResourceSelectorRegion extends GroupMembersStep {
- // private ResourceSelector selector = null;
- private CustomizedResourceSelector selector = null;
private Integer[] currentlyAssignedIds;
public Integer[] getCurrentlyAssignedIds() {
@@ -605,20 +598,20 @@ class AlertResourceSelectorRegion extends GroupMembersStep {
}
public AlertResourceSelectorRegion(Integer[] assigned) {
- super(null);
this.currentlyAssignedIds = assigned;
}
public Canvas getCanvas() {
if (selector == null) {
- // selector = new ResourceSelector(getName());
- selector = new CustomizedResourceSelector(getName(), ResourceType.ANY_PLATFORM_TYPE, true);
+ selector = new ResourceSelector("Select Members", ResourceType.ANY_PLATFORM_TYPE, true);
selector.setWidth100();
selector.setWidth(RecentAlertsPortlet.ALERT_RESOURCE_SELECTION_WIDTH);
//widget ui updates
selector.getAvailableGrid().setTitle("Available Resources");
selector.getAvailableGrid().setEmptyMessage("Loading data...");
selector.getAssignedGrid().setTitle("Selected Resources");
+ //disable display typeFilter.
+ selector.setDisplayResourceTypeFilter(false);
//populate fields for grid.
ListGridField nameField = new ListGridField("name", "Name");
@@ -634,12 +627,14 @@ class AlertResourceSelectorRegion extends GroupMembersStep {
if ((getCurrentlyAssignedIds() != null) && (getCurrentlyAssignedIds().length > 0)) {
//retrieve the loaded data and add to the table itself
RecordList recordList = selector.getAvailableGrid().getDataAsRecordList();
+ //for each of the resource ids loaded from settings, select that row for transfer.
for (int ci : getCurrentlyAssignedIds()) {
int located = recordList.findIndex("id", ci);
if (located > -1) {
selector.getAvailableGrid().selectRecord(located);
}
}
+ //simulate 'add' button push.
selector.addAvailableGridSelectionsToAssignedGrid();
selector.getAssignedGrid().invalidateCache();
selector.getAssignedGrid().markForRedraw();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
index 54647a1..2484d63 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/operations/OperationsPortlet.java
@@ -21,7 +21,6 @@ package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.operatio
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.events.SubmitValuesEvent;
import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
@@ -43,7 +42,9 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
import org.rhq.enterprise.gui.coregui.client.operation.RecentOperationsDataSource;
import org.rhq.enterprise.gui.coregui.client.operation.ScheduledOperationsDataSource;
+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.LocatableLabel;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableListGrid;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
@@ -193,17 +194,17 @@ public class OperationsPortlet extends LocatableVLayout implements CustomSetting
public DynamicForm getCustomSettingsForm() {
//root dynamic form instance
- final DynamicForm form = new DynamicForm();
+ final LocatableDynamicForm form = new LocatableDynamicForm("custom-settings");
//vertical layout
VStack column = new VStack();
//label
- Label operationRange = new Label("Operation Range");
+ LocatableLabel operationRange = new LocatableLabel(extendLocatorId("operation-range"), "Operation Range");
column.addMember(operationRange);
//horizontal layout
- LocatableHLayout row = new LocatableHLayout("enable.completed.operations");
+ LocatableHLayout row = new LocatableHLayout(extendLocatorId("enable.completed.operations"));
//checkbox indicating whether to apply completed operations grouping settings
final CheckboxItem enableCompletedOperationsGrouping = new CheckboxItem();
@@ -266,7 +267,7 @@ public class OperationsPortlet extends LocatableVLayout implements CustomSetting
row.addMember(item2);
//horizontal layout
- LocatableHLayout row2 = new LocatableHLayout("enable.scheduled.operations");
+ LocatableHLayout sheduledOperationsLayout = new LocatableHLayout(extendLocatorId("enable.scheduled.operations"));
final CheckboxItem enableScheduledOperationsGrouping = new CheckboxItem();
enableScheduledOperationsGrouping.setName(OPERATIONS_RANGE_SCHEDULED_ENABLED);
@@ -282,7 +283,7 @@ public class OperationsPortlet extends LocatableVLayout implements CustomSetting
//wrap field item in dynamicform for addition
DynamicForm fieldWrapper = new DynamicForm();
fieldWrapper.setFields(enableScheduledOperationsGrouping);
- row2.addMember(fieldWrapper);
+ sheduledOperationsLayout.addMember(fieldWrapper);
//retrieve previous value otherwise initialize to true(live unlimited list)
retrieved = storedPortlet.getConfiguration().getSimple(OPERATIONS_RANGE_SCHEDULED_ENABLED);
@@ -321,9 +322,9 @@ public class OperationsPortlet extends LocatableVLayout implements CustomSetting
maximumScheduledOperationsComboBox.setDefaultValue(selectedValue);
DynamicForm fieldWrapper2 = new DynamicForm();
fieldWrapper2.setFields(maximumScheduledOperationsComboBox);
- row2.addMember(fieldWrapper2);
+ sheduledOperationsLayout.addMember(fieldWrapper2);
column.addMember(row);
- column.addMember(row2);
+ column.addMember(sheduledOperationsLayout);
form.addChild(column);
//submit handler
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
index 2778c59..d233d5b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/problems/ProblemResourcesPortlet.java
@@ -26,7 +26,6 @@ import java.util.List;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
-import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.events.SubmitValuesEvent;
import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
@@ -46,7 +45,9 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
import org.rhq.enterprise.gui.coregui.client.resource.ProblemResourcesDataSource;
import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
+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.LocatableLabel;
/**
* A view that displays a paginated table of Resources with alerts,
@@ -157,7 +158,7 @@ public class ProblemResourcesPortlet extends Table implements CustomSettingsPort
*/
public DynamicForm getCustomSettingsForm() {
- final DynamicForm form = new DynamicForm();
+ final LocatableDynamicForm form = new LocatableDynamicForm(extendLocatorId("custom-settings"));
//-------------combobox for number of resource to display on the dashboard
final SelectItem maximumProblemResourcesComboBox = new SelectItem(PROBLEM_RESOURCE_SHOW_MAX);
@@ -289,7 +290,7 @@ public class ProblemResourcesPortlet extends Table implements CustomSettingsPort
* @author spinder
*/
class TimeRange extends LocatableHLayout implements TableWidget {
- private Label label = new Label();
+ private LocatableLabel label = new LocatableLabel(extendLocatorId("time-range-label"));
private ProblemResourcesPortlet portlet = null;
public TimeRange(String locatorId, ProblemResourcesPortlet problemResourcesPortlet) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java
index 859a7d5..361a1f7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/summary/InventorySummaryView.java
@@ -45,25 +45,30 @@ import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceBossGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.InventoryView;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
public class InventorySummaryView extends LocatableVLayout implements Portlet {
private ResourceBossGWTServiceAsync resourceBossService = GWTServiceLookup.getResourceBossService();
- private DynamicForm form;
+ private LocatableDynamicForm form;
public static final String KEY = "Summary Counts";
public InventorySummaryView(String locatorId) {
super(locatorId);
+ loadInventoryViewDiata();
+ }
+
+ private void loadInventoryViewDiata() {
resourceBossService.getInventorySummaryForLoggedInUser(new AsyncCallback<InventorySummary>() {
public void onFailure(Throwable throwable) {
CoreGUI.getErrorHandler().handleError("Failed to retrieve inventory summary", throwable);
}
public void onSuccess(InventorySummary summary) {
- form = new DynamicForm();
+ form = new LocatableDynamicForm("Portlet_Inventory_Summary");
List<FormItem> formItems = new ArrayList<FormItem>();
// HeaderItem headerItem = new HeaderItem("header");
@@ -131,6 +136,17 @@ public class InventorySummaryView extends LocatableVLayout implements Portlet {
return null; // TODO: Implement this method.
}
+ /** Custom refresh operation as we are not directly extending Table
+ */
+ @Override
+ public void redraw() {
+ super.redraw();
+ //destroy form
+ form.destroy();
+ //now reload the data
+ loadInventoryViewDiata();
+ }
+
public static final class Factory implements PortletViewFactory {
public static PortletViewFactory INSTANCE = new Factory();
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 63ed782..a881444 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
@@ -39,8 +39,6 @@ import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
-import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
-import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.inventory.queue.AutodiscoveryPortlet;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
@@ -49,15 +47,10 @@ import org.rhq.enterprise.gui.coregui.client.gwt.ResourceGWTServiceAsync;
*/
public class AutodiscoveryQueueDataSource extends DataSource {
- private Portlet portlet = null;
private int unlimited = -1;
+ private int maximumPlatformsToDisplay = -1;
private ResourceGWTServiceAsync resourceService = GWTServiceLookup.getResourceService();
- public AutodiscoveryQueueDataSource(Portlet portlet) {
- this();
- this.portlet = portlet;
- }
-
public AutodiscoveryQueueDataSource() {
setClientOnly(false);
setDataProtocol(DSProtocol.CLIENTCUSTOM);
@@ -159,10 +152,8 @@ public class AutodiscoveryQueueDataSource extends DataSource {
protected PageControl getPageControl(DSRequest request) {
// Initialize paging.
PageControl pageControl;
- //retrieve portlet.configurationInformation
- if ((this.portlet != null) || (this.portlet instanceof AutodiscoveryPortlet)) {//using default
- AutodiscoveryPortlet settings = (AutodiscoveryPortlet) this.portlet;
- pageControl = new PageControl(0, settings.getMaximumPlatformsToDisplay());
+ if (getMaximumPlatformsToDisplay() > -1) {//using default
+ pageControl = new PageControl(0, getMaximumPlatformsToDisplay());
} else {
pageControl = new PageControl(0, unlimited);
}
@@ -221,4 +212,13 @@ public class AutodiscoveryQueueDataSource extends DataSource {
return getAttribute("parentId");
}
}
+
+ public int getMaximumPlatformsToDisplay() {
+ return maximumPlatformsToDisplay;
+ }
+
+ public void setMaximumPlatformsToDisplay(int maximumPlatformsToDisplay) {
+ this.maximumPlatformsToDisplay = maximumPlatformsToDisplay;
+ }
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
index 0047b1f..432ca27 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/ResourceSelector.java
@@ -49,6 +49,7 @@ public class ResourceSelector extends AbstractSelector<Resource> {
private ResourceType resourceTypeFilter;
private boolean forceResourceTypeFilter;
+ private boolean displayResourceTypeFilter = true;
private IPickTreeItem typeSelectItem;
public ResourceSelector(String locatorId) {
@@ -80,6 +81,9 @@ public class ResourceSelector extends AbstractSelector<Resource> {
if (this.forceResourceTypeFilter) {
typeSelectItem.setDisabled(true);
}
+ if (!isDisplayResourceTypeFilter()) {
+ typeSelectItem.setVisible(false);
+ }
categorySelect = new SelectItem("category", "Category");
categorySelect.setValueMap("Platform", "Server", "Service");
@@ -126,6 +130,14 @@ public class ResourceSelector extends AbstractSelector<Resource> {
return criteria;
}
+ /** transfers selected data to the assigned grid. This operation mimics button click from ResourceSelection.
+ */
+ public void addAvailableGridSelectionsToAssignedGrid() {
+ assignedGrid.transferSelectedData(availableGrid);
+ select(assignedGrid.getSelection());
+ updateButtons();
+ }
+
// protected Criteria getLatestCriteria(DynamicForm availableFilterForm) {
// String search = (String) availableFilterForm.getValue("search");
// String type = availableFilterForm.getValueAsString("type");
@@ -183,4 +195,12 @@ public class ResourceSelector extends AbstractSelector<Resource> {
}
}
+
+ public boolean isDisplayResourceTypeFilter() {
+ return displayResourceTypeFilter;
+ }
+
+ public void setDisplayResourceTypeFilter(boolean displayResourceTypeFilter) {
+ this.displayResourceTypeFilter = displayResourceTypeFilter;
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
index 2c02f25..863afe2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/RecentOperationsDataSource.java
@@ -48,6 +48,7 @@ import org.rhq.enterprise.gui.coregui.client.util.RPCDataSource;
*/
public class RecentOperationsDataSource extends
RPCDataSource<DisambiguationReport<ResourceOperationLastCompletedComposite>> {
+ //ui keys
public static final String resource = "resource";
public static final String location = "location";
public static final String operation = "operation";
@@ -58,7 +59,6 @@ public class RecentOperationsDataSource extends
//config attributes
private boolean operationsRangeLastEnabled = false;
private int operationsRangeCompleted = -1;
- private boolean dataRangeDisabled = true;
public static String RANGE_DISABLED_MESSAGE = "(Results currently disabled. Change settings to enable results.)";
/** Build list of fields for the datasource and then adds them to it.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/WidgetsField.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/WidgetsField.java
new file mode 100644
index 0000000..ba8413a
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/WidgetsField.java
@@ -0,0 +1,63 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 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.util;
+
+public enum WidgetsField {
+
+ UNLIMITED("unlimited", "Unlimited");
+
+ // DESCRIPTION("description", "Description"),
+ //
+ // TYPE("resourceType.name", "Type"),
+ //
+ // PLUGIN("pluginName", "Plugin"),
+ //
+ // CATEGORY("resourceType.category", "Category"),
+ //
+ // AVAILABILITY("currentAvailability", "Availability");
+
+ /**
+ * Corresponds to a property name of Resource
+ */
+ private String propertyName;
+
+ /**
+ * The display name for the field or property
+ */
+ private String title;
+
+ private WidgetsField(String propertyName, String title) {
+ this.propertyName = propertyName;
+ this.title = title;
+ }
+
+ public String propertyName() {
+ return propertyName;
+ }
+
+ public String title() {
+ return title;
+ }
+
+}
commit ca19ca4e70a06d02fd701e2aa57a4c7090f4e2f8
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Wed Sep 22 12:24:02 2010 -0400
initial rss portet badge work.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
index 457b75d..caffe54 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/PortletWindow.java
@@ -27,6 +27,7 @@ import com.smartgwt.client.types.HeaderControls;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HeaderControl;
+import com.smartgwt.client.widgets.HeaderControl.HeaderIcon;
import com.smartgwt.client.widgets.events.ClickEvent;
import com.smartgwt.client.widgets.events.ClickHandler;
import com.smartgwt.client.widgets.events.CloseClickHandler;
@@ -46,6 +47,7 @@ public class PortletWindow extends LocatableWindow {
private DashboardView dashboardView;
private DashboardPortlet dashboardPortlet;
+ private static String RSS = "Rss";
private Portlet view;
@@ -58,6 +60,8 @@ public class PortletWindow extends LocatableWindow {
private ClickHandler helpHandlerDelegate = NO_OP_HANDLER;
+ private ClickHandler rssHandlerDelegate = NO_OP_HANDLER;
+
private ClickHandler settingsHandler = new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
settingsHandlerDelegate.onClick(clickEvent);
@@ -70,6 +74,12 @@ public class PortletWindow extends LocatableWindow {
}
};
+ private ClickHandler rssHandler = new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ rssHandlerDelegate.onClick(clickEvent);
+ }
+ };
+
private ClickHandler refreshHandler = new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
if (PortletWindow.this.view instanceof Table) {
@@ -91,6 +101,11 @@ public class PortletWindow extends LocatableWindow {
// setShowHeader(false);
// setShowEdges(false);
+ //configure HeaderControls with toolTips
+ LocatableHeaderControl RssHeader = new LocatableHeaderControl(extendLocatorId(RSS), new HeaderIcon(
+ "[SKIN]/headerIcons/clipboard.png"), rssHandler);
+ RssHeader.setTooltip(RSS);
+
// customize the appearance and order of the controls in the window header
setHeaderControls(HeaderControls.MINIMIZE_BUTTON, HeaderControls.HEADER_LABEL, new LocatableHeaderControl(
extendLocatorId("Refresh"), HeaderControl.REFRESH, refreshHandler), new LocatableHeaderControl(
commit ef9231d7fcda51f9ca9e64bf91086e2237d63ccd
Merge: 2f19995... ed4c35f...
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Sep 21 18:04:25 2010 -0400
Merge branch 'master' of ssh://spinder@git.fedorahosted.org/git/rhq/rhq into track-master
commit 2f1999541edf590c3af79484071c28ef6dffeee6
Merge: 09d836b... a67696b...
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Sep 21 16:37:00 2010 -0400
Merge branch 'master' of ssh://spinder@git.fedorahosted.org/git/rhq/rhq into track-master
commit 09d836bba1d73eef4d48cc6dcf83931b042572fd
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Sep 21 14:52:29 2010 -0400
commit to bind WS namespace to the build versioning.
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index 04d3557..4c4e9a5 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -406,7 +406,16 @@
<build>
<finalName>${project.artifactId}</finalName>
+ <!-- point to new source code directory that has been filtered. -->
+ <sourceDirectory>target/filtered-sources/java</sourceDirectory>
+
<resources>
+ <!-- Redefine which directories to treat like resources(which are filtered). -->
+ <resource>
+ <directory>src/main/java</directory>
+ <filtering>true</filtering>
+ <targetPath>../filtered-sources/java</targetPath>
+ </resource>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/ServerVersion.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/ServerVersion.java
index e8114aa..275a5c6 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/ServerVersion.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/ServerVersion.java
@@ -42,10 +42,8 @@ public class ServerVersion implements Serializable {
private String version;
private String build;
- //This value must be set by build system just before Build Time.
- public static final String namespace = "http://www.rhq-project.org/2.4/2010/7/Webservices.xsd";
-
- // private final String namespace = "@ws-namespace@";
+ //This value must be set by build system just before Build/Compile Time.
+ public static final String namespace = "http://www.rhq-project.org/${pom.version}/Webservices.xsd";
public ServerVersion(String version, String build) {
this.version = version;
commit 2fa80f50dfdbf1ba8820f1300066b669e2328eb1
Merge: 9075e22... c073bce...
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Sep 21 14:36:28 2010 -0400
Merge branch 'master' of ssh://spinder@git.fedorahosted.org/git/rhq/rhq into track-master
commit 9075e226eaac9f7476d7b51f8582749eea54d50d
Merge: aba004b... 73c0d37...
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Sep 21 09:10:35 2010 -0400
Merge branch 'master' of ssh://spinder@git.fedorahosted.org/git/rhq/rhq into track-master
commit aba004b202fd48d2d869908b96052cae9d9a5aca
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Tue Sep 21 08:40:46 2010 -0400
RecentAlerts config changes and some modifications to super classes for reuse.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletDataSource.java
index a639fca..d21ab76 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletDataSource.java
@@ -7,10 +7,15 @@ import com.smartgwt.client.rpc.RPCResponse;
import org.rhq.core.domain.alert.Alert;
import org.rhq.core.domain.alert.AlertPriority;
+import org.rhq.core.domain.configuration.Property;
+import org.rhq.core.domain.configuration.PropertyList;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.criteria.AlertCriteria;
+import org.rhq.core.domain.dashboard.DashboardPortlet;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts.RecentAlertsPortlet;
public class AlertPortletDataSource extends AlertDataSource {
//configuration attributes
@@ -19,12 +24,50 @@ public class AlertPortletDataSource extends AlertDataSource {
private long alertTimeRange = -1;
private String alertResourcesToUse = "all";
private Integer[] alertFilterResourceIds = {};
+ private DashboardPortlet portlet = null;
+
+ public AlertPortletDataSource() {
+ super();
+ }
+
+ public AlertPortletDataSource(DashboardPortlet recentAlertsPortlet) {
+ super();
+ this.portlet = recentAlertsPortlet;
+ }
/** Override the executeFetch for AlertPortlet to allow specifying smaller than total
* result displays.
*/
protected void executeFetch(final DSRequest request, final DSResponse response) {
final long start = System.currentTimeMillis();
+ //retrieve previous settings from portlet config
+ if ((portlet != null) && (this.portlet instanceof DashboardPortlet)) {
+ //must check for whether portlet config
+ PropertySimple property = portlet.getConfiguration().getSimple(
+ RecentAlertsPortlet.ALERT_RANGE_RESOURCES_VALUE);
+ if ((property != null) && (property.getStringValue() != null)) {
+ //retrieve and translate to int
+ String retrieved = property.getStringValue();
+ if (retrieved.trim().equalsIgnoreCase(RecentAlertsPortlet.RESOURCES_SELECTED)) {
+ setAlertResourcesToUse(RecentAlertsPortlet.RESOURCES_SELECTED);
+ } else {
+ setAlertResourcesToUse(RecentAlertsPortlet.RESOURCES_ALL);
+ }
+ //if 'selected' then check for previously set resource ids to filter on
+ if (getAlertResourcesToUse().equals(RecentAlertsPortlet.RESOURCES_SELECTED)) {
+ Integer[] alertResourceFilterIds = null;
+ alertResourceFilterIds = extractFilterResourceIds(portlet, alertResourceFilterIds);
+ if (alertFilterResourceIds != null) {
+ setAlertFilterResourceId(alertFilterResourceIds);
+ }
+ }
+ } else {//create setting
+ portlet.getConfiguration().put(
+ new PropertySimple(RecentAlertsPortlet.ALERT_RANGE_RESOURCES_VALUE,
+ RecentAlertsPortlet.defaultResourceValue));
+ setAlertResourcesToUse(RecentAlertsPortlet.RESOURCES_ALL);
+ }
+ }
AlertCriteria criteria = new AlertCriteria();
criteria.fetchAlertDefinition(true);
@@ -34,7 +77,8 @@ public class AlertPortletDataSource extends AlertDataSource {
PageControl pc = new PageControl(0, getAlertRangeCompleted());
criteria.setPageControl(pc);//display per page
criteria.addFilterStartTime(getAlertTimeRange());//alert age
- if (getAlertResourcesToUse().equalsIgnoreCase("selected")) {
+ if ((getAlertResourcesToUse().equalsIgnoreCase(RecentAlertsPortlet.RESOURCES_SELECTED))
+ && (getAlertFilterResourceIds().length > 0)) {
//add resource ids to filter on
criteria.addFilterResourceIds(getAlertFilterResourceIds());
}
@@ -99,4 +143,25 @@ public class AlertPortletDataSource extends AlertDataSource {
public void setAlertFilterResourceId(Integer[] alertFilterResourceId) {
this.alertFilterResourceIds = alertFilterResourceId;
}
+
+ public Integer[] extractFilterResourceIds(DashboardPortlet storedPortlet, Integer[] filterResourceIds) {
+ PropertyList propertyList = storedPortlet.getConfiguration().getList(
+ RecentAlertsPortlet.ALERT_RANGE_RESOURCE_IDS);
+ if ((propertyList != null) && (propertyList.getList() != null) && (!propertyList.getList().isEmpty())
+ && (propertyList.getList().get(0) != null)) {
+ Property container = propertyList.getList().get(0);
+ if (container instanceof PropertyList) {
+ PropertyList anotherList = (PropertyList) container;
+ if (anotherList.getList() != null) {
+ filterResourceIds = new Integer[anotherList.getList().size()];
+ int index = 0;
+ for (Property p : anotherList.getList()) {
+ filterResourceIds[index++] = ((PropertySimple) p).getIntegerValue();
+ }
+ }
+ }
+ }
+ return filterResourceIds;
+ }
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
index 1c8774f..e5a9d1f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/AbstractSelector.java
@@ -182,6 +182,7 @@ public abstract class AbstractSelector<T> extends LocatableVLayout {
updateButtons();
}
});
+
removeButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
deselect(assignedGrid.getSelection());
@@ -265,6 +266,16 @@ public abstract class AbstractSelector<T> extends LocatableVLayout {
addMember(hlayout);
}
+ protected ClickHandler getAddButtonClickHandler() {
+ return new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ assignedGrid.transferSelectedData(availableGrid);
+ select(assignedGrid.getSelection());
+ updateButtons();
+ }
+ };
+ }
+
@Override
protected void onDestroy() {
super.onDestroy();
@@ -310,4 +321,16 @@ public abstract class AbstractSelector<T> extends LocatableVLayout {
}
availableGrid.markForRedraw();
}
+
+ public LocatableListGrid getAvailableGrid() {
+ return availableGrid;
+ }
+
+ public LocatableListGrid getAssignedGrid() {
+ return assignedGrid;
+ }
+
+ // public TransferImgButton getAddButton() {
+ // return addButton;
+ // }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
index 9e0ee74..c3dea19 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/DashboardsView.java
@@ -223,13 +223,13 @@ public class DashboardsView extends LocatableVLayout implements BookmarkableView
DashboardPortlet discoveryQueue = new DashboardPortlet("Discovery Queue", AutodiscoveryPortlet.KEY, 250);
dashboard.addPortlet(discoveryQueue, 1, 2);
- DashboardPortlet recentAlerts = new DashboardPortlet("Recent Alerts", RecentAlertsPortlet.KEY, 250);
+ DashboardPortlet recentAlerts = new DashboardPortlet(RecentAlertsPortlet.KEY, RecentAlertsPortlet.KEY, 250);
dashboard.addPortlet(recentAlerts, 1, 3);
DashboardPortlet recentlyAdded = new DashboardPortlet("Recently Added Resources", RecentlyAddedView.KEY, 250);
dashboard.addPortlet(recentlyAdded, 1, 4);
- DashboardPortlet operations = new DashboardPortlet("Operations", OperationsPortlet.KEY, 250);
+ DashboardPortlet operations = new DashboardPortlet("Operations", OperationsPortlet.KEY, 500);
dashboard.addPortlet(operations, 1, 5);
DashboardPortlet problemResources = new DashboardPortlet("Has Alerts or Currently Unavailable",
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
index c1a4ef9..f88f949 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
@@ -19,6 +19,9 @@
package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts;
import com.smartgwt.client.data.Criteria;
+import com.smartgwt.client.data.Record;
+import com.smartgwt.client.data.RecordList;
+import com.smartgwt.client.types.ListGridFieldType;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
@@ -27,24 +30,34 @@ import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.events.SubmitValuesEvent;
import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.SpacerItem;
import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
+import com.smartgwt.client.widgets.grid.ListGridField;
+import com.smartgwt.client.widgets.grid.events.DataArrivedEvent;
+import com.smartgwt.client.widgets.grid.events.DataArrivedHandler;
+import com.smartgwt.client.widgets.layout.HLayout;
import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.alert.AlertPriority;
+import org.rhq.core.domain.configuration.PropertyList;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.gui.coregui.client.alert.AlertPortletDataSource;
import org.rhq.enterprise.gui.coregui.client.alert.AlertsView;
import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.wizard.GroupMembersStep;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.selection.ResourceSelector;
import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
/**
+ * @author Simeon Pinder
* @author Greg Hinkle
*/
public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPortlet {
@@ -52,10 +65,11 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
public static final String KEY = "Recent Alerts";
public static final String TITLE = KEY;
//widget keys also used in form population
- private static final String ALERT_RANGE_DISPLAY_AMOUNT_VALUE = "alert-range-display-amount-value";
- private static final String ALERT_RANGE_PRIORITY_VALUE = "alert-range-priority-value";
- private static final String ALERT_RANGE_TIME_VALUE = "alert-range-time-value";
- private static final String ALERT_RANGE_RESOURCES_VALUE = "alert-range-resource-value";
+ public static final String ALERT_RANGE_DISPLAY_AMOUNT_VALUE = "alert-range-display-amount-value";
+ public static final String ALERT_RANGE_PRIORITY_VALUE = "alert-range-priority-value";
+ public static final String ALERT_RANGE_TIME_VALUE = "alert-range-time-value";
+ public static final String ALERT_RANGE_RESOURCES_VALUE = "alert-range-resource-value";
+ public static final String ALERT_RANGE_RESOURCE_IDS = "alert-range-resource-ids";
//configuration default information
private static final String defaultAlertCountValue = "5";
private static final String PRIORITY_ALL = "ALL";
@@ -70,16 +84,24 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
private static final String TIME_WEEK = "week";
private static final String TIME_MONTH = "month";
private static final String defaultTimeValue = TIME_DAY;
- private static final String RESOURCES_ALL = "all resources";
- private static final String RESOURCES_SELECTED = "selected resources";
- private static final String defaultResourceValue = RESOURCES_ALL;
+ public static final String RESOURCES_ALL = "all resources";
+ public static final String RESOURCES_SELECTED = "selected resources";
+ public static final String defaultResourceValue = RESOURCES_ALL;
private static final String unlimited = "unlimited";
- //configuration container element
+ //alert resource labels
+ public static final String ALERT_LABEL_SELECTED_RESOURCES = "Selected Resources";
+ public static final String ALERT_LABEL_AVAILABLE_RESOURCES = "Available Resources";
+ public static final String ALERT_LABEL_RESOURCE_INVENTORY = "Resource Inventory";
+ public static final int ALERT_RESOURCE_SELECTION_WIDTH = 800;
+ public static final String ID = "id";
+ //shared private UI elements
+ private AlertResourceSelectorRegion resourceSelector;
private DashboardPortlet storedPortlet = null;
private AlertPortletDataSource dataSource;
+ private Canvas containerCanvas;
+ private HLayout resourceSelectionLabelRow;
public RecentAlertsPortlet(String locatorId) {
- // super(locatorId);
this(locatorId, null, null);
setShowHeader(false);
@@ -106,7 +128,6 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
//retrieve and translate to int
String retrieved = property.getStringValue();
int translatedAlertRangeSelection = translatedAlertRangeSelection(retrieved);
- // getDataSource().setAlertRangeCompleted(Integer.parseInt(retrieved));
getDataSource().setAlertRangeCompleted(translatedAlertRangeSelection);
} else {//create setting
storedPortlet.getConfiguration().put(
@@ -143,13 +164,35 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
//retrieve and translate to int
String retrieved = property.getStringValue();
if (retrieved.trim().equalsIgnoreCase(RESOURCES_SELECTED)) {
- getDataSource().setAlertResourcesToUse("selected");
+ getDataSource().setAlertResourcesToUse(RESOURCES_SELECTED);
} else {
- getDataSource().setAlertResourcesToUse("all");
+ getDataSource().setAlertResourcesToUse(RESOURCES_ALL);
}
} else {//create setting
storedPortlet.getConfiguration().put(new PropertySimple(ALERT_RANGE_RESOURCES_VALUE, defaultResourceValue));
- getDataSource().setAlertResourcesToUse("all");
+ getDataSource().setAlertResourcesToUse(RESOURCES_ALL);
+ }
+
+ //resource ids to be conditionally included in the query
+ Integer[] filterResourceIds = null;
+ filterResourceIds = getDataSource().extractFilterResourceIds(storedPortlet, filterResourceIds);
+ //no defaults
+
+ if (filterResourceIds != null) {
+ getDataSource().setAlertFilterResourceId(filterResourceIds);
+ }
+
+ //conditionally display the selected resources ui
+ if (containerCanvas != null) {
+ //empty out earlier canvas
+ for (Canvas c : containerCanvas.getChildren()) {
+ c.destroy();
+ }
+ if ((resourceSelector != null) && getDataSource().getAlertResourcesToUse().equals(RESOURCES_SELECTED)) {
+ containerCanvas.addChild(resourceSelector.getCanvas());
+ } else {
+ containerCanvas.addChild(new Canvas());
+ }
}
}
@@ -222,8 +265,11 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
//root dynamic form instance
final DynamicForm form = new DynamicForm();
- form.setWidth(200);
+ form.setWidth(RecentAlertsPortlet.ALERT_RESOURCE_SELECTION_WIDTH + 40);//largest widget display + 40 for buttons
+ form.setHeight(450);
+ form.setMargin(5);
+ //vertical container
VLayout column = new VLayout();
//label
@@ -348,12 +394,29 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
alertResourcesComboBox.setType("selection");
String[] acceptableResourceDisplayValues = { RESOURCES_ALL, RESOURCES_SELECTED };
alertResourcesComboBox.setValueMap(acceptableResourceDisplayValues);
- alertResourcesComboBox.setWidth(100);
+ alertResourcesComboBox.setWidth(150);
alertResourcesComboBox.addChangeHandler(new ChangeHandler() {
public void onChange(ChangeEvent event) {
String selectedItem = "" + event.getValue();
//stuff into the master form for retrieval
form.setValue(ALERT_RANGE_RESOURCES_VALUE, selectedItem);
+ //empty out earlier canvas
+ for (Canvas c : containerCanvas.getChildren()) {
+ c.destroy();
+ }
+ if (selectedItem.equals(RESOURCES_SELECTED)) {
+ containerCanvas.addChild(resourceSelector.getCanvas());
+ resourceSelectionLabelRow.setVisible(true);
+ for (Canvas c : resourceSelectionLabelRow.getMembers()) {
+ c.setVisible(true);
+ }
+ } else {
+ containerCanvas.addChild(new Canvas());
+ resourceSelectionLabelRow.setVisible(false);
+ for (Canvas c : resourceSelectionLabelRow.getMembers()) {
+ c.setVisible(false);
+ }
+ }
}
});
@@ -379,8 +442,62 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
row2.addMember(alertRangeSpanLabel);
row2.addMember(timeSelectionWrapper);
row2.addMember(resourceSelectionWrapper);
+
+ //Row 3 of labels for the alert selected resources area
+ resourceSelectionLabelRow = new HLayout();
+ resourceSelectionLabelRow.setHeight(30);
+ resourceSelectionLabelRow.setMembersMargin(5);
+ resourceSelectionLabelRow.setWidth(RecentAlertsPortlet.ALERT_RESOURCE_SELECTION_WIDTH);//ui size + fixed button widths
+ Label availableResourcesLabel = new Label("<b>" + ALERT_LABEL_AVAILABLE_RESOURCES + "</b>");
+ availableResourcesLabel.setHeight(20);
+ availableResourcesLabel.setWrap(false);
+ resourceSelectionLabelRow.addMember(availableResourcesLabel);
+ Label spacer = new Label("");
+ spacer.setWidth(400);
+ Label selectedResourcesLabel = new Label("<b>" + ALERT_LABEL_SELECTED_RESOURCES + "</b>");
+ selectedResourcesLabel.setHeight(20);
+ selectedResourcesLabel.setWrap(false);
+ resourceSelectionLabelRow.addMember(spacer);
+ resourceSelectionLabelRow.addMember(selectedResourcesLabel);
+
+ //##### if portlet config setting exist, then retrieve#############
+ Integer[] alertFilterResourceIds = null;
+ alertFilterResourceIds = getDataSource().extractFilterResourceIds(storedPortlet, alertFilterResourceIds);
+ if (alertFilterResourceIds != null) {
+ getDataSource().setAlertFilterResourceId(alertFilterResourceIds);
+ }
+
+ HLayout row4 = new HLayout();
+ row4.setID("row4");
+ // resourceSelector = new MemberSelect();
+ resourceSelector = new AlertResourceSelectorRegion(alertFilterResourceIds);
+ row4.setWidth100();
+ containerCanvas = new Canvas();
+ String retProp = storedPortlet.getConfiguration().getSimple(ALERT_RANGE_RESOURCES_VALUE).getStringValue();
+
+ //reload the ResourceSelectionRegion if user has chosen to focus on specific resources with alerts
+ if (retProp.equals(RESOURCES_SELECTED)) {
+ containerCanvas.addChild(resourceSelector.getCanvas());
+ } else {
+ containerCanvas.addChild(new Canvas());
+ //iterate over children of row3 and make invisible
+ for (Canvas c : resourceSelectionLabelRow.getMembers()) {
+ c.setVisible(false);
+ }
+ }
+ //add contain resource selection region.
+ row4.addMember(containerCanvas);
+
+ //finish construction of the layout
column.addMember(row);
column.addMember(row2);
+ SpacerItem verticalSpace = new SpacerItem();
+ verticalSpace.setHeight(20);
+ DynamicForm spacerWrapper = new DynamicForm();
+ spacerWrapper.setItems(verticalSpace);
+ column.addMember(spacerWrapper);
+ column.addMember(resourceSelectionLabelRow);
+ column.addMember(row4);
form.addChild(column);
//submit handler
@@ -390,12 +507,30 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
//no need to insert validation here as user not allowed to enter values
parseFormAndPopulateConfiguration(form, storedPortlet, ALERT_RANGE_DISPLAY_AMOUNT_VALUE,
ALERT_RANGE_PRIORITY_VALUE, ALERT_RANGE_RESOURCES_VALUE, ALERT_RANGE_TIME_VALUE);
+
+ //retrieve alert-resource-selection property
+ PropertySimple prop = storedPortlet.getConfiguration().getSimple(ALERT_RANGE_RESOURCES_VALUE);
+
+ //check to see if "Selected Resources" or "All Resources"
+ if (prop.getStringValue().equals(RESOURCES_SELECTED)) {
+ //retrieve currentlyAssignedIds
+ Integer[] valuesToPersist = resourceSelector.getListGridValues();
+ resourceSelector.setCurrentlyAssignedIds(valuesToPersist);
+
+ //build property list of ids to persist
+ PropertyList list = new PropertyList(ALERT_RANGE_RESOURCE_IDS);
+ for (int rid : resourceSelector.getCurrentlyAssignedIds()) {
+ list.add(new PropertySimple(ALERT_RANGE_RESOURCE_IDS, rid));
+ }
+ storedPortlet.getConfiguration().put(new PropertyList(ALERT_RANGE_RESOURCE_IDS, list));
+ getDataSource().setAlertFilterResourceId(resourceSelector.getCurrentlyAssignedIds());
+ }
refresh();//
+ markForRedraw();
}
});
return form;
-
}
/**Iterates over DynamicForm instance to check for properties passed in and if they have been set
@@ -428,3 +563,95 @@ public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPor
}
}
}
+
+class CustomizedResourceSelector extends ResourceSelector {
+ public CustomizedResourceSelector(String id) {
+ super(id);
+ }
+
+ public void addAvailableGridSelectionsToAssignedGrid() {
+ assignedGrid.transferSelectedData(availableGrid);
+ select(assignedGrid.getSelection());
+ updateButtons();
+ }
+}
+
+class AlertResourceSelectorRegion extends GroupMembersStep {
+ // private ResourceSelector selector = null;
+ private CustomizedResourceSelector selector = null;
+ private ResourceType requireType = null;
+ private Integer[] currentlyAssignedIds;
+
+ public Integer[] getCurrentlyAssignedIds() {
+ return currentlyAssignedIds;
+ }
+
+ public Integer[] getListGridValues() {
+ Integer[] listGridValues = new Integer[0];
+ if ((null != selector) && (null != selector.getAssignedGrid())) {
+ RecordList allRecords = selector.getAssignedGrid().getDataAsRecordList();
+ if (allRecords.getLength() > 0) {
+ listGridValues = new Integer[allRecords.getLength()];
+ for (int i = 0; i < allRecords.getLength(); i++) {
+ Record record = allRecords.get(i);
+ listGridValues[i] = record.getAttributeAsInt(RecentAlertsPortlet.ID);
+ }
+ }
+ }
+ return listGridValues;
+ }
+
+ public AlertResourceSelectorRegion(Integer[] assigned) {
+ super(null);
+ this.currentlyAssignedIds = assigned;
+ }
+
+ public Canvas getCanvas() {
+ ResourceType rt = ResourceType.ANY_PLATFORM_TYPE;
+ if ((selector == null) || (rt != requireType)) {
+ // selector = new ResourceSelector(getName());
+ selector = new CustomizedResourceSelector(getName());
+ selector.setWidth100();
+ selector.setWidth(RecentAlertsPortlet.ALERT_RESOURCE_SELECTION_WIDTH);
+ selector.setRequireType(rt);
+ //widget ui updates
+ selector.getAvailableGrid().setTitle("Available Resources");
+ selector.getAvailableGrid().setEmptyMessage("Loading data...");
+ selector.getAssignedGrid().setTitle("Selected Resources");
+
+ //populate fields for grid.
+ ListGridField nameField = new ListGridField("name", "Name");
+ ListGridField iconField = new ListGridField("icon", "icon", 50);
+ iconField.setImageURLPrefix("types/");
+ iconField.setType(ListGridFieldType.ICON);
+ selector.getAssignedGrid().setFields(iconField, nameField);
+
+ //add listener to AvailableGrid, to act after successfully populated.
+ selector.getAvailableGrid().addDataArrivedHandler(new DataArrivedHandler() {
+ @Override
+ public void onDataArrived(DataArrivedEvent event) {
+ if ((getCurrentlyAssignedIds() != null) && (getCurrentlyAssignedIds().length > 0)) {
+ //retrieve the loaded data and add to the table itself
+ RecordList recordList = selector.getAvailableGrid().getDataAsRecordList();
+ for (int ci : getCurrentlyAssignedIds()) {
+ int located = recordList.findIndex("id", ci);
+ if (located > -1) {
+ selector.getAvailableGrid().selectRecord(located);
+ }
+ }
+ selector.addAvailableGridSelectionsToAssignedGrid();
+ selector.getAssignedGrid().invalidateCache();
+ selector.getAssignedGrid().markForRedraw();
+ } else {//no selected resources found
+ selector.getAvailableGrid().setEmptyMessage("No items to show");
+ }
+ }
+ });
+ }
+ return selector;
+ }
+
+ public void setCurrentlyAssignedIds(Integer[] currentlyAssignedIds) {
+ this.currentlyAssignedIds = currentlyAssignedIds;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
index 8a55ed7..71e6eee 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
@@ -85,7 +85,6 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
}
public void executeFetch(final DSRequest request, final DSResponse response) {
-
ResourceCriteria criteria = getFetchCriteria(request);
resourceService.findResourcesByCriteria(criteria, new AsyncCallback<PageList<Resource>>() {
@@ -208,4 +207,8 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
return record;
}
+
+ public ResourceGWTServiceAsync getResourceService() {
+ return resourceService;
+ }
}
commit 4b53c0811d1e0d6d876806ac368a440ce50663c1
Author: Simeon Pinder <spinder(a)redhat.com>
Date: Thu Sep 16 16:13:46 2010 -0400
enable recent alerts config(minus resource selection) and table footer
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
index 33d32b3..61b58b7 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertDataSource.java
@@ -144,6 +144,7 @@ public class AlertDataSource extends RPCDataSource<Alert> {
AlertCriteria criteria = getCriteria(request);
this.alertService.findAlertsByCriteria(criteria, new AsyncCallback<PageList<Alert>>() {
+
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError("Failed to fetch alerts data", caught);
response.setStatus(RPCResponse.STATUS_FAILURE);
@@ -153,7 +154,6 @@ public class AlertDataSource extends RPCDataSource<Alert> {
public void onSuccess(PageList<Alert> result) {
long fetchTime = System.currentTimeMillis() - start;
System.out.println(result.size() + " alerts fetched in: " + fetchTime + "ms");
-
response.setData(buildRecords(result));
// For paging to work, we have to specify size of full result set.
response.setTotalRows(result.getTotalSize());
@@ -296,4 +296,8 @@ public class AlertDataSource extends RPCDataSource<Alert> {
}
});
}
+
+ public AlertGWTServiceAsync getAlertService() {
+ return alertService;
+ }
}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletDataSource.java
new file mode 100644
index 0000000..a639fca
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/AlertPortletDataSource.java
@@ -0,0 +1,102 @@
+package org.rhq.enterprise.gui.coregui.client.alert;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.data.DSResponse;
+import com.smartgwt.client.rpc.RPCResponse;
+
+import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.alert.AlertPriority;
+import org.rhq.core.domain.criteria.AlertCriteria;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+
+public class AlertPortletDataSource extends AlertDataSource {
+ //configuration attributes
+ private int alertRangeCompleted = -1;
+ private int alertPriorityIndex = -1;
+ private long alertTimeRange = -1;
+ private String alertResourcesToUse = "all";
+ private Integer[] alertFilterResourceIds = {};
+
+ /** Override the executeFetch for AlertPortlet to allow specifying smaller than total
+ * result displays.
+ */
+ protected void executeFetch(final DSRequest request, final DSResponse response) {
+ final long start = System.currentTimeMillis();
+
+ AlertCriteria criteria = new AlertCriteria();
+ criteria.fetchAlertDefinition(true);
+ criteria.fetchRecoveryAlertDefinition(true);
+ // TODO: Uncomment the below once the bad performance of it has been fixed.
+ //criteria.fetchConditionLogs(true);
+ PageControl pc = new PageControl(0, getAlertRangeCompleted());
+ criteria.setPageControl(pc);//display per page
+ criteria.addFilterStartTime(getAlertTimeRange());//alert age
+ if (getAlertResourcesToUse().equalsIgnoreCase("selected")) {
+ //add resource ids to filter on
+ criteria.addFilterResourceIds(getAlertFilterResourceIds());
+ }
+ if (getAlertPriorityIndex() > 0) {//add priority selection
+ criteria.addFilterPriority(AlertPriority.getByLegacyIndex(getAlertPriorityIndex()));
+ }
+
+ getAlertService().findAlertsByCriteria(criteria, new AsyncCallback<PageList<Alert>>() {
+
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError("Failed to fetch alerts data", caught);
+ response.setStatus(RPCResponse.STATUS_FAILURE);
+ processResponse(request.getRequestId(), response);
+ }
+
+ public void onSuccess(PageList<Alert> result) {
+ long fetchTime = System.currentTimeMillis() - start;
+ System.out.println(result.size() + " alerts fetched in: " + fetchTime + "ms");
+ response.setData(buildRecords(result));
+ response.setTotalRows(result.size());
+ processResponse(request.getRequestId(), response);
+ }
+ });
+ }
+
+ public int getAlertRangeCompleted() {
+ return alertRangeCompleted;
+ }
+
+ public void setAlertRangeCompleted(int alertRangeCompleted) {
+ this.alertRangeCompleted = alertRangeCompleted;
+ }
+
+ public int getAlertPriorityIndex() {
+ return alertPriorityIndex;
+ }
+
+ public void setAlertPriorityIndex(int alertPriorityIndex) {
+ this.alertPriorityIndex = alertPriorityIndex;
+ }
+
+ public long getAlertTimeRange() {
+ return alertTimeRange;
+ }
+
+ public void setAlertTimeRange(long alertTimeRange) {
+ this.alertTimeRange = alertTimeRange;
+ }
+
+ public String getAlertResourcesToUse() {
+ return alertResourcesToUse;
+ }
+
+ public void setAlertResourcesToUse(String resourcesToUse) {
+ this.alertResourcesToUse = resourcesToUse;
+ }
+
+ public Integer[] getAlertFilterResourceIds() {
+ return alertFilterResourceIds;
+ }
+
+ public void setAlertFilterResourceId(Integer[] alertFilterResourceId) {
+ this.alertFilterResourceIds = alertFilterResourceId;
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
index 60a3783..c1a4ef9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/recent/alerts/RecentAlertsPortlet.java
@@ -18,35 +18,200 @@
*/
package org.rhq.enterprise.gui.coregui.client.dashboard.portlets.recent.alerts;
+import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.HTMLFlow;
+import com.smartgwt.client.widgets.Label;
import com.smartgwt.client.widgets.form.DynamicForm;
+import com.smartgwt.client.widgets.form.events.SubmitValuesEvent;
+import com.smartgwt.client.widgets.form.events.SubmitValuesHandler;
+import com.smartgwt.client.widgets.form.fields.SelectItem;
+import com.smartgwt.client.widgets.form.fields.events.ChangeEvent;
+import com.smartgwt.client.widgets.form.fields.events.ChangeHandler;
+import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.alert.AlertPriority;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.dashboard.DashboardPortlet;
+import org.rhq.enterprise.gui.coregui.client.alert.AlertPortletDataSource;
import org.rhq.enterprise.gui.coregui.client.alert.AlertsView;
+import org.rhq.enterprise.gui.coregui.client.dashboard.CustomSettingsPortlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.Portlet;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletViewFactory;
import org.rhq.enterprise.gui.coregui.client.dashboard.PortletWindow;
+import org.rhq.enterprise.gui.coregui.client.util.MeasurementUtility;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableLabel;
/**
* @author Greg Hinkle
*/
-public class RecentAlertsPortlet extends AlertsView implements Portlet {
+public class RecentAlertsPortlet extends AlertsView implements CustomSettingsPortlet {
public static final String KEY = "Recent Alerts";
+ public static final String TITLE = KEY;
+ //widget keys also used in form population
+ private static final String ALERT_RANGE_DISPLAY_AMOUNT_VALUE = "alert-range-display-amount-value";
+ private static final String ALERT_RANGE_PRIORITY_VALUE = "alert-range-priority-value";
+ private static final String ALERT_RANGE_TIME_VALUE = "alert-range-time-value";
+ private static final String ALERT_RANGE_RESOURCES_VALUE = "alert-range-resource-value";
+ //configuration default information
+ private static final String defaultAlertCountValue = "5";
+ private static final String PRIORITY_ALL = "ALL";
+ private static final String PRIORITY_HIGH = AlertPriority.HIGH.getDisplayName();
+ private static final String PRIORITY_MEDIUM = AlertPriority.MEDIUM.getDisplayName();
+ private static final String PRIORITY_LOW = AlertPriority.LOW.getDisplayName();
+ private static final String defaultPriorityValue = PRIORITY_ALL;
+ private static final String TIME_30_MINS = "30 minutes";
+ private static final String TIME_HOUR = "hour";
+ private static final String TIME_12_HRS = "12 hours";
+ private static final String TIME_DAY = "day";
+ private static final String TIME_WEEK = "week";
+ private static final String TIME_MONTH = "month";
+ private static final String defaultTimeValue = TIME_DAY;
+ private static final String RESOURCES_ALL = "all resources";
+ private static final String RESOURCES_SELECTED = "selected resources";
+ private static final String defaultResourceValue = RESOURCES_ALL;
+ private static final String unlimited = "unlimited";
+ //configuration container element
+ private DashboardPortlet storedPortlet = null;
+ private AlertPortletDataSource dataSource;
public RecentAlertsPortlet(String locatorId) {
- super(locatorId);
+ // super(locatorId);
+ this(locatorId, null, null);
setShowHeader(false);
- setShowFooter(false);
+ setShowFooter(true);
+ //disable footer refresh
+ setShowFooterRefresh(false);
setOverflow(Overflow.HIDDEN);
}
+ public RecentAlertsPortlet(String locatorId, Criteria criteria, String[] excludedFieldNames) {
+ super(locatorId, criteria, excludedFieldNames);
+
+ //override the shared datasource
+ this.dataSource = new AlertPortletDataSource();
+ setDataSource(this.dataSource);
+ }
+
public void configure(PortletWindow portletWindow, DashboardPortlet storedPortlet) {
- // TODO: Implement this method.
+ this.storedPortlet = storedPortlet;
+ //Operation range property - retrieve existing value
+ PropertySimple property = storedPortlet.getConfiguration().getSimple(ALERT_RANGE_DISPLAY_AMOUNT_VALUE);
+ if ((property != null) && (property.getStringValue() != null)) {
+ //retrieve and translate to int
+ String retrieved = property.getStringValue();
+ int translatedAlertRangeSelection = translatedAlertRangeSelection(retrieved);
+ // getDataSource().setAlertRangeCompleted(Integer.parseInt(retrieved));
+ getDataSource().setAlertRangeCompleted(translatedAlertRangeSelection);
+ } else {//create setting
+ storedPortlet.getConfiguration().put(
+ new PropertySimple(ALERT_RANGE_DISPLAY_AMOUNT_VALUE, defaultAlertCountValue));
+ getDataSource().setAlertRangeCompleted(Integer.parseInt(defaultAlertCountValue));
+ }
+ //Operation priority property setting
+ property = storedPortlet.getConfiguration().getSimple(ALERT_RANGE_PRIORITY_VALUE);
+ if ((property != null) && (property.getStringValue() != null)) {
+ //retrieve and translate to int
+ String retrieved = property.getStringValue();
+ int translatedPriorityIndex = translatedPriorityToValidIndex(retrieved);
+ getDataSource().setAlertPriorityIndex(translatedPriorityIndex);
+ } else {//create setting
+ storedPortlet.getConfiguration().put(new PropertySimple(ALERT_RANGE_PRIORITY_VALUE, defaultPriorityValue));
+ getDataSource().setAlertPriorityIndex(translatedPriorityToValidIndex(PRIORITY_ALL));
+ }
+
+ //Range to time that alerts will be shown for
+ property = storedPortlet.getConfiguration().getSimple(ALERT_RANGE_TIME_VALUE);
+ if ((property != null) && (property.getStringValue() != null)) {
+ //retrieve and translate to int
+ String retrieved = property.getStringValue();
+ long translatedRange = translateTimeToValidRange(retrieved);
+ getDataSource().setAlertTimeRange(translatedRange);
+ } else {//create setting
+ storedPortlet.getConfiguration().put(new PropertySimple(ALERT_RANGE_TIME_VALUE, defaultTimeValue));
+ getDataSource().setAlertTimeRange(translateTimeToValidRange(defaultTimeValue));
+ }
+
+ //Range of resources to be included in the query
+ property = storedPortlet.getConfiguration().getSimple(ALERT_RANGE_RESOURCES_VALUE);
+ if ((property != null) && (property.getStringValue() != null)) {
+ //retrieve and translate to int
+ String retrieved = property.getStringValue();
+ if (retrieved.trim().equalsIgnoreCase(RESOURCES_SELECTED)) {
+ getDataSource().setAlertResourcesToUse("selected");
+ } else {
+ getDataSource().setAlertResourcesToUse("all");
+ }
+ } else {//create setting
+ storedPortlet.getConfiguration().put(new PropertySimple(ALERT_RANGE_RESOURCES_VALUE, defaultResourceValue));
+ getDataSource().setAlertResourcesToUse("all");
+ }
+ }
+
+ private int translatedAlertRangeSelection(String retrieved) {
+ int translated = -1;
+ if ((retrieved != null) && (!retrieved.trim().isEmpty())) {
+ if (retrieved.equalsIgnoreCase(unlimited)) {
+ translated = -1;
+ } else {
+ translated = Integer.parseInt(retrieved);//default to all
+ }
+ } else {//default to defaultValue
+ if (defaultAlertCountValue.equalsIgnoreCase(unlimited)) {
+ translated = -1;
+ } else {
+ translated = Integer.parseInt(defaultAlertCountValue);
+ }
+ }
+ return translated;
+ }
+
+ private int translatedPriorityToValidIndex(String retrieved) {
+ int translatedPriority = 0;//default to all
+ if ((retrieved != null) && (!retrieved.trim().isEmpty())) {
+ if (retrieved.equalsIgnoreCase(PRIORITY_HIGH)) {
+ translatedPriority = 3;
+ } else if (retrieved.equalsIgnoreCase(PRIORITY_MEDIUM)) {
+ translatedPriority = 2;
+ } else if (retrieved.equalsIgnoreCase(PRIORITY_LOW)) {
+ translatedPriority = 1;
+ } else {
+ translatedPriority = 0;//default to all
+ }
+ }
+ return translatedPriority;
+ }
+
+ /**Translates the UI selection options into time values for alert query.
+ *
+ * @param retrieved
+ * @return long value mapping to string passed in.
+ */
+ private long translateTimeToValidRange(String retrieved) {
+ long translated = 0;//default to ALL
+ if ((retrieved != null) && (!retrieved.trim().isEmpty())) {
+ if (retrieved.equalsIgnoreCase(TIME_30_MINS)) {
+ translated = MeasurementUtility.MINUTES * 30;
+ } else if (retrieved.equalsIgnoreCase(TIME_HOUR)) {
+ translated = MeasurementUtility.HOURS;
+ } else if (retrieved.equalsIgnoreCase(TIME_12_HRS)) {
+ translated = MeasurementUtility.HOURS * 12;
+ } else if (retrieved.equalsIgnoreCase(TIME_DAY)) {
+ translated = MeasurementUtility.DAYS;
+ } else if (retrieved.equalsIgnoreCase(TIME_WEEK)) {
+ translated = MeasurementUtility.WEEKS;
+ } else if (retrieved.equalsIgnoreCase(TIME_MONTH)) {
+ translated = MeasurementUtility.DAYS * 28;//replicated from old struts def.
+ } else {
+ translated = MeasurementUtility.DAYS;//default to day otherwise.
+ }
+ }
+ return translated;
}
public Canvas getHelpCanvas() {
@@ -54,7 +219,205 @@ public class RecentAlertsPortlet extends AlertsView implements Portlet {
}
public DynamicForm getCustomSettingsForm() {
- return null; // TODO: Implement this method.
+
+ //root dynamic form instance
+ final DynamicForm form = new DynamicForm();
+ form.setWidth(200);
+
+ VLayout column = new VLayout();
+
+ //label
+ LocatableLabel alertRangeLabel = new LocatableLabel("DynamicForm_Label_Alert_Range", "<b>Alert Range</b>");
+
+ //horizontal layout
+ LocatableHLayout row = new LocatableHLayout("alert-range-settings-row-1");
+ row.setMembersMargin(10);
+
+ //-------------combobox for number of completed scheduled ops to display on the dashboard
+ final SelectItem alertRangeLastComboBox = new SelectItem(ALERT_RANGE_DISPLAY_AMOUNT_VALUE);
+ alertRangeLastComboBox.setTitle("Last");
+ alertRangeLastComboBox.setType("selection");
+ //define acceptable values for display amount
+ String[] acceptableDisplayValues = { "5", "10", "unlimited" };
+ alertRangeLastComboBox.setValueMap(acceptableDisplayValues);
+ //set width of dropdown display region
+ alertRangeLastComboBox.setWidth(100);
+ alertRangeLastComboBox.addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent event) {
+ String selectedItem = "" + event.getValue();
+ //stuff into the master form for retrieval
+ form.setValue(ALERT_RANGE_DISPLAY_AMOUNT_VALUE, selectedItem);
+ }
+ });
+
+ //default selected value to 'unlimited'(live lists) and check both combobox settings here.
+ String selectedValue = defaultAlertCountValue;
+ if (storedPortlet != null) {
+ //if property exists retrieve it
+ if (storedPortlet.getConfiguration().getSimple(ALERT_RANGE_DISPLAY_AMOUNT_VALUE) != null) {
+ selectedValue = storedPortlet.getConfiguration().getSimple(ALERT_RANGE_DISPLAY_AMOUNT_VALUE)
+ .getStringValue();
+ } else {//insert default value
+ storedPortlet.getConfiguration().put(
+ new PropertySimple(ALERT_RANGE_DISPLAY_AMOUNT_VALUE, defaultAlertCountValue));
+ }
+ }
+ //prepopulate the combobox with the previously stored selection
+ alertRangeLastComboBox.setDefaultValue(selectedValue);
+
+ //-------------combobox for number of completed scheduled ops to display on the dashboard
+ final SelectItem alertRangePriorityComboBox = new SelectItem(ALERT_RANGE_PRIORITY_VALUE);
+ alertRangePriorityComboBox.setTitle("");
+ alertRangePriorityComboBox.setHint("<nobr> <b> priority Alerts,</b></nobr>");
+ alertRangePriorityComboBox.setType("selection");
+ //define acceptable values for display amount
+ String[] acceptablePriorityDisplayValues = { PRIORITY_ALL, PRIORITY_HIGH, PRIORITY_MEDIUM, PRIORITY_LOW };
+ alertRangePriorityComboBox.setValueMap(acceptablePriorityDisplayValues);
+ //set width of dropdown display region
+ alertRangePriorityComboBox.setWidth(100);
+ alertRangePriorityComboBox.addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent event) {
+ String selectedItem = "" + event.getValue();
+ //stuff into the master form for retrieval
+ form.setValue(ALERT_RANGE_PRIORITY_VALUE, selectedItem);
+ }
+ });
+
+ //default selected value to 'unlimited'(live lists) and check both combobox settings here.
+ selectedValue = defaultPriorityValue;
+ if (storedPortlet != null) {
+ //if property exists retrieve it
+ if (storedPortlet.getConfiguration().getSimple(ALERT_RANGE_PRIORITY_VALUE) != null) {
+ selectedValue = storedPortlet.getConfiguration().getSimple(ALERT_RANGE_PRIORITY_VALUE).getStringValue();
+ } else {//insert default value
+ storedPortlet.getConfiguration().put(
+ new PropertySimple(ALERT_RANGE_PRIORITY_VALUE, defaultPriorityValue));
+ }
+ }
+ //prepopulate the combobox with the previously stored selection
+ alertRangePriorityComboBox.setDefaultValue(selectedValue);
+ row.addMember(alertRangeLabel);
+ DynamicForm wrappedRange = new DynamicForm();
+ wrappedRange.setFields(alertRangeLastComboBox);
+ row.addMember(wrappedRange);
+
+ DynamicForm wrappedPriority = new DynamicForm();
+ wrappedPriority.setFields(alertRangePriorityComboBox);
+ row.addMember(wrappedPriority);
+
+ //horizontal layout
+ LocatableHLayout row2 = new LocatableHLayout("alert-range-settings-row-2");
+
+ Label alertRangeSpanLabel = new Label("<b>within the past<b>");
+ //------------- Build second combobox for timeframe for problem resources search.
+ final SelectItem alertRangeTimeComboBox = new SelectItem(ALERT_RANGE_TIME_VALUE);
+ alertRangeTimeComboBox.setTitle("");
+ alertRangeTimeComboBox.setHint("");
+ alertRangeTimeComboBox.setType("selection");
+ String[] acceptableTimeDisplayValues = { TIME_30_MINS, TIME_HOUR, TIME_12_HRS, TIME_DAY, TIME_WEEK, TIME_MONTH };
+ alertRangeTimeComboBox.setValueMap(acceptableTimeDisplayValues);
+ alertRangeTimeComboBox.setWidth(100);
+ alertRangeTimeComboBox.addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent event) {
+ String selectedItem = "" + event.getValue();
+ //stuff into the master form for retrieval
+ form.setValue(ALERT_RANGE_TIME_VALUE, selectedItem);
+ }
+ });
+
+ //set to default
+ selectedValue = defaultTimeValue;
+ if (storedPortlet != null) {
+ //if property exists retrieve it
+ if (storedPortlet.getConfiguration().getSimple(ALERT_RANGE_TIME_VALUE) != null) {
+ selectedValue = storedPortlet.getConfiguration().getSimple(ALERT_RANGE_TIME_VALUE).getStringValue();
+ } else {//insert default value
+ storedPortlet.getConfiguration().put(new PropertySimple(ALERT_RANGE_TIME_VALUE, defaultTimeValue));
+ }
+ }
+ //prepopulate the combobox with the previously stored selection
+ alertRangeTimeComboBox.setDefaultValue(selectedValue);
+ DynamicForm timeSelectionWrapper = new DynamicForm();
+ timeSelectionWrapper.setFields(alertRangeTimeComboBox);
+
+ // build resource selection drop down
+ //------------- Build second combobox for timeframe for problem resources search.
+ final SelectItem alertResourcesComboBox = new SelectItem(ALERT_RANGE_RESOURCES_VALUE);
+ alertResourcesComboBox.setTitle("for");
+ alertResourcesComboBox.setHint("");
+ alertResourcesComboBox.setType("selection");
+ String[] acceptableResourceDisplayValues = { RESOURCES_ALL, RESOURCES_SELECTED };
+ alertResourcesComboBox.setValueMap(acceptableResourceDisplayValues);
+ alertResourcesComboBox.setWidth(100);
+ alertResourcesComboBox.addChangeHandler(new ChangeHandler() {
+ public void onChange(ChangeEvent event) {
+ String selectedItem = "" + event.getValue();
+ //stuff into the master form for retrieval
+ form.setValue(ALERT_RANGE_RESOURCES_VALUE, selectedItem);
+ }
+ });
+
+ //set to default
+ selectedValue = defaultResourceValue;
+ if (storedPortlet != null) {
+ //if property exists retrieve it
+ if (storedPortlet.getConfiguration().getSimple(ALERT_RANGE_RESOURCES_VALUE) != null) {
+ selectedValue = storedPortlet.getConfiguration().getSimple(ALERT_RANGE_RESOURCES_VALUE)
+ .getStringValue();
+ } else {//insert default value
+ storedPortlet.getConfiguration().put(
+ new PropertySimple(ALERT_RANGE_RESOURCES_VALUE, defaultResourceValue));
+ }
+ }
+ //prepopulate the combobox with the previously stored selection
+ alertResourcesComboBox.setDefaultValue(selectedValue);
+ DynamicForm resourceSelectionWrapper = new DynamicForm();
+ resourceSelectionWrapper.setFields(alertResourcesComboBox);
+
+ alertRangeSpanLabel.setWrap(false);
+ alertRangeSpanLabel.setWidth(150);
+ row2.addMember(alertRangeSpanLabel);
+ row2.addMember(timeSelectionWrapper);
+ row2.addMember(resourceSelectionWrapper);
+ column.addMember(row);
+ column.addMember(row2);
+ form.addChild(column);
+
+ //submit handler
+ form.addSubmitValuesHandler(new SubmitValuesHandler() {
+ @Override
+ public void onSubmitValues(SubmitValuesEvent event) {
+ //no need to insert validation here as user not allowed to enter values
+ parseFormAndPopulateConfiguration(form, storedPortlet, ALERT_RANGE_DISPLAY_AMOUNT_VALUE,
+ ALERT_RANGE_PRIORITY_VALUE, ALERT_RANGE_RESOURCES_VALUE, ALERT_RANGE_TIME_VALUE);
+ refresh();//
+ }
+ });
+
+ return form;
+
+ }
+
+ /**Iterates over DynamicForm instance to check for properties passed in and if they have been set
+ * to put that property into the DashboardPortlet configuration.
+ *
+ * @param form Dynamic form storing user selections
+ * @param portlet Container for configuration changes
+ * @param properties Variable list of keys used to verify or populate properties.
+ */
+ private void parseFormAndPopulateConfiguration(final DynamicForm form, DashboardPortlet portlet,
+ String... properties) {
+ if ((form != null) && (portlet != null)) {
+ for (String property : properties) {
+ if (form.getValue(property) != null) {//if new value supplied
+ storedPortlet.getConfiguration().put(new PropertySimple(property, form.getValue(property)));
+ }
+ }
+ }
+ }
+
+ public AlertPortletDataSource getDataSource() {
+ return dataSource;
}
public static final class Factory implements PortletViewFactory {
13 years, 8 months
[rhq] 3 commits - modules/enterprise
by mazz
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java | 70 ++++++----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java | 2
3 files changed, 48 insertions(+), 27 deletions(-)
New commits:
commit 6eea739a198db967a5bb26567b0133b77b363466
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Sep 23 12:15:32 2010 -0400
finish the dampening editor
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java
index 87eecea..1942004 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/DampeningAlertDefinitionForm.java
@@ -30,6 +30,8 @@ import com.smartgwt.client.widgets.form.fields.SpinnerItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.events.ChangedEvent;
import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
+import com.smartgwt.client.widgets.form.fields.events.ItemHoverEvent;
+import com.smartgwt.client.widgets.form.fields.events.ItemHoverHandler;
import org.rhq.core.domain.alert.AlertDampening;
import org.rhq.core.domain.alert.AlertDefinition;
@@ -109,10 +111,12 @@ public class DampeningAlertDefinitionForm extends LocatableDynamicForm implement
alertDefinition.setAlertDampening(alertDampening);
}
- dampeningRuleSelection.setValue(alertDampening.getCategory().name());
- dampeningRuleStatic.setValue(getCategoryTitle(alertDampening.getCategory()));
+ Category category = alertDampening.getCategory();
+ dampeningRuleSelection.setValue(category.name());
+ dampeningRuleStatic.setValue(getCategoryTitle(category));
+ dampeningRuleStatic.setTooltip(getCategoryHelp(category.name()));
- switch (alertDampening.getCategory()) {
+ switch (category) {
case NONE: {
break;
}
@@ -141,8 +145,7 @@ public class DampeningAlertDefinitionForm extends LocatableDynamicForm implement
break;
}
default: {
- throw new IllegalStateException("Invalid category - please report this as a bug: "
- + alertDampening.getCategory()); // should never happen
+ throw new IllegalStateException("Invalid category - please report this as a bug: " + category); // should never happen
}
}
}
@@ -380,8 +383,6 @@ public class DampeningAlertDefinitionForm extends LocatableDynamicForm implement
private void buildForm() {
if (!formBuilt) {
- setNumCols(3);
-
dampeningRuleSelection = new SelectItem("dampeningRule", "Dampening Rule");
LinkedHashMap<String, String> rules = new LinkedHashMap<String, String>(4);
rules.put(AlertDampening.Category.NONE.name(), getCategoryTitle(AlertDampening.Category.NONE));
@@ -395,79 +396,86 @@ public class DampeningAlertDefinitionForm extends LocatableDynamicForm implement
dampeningRuleSelection.setDefaultValue(AlertDampening.Category.NONE.name());
dampeningRuleSelection.setWrapTitle(false);
dampeningRuleSelection.setRedrawOnChange(true);
- dampeningRuleSelection.setColSpan(2);
+ dampeningRuleSelection.setHoverWidth(300);
+ dampeningRuleSelection.addItemHoverHandler(new ItemHoverHandler() {
+ @Override
+ public void onItemHover(ItemHoverEvent event) {
+ String selection = dampeningRuleSelection.getValue().toString();
+ dampeningRuleSelection.setTooltip(getCategoryHelp(selection));
+ }
+ });
+
dampeningRuleStatic = new StaticTextItem("dampeningRuleStatic", "Dampening Rule");
- dampeningRuleStatic.setColSpan(2);
dampeningRuleStatic.setWrapTitle(false);
+ dampeningRuleStatic.setHoverWidth(300);
// NONE
// nothing to do - the none category has no ui components to render
// CONSECUTIVE_COUNT
consecutiveOccurrencesSpinner = new SpinnerItem("consecutiveOccurrencesSpinner", "Occurrences");
- consecutiveOccurrencesSpinner.setColSpan(2);
consecutiveOccurrencesSpinner.setWrapTitle(false);
consecutiveOccurrencesSpinner.setMin(1);
consecutiveOccurrencesSpinner.setMax(999999);
consecutiveOccurrencesSpinner.setStep(1);
consecutiveOccurrencesSpinner.setDefaultValue(1);
+ consecutiveOccurrencesSpinner.setHoverWidth(300);
consecutiveOccurrencesSpinner
.setTooltip("The number of times the condition set must be consecutively true before the alert is triggered.");
consecutiveOccurrencesStatic = new StaticTextItem("consecutiveOccurrencesStatic", "Occurrences");
- consecutiveOccurrencesStatic.setColSpan(2);
consecutiveOccurrencesStatic.setWrapTitle(false);
// PARTIAL_COUNT
partialOccurrencesSpinner = new SpinnerItem("partialOccurrencesSpinner", "Occurrences");
- partialOccurrencesSpinner.setColSpan(2);
partialOccurrencesSpinner.setWrapTitle(false);
partialOccurrencesSpinner.setMin(1);
partialOccurrencesSpinner.setMax(999999);
partialOccurrencesSpinner.setStep(1);
partialOccurrencesSpinner.setDefaultValue(1);
+ partialOccurrencesSpinner.setHoverWidth(300);
partialOccurrencesSpinner
.setTooltip("The number of times the condition set must be true during the last N evaluations before the alert is triggered.");
partialOccurrencesStatic = new StaticTextItem("partialOccurrencesStatic", "Occurrences");
- partialOccurrencesStatic.setColSpan(2);
partialOccurrencesStatic.setWrapTitle(false);
partialEvaluationsSpinner = new SpinnerItem("partialEvaluationsSpinner", "Evaluations");
- partialEvaluationsSpinner.setColSpan(2);
partialEvaluationsSpinner.setWrapTitle(false);
partialEvaluationsSpinner.setMin(1);
partialEvaluationsSpinner.setMax(999999);
partialEvaluationsSpinner.setStep(1);
partialEvaluationsSpinner.setDefaultValue(1);
+ partialEvaluationsSpinner.setHoverWidth(300);
+ partialEvaluationsSpinner
+ .setTooltip("The total number of times the condition set will be tested to see if the given number of occurrences are true.");
partialEvaluationsStatic = new StaticTextItem("partialEvaluationStatic", "Evaluations");
- partialEvaluationsStatic.setColSpan(2);
partialEvaluationsStatic.setWrapTitle(false);
// DURATION_COUNT
durationOccurrencesSpinner = new SpinnerItem("durationOccurrencesSpinner", "Occurrences");
- durationOccurrencesSpinner.setColSpan(2);
durationOccurrencesSpinner.setWrapTitle(false);
durationOccurrencesSpinner.setMin(1);
durationOccurrencesSpinner.setMax(999999);
durationOccurrencesSpinner.setStep(1);
durationOccurrencesSpinner.setDefaultValue(1);
+ durationOccurrencesSpinner.setHoverWidth(300);
durationOccurrencesSpinner
.setTooltip("The number of times the condition set must be true during the given time period before the alert is triggered.");
durationOccurrencesStatic = new StaticTextItem("durationOccurrencesStatic", "Occurrences");
- durationOccurrencesStatic.setColSpan(2);
durationOccurrencesStatic.setWrapTitle(false);
durationTimePeriodSpinner = new SpinnerItem("durationTimePeriodSpinner", "Time Period");
- durationTimePeriodSpinner.setEndRow(false);
durationTimePeriodSpinner.setWrapTitle(false);
durationTimePeriodSpinner.setMin(1);
durationTimePeriodSpinner.setMax(999999);
durationTimePeriodSpinner.setStep(1);
durationTimePeriodSpinner.setDefaultValue(1);
+ durationTimePeriodSpinner.setHoverWidth(300);
+ durationTimePeriodSpinner
+ .setTooltip("The time span in which the condition set will be tested to see if the given number of occurrences are true.");
durationTimePeriodStatic = new StaticTextItem("durationTimePeriodStatic", "Time Period");
- durationTimePeriodStatic.setEndRow(false);
durationTimePeriodStatic.setWrapTitle(false);
- durationTimeUnitsSelection = new SelectItem("durationTimeUnits");
+ durationTimeUnitsSelection = new SelectItem("durationTimeUnits", "");
LinkedHashMap<String, String> units = new LinkedHashMap<String, String>(4);
units.put(AlertDampening.TimeUnits.MINUTES.name(), getTimeUnitsTitle(AlertDampening.TimeUnits.MINUTES));
units.put(AlertDampening.TimeUnits.HOURS.name(), getTimeUnitsTitle(AlertDampening.TimeUnits.HOURS));
@@ -475,13 +483,7 @@ public class DampeningAlertDefinitionForm extends LocatableDynamicForm implement
units.put(AlertDampening.TimeUnits.WEEKS.name(), getTimeUnitsTitle(AlertDampening.TimeUnits.WEEKS));
durationTimeUnitsSelection.setValueMap(units);
durationTimeUnitsSelection.setDefaultValue(AlertDampening.TimeUnits.MINUTES.name());
- durationTimeUnitsSelection.setStartRow(false);
- durationTimeUnitsSelection.setEndRow(true);
- durationTimeUnitsSelection.setShowTitle(false);
- durationTimeUnitsStatic = new StaticTextItem("durationTimeUnitsStatic");
- durationTimeUnitsStatic.setStartRow(false);
- durationTimeUnitsStatic.setEndRow(true);
- durationTimeUnitsStatic.setShowTitle(false);
+ durationTimeUnitsStatic = new StaticTextItem("durationTimeUnitsStatic", "");
dampeningRuleSelection.addChangedHandler(new ChangedHandler() {
@Override
@@ -582,4 +584,18 @@ public class DampeningAlertDefinitionForm extends LocatableDynamicForm implement
}
}
}
+
+ private String getCategoryHelp(String categorySelection) {
+ if (AlertDampening.Category.NONE.name().equals(categorySelection)) {
+ return "Dampening is disabled. Every time the condition set is true, an alert will be triggered.";
+ } else if (AlertDampening.Category.CONSECUTIVE_COUNT.name().equals(categorySelection)) {
+ return "An alert is triggered once every X occurrences the condition set is true consecutively.";
+ } else if (AlertDampening.Category.PARTIAL_COUNT.name().equals(categorySelection)) {
+ return "An alert is triggered once every X occurrences the condition set is true during the last N evaluations of the condition set.";
+ } else if (AlertDampening.Category.DURATION_COUNT.name().equals(categorySelection)) {
+ return "An alert is triggered once every X occurrences the condition set is true within a given time period.";
+ }
+
+ return null; // should never happen
+ }
}
commit ef0e71c4bea6ebb2f9fb4b14eac1891007931b2e
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Sep 23 12:15:04 2010 -0400
widen the tooltip window
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java
index 86d816b..b539d0a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/RecoveryAlertDefinitionForm.java
@@ -158,6 +158,7 @@ public class RecoveryAlertDefinitionForm extends LocatableDynamicForm implements
disableWhenFiredSelection.setDefaultValue("no");
disableWhenFiredSelection.setWrapTitle(false);
disableWhenFiredSelection.setWidth(300);
+ disableWhenFiredSelection.setHoverWidth(300);
disableWhenFiredSelection
.setTooltip("Indicates if this alert will be disabled after it fires. Once disabled, the alert can be manually re-enabled or a recovery alert can be set up to automatically re-enable it. If this alert is a recovery alert itself, this setting cannot be turned on.");
disableWhenFiredStatic = new StaticTextItem("disableWhenFiredStatic", "Disable When Fired");
@@ -166,6 +167,7 @@ public class RecoveryAlertDefinitionForm extends LocatableDynamicForm implements
recoverAlertSelection = new SelectItem("recoveryAlert", "Recover Alert");
recoverAlertSelection.setDefaultValue("0");
recoverAlertSelection.setWrapTitle(false);
+ recoverAlertSelection.setHoverWidth(300);
recoverAlertSelection
.setTooltip("The target alert that will be recovered (i.e. re-enabled) after this alert triggers. Do not select an alert here if you are not defining a recovery alert.");
commit 4092afb4e2b2c764b5ab0e8111b37110e9af73ea
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Sep 23 12:14:44 2010 -0400
add tooltip to explain ANY and ALL
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java
index 571daed..6991b2c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsAlertDefinitionForm.java
@@ -143,6 +143,9 @@ public class ConditionsAlertDefinitionForm extends LocatableVLayout implements E
conditionExpression.setValueMap(condExprs);
conditionExpression.setDefaultValue(BooleanExpression.ANY.name());
conditionExpression.setWrapTitle(false);
+ conditionExpression.setHoverWidth(300);
+ conditionExpression
+ .setTooltip("Determines if ANY or ALL of the conditions must evaluate to true in order for the entire condition set to be considered true.");
conditionExpressionStatic = new StaticTextItem("conditionExpressionStatic", "Fire alert when");
conditionExpressionStatic.setWrapTitle(false);
13 years, 8 months
[rhq] 4 commits - modules/enterprise
by Jay Shaughnessy
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java | 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java | 273 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java | 16
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java | 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java | 51 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java | 62 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java | 78 +-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java | 2
8 files changed, 290 insertions(+), 219 deletions(-)
New commits:
commit 34952d9da9c662bc241c90011e199e74c4a931cb
Merge: d905826... 9a36c9d...
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Sep 23 10:58:11 2010 -0400
Merge branch 'master' into master-jay
commit d9058264c89ab9c489de7e698fd1af5de9245908
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Sep 23 10:56:56 2010 -0400
Added MANAGE_INVENTORY check for group membership subtab enablement
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
index c11659e..50700f2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
@@ -18,13 +18,17 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.common.detail;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import com.google.gwt.user.client.History;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Side;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.Layout;
+import org.rhq.core.domain.authz.Permission;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
@@ -33,6 +37,7 @@ import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTab;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedEvent;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedHandler;
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSet;
+import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
/**
@@ -79,9 +84,9 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
protected abstract List<TwoLevelTab> createTabs();
- protected abstract void loadSelectedItem(int itemId, ViewPath viewPath);
+ protected abstract void loadSelectedItem(int itemId, ViewPath viewPath, Set<Permission> globalPermissions);
- protected abstract void updateTabContent(T selectedItem);
+ protected abstract void updateTabContent(T selectedItem, Set<Permission> globalPermissions);
// ---------------------------------------------------------
@@ -136,10 +141,10 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
}
}
- public void renderView(ViewPath viewPath) {
+ public void renderView(final ViewPath viewPath) {
// e.g. #Resource/10010/Summary/Overview
// ^ current path
- int id = Integer.parseInt(viewPath.getCurrent().getPath());
+ final int id = Integer.parseInt(viewPath.getCurrent().getPath());
viewPath.next();
if (!viewPath.isEnd()) {
@@ -160,8 +165,23 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
}
if (getSelectedItemId() == null || getSelectedItemId() != id) {
- // A different Resource or first load - go get data.
- loadSelectedItem(id, viewPath);
+ GWTServiceLookup.getAuthorizationService().getExplicitGlobalPermissions(
+ new AsyncCallback<Set<Permission>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(
+ "Could not determine global permissions for user, defaulting to no global permissions.",
+ caught);
+ // A different Resource or first load - go get data.
+ loadSelectedItem(id, viewPath, new HashSet<Permission>());
+ }
+
+ @Override
+ public void onSuccess(Set<Permission> result) {
+ // A different Resource or first load - go get data.
+ loadSelectedItem(id, viewPath, result);
+ }
+ });
} else {
// Same Resource - just switch tabs.
selectTab(this.tabName, this.subTabName, viewPath);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index 17d901c..f273c40 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -178,7 +178,8 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
return tabs;
}
- protected void updateTabContent(ResourceGroupComposite groupComposite) {
+ protected void updateTabContent(ResourceGroupComposite groupComposite, Set<Permission> globalPermissions) {
+ boolean enabled;
boolean visible;
Canvas canvas;
@@ -227,9 +228,10 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
//updateSubTab(this.inventoryTab, this.inventoryConn,
// new GroupPluginConfigurationEditView(this.group.getId(), this.group.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin),
// facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION), true);
- // TODO: should require MANAGE_INVENTORY authz
- updateSubTab(this.inventoryTab, this.inventoryMembership, new ResourceGroupMembershipView(this.inventoryTab
- .extendLocatorId("MembershipView"), groupId), true, true);
+ enabled = globalPermissions.contains(Permission.MANAGE_INVENTORY);
+ canvas = (enabled) ? new ResourceGroupMembershipView(this.inventoryTab.extendLocatorId("MembershipView"),
+ groupId) : null;
+ updateSubTab(this.inventoryTab, this.inventoryMembership, canvas, true, enabled);
if (updateTab(this.operationsTab, groupCategory == GroupCategory.COMPATIBLE
&& facets.contains(ResourceTypeFacet.OPERATION), true)) {
@@ -263,7 +265,7 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
markForRedraw();
}
- protected void loadSelectedItem(final int groupId, final ViewPath viewPath) {
+ protected void loadSelectedItem(final int groupId, final ViewPath viewPath, final Set<Permission> globalPermissions) {
this.groupId = groupId;
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
@@ -279,12 +281,13 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
public void onSuccess(PageList<ResourceGroupComposite> result) {
groupComposite = result.get(0);
- loadResourceType(groupComposite, viewPath);
+ loadResourceType(groupComposite, viewPath, globalPermissions);
}
});
}
- private void loadResourceType(final ResourceGroupComposite groupComposite, final ViewPath viewPath) {
+ private void loadResourceType(final ResourceGroupComposite groupComposite, final ViewPath viewPath,
+ final Set<Permission> globalPermissions) {
final ResourceGroup group = this.groupComposite.getResourceGroup();
if (group.getGroupCategory() == GroupCategory.COMPATIBLE) {
@@ -307,14 +310,14 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
public void onSuccess(Set<Permission> result) {
ResourceGroupDetailView.this.permissions = new ResourcePermission(result);
- updateTabContent(groupComposite);
+ updateTabContent(groupComposite, globalPermissions);
selectTab(getTabName(), getSubTabName(), viewPath);
}
});
}
});
} else {
- updateTabContent(groupComposite);
+ updateTabContent(groupComposite, globalPermissions);
selectTab(getTabName(), getSubTabName(), viewPath);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index ba88b87..7236d4b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -27,6 +27,7 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.tab.Tab;
+import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementDefinition;
@@ -189,7 +190,8 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
return new ResourceTitleBar(extendLocatorId("TitleBar"));
}
- protected void updateTabContent(ResourceComposite resourceComposite) {
+ protected void updateTabContent(ResourceComposite resourceComposite, Set<Permission> globalPermissions) {
+ boolean enabled;
boolean visible;
Canvas canvas;
@@ -201,7 +203,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
((TwoLevelTab) top).getLayout().destroyViews();
}
- ResourcePermission permissions = this.resourceComposite.getResourcePermission();
+ ResourcePermission resourcePermissions = this.resourceComposite.getResourcePermission();
Set<ResourceTypeFacet> facets = this.resourceComposite.getResourceFacets().getFacets();
updateSubTab(this.summaryTab, this.summaryOverview, new OverviewView(this.summaryTab
@@ -239,9 +241,10 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
updateSubTab(this.inventoryTab, this.inventoryConn, canvas, visible, true);
updateSubTab(this.inventoryTab, this.inventoryGroups, ResourceGroupListView.getGroupsOf(this.inventoryTab
.extendLocatorId("GroupsView"), resource.getId()), true, true);
- // TODO: authz check for this subtab: MANAGE_INVENTORY
- updateSubTab(this.inventoryTab, this.inventoryGroupMembership, new ResourceResourceGroupsView(this.inventoryTab
- .extendLocatorId("GroupMembershipView"), resourceId), true, true);
+ enabled = globalPermissions.contains(Permission.MANAGE_INVENTORY);
+ canvas = (enabled) ? new ResourceResourceGroupsView(this.inventoryTab.extendLocatorId("GroupMembershipView"),
+ resourceId) : null;
+ updateSubTab(this.inventoryTab, this.inventoryGroupMembership, canvas, true, enabled);
if (updateTab(this.operationsTab, facets.contains(ResourceTypeFacet.OPERATION), true)) {
// comment out GWT-based operation history until...
@@ -268,7 +271,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
updateSubTab(this.alertsTab, this.alertDelete, new FullHTMLPane(
"/rhq/resource/alert/listAlertDefinitions-plain.xhtml?id=" + resource.getId()), true, true);
- if (updateTab(this.configurationTab, facets.contains(ResourceTypeFacet.CONFIGURATION), permissions
+ if (updateTab(this.configurationTab, facets.contains(ResourceTypeFacet.CONFIGURATION), resourcePermissions
.isConfigureRead())) {
updateSubTab(this.configurationTab, this.configCurrent, new ResourceConfigurationEditView(this
.extendLocatorId("ResourceConfigView"), resource), true, true);
@@ -300,7 +303,8 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
return this.resourceId;
}
- protected void loadSelectedItem(final int resourceId, final ViewPath viewPath) {
+ protected void loadSelectedItem(final int resourceId, final ViewPath viewPath,
+ final Set<Permission> globalPermissions) {
this.resourceId = resourceId;
ResourceCriteria criteria = new ResourceCriteria();
@@ -323,13 +327,14 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
onFailure(new Exception("Resource with id [" + resourceId + "] does not exist."));
} else {
final ResourceComposite resourceComposite = result.get(0);
- loadResourceType(resourceComposite, viewPath);
+ loadResourceType(resourceComposite, viewPath, globalPermissions);
}
}
});
}
- private void loadResourceType(final ResourceComposite resourceComposite, final ViewPath viewPath) {
+ private void loadResourceType(final ResourceComposite resourceComposite, final ViewPath viewPath,
+ final Set<Permission> globalPermissions) {
final Resource resource = resourceComposite.getResource();
ResourceTypeRepository.Cache.getInstance().getResourceTypes(
resource.getResourceType().getId(),
@@ -341,7 +346,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
public void onTypesLoaded(ResourceType type) {
resourceComposite.getResource().setResourceType(type);
ResourceDetailView.this.resourceComposite = resourceComposite;
- updateTabContent(resourceComposite);
+ updateTabContent(resourceComposite, globalPermissions);
selectTab(getTabName(), getSubTabName(), viewPath);
}
});
commit 964d6819a63b7a44baacbc015d72e0fc9b4c588b
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Sep 23 09:58:57 2010 -0400
Tab and SubTab work
- Rearranged things a bit to avoid ID conflicts/leaked widgets. Buttons
that were created but not visible (subtabs of detached tabs) were
not being destroyed in a timely manner. So, now create buttons only
when they are going to be visible. To help this I also encapsulated the
Button into the SubTab object itself.
- Added logic to not create views for subtabs that are not visible.
- Work to fix initial subtab selection.
- Work to avoid flash of buttons by hiding the detail view until after the
tabs have been updated the first time.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java
index 1d6134b..e149772 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTab.java
@@ -22,6 +22,7 @@ package org.rhq.enterprise.gui.coregui.client.components.tab;
import com.smartgwt.client.widgets.Canvas;
import org.rhq.enterprise.gui.coregui.client.util.selenium.Locatable;
+import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableButton;
/**
* Simple class to provide a SubTab a locatorId.
@@ -32,11 +33,13 @@ public class SubTab implements Locatable {
private String locatorId;
private String title;
private Canvas canvas;
+ private LocatableButton button;
public SubTab(String locatorId, String title, Canvas canvas) {
this.locatorId = locatorId;
this.title = title;
this.canvas = canvas;
+ this.button = null;
}
public String getLocatorId() {
@@ -55,9 +58,17 @@ public class SubTab implements Locatable {
this.canvas = canvas;
}
+ public LocatableButton getButton() {
+ return button;
+ }
+
+ public void setButton(LocatableButton button) {
+ this.button = button;
+ }
+
@Override
public String extendLocatorId(String extension) {
- return this.locatorId + "_" + extension;
+ return this.locatorId + "_" + extension;
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
index 0005436..ff78476 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/SubTabLayout.java
@@ -18,7 +18,10 @@
*/
package org.rhq.enterprise.gui.coregui.client.components.tab;
-import java.util.*;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
import com.google.gwt.event.shared.HandlerManager;
import com.google.gwt.event.shared.HandlerRegistration;
@@ -39,15 +42,14 @@ import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
*/
public class SubTabLayout extends LocatableVLayout {
- /** maps subtab locator IDs to SubTabs */
- private Map<String, SubTab> subtabs = new LinkedHashMap<String, SubTab>();
- /** maps subtab locator IDs to subtab Buttons */
- private Map<String, Button> subTabButtons = new LinkedHashMap<String, Button>();
- /** locator IDs of subtabs that are disabled */
+ /** maps subTab locator IDs to SubTabs */
+ private Map<String, SubTab> subTabs = new LinkedHashMap<String, SubTab>();
+ /** locator IDs of subTabs that are disabled */
private Set<String> disabledSubTabs = new HashSet<String>();
private SubTab currentlyDisplayed;
private String currentlySelected;
+ private ToolStrip buttonBar;
public SubTabLayout(String locatorId) {
super(locatorId);
@@ -63,154 +65,149 @@ public class SubTabLayout extends LocatableVLayout {
setMargin(0);
setPadding(0);
- ToolStrip buttonBar = new ToolStrip();
+ buttonBar = new ToolStrip();
buttonBar.setBackgroundColor("grey");
buttonBar.setWidth100();
buttonBar.setBorder(null);
buttonBar.setMembersMargin(30);
addMember(buttonBar);
-
- int i = 0;
-
- for (final String locatorId : subtabs.keySet()) {
-
- SubTab subTab = subtabs.get(locatorId);
-
- if (currentlySelected == null) {
- currentlySelected = locatorId;
- }
-
- Button button = new LocatableButton(locatorId, subTab.getTitle());
- button.setShowRollOver(false);
- button.setActionType(SelectionType.RADIO);
- button.setRadioGroup("subtabs");
- button.setBorder(null);
- button.setAutoFit(true);
- if (disabledSubTabs.contains(locatorId)) {
- button.disable();
- } else {
- button.enable();
- }
-
- button.setBaseStyle("SubTabButton");
-
- // button.setStyleName("SubTabButton");
- // button.setStylePrimaryName("SubTabButton");
-
- button.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- currentlySelected = locatorId;
- fireSubTabSelection();
- draw();
- }
- });
-
- subTabButtons.put(locatorId, button);
-
- buttonBar.addMember(button);
- }
-
- // Initial settings
- selectSubTabByLocatorId(currentlySelected);
}
@Override
protected void onDraw() {
super.onDraw();
- selectSubTabByLocatorId(currentlySelected);
+ if (null == currentlySelected) {
+ SubTab initial = getDefaultSubTab();
+ if (null != initial) {
+ currentlySelected = initial.getLocatorId();
+ }
+ }
+ if (null != currentlySelected) {
+ selectSubTabByLocatorId(currentlySelected);
+ }
}
- public void enableSubTab(String locatorId) {
- disabledSubTabs.remove(locatorId);
- if (subTabButtons.containsKey(locatorId)) {
- subTabButtons.get(locatorId).enable();
- markForRedraw();
+ /**
+ * Make subTab visible.
+ *
+ * @param subTab not null
+ */
+ public void showSubTab(SubTab subTab) {
+ LocatableButton button = subTab.getButton();
+ if (null == button) {
+ button = createSubTabButton(subTab);
+ buttonBar.addMember(button);
+ subTab.setButton(button);
}
+ button.show();
}
- public void disableSubTab(String locatorId) {
- disabledSubTabs.add(locatorId);
- if (subTabButtons.containsKey(locatorId)) {
- subTabButtons.get(locatorId).disable();
- markForRedraw();
+ /**
+ * Make subTab not visible.
+ *
+ * @param subTab not null
+ */
+ public void hideSubTab(SubTab subTab) {
+ Button button = subTab.getButton();
+ if (null != button) {
+ buttonBar.removeMember(button);
+ button.destroy();
+ subTab.setButton(null);
}
}
- public void updateSubTab(SubTab subTab) {
+ public boolean isSubTabVisible(SubTab subTab) {
+ return (null != subTab && null != subTab.getButton());
+ }
- // Destroy old views so they don't leak
- // TODO: You've already leaked because the subtab has already had its canvas replaced.
-// Canvas oldCanvas = subTab.getCanvas();
-// if (oldCanvas != null) {
-// oldCanvas.destroy();
-// }
+ private LocatableButton createSubTabButton(final SubTab subTab) {
+ LocatableButton button = new LocatableButton(subTab.getLocatorId(), subTab.getTitle());
+ button.setShowRollOver(false);
+ button.setActionType(SelectionType.RADIO);
+ button.setRadioGroup("subTabs");
+ button.setBorder(null);
+ button.setAutoFit(true);
- String locatorId = subTab.getLocatorId();
- this.subtabs.put(locatorId, subTab);
- if (locatorId.equals(this.currentlySelected)) {
- refresh();
+ button.setBaseStyle("SubTabButton");
+
+ // button.setStyleName("SubTabButton");
+ // button.setStylePrimaryName("SubTabButton");
+
+ button.addClickHandler(new ClickHandler() {
+ public void onClick(ClickEvent clickEvent) {
+ SubTabLayout.this.currentlySelected = subTab.getLocatorId();
+ fireSubTabSelection();
+ draw();
+ }
+ });
+
+ return (button);
+ }
+
+ /**
+ * Ignored if not visible. Otherwise, enabled.
+ */
+ public void enableSubTab(SubTab subTab) {
+ if (isSubTabVisible(subTab)) {
+ disabledSubTabs.remove(subTab.getLocatorId());
+ subTab.getButton().enable();
+ subTab.getButton().show();
+ }
+ }
+
+ /**
+ * Ignored if not visible. Otherwise, disabled.
+ */
+ public void disableSubTab(SubTab subTab) {
+ if (isSubTabVisible(subTab)) {
+ disabledSubTabs.add(subTab.getLocatorId());
+ subTab.getButton().disable();
+ subTab.getButton().show();
}
}
- public void unregisterAllSubTabs() {
- destroyViews();
- subtabs.clear();
- markForRedraw();
+ /**
+ * @return true if not visible or disabled
+ */
+ public boolean isSubTabDisabled(SubTab subTab) {
+ return (!isSubTabVisible(subTab) || subTab.getButton().getDisabled());
}
public void registerSubTab(SubTab subTab) {
String locatorId = subTab.getLocatorId();
- if (currentlySelected == null) {
- currentlySelected = locatorId;
- }
- subtabs.put(locatorId, subTab);
- }
-
- public void setVisible(SubTab subTab, boolean visible) {
- Button button = this.subTabButtons.get(subTab.getLocatorId());
- if (visible) {
- if (!button.isVisible()) {
- button.show();
- markForRedraw();
- }
- } else {
- if (button.isVisible()) {
- button.hide();
- markForRedraw();
- }
- }
+ subTabs.put(locatorId, subTab);
}
public SubTab getDefaultSubTab() {
- // the default subtab is the first one in the set that is not disabled
- for (SubTab subtab : this.subtabs.values()) {
- if (!this.disabledSubTabs.contains(subtab.getLocatorId())) {
- return subtab;
+ // the default subTab is the first one in the set that is visible and not disabled
+ for (SubTab subTab : this.subTabs.values()) {
+ if (!isSubTabDisabled(subTab)) {
+ return subTab;
}
}
return null;
}
- public boolean selectSubTab(SubTab subtab) {
- if (subtab == null) {
- throw new IllegalArgumentException("subtab is null.");
+ public boolean selectSubTab(SubTab subTab) {
+ if (subTab == null) {
+ throw new IllegalArgumentException("subTab is null.");
}
- return selectSubTabByLocatorId(subtab.getLocatorId());
+ return selectSubTabByLocatorId(subTab.getLocatorId());
}
public boolean selectSubTabByLocatorId(String locatorId) {
boolean foundTab = false;
- for (String subtabLocatorId : this.subtabs.keySet()) {
- if (subtabLocatorId.equals(locatorId)) {
- if (this.disabledSubTabs.contains(subtabLocatorId)) {
+ for (String subTabLocatorId : this.subTabs.keySet()) {
+ if (subTabLocatorId.equals(locatorId)) {
+ if (this.disabledSubTabs.contains(subTabLocatorId)) {
// Nice try - user tried to select a disabled tab, probably by going directly to a bookmark URL.
- SubTab subtab = this.subtabs.get(subtabLocatorId);
- CoreGUI.getErrorHandler().handleError("Cannot select disabled subtab '" + subtab.getTitle() + "'.");
+ SubTab subTab = this.subTabs.get(subTabLocatorId);
+ CoreGUI.getErrorHandler().handleError("Cannot select disabled subTab '" + subTab.getTitle() + "'.");
} else {
- this.currentlySelected = subtabLocatorId;
+ this.currentlySelected = subTabLocatorId;
foundTab = true;
}
break;
@@ -225,10 +222,10 @@ public class SubTabLayout extends LocatableVLayout {
}
public SubTab getSubTabByTitle(String title) {
- for (String subtabLocatorId : this.subtabs.keySet()) {
- SubTab subtab = this.subtabs.get(subtabLocatorId);
- if (subtab.getTitle().equals(title)) {
- return subtab;
+ for (String subTabLocatorId : this.subTabs.keySet()) {
+ SubTab subTab = this.subTabs.get(subTabLocatorId);
+ if (subTab.getTitle().equals(title)) {
+ return subTab;
}
}
@@ -236,9 +233,9 @@ public class SubTabLayout extends LocatableVLayout {
}
public SubTab getSubTabByLocatorId(String locatorId) {
- for (String subtabLocatorId : this.subtabs.keySet()) {
- if (subtabLocatorId.equals(locatorId)) {
- return this.subtabs.get(subtabLocatorId);
+ for (String subTabLocatorId : this.subTabs.keySet()) {
+ if (subTabLocatorId.equals(locatorId)) {
+ return this.subTabs.get(subTabLocatorId);
}
}
@@ -246,23 +243,31 @@ public class SubTabLayout extends LocatableVLayout {
}
public boolean selectSubTabByTitle(String title) {
- SubTab subtab = getSubTabByTitle(title);
- if (subtab == null) {
+ SubTab subTab = getSubTabByTitle(title);
+ if (subTab == null) {
return false;
} else {
- if (this.disabledSubTabs.contains(subtab.getLocatorId())) {
+ if (this.disabledSubTabs.contains(subTab.getLocatorId())) {
// Nice try - user tried to select a disabled tab, probably by going directly to a bookmark URL.
- CoreGUI.getErrorHandler().handleError("Cannot select disabled subtab '" + title + "'.");
+ CoreGUI.getErrorHandler().handleError("Cannot select disabled subTab '" + title + "'.");
return false;
}
- this.currentlySelected = subtab.getLocatorId();
+ this.currentlySelected = subTab.getLocatorId();
refresh();
return true;
}
}
public SubTab getCurrentSubTab() {
- return this.subtabs.get(this.currentlySelected);
+ if (null == currentlySelected) {
+ SubTab current = getDefaultSubTab();
+ if (null != current) {
+ currentlySelected = current.getLocatorId();
+ }
+ return current;
+ }
+
+ return this.subTabs.get(this.currentlySelected);
}
// ------- Event support -------
@@ -276,34 +281,34 @@ public class SubTabLayout extends LocatableVLayout {
public void fireSubTabSelection() {
TwoLevelTabSelectedEvent event = new TwoLevelTabSelectedEvent("?", getCurrentSubTab().getTitle(), -1,
- getCurrentCanvas());
+ getCurrentCanvas());
hm.fireEvent(event);
}
public Canvas getCurrentCanvas() {
- return currentlyDisplayed != null ? currentlyDisplayed.getCanvas() : subtabs.get(currentlySelected).getCanvas();
+ return currentlyDisplayed != null ? currentlyDisplayed.getCanvas() : subTabs.get(currentlySelected).getCanvas();
}
/**
* Destroy all the currently held views so that they can be replaced with new versions
*/
public void destroyViews() {
- for (SubTab subtab : subtabs.values()) {
- if (subtab.getCanvas() != null) {
- subtab.getCanvas().destroy();
- subtab.setCanvas(null);
+ for (SubTab subTab : subTabs.values()) {
+ if (subTab.getCanvas() != null) {
+ subTab.getCanvas().destroy();
+ subTab.setCanvas(null);
}
}
}
private void refresh() {
- if (isDrawn()) {
- Button button = this.subTabButtons.get(this.currentlySelected);
+ if (isDrawn() && null != this.currentlySelected) {
+ Button button = this.subTabs.get(this.currentlySelected).getButton();
button.select();
- SubTab currentSubtab = this.subtabs.get(this.currentlySelected);
+ SubTab currentSubTab = this.subTabs.get(this.currentlySelected);
- if (this.currentlyDisplayed != null && this.currentlyDisplayed.getCanvas() != currentSubtab.getCanvas()) {
+ if (this.currentlyDisplayed != null && this.currentlyDisplayed.getCanvas() != currentSubTab.getCanvas()) {
try {
this.currentlyDisplayed.getCanvas().hide();
} catch (Exception e) {
@@ -311,7 +316,7 @@ public class SubTabLayout extends LocatableVLayout {
}
}
- Canvas canvas = currentSubtab.getCanvas();
+ Canvas canvas = currentSubTab.getCanvas();
if (canvas != null) {
if (hasMember(canvas)) {
if (!canvas.isVisible()) {
@@ -324,7 +329,7 @@ public class SubTabLayout extends LocatableVLayout {
addMember(canvas);
}
markForRedraw();
- this.currentlyDisplayed = currentSubtab;
+ this.currentlyDisplayed = currentSubTab;
}
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
index cbb6370..4468d93 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTab.java
@@ -34,10 +34,6 @@ public class TwoLevelTab extends LocatableTab {
layout = new SubTabLayout(locatorId);
}
- public void updateSubTab(SubTab subTab) {
- layout.updateSubTab(subTab);
- }
-
public void registerSubTabs(SubTab... subTabs) {
for (SubTab subTab : subTabs) {
layout.registerSubTab(subTab);
@@ -45,14 +41,18 @@ public class TwoLevelTab extends LocatableTab {
}
public void setVisible(SubTab subTab, boolean visible) {
- layout.setVisible(subTab, visible);
+ if (visible) {
+ layout.showSubTab(subTab);
+ } else {
+ layout.hideSubTab(subTab);
+ }
}
- public void setSubTabEnabled(String locatorId, boolean enabled) {
+ public void setSubTabEnabled(SubTab subTab, boolean enabled) {
if (enabled) {
- layout.enableSubTab(locatorId);
+ layout.enableSubTab(subTab);
} else {
- layout.disableSubTab(locatorId);
+ layout.disableSubTab(subTab);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
index d39efb7..d8e29b2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/tab/TwoLevelTabSet.java
@@ -39,7 +39,7 @@ public class TwoLevelTabSet extends LocatableTabSet implements TabSelectedHandle
public void setTabs(TwoLevelTab... tabs) {
super.setTabs(tabs);
- for (TwoLevelTab tab : tabs) {
+ for (TwoLevelTab tab : tabs) {
tab.getLayout().addTwoLevelTabSelectedHandler(this);
updateTab(tab, tab.getPane());
}
@@ -71,15 +71,17 @@ public class TwoLevelTabSet extends LocatableTabSet implements TabSelectedHandle
public void onTabSelected(TabSelectedEvent tabSelectedEvent) {
TwoLevelTab tab = (TwoLevelTab) getSelectedTab();
- TwoLevelTabSelectedEvent event = new TwoLevelTabSelectedEvent(tab.getTitle(),
- tab.getLayout().getCurrentSubTab().getTitle(), tabSelectedEvent.getTabNum(),
- tab.getLayout().getCurrentCanvas());
- m.fireEvent(event);
+ SubTab currentSubTab = tab.getLayout().getCurrentSubTab();
+ if (null != currentSubTab) {
+ TwoLevelTabSelectedEvent event = new TwoLevelTabSelectedEvent(tab.getTitle(), tab.getLayout()
+ .getCurrentSubTab().getTitle(), tabSelectedEvent.getTabNum(), tab.getLayout().getCurrentCanvas());
+ m.fireEvent(event);
+ }
}
public void onTabSelected(TwoLevelTabSelectedEvent tabSelectedEvent) {
tabSelectedEvent.setTabNum(getSelectedTabNumber());
- Tab tab = getSelectedTab();
+ Tab tab = getSelectedTab();
tabSelectedEvent.setId(tab.getTitle());
m.fireEvent(tabSelectedEvent);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
index 8f7452c..c11659e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/AbstractTwoLevelTabSetView.java
@@ -18,10 +18,13 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.common.detail;
+import java.util.List;
+
import com.google.gwt.user.client.History;
import com.smartgwt.client.types.Side;
import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.layout.Layout;
+
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.ViewPath;
@@ -32,14 +35,12 @@ import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSelectedH
import org.rhq.enterprise.gui.coregui.client.components.tab.TwoLevelTabSet;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableVLayout;
-import java.util.List;
-
/**
* @author Greg Hinkle
* @author Ian Springer
*/
-public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends LocatableVLayout
- implements BookmarkableView, TwoLevelTabSelectedHandler {
+public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends LocatableVLayout implements
+ BookmarkableView, TwoLevelTabSelectedHandler {
private String baseViewPath;
private TwoLevelTabSet tabSet;
private String tabName;
@@ -81,6 +82,7 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
protected abstract void loadSelectedItem(int itemId, ViewPath viewPath);
protected abstract void updateTabContent(T selectedItem);
+
// ---------------------------------------------------------
protected U getTitleBar() {
@@ -101,13 +103,13 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
}
}
- return enabled;
+ return (visible && enabled);
}
protected void updateSubTab(TwoLevelTab tab, SubTab subTab, Canvas canvas, boolean visible, boolean enabled) {
tab.setVisible(subTab, visible);
if (visible) {
- tab.setSubTabEnabled(subTab.getLocatorId(), enabled);
+ tab.setSubTabEnabled(subTab, enabled);
if (enabled) {
subTab.setCanvas(canvas);
}
@@ -175,8 +177,7 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
*/
public void selectTab(String tabTitle, String subtabTitle, ViewPath viewPath) {
try {
- TwoLevelTab tab = (tabTitle != null) ? this.tabSet.getTabByTitle(tabTitle) :
- this.tabSet.getDefaultTab();
+ TwoLevelTab tab = (tabTitle != null) ? this.tabSet.getTabByTitle(tabTitle) : this.tabSet.getDefaultTab();
if (tab == null || tab.getDisabled()) {
CoreGUI.getErrorHandler().handleError("Invalid tab name: " + tabTitle);
// TODO: Should we fire a history event here to redirect to a valid bookmark?
@@ -221,5 +222,5 @@ public abstract class AbstractTwoLevelTabSetView<T, U extends Layout> extends Lo
public String getSubTabName() {
return subTabName;
- }
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
index 05590ff..17d901c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupDetailView.java
@@ -24,6 +24,7 @@ import java.util.List;
import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.tab.Tab;
import org.rhq.core.domain.authz.Permission;
@@ -98,6 +99,7 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
public ResourceGroupDetailView(String locatorId) {
super(locatorId, BASE_VIEW_PATH);
+ this.hide();
}
@Override
@@ -177,6 +179,9 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
}
protected void updateTabContent(ResourceGroupComposite groupComposite) {
+ boolean visible;
+ Canvas canvas;
+
this.groupComposite = groupComposite;
ResourceGroup group = groupComposite.getResourceGroup();
int groupId = group.getId();
@@ -194,22 +199,24 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
// summaryTab.updateSubTab("Timeline", timelinePane);
// Summary tab is always visible and enabled.
updateSubTab(this.summaryTab, this.summaryOverview, new OverviewView(this.summaryTab
- .extendLocatorId("Overview"), this.groupComposite), true, true);
+ .extendLocatorId("OverviewView"), this.groupComposite), true, true);
if (updateTab(this.monitoringTab, groupCategory == GroupCategory.COMPATIBLE, true)) {
- updateSubTab(this.monitoringTab, this.monitorGraphs, new FullHTMLPane(
- "/rhq/group/monitor/graphs-plain.xhtml?groupId=" + groupId), hasMetricsOfType(this.groupComposite,
- DataType.MEASUREMENT), true);
- updateSubTab(this.monitoringTab, this.monitorTables, new FullHTMLPane(
- "/rhq/group/monitor/tables-plain.xhtml?groupId=" + groupId), hasMetricsOfType(this.groupComposite,
- DataType.MEASUREMENT), true);
- updateSubTab(this.monitoringTab, this.monitorTraits, new TraitsView(this.monitoringTab
- .extendLocatorId("TraitsView"), groupId), hasMetricsOfType(this.groupComposite, DataType.TRAIT), true);
- updateSubTab(this.monitoringTab, this.monitorSched, new SchedulesView(this.monitoringTab
- .extendLocatorId("SchedulesView"), groupId), hasMetricsOfType(this.groupComposite, null), true);
- updateSubTab(this.monitoringTab, this.monitorCallTime, new FullHTMLPane(
- "/rhq/group/monitor/response-plain.xhtml?groupId=" + groupId), facets
- .contains(ResourceTypeFacet.CALL_TIME), true);
+ visible = hasMetricsOfType(this.groupComposite, DataType.MEASUREMENT);
+ canvas = (visible) ? new FullHTMLPane("/rhq/group/monitor/graphs-plain.xhtml?groupId=" + groupId) : null;
+ updateSubTab(this.monitoringTab, this.monitorGraphs, canvas, visible, true);
+ // visible = same test as above
+ canvas = (visible) ? new FullHTMLPane("/rhq/group/monitor/tables-plain.xhtml?groupId=" + groupId) : null;
+ updateSubTab(this.monitoringTab, this.monitorTables, canvas, visible, true);
+ visible = hasMetricsOfType(this.groupComposite, DataType.TRAIT);
+ canvas = (visible) ? new TraitsView(this.monitoringTab.extendLocatorId("TraitsView"), groupId) : null;
+ updateSubTab(this.monitoringTab, this.monitorTraits, canvas, visible, true);
+ visible = hasMetricsOfType(this.groupComposite, null);
+ canvas = (visible) ? new SchedulesView(this.monitoringTab.extendLocatorId("SchedulesView"), groupId) : null;
+ updateSubTab(this.monitoringTab, this.monitorSched, canvas, visible, true);
+ visible = facets.contains(ResourceTypeFacet.CALL_TIME);
+ canvas = (visible) ? new FullHTMLPane("/rhq/group/monitor/response-plain.xhtml?groupId=" + groupId) : null;
+ updateSubTab(this.monitoringTab, this.monitorCallTime, canvas, visible, true);
// TODO (ips): Add Availability subtab.
}
@@ -220,6 +227,7 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
//updateSubTab(this.inventoryTab, this.inventoryConn,
// new GroupPluginConfigurationEditView(this.group.getId(), this.group.getResourceType().getId(), ConfigurationEditor.ConfigType.plugin),
// facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION), true);
+ // TODO: should require MANAGE_INVENTORY authz
updateSubTab(this.inventoryTab, this.inventoryMembership, new ResourceGroupMembershipView(this.inventoryTab
.extendLocatorId("MembershipView"), groupId), true, true);
@@ -238,8 +246,8 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
"/rhq/group/alert/listGroupAlertDefinitions-plain.xhtml?groupId=" + groupId), true, true);
}
- if (updateTab(this.configurationTab, groupCategory == GroupCategory.COMPATIBLE
- && facets.contains(ResourceTypeFacet.CONFIGURATION), this.permissions.isConfigureRead())) {
+ visible = groupCategory == GroupCategory.COMPATIBLE && facets.contains(ResourceTypeFacet.CONFIGURATION);
+ if (updateTab(this.configurationTab, visible, visible && this.permissions.isConfigureRead())) {
updateSubTab(this.configurationTab, this.configCurrent, new FullHTMLPane(
"/rhq/group/configuration/viewCurrent-plain.xhtml?groupId=" + groupId), true, true);
updateSubTab(this.configurationTab, this.configHistory, new FullHTMLPane(
@@ -250,6 +258,9 @@ public class ResourceGroupDetailView extends AbstractTwoLevelTabSetView<Resource
&& facets.contains(ResourceTypeFacet.EVENT), true)) {
updateSubTab(this.eventsTab, this.eventHistory, EventCompositeHistoryView.get(groupComposite), true, true);
}
+
+ this.show();
+ markForRedraw();
}
protected void loadSelectedItem(final int groupId, final ViewPath viewPath) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
index 8e4e16f..ba88b87 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceDetailView.java
@@ -24,6 +24,7 @@ import java.util.List;
import java.util.Set;
import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.tab.Tab;
import org.rhq.core.domain.criteria.ResourceCriteria;
@@ -110,6 +111,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
public ResourceDetailView(String locatorId) {
super(locatorId, BASE_VIEW_PATH);
+ this.hide();
}
protected List<TwoLevelTab> createTabs() {
@@ -188,6 +190,9 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
}
protected void updateTabContent(ResourceComposite resourceComposite) {
+ boolean visible;
+ Canvas canvas;
+
this.resourceComposite = resourceComposite;
Resource resource = this.resourceComposite.getResource();
getTitleBar().setResource(resource);
@@ -205,31 +210,36 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
updateSubTab(this.summaryTab, this.summaryTimeline, new FullHTMLPane(
"/rhq/resource/summary/timeline-plain.xhtml?id=" + resource.getId()), true, true);
- updateSubTab(this.monitoringTab, this.monitorGraphs, new GraphListView(this.monitoringTab
- .extendLocatorId("GraphListView"), resource),
- hasMetricsOfType(this.resourceComposite, DataType.MEASUREMENT), true);
- updateSubTab(this.monitoringTab, this.monitorTables, new FullHTMLPane(
- "/rhq/common/monitor/tables-plain.xhtml?id=" + resource.getId()), hasMetricsOfType(this.resourceComposite,
- DataType.MEASUREMENT), true);
- updateSubTab(this.monitoringTab, this.monitorTraits, new TraitsView(this.monitoringTab
- .extendLocatorId("TraitsView"), resource.getId()),
- hasMetricsOfType(this.resourceComposite, DataType.TRAIT), true);
+ visible = hasMetricsOfType(this.resourceComposite, DataType.MEASUREMENT);
+ canvas = (visible) ? new GraphListView(this.monitoringTab.extendLocatorId("GraphListView"), resource) : null;
+ updateSubTab(this.monitoringTab, this.monitorGraphs, canvas, visible, true);
+ // visible = same test as above
+ canvas = (visible) ? new FullHTMLPane("/rhq/common/monitor/tables-plain.xhtml?id=" + resource.getId()) : null;
+ updateSubTab(this.monitoringTab, this.monitorTables, canvas, visible, true);
+ visible = hasMetricsOfType(this.resourceComposite, DataType.TRAIT);
+ canvas = (visible) ? new TraitsView(this.monitoringTab.extendLocatorId("TraitsView"), resource.getId()) : null;
+ updateSubTab(this.monitoringTab, this.monitorTraits, canvas, visible, true);
updateSubTab(this.monitoringTab, this.monitorAvail, new FullHTMLPane(
"/rhq/resource/monitor/availabilityHistory-plain.xhtml?id=" + resource.getId()), true, true);
updateSubTab(this.monitoringTab, this.monitorSched, new SchedulesView(monitoringTab
.extendLocatorId("SchedulesView"), resource.getId()), hasMetricsOfType(this.resourceComposite, null), true);
- updateSubTab(this.monitoringTab, this.monitorCallTime, new FullHTMLPane(
- "/rhq/resource/monitor/response-plain.xhtml?id=" + resource.getId()), facets
- .contains(ResourceTypeFacet.CALL_TIME), true);
+ visible = facets.contains(ResourceTypeFacet.CALL_TIME);
+ canvas = (visible) ? new FullHTMLPane("/rhq/resource/monitor/response-plain.xhtml?id=" + resource.getId())
+ : null;
+ updateSubTab(this.monitoringTab, this.monitorCallTime, canvas, visible, true);
ResourceType type = this.resourceComposite.getResource().getResourceType();
- updateSubTab(this.inventoryTab, this.inventoryChildren, ResourceSearchView.getChildrenOf(this.inventoryTab
- .extendLocatorId("ChildrenView"), resource.getId()), !type.getChildResourceTypes().isEmpty(), true);
- updateSubTab(this.inventoryTab, this.inventoryConn, new PluginConfigurationEditView(this.inventoryTab
- .extendLocatorId("PluginConfigView"), resource), facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION),
- true);
+ visible = !type.getChildResourceTypes().isEmpty();
+ canvas = (visible) ? ResourceSearchView.getChildrenOf(this.inventoryTab.extendLocatorId("ChildrenView"),
+ resource.getId()) : null;
+ updateSubTab(this.inventoryTab, this.inventoryChildren, canvas, visible, true);
+ visible = facets.contains(ResourceTypeFacet.PLUGIN_CONFIGURATION);
+ canvas = (visible) ? new PluginConfigurationEditView(this.inventoryTab.extendLocatorId("PluginConfigView"),
+ resource) : null;
+ updateSubTab(this.inventoryTab, this.inventoryConn, canvas, visible, true);
updateSubTab(this.inventoryTab, this.inventoryGroups, ResourceGroupListView.getGroupsOf(this.inventoryTab
.extendLocatorId("GroupsView"), resource.getId()), true, true);
+ // TODO: authz check for this subtab: MANAGE_INVENTORY
updateSubTab(this.inventoryTab, this.inventoryGroupMembership, new ResourceResourceGroupsView(this.inventoryTab
.extendLocatorId("GroupMembershipView"), resourceId), true, true);
@@ -241,7 +251,7 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
// 4) user can navigate to the group operation that spawned this resource operation history, if appropriate
// note: enabled operation execution/schedules from left-nav, if it doesn't already exist
updateSubTab(this.operationsTab, this.opHistory, OperationHistoryView.getResourceHistoryView(operationsTab
- .extendLocatorId("History"), this.resourceComposite), true, true);
+ .extendLocatorId("HistoryView"), this.resourceComposite), true, true);
updateSubTab(this.operationsTab, this.opSched, new FullHTMLPane(
"/rhq/resource/operation/resourceOperationSchedules-plain.xhtml?id=" + resource.getId()), true, true);
}
@@ -254,16 +264,16 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
updateSubTab(this.alertsTab, this.alertHistory, new FullHTMLPane(
"/rhq/resource/alert/listAlertHistory-plain.xhtml?id=" + resource.getId()), true, true);
updateSubTab(this.alertsTab, this.alertDef, new ResourceAlertDefinitionsView(alertsTab
- .extendLocatorId("AlertDef"), this.resourceComposite), true, true);
+ .extendLocatorId("AlertDefView"), this.resourceComposite), true, true);
updateSubTab(this.alertsTab, this.alertDelete, new FullHTMLPane(
"/rhq/resource/alert/listAlertDefinitions-plain.xhtml?id=" + resource.getId()), true, true);
if (updateTab(this.configurationTab, facets.contains(ResourceTypeFacet.CONFIGURATION), permissions
.isConfigureRead())) {
updateSubTab(this.configurationTab, this.configCurrent, new ResourceConfigurationEditView(this
- .extendLocatorId("ResourceConfig"), resource), true, true);
+ .extendLocatorId("ResourceConfigView"), resource), true, true);
updateSubTab(this.configurationTab, this.configHistory, ConfigurationHistoryView.getHistoryOf(
- configurationTab.extendLocatorId("Hist"), resource.getId()), true, true);
+ configurationTab.extendLocatorId("HistoryView"), resource.getId()), true, true);
}
if (updateTab(this.eventsTab, facets.contains(ResourceTypeFacet.EVENT), true)) {
@@ -281,6 +291,9 @@ public class ResourceDetailView extends AbstractTwoLevelTabSetView<ResourceCompo
updateSubTab(this.contentTab, this.contentHistory, new FullHTMLPane(
"/rhq/resource/content/history-plain.xhtml?id=" + resource.getId()), true, true);
}
+
+ this.show();
+ markForRedraw();
}
public Integer getSelectedItemId() {
commit 43ce65db4af85551e98c636db80f113cb7be2d98
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Sep 21 18:30:53 2010 -0400
Allow Resource.explicitGroups to be passed from server to CoreGUI.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
index 25b19b0..66a25be 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/ResourceGWTServiceImpl.java
@@ -86,7 +86,7 @@ public class ResourceGWTServiceImpl extends AbstractGWTServiceImpl implements Re
// "resourceConfigurationUpdates \n" +
// "pluginConfigurationUpdates \n" +
// "implicitGroups \n" +
- // "explicitGroups \n" +
+ "explicitGroups",
// "contentServiceRequests \n" +
// "createChildResourceRequests \n" +
// "deleteResourceRequests \n" +
13 years, 8 months
[rhq] 3 commits - modules/core modules/enterprise
by Joseph Marques
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java | 8
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java | 6
modules/core/domain/src/main/java/org/rhq/core/domain/util/CriteriaUtils.java | 58 +++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupDataSourceField.java | 71 ++++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java | 32 ---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDataSourceField.java | 10 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java | 82 +---------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java | 77 ++++++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java | 64 +++++++
9 files changed, 286 insertions(+), 122 deletions(-)
New commits:
commit 9a36c9d68e27aead173d141e7819b2a16d6c9236
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Sep 23 07:49:43 2010 -0400
simplify the process of creating Criteria objects from a DSRequest
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupDataSourceField.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupDataSourceField.java
new file mode 100644
index 0000000..d7deadd
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupDataSourceField.java
@@ -0,0 +1,71 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 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.inventory.groups;
+
+import com.smartgwt.client.widgets.grid.ListGridField;
+
+public enum ResourceGroupDataSourceField {
+
+ NAME("name", "Name"),
+
+ DESCRIPTION("description", "Description"),
+
+ TYPE("typeName", "Type"),
+
+ PLUGIN("pluginName", "Plugin"),
+
+ CATEGORY("category", "Category");
+
+ /**
+ * Corresponds to a property name of Resource
+ */
+ private String propertyName;
+
+ /**
+ * The display name for the field or property
+ */
+ private String title;
+
+ private ResourceGroupDataSourceField(String propertyName, String title) {
+ this.propertyName = propertyName;
+ this.title = title;
+ }
+
+ public String propertyName() {
+ return propertyName;
+ }
+
+ public String title() {
+ return title;
+ }
+
+ public ListGridField getListGridField() {
+ return new ListGridField(propertyName, title);
+ }
+
+ public ListGridField getListGridField(int width) {
+ return new ListGridField(propertyName, title, width);
+ }
+
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
index 91bf412..2a02c99 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/ResourceGroupsDataSource.java
@@ -18,6 +18,9 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.groups;
+import static org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.CATEGORY;
+import static org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField.NAME;
+
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
@@ -93,32 +96,13 @@ public class ResourceGroupsDataSource extends RPCDataSource<ResourceGroup> {
protected ResourceGroupCriteria getFetchCriteria(final DSRequest request) {
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
-
criteria.setPageControl(getPageControl(request));
- if (request.getCriteria().getValues().get("name") != null) {
- criteria.addFilterName((String) request.getCriteria().getValues().get("name"));
- }
-
- if (request.getCriteria().getValues().get("category") != null) {
- criteria.addFilterGroupCategory(GroupCategory.valueOf(((String) request.getCriteria().getValues().get(
- "category")).toUpperCase()));
- }
-
- if (request.getCriteria().getValues().get("downMemberCount") != null) {
- criteria.addFilterDownMemberCount(Integer.parseInt((String) request.getCriteria().getValues().get(
- "downMemberCount")));
- }
-
- if (request.getCriteria().getValues().get("explicitResourceId") != null) {
- criteria.addFilterExplicitResourceIds(Integer.parseInt((String) request.getCriteria().getValues().get(
- "explicitResourceId")));
- }
-
- if (request.getCriteria().getValues().get("groupDefinitionId") != null) {
- criteria.addFilterGroupDefinitionId(Integer.parseInt((String) request.getCriteria().getValues().get(
- "groupDefinitionId")));
- }
+ criteria.addFilterName(getFilter(request, NAME.propertyName(), String.class));
+ criteria.addFilterGroupCategory(getFilter(request, CATEGORY.propertyName(), GroupCategory.class));
+ criteria.addFilterDownMemberCount(getFilter(request, "downMemberCount", Integer.class));
+ criteria.addFilterExplicitResourceIds(getFilter(request, "explicitResourceId", Integer.class));
+ criteria.addFilterGroupDefinitionId(getFilter(request, "groupDefinitionId", Integer.class));
return criteria;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDataSourceField.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDataSourceField.java
index 8b81f4c..59b55e9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDataSourceField.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDataSourceField.java
@@ -23,6 +23,8 @@
package org.rhq.enterprise.gui.coregui.client.inventory.resource;
+import com.smartgwt.client.widgets.grid.ListGridField;
+
public enum ResourceDataSourceField {
NAME("name", "Name"),
@@ -60,4 +62,12 @@ public enum ResourceDataSourceField {
return title;
}
+ public ListGridField getListGridField() {
+ return new ListGridField(propertyName, title);
+ }
+
+ public ListGridField getListGridField(int width) {
+ return new ListGridField(propertyName, title, width);
+ }
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
index 71e6eee..766df27 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceDatasource.java
@@ -25,8 +25,6 @@ import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceD
import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.PLUGIN;
import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.TYPE;
-import java.util.Map;
-
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
@@ -41,7 +39,6 @@ import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
-import org.rhq.core.domain.tagging.Tag;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -101,75 +98,22 @@ public class ResourceDatasource extends RPCDataSource<Resource> {
});
}
- @SuppressWarnings("unchecked")
protected ResourceCriteria getFetchCriteria(final DSRequest request) {
-
ResourceCriteria criteria = new ResourceCriteria();
criteria.setPageControl(getPageControl(request));
- // TODO: This call is broken in 2.2, http://code.google.com/p/smartgwt/issues/detail?id=490
- // when using AdvancedCriteria
- Map<String, Object> criteriaMap = request.getCriteria().getValues();
-
- if (criteriaMap.get("parentId") != null) {
- criteria.addFilterParentResourceId(Integer.parseInt((String) criteriaMap.get("parentId")));
- }
-
- if (criteriaMap.get("id") != null) {
- criteria.addFilterId(Integer.parseInt(request.getCriteria().getAttribute("id")));
- }
-
- if (criteriaMap.get("resourceIds") != null) {
- int[] ids = request.getCriteria().getAttributeAsIntArray("resourceIds");
- Integer[] oids = new Integer[ids.length];
- for (int i = 0; i < ids.length; i++) {
- oids[i] = ids[i++];
- }
- criteria.addFilterIds(oids);
- }
-
- // Fetch member Resources of the group with the specified id.
- if (criteriaMap.get("groupId") != null) {
- int groupId = Integer.parseInt((String) criteriaMap.get("groupId"));
- criteria.addFilterImplicitGroupIds(groupId);
- }
-
- if (criteriaMap.get(NAME.propertyName()) != null) {
- criteria.addFilterName((String) criteriaMap.get(NAME.propertyName()));
- }
-
- if (criteriaMap.get(CATEGORY.propertyName()) != null) {
- criteria.addFilterResourceCategory(ResourceCategory.valueOf(((String) criteriaMap.get(CATEGORY
- .propertyName())).toUpperCase()));
- }
-
- if (criteriaMap.get(AVAILABILITY.propertyName()) != null) {
- criteria.addFilterCurrentAvailability(AvailabilityType.valueOf(((String) criteriaMap.get(AVAILABILITY
- .propertyName())).toUpperCase()));
- }
-
- if (criteriaMap.get(TYPE.propertyName()) != null) {
- criteria.addFilterResourceTypeId(Integer.parseInt(((String) criteriaMap.get(TYPE.propertyName()))));
- }
-
- if (criteriaMap.get(PLUGIN.propertyName()) != null) {
- criteria.addFilterPluginName((String) criteriaMap.get(PLUGIN.propertyName()));
- }
-
- if (criteriaMap.get("tag") != null) {
- criteria.addFilterTag((Tag) criteriaMap.get("tag"));
- }
-
- if (criteriaMap.get("tagNamespace") != null) {
- criteria.addFilterTagNamespace((String) criteriaMap.get("tagNamespace"));
- }
-
- if (criteriaMap.get("tagSemantic") != null) {
- criteria.addFilterTagSemantic((String) criteriaMap.get("tagSemantic"));
- }
-
- if (criteriaMap.get("tagName") != null) {
- criteria.addFilterTagName((String) criteriaMap.get("tagName"));
- }
+
+ criteria.addFilterId(getFilter(request, "id", Integer.class));
+ criteria.addFilterParentResourceId(getFilter(request, "parentId", Integer.class));
+ criteria.addFilterCurrentAvailability(getFilter(request, AVAILABILITY.propertyName(), AvailabilityType.class));
+ criteria.addFilterResourceCategory(getFilter(request, CATEGORY.propertyName(), ResourceCategory.class));
+ criteria.addFilterIds(getArrayFilter(request, "resourceIds", Integer.class));
+ criteria.addFilterImplicitGroupIds(getFilter(request, "groupId", Integer.class));
+ criteria.addFilterName(getFilter(request, NAME.propertyName(), String.class));
+ criteria.addFilterResourceTypeId(getFilter(request, TYPE.propertyName(), Integer.class));
+ criteria.addFilterPluginName(getFilter(request, PLUGIN.propertyName(), String.class));
+ criteria.addFilterTagNamespace(getFilter(request, "tagNamespace", String.class));
+ criteria.addFilterTagSemantic(getFilter(request, "tagSemantic", String.class));
+ criteria.addFilterTagName(getFilter(request, "tagName", String.class));
return criteria;
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index 5b3ecf7..b61458f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -24,6 +24,7 @@ import java.util.List;
import java.util.Map;
import com.google.gwt.core.client.JavaScriptObject;
+import com.smartgwt.client.data.Criteria;
import com.smartgwt.client.data.DSRequest;
import com.smartgwt.client.data.DSResponse;
import com.smartgwt.client.data.DataSource;
@@ -241,4 +242,67 @@ public abstract class RPCDataSource<T> extends DataSource {
JSOHelper.apply(data, newRecord.getJsObj());
return newRecord;
}
+
+ @SuppressWarnings("unchecked")
+ public static <S> S[] getArrayFilter(DSRequest request, String paramName, Class<S> type) {
+ System.out.println("Fetching array " + paramName + " (" + type + ")");
+ Criteria criteria = request.getCriteria();
+ Map<String, Object> criteriaMap = criteria.getValues();
+
+ S[] resultArray = null;
+
+ Object value = (String) criteriaMap.get(paramName);
+ if (value == null) {
+ // nothing to do, result is already null
+ } else if (type == Integer.class) {
+ int[] intermediates = criteria.getAttributeAsIntArray(paramName);
+ resultArray = (S[]) new Integer[intermediates.length];
+ int index = 0;
+ for (int next : intermediates) {
+ resultArray[index++] = (S) (Integer) next;
+ }
+ } else if (type == String.class) {
+ String[] intermediates = criteria.getAttributeAsStringArray(paramName);
+ resultArray = (S[]) new String[intermediates.length];
+ int index = 0;
+ for (String next : intermediates) {
+ resultArray[index++] = (S) next;
+ }
+ } else {
+ throw new IllegalArgumentException("No support for passing array filters of type " + type);
+ }
+
+ System.out.println("Result array = " + resultArray);
+
+ return resultArray;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static <S> S getFilter(DSRequest request, String paramName, Class<S> type) {
+ System.out.println("Fetching " + paramName + " (" + type + ")");
+ Criteria criteria = request.getCriteria();
+ Map<String, Object> criteriaMap = criteria.getValues();
+
+ S result = null;
+
+ Object value = criteriaMap.get(paramName);
+ if (value == null) {
+ // nothing to do, result is already null
+ } else {
+ String strValue = value.toString();
+ if (type == String.class) {
+ result = (S) strValue;
+ } else if (type == Integer.class) {
+ result = (S) Integer.valueOf(strValue);
+ } else if (type.isEnum()) {
+ result = (S) Enum.valueOf((Class<? extends Enum>) type, strValue.toUpperCase());
+ } else {
+ result = (S) value; // otherwise presume the object is already that type, and just cast it
+ }
+ }
+
+ System.out.println("Result = " + result);
+
+ return result;
+ }
}
commit fb3843196fe9fa6c29b90f9cf8ba5e510e19fa97
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Sep 23 07:48:54 2010 -0400
greater resiliance when passing null-"ish" values to addFilterXXX Criteria methods
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
index 1eae4a3..0fd3a0a 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
@@ -22,7 +22,6 @@
*/
package org.rhq.core.domain.criteria;
-import java.util.Arrays;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
@@ -33,6 +32,7 @@ import org.rhq.core.domain.measurement.AvailabilityType;
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.util.CriteriaUtils;
import org.rhq.core.domain.util.PageOrdering;
/**
@@ -213,15 +213,15 @@ public class ResourceCriteria extends TaggedCriteria {
}
public void addFilterIds(Integer... filterIds) {
- this.filterIds = Arrays.asList(filterIds);
+ this.filterIds = CriteriaUtils.getListIgnoringNulls(filterIds);
}
public void addFilterExplicitGroupIds(Integer... filterExplicitGroupIds) {
- this.filterExplicitGroupIds = Arrays.asList(filterExplicitGroupIds);
+ this.filterExplicitGroupIds = CriteriaUtils.getListIgnoringNulls(filterExplicitGroupIds);
}
public void addFilterImplicitGroupIds(Integer... filterImplicitGroupIds) {
- this.filterImplicitGroupIds = Arrays.asList(filterImplicitGroupIds);
+ this.filterImplicitGroupIds = CriteriaUtils.getListIgnoringNulls(filterImplicitGroupIds);
}
public void addFilterRootResourceId(Integer filterRootResourceId) {
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
index 1a54f0f..6f5c259 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
@@ -22,7 +22,6 @@
*/
package org.rhq.core.domain.criteria;
-import java.util.Arrays;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
@@ -31,6 +30,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.util.CriteriaUtils;
import org.rhq.core.domain.util.PageOrdering;
/**
@@ -155,11 +155,11 @@ public class ResourceGroupCriteria extends TaggedCriteria {
}
public void addFilterExplicitResourceIds(Integer... filterExplicitResourceIds) {
- this.filterExplicitResourceIds = Arrays.asList(filterExplicitResourceIds);
+ this.filterExplicitResourceIds = CriteriaUtils.getListIgnoringNulls(filterExplicitResourceIds);
}
public void addFilterImplicitResourceIds(Integer... filterImplicitResourceIds) {
- this.filterImplicitResourceIds = Arrays.asList(filterImplicitResourceIds);
+ this.filterImplicitResourceIds = CriteriaUtils.getListIgnoringNulls(filterImplicitResourceIds);
}
/** A somewhat special case filter that ensures that all explicit group members
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/util/CriteriaUtils.java b/modules/core/domain/src/main/java/org/rhq/core/domain/util/CriteriaUtils.java
new file mode 100644
index 0000000..d6ca5e2
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/util/CriteriaUtils.java
@@ -0,0 +1,58 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 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.core.domain.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * A dumping ground for utility methods used by Criteria objects. We specifically don't want to put these into the
+ * Criteria abstract class because they would become part of the auto-completion candidate list in the interactive CLI.
+ * Putting them here (in core/domain versus, say, core/util) will provide the necessary utility without requiring
+ * further module inheritance at the coregui layer.
+ *
+ * @author Joseph Marques
+ */
+public class CriteriaUtils {
+ /*
+ * remove nulls from the passed items, and return the resultant list. return null if no non-null items exist.
+ * this is useful in criteria addFilterXXX methods which take varargs, where a single null argument should be
+ * interpreted as a null collection (instead of one-item collection whose first value is null).
+ */
+ public static <T> List<T> getListIgnoringNulls(T[] items) {
+ if (items == null) {
+ return null;
+ }
+
+ List<T> results = new ArrayList<T>();
+ for (T next : items) {
+ if (next != null) {
+ results.add(next);
+ }
+ }
+ if (results.size() == 0) {
+ return null;
+ }
+ return results;
+ }
+}
commit 260db28def8e9f080f3cf4bda8df8a75e3bd81be
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Sep 23 07:45:41 2010 -0400
fix SearchBarPane so it searches for both resources and groups
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java
index 81abe79..0d920ef 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/menu/SearchBarPane.java
@@ -18,13 +18,6 @@
*/
package org.rhq.enterprise.gui.coregui.client.menu;
-import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.AVAILABILITY;
-import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.CATEGORY;
-import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.DESCRIPTION;
-import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.NAME;
-import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.PLUGIN;
-import static org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField.TYPE;
-
import com.google.gwt.user.client.History;
import com.smartgwt.client.types.Alignment;
import com.smartgwt.client.types.TextMatchStyle;
@@ -42,7 +35,9 @@ import com.smartgwt.client.widgets.form.fields.events.ChangedHandler;
import com.smartgwt.client.widgets.grid.ListGridField;
import org.rhq.enterprise.gui.coregui.client.LinkManager;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupDataSourceField;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource;
+import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDataSourceField;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.ResourceDatasource;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableDynamicForm;
import org.rhq.enterprise.gui.coregui.client.util.selenium.LocatableHLayout;
@@ -69,8 +64,14 @@ public class SearchBarPane extends LocatableHLayout {
final SelectItem searchType = new SelectItem("searchType", "Search");
searchType.setWidth(120);
- searchType.setValueMap("Resources", "Resource Groups", "Bundles", "Packages", "Users", "Roles");
+ searchType.setValueMap("Resources", "Resource Groups"/*, "Bundles", "Packages", "Users", "Roles"*/);
searchType.setValue("Resources");
+ searchType.addChangedHandler(new ChangedHandler() {
+ @Override
+ public void onChanged(ChangedEvent event) {
+ markForRedraw();
+ }
+ });
ComboBoxItem resourceSearch = getResourceComboBox();
resourceSearch.setShowIfCondition(new FormItemIfFunction() {
@@ -79,6 +80,13 @@ public class SearchBarPane extends LocatableHLayout {
}
});
+ ComboBoxItem groupSearch = getGroupComboBox();
+ groupSearch.setShowIfCondition(new FormItemIfFunction() {
+ public boolean execute(FormItem formItem, Object o, DynamicForm dynamicForm) {
+ return form.getValueAsString("searchType").equals("Resource Groups");
+ }
+ });
+
TextItem query = new TextItem("query");
query.setShowTitle(false);
@@ -88,7 +96,7 @@ public class SearchBarPane extends LocatableHLayout {
search.setShowTitle(false);
search.setIcon(Window.getImgURL("[SKIN]/actions/view.png"));
- form.setItems(searchType, resourceSearch, search, new SpacerItem());
+ form.setItems(searchType, resourceSearch, groupSearch, search, new SpacerItem());
addMember(form);
}
@@ -103,19 +111,19 @@ public class SearchBarPane extends LocatableHLayout {
comboBox.setOptionDataSource(new ResourceDatasource());
- ListGridField nameField = new ListGridField(NAME.propertyName(), NAME.title(), 250);
- ListGridField descriptionField = new ListGridField(DESCRIPTION.propertyName(), DESCRIPTION.title());
- ListGridField typeNameField = new ListGridField(TYPE.propertyName(), TYPE.title(), 130);
- ListGridField pluginNameField = new ListGridField(PLUGIN.propertyName(), PLUGIN.title(), 100);
- ListGridField categoryField = new ListGridField(CATEGORY.propertyName(), CATEGORY.title(), 60);
- ListGridField availabilityField = new ListGridField(AVAILABILITY.propertyName(), AVAILABILITY.title(), 55);
+ ListGridField nameField = ResourceDataSourceField.NAME.getListGridField(250);
+ ListGridField descriptionField = ResourceDataSourceField.DESCRIPTION.getListGridField();
+ ListGridField typeNameField = ResourceDataSourceField.TYPE.getListGridField(130);
+ ListGridField pluginNameField = ResourceDataSourceField.PLUGIN.getListGridField(100);
+ ListGridField categoryField = ResourceDataSourceField.CATEGORY.getListGridField(60);
+ ListGridField availabilityField = ResourceDataSourceField.AVAILABILITY.getListGridField(55);
availabilityField.setAlign(Alignment.CENTER);
comboBox.setPickListFields(nameField, descriptionField, typeNameField, pluginNameField, categoryField,
availabilityField);
comboBox.setValueField("id");
- comboBox.setDisplayField("name");
+ comboBox.setDisplayField(ResourceDataSourceField.NAME.propertyName());
comboBox.setPickListWidth(800);
comboBox.setTextMatchStyle(TextMatchStyle.SUBSTRING);
comboBox.setCompleteOnTab(true);
@@ -141,19 +149,44 @@ public class SearchBarPane extends LocatableHLayout {
}
private ComboBoxItem getGroupComboBox() {
- ComboBoxItem comboBox = new ComboBoxItem("query", "Query");
+ final ComboBoxItem comboBox = new ComboBoxItem("query", "Query");
comboBox.setWidth(400);
comboBox.setShowTitle(false);
+ comboBox.setHint("group search");
+ comboBox.setShowHintInField(true);
comboBox.setOptionDataSource(new ResourceGroupsDataSource());
- ListGridField nameField = new ListGridField("name");
- ListGridField descriptionField = new ListGridField("description");
- comboBox.setPickListFields(nameField, descriptionField);
+
+ ListGridField nameField = ResourceGroupDataSourceField.NAME.getListGridField(250);
+ ListGridField descriptionField = ResourceGroupDataSourceField.DESCRIPTION.getListGridField();
+ ListGridField typeNameField = ResourceGroupDataSourceField.TYPE.getListGridField(130);
+ ListGridField pluginNameField = ResourceGroupDataSourceField.PLUGIN.getListGridField(100);
+ ListGridField categoryField = ResourceGroupDataSourceField.CATEGORY.getListGridField(105);
+
+ comboBox.setPickListFields(nameField, descriptionField, typeNameField, pluginNameField, categoryField);
comboBox.setValueField("id");
- comboBox.setDisplayField("name");
- comboBox.setPickListWidth(600);
+ comboBox.setDisplayField(ResourceGroupDataSourceField.NAME.propertyName());
+ comboBox.setPickListWidth(800);
comboBox.setTextMatchStyle(TextMatchStyle.SUBSTRING);
+ comboBox.setCompleteOnTab(true);
+
+ comboBox.addChangedHandler(new ChangedHandler() {
+ public void onChanged(ChangedEvent changedEvent) {
+ try {
+ Integer groupId = (Integer) changedEvent.getValue();
+ comboBox.setValue("");
+
+ String link = LinkManager.getResourceGroupLink(groupId);
+ if (!link.contains("#")) {
+ com.google.gwt.user.client.Window.Location.assign(link);
+ } else {
+ History.newItem(link.substring(1));
+ }
+ } catch (Exception e) {
+ }
+ }
+ });
return comboBox;
}
13 years, 8 months
[rhq] 3 commits - modules/core modules/enterprise
by Joseph Marques
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/TaggedCriteria.java | 9 +++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java | 26 +++++-----
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java | 8 +--
3 files changed, 25 insertions(+), 18 deletions(-)
New commits:
commit a0e563db21d42cc467bd4e8102d1ae9dd2db450f
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Sep 23 07:41:39 2010 -0400
make sure to create contentCanvas and sectionStack early
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
index c6d5289..01f23a2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/InventoryView.java
@@ -95,6 +95,19 @@ public class InventoryView extends LocatableHLayout implements BookmarkableView
protected void onInit() {
super.onInit();
+ setWidth100();
+ setHeight100();
+
+ contentCanvas = new Canvas();
+ contentCanvas.setWidth("*");
+ contentCanvas.setHeight100();
+
+ sectionStack = new LocatableSectionStack(getLocatorId());
+ sectionStack.setShowResizeBar(true);
+ sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
+ sectionStack.setWidth(250);
+ sectionStack.setHeight100();
+
GWTServiceLookup.getAuthorizationService().getExplicitGlobalPermissions(new AsyncCallback<Set<Permission>>() {
@Override
public void onFailure(Throwable caught) {
@@ -111,19 +124,6 @@ public class InventoryView extends LocatableHLayout implements BookmarkableView
}
private void finishOnInit(Set<Permission> globalPermissions) {
- setWidth100();
- setHeight100();
-
- contentCanvas = new Canvas();
- contentCanvas.setWidth("*");
- contentCanvas.setHeight100();
-
- sectionStack = new LocatableSectionStack(getLocatorId());
- sectionStack.setShowResizeBar(true);
- sectionStack.setVisibilityMode(VisibilityMode.MULTIPLE);
- sectionStack.setWidth(250);
- sectionStack.setHeight100();
-
buildResourcesSection(globalPermissions);
buildGroupsSection(globalPermissions);
commit 3321fe23ca85876b6fff148737f6a58112e2c6c1
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Sep 23 06:51:22 2010 -0400
never change the internal state of a Criteria object, if the filter is NULL
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/TaggedCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/TaggedCriteria.java
index 6ef2ce6..effbb4e 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/TaggedCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/TaggedCriteria.java
@@ -51,6 +51,9 @@ public abstract class TaggedCriteria extends Criteria {
}
public void addFilterTagNamespace(String filterTagNamespace) {
+ if (filterTagNamespace == null) {
+ return; // do nothing if the filter is empty
+ }
if (this.filterTag == null) {
this.filterTag = new Tag();
}
@@ -58,6 +61,9 @@ public abstract class TaggedCriteria extends Criteria {
}
public void addFilterTagSemantic(String filterTagSemantic) {
+ if (filterTagSemantic == null) {
+ return; // do nothing if the filter is empty
+ }
if (this.filterTag == null) {
this.filterTag = new Tag();
}
@@ -65,6 +71,9 @@ public abstract class TaggedCriteria extends Criteria {
}
public void addFilterTagName(String filterTagName) {
+ if (filterTagName == null) {
+ return; // do nothing if the filter is empty
+ }
if (this.filterTag == null) {
this.filterTag = new Tag();
}
commit 37633f6d8e7f5ceb222a415db1b9521258d46adf
Author: Joseph Marques <joseph(a)redhat.com>
Date: Thu Sep 23 06:45:10 2010 -0400
fix tagged view, so all tables that are tiled under it render correctly
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
index 981852e..66ff323 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/report/tag/TaggedView.java
@@ -25,7 +25,6 @@ package org.rhq.enterprise.gui.coregui.client.report.tag;
import java.util.ArrayList;
import com.smartgwt.client.data.Criteria;
-import com.smartgwt.client.data.SortSpecifier;
import org.rhq.core.domain.tagging.Tag;
import org.rhq.enterprise.gui.coregui.client.BookmarkableView;
@@ -91,10 +90,6 @@ public class TaggedView extends LocatableVLayout implements BookmarkableView {
tileLayout.setTileWidth(getWidth() / 2 - 20);
addMember(tileLayout);
- ResourceSearchView resourceView = new ResourceSearchView(getLocatorId(), criteria, "Tagged Resources",
- new SortSpecifier[] {}, new String[] { "pluginName", "category", "currentAvailability" });
- tiles.add(resourceView);
-
BundlesListView bundlesView = new BundlesListView(getLocatorId(), criteria);
tiles.add(bundlesView);
@@ -108,6 +103,9 @@ public class TaggedView extends LocatableVLayout implements BookmarkableView {
criteria);
tiles.add(bundleDestinationListView);
+ ResourceSearchView resourceView = new ResourceSearchView(getLocatorId(), criteria, "Tagged Resources");
+ tiles.add(resourceView);
+
for (Table t : tiles) {
t.setShowFooter(false);
tileLayout.addTile(t);
13 years, 8 months
[rhq] Branch 'coverage' - modules/plugins
by fdrabek
modules/plugins/JBossOSGi/pom.xml | 84 +++++++++++++++++++++++++++
modules/plugins/aliases/pom.xml | 86 ++++++++++++++++++++++++++++
modules/plugins/ant-bundle/pom.xml | 84 +++++++++++++++++++++++++++
modules/plugins/apache/pom.xml | 86 +++++++++++++++++++++++++++-
modules/plugins/byteman/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/cobbler/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/cron/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/database/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/filetemplate-bundle/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/grub/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/hadoop/pom.xml | 84 +++++++++++++++++++++++++++
modules/plugins/hibernate/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/hosts/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/hudson/pom.xml | 2
modules/plugins/iis/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/irc/pom.xml | 84 +++++++++++++++++++++++++++
modules/plugins/jboss-as-5/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/jboss-as/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/jboss-cache-v3/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/jboss-cache/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/jdbctrace/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/jira/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/jmx/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/kickstart/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/lsof/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/mysql/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/netservices/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/nss/pom.xml | 84 +++++++++++++++++++++++++++
modules/plugins/onewire/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/oracle/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/perftest/pom.xml | 2
modules/plugins/platform/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/pom.xml | 6 +
modules/plugins/postfix/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/postgres/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/rhq-agent/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/rhq-server/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/samba/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/script/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/script2/pom.xml | 84 +++++++++++++++++++++++++++
modules/plugins/services/pom.xml | 84 +++++++++++++++++++++++++++
modules/plugins/snmptrapd/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/sshd/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/sudoers/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/tomcat/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/twitter/pom.xml | 85 +++++++++++++++++++++++++++
modules/plugins/virt/pom.xml | 85 +++++++++++++++++++++++++++
47 files changed, 3707 insertions(+), 38 deletions(-)
New commits:
commit 505752865b2a2dda3e8a87728855c5964ed8cfd0
Author: Filip Drabek <fdrabek(a)dhcp-lab-136.englab.brq.redhat.com>
Date: Thu Sep 23 13:28:48 2010 +0200
Settings of cobertura for rhq plugins.
diff --git a/modules/plugins/JBossOSGi/pom.xml b/modules/plugins/JBossOSGi/pom.xml
index fa6dde6..38828c4 100644
--- a/modules/plugins/JBossOSGi/pom.xml
+++ b/modules/plugins/JBossOSGi/pom.xml
@@ -157,6 +157,90 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
diff --git a/modules/plugins/aliases/pom.xml b/modules/plugins/aliases/pom.xml
index 0370302..4a4c20c 100644
--- a/modules/plugins/aliases/pom.xml
+++ b/modules/plugins/aliases/pom.xml
@@ -222,6 +222,92 @@
</build>
</profile>
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+
</profiles>
</project>
diff --git a/modules/plugins/ant-bundle/pom.xml b/modules/plugins/ant-bundle/pom.xml
index d7e6d8a..812bba1 100644
--- a/modules/plugins/ant-bundle/pom.xml
+++ b/modules/plugins/ant-bundle/pom.xml
@@ -273,6 +273,90 @@
</build>
</profile>
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/modules/plugins/apache/pom.xml b/modules/plugins/apache/pom.xml
index 9f46fc9..ef266c1 100644
--- a/modules/plugins/apache/pom.xml
+++ b/modules/plugins/apache/pom.xml
@@ -128,7 +128,7 @@
<configuration>
<tasks>
<echo>Setting up plugin dependencies for ${project.artifactId}-${project.version}.jar...</echo>
- <property name="settings.localRepository" location="${user.home}/.m2/repository" />
+ <property name="settings.localRepository" location="${user.home}/.m2/repository/net/sourceforge/cobertura/cobertura/1.9.4.1/" />
<mkdir dir="target/itest" />
<mkdir dir="target/itest/plugins" />
<mkdir dir="target/itest/lib" />
@@ -279,6 +279,90 @@
</build>
</profile>
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file
diff --git a/modules/plugins/byteman/pom.xml b/modules/plugins/byteman/pom.xml
index cb324cc..edae303 100644
--- a/modules/plugins/byteman/pom.xml
+++ b/modules/plugins/byteman/pom.xml
@@ -239,7 +239,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/modules/plugins/cobbler/pom.xml b/modules/plugins/cobbler/pom.xml
index 1082bb3..d4ea9bb 100644
--- a/modules/plugins/cobbler/pom.xml
+++ b/modules/plugins/cobbler/pom.xml
@@ -248,7 +248,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/modules/plugins/cron/pom.xml b/modules/plugins/cron/pom.xml
index 9371766..3869f7f 100644
--- a/modules/plugins/cron/pom.xml
+++ b/modules/plugins/cron/pom.xml
@@ -212,7 +212,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/modules/plugins/database/pom.xml b/modules/plugins/database/pom.xml
index c72f79a..d4b383a 100644
--- a/modules/plugins/database/pom.xml
+++ b/modules/plugins/database/pom.xml
@@ -94,7 +94,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file
diff --git a/modules/plugins/filetemplate-bundle/pom.xml b/modules/plugins/filetemplate-bundle/pom.xml
index 0b85a57..e7134fe 100644
--- a/modules/plugins/filetemplate-bundle/pom.xml
+++ b/modules/plugins/filetemplate-bundle/pom.xml
@@ -246,7 +246,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/modules/plugins/grub/pom.xml b/modules/plugins/grub/pom.xml
index d783ffc..787131c 100644
--- a/modules/plugins/grub/pom.xml
+++ b/modules/plugins/grub/pom.xml
@@ -211,7 +211,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/modules/plugins/hadoop/pom.xml b/modules/plugins/hadoop/pom.xml
index 7fc2837..fb74b41 100644
--- a/modules/plugins/hadoop/pom.xml
+++ b/modules/plugins/hadoop/pom.xml
@@ -120,6 +120,90 @@
</build>
</profile>
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
diff --git a/modules/plugins/hibernate/pom.xml b/modules/plugins/hibernate/pom.xml
index a7bac31..f852671 100644
--- a/modules/plugins/hibernate/pom.xml
+++ b/modules/plugins/hibernate/pom.xml
@@ -239,7 +239,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file
diff --git a/modules/plugins/hosts/pom.xml b/modules/plugins/hosts/pom.xml
index ef32374..e7d4d5b 100644
--- a/modules/plugins/hosts/pom.xml
+++ b/modules/plugins/hosts/pom.xml
@@ -222,7 +222,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/modules/plugins/hudson/pom.xml b/modules/plugins/hudson/pom.xml
index 68eae1a..ed2fffc 100644
--- a/modules/plugins/hudson/pom.xml
+++ b/modules/plugins/hudson/pom.xml
@@ -72,9 +72,7 @@
</execution>
</executions>
</plugin>
-
</plugins>
</build>
-
</project>
diff --git a/modules/plugins/iis/pom.xml b/modules/plugins/iis/pom.xml
index ad90e83..e2f2c75 100644
--- a/modules/plugins/iis/pom.xml
+++ b/modules/plugins/iis/pom.xml
@@ -198,7 +198,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file
diff --git a/modules/plugins/irc/pom.xml b/modules/plugins/irc/pom.xml
index ab18766..d56d15a 100644
--- a/modules/plugins/irc/pom.xml
+++ b/modules/plugins/irc/pom.xml
@@ -140,6 +140,90 @@
</build>
</profile>
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
diff --git a/modules/plugins/jboss-as-5/pom.xml b/modules/plugins/jboss-as-5/pom.xml
index 2766efd..ef4aff1 100644
--- a/modules/plugins/jboss-as-5/pom.xml
+++ b/modules/plugins/jboss-as-5/pom.xml
@@ -629,7 +629,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
diff --git a/modules/plugins/jboss-as/pom.xml b/modules/plugins/jboss-as/pom.xml
index 31d5fbc..77e628e 100644
--- a/modules/plugins/jboss-as/pom.xml
+++ b/modules/plugins/jboss-as/pom.xml
@@ -349,7 +349,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file
diff --git a/modules/plugins/jboss-cache-v3/pom.xml b/modules/plugins/jboss-cache-v3/pom.xml
index b09a9aa..1c024f7 100644
--- a/modules/plugins/jboss-cache-v3/pom.xml
+++ b/modules/plugins/jboss-cache-v3/pom.xml
@@ -560,7 +560,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
diff --git a/modules/plugins/jboss-cache/pom.xml b/modules/plugins/jboss-cache/pom.xml
index e9dca27..e5a2f5b 100644
--- a/modules/plugins/jboss-cache/pom.xml
+++ b/modules/plugins/jboss-cache/pom.xml
@@ -214,7 +214,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/modules/plugins/jdbctrace/pom.xml b/modules/plugins/jdbctrace/pom.xml
index c7ab30c..6601d08 100644
--- a/modules/plugins/jdbctrace/pom.xml
+++ b/modules/plugins/jdbctrace/pom.xml
@@ -268,7 +268,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/modules/plugins/jira/pom.xml b/modules/plugins/jira/pom.xml
index 8e0a879..8551a65 100644
--- a/modules/plugins/jira/pom.xml
+++ b/modules/plugins/jira/pom.xml
@@ -316,7 +316,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/modules/plugins/jmx/pom.xml b/modules/plugins/jmx/pom.xml
index 83e3030..0d9c538 100644
--- a/modules/plugins/jmx/pom.xml
+++ b/modules/plugins/jmx/pom.xml
@@ -254,7 +254,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file
diff --git a/modules/plugins/kickstart/pom.xml b/modules/plugins/kickstart/pom.xml
index a1a61cf..c8a04aa 100644
--- a/modules/plugins/kickstart/pom.xml
+++ b/modules/plugins/kickstart/pom.xml
@@ -108,6 +108,89 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
-
</project>
diff --git a/modules/plugins/lsof/pom.xml b/modules/plugins/lsof/pom.xml
index 0667659..df802e2 100644
--- a/modules/plugins/lsof/pom.xml
+++ b/modules/plugins/lsof/pom.xml
@@ -239,7 +239,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/modules/plugins/mysql/pom.xml b/modules/plugins/mysql/pom.xml
index 5152236..ad260d7 100644
--- a/modules/plugins/mysql/pom.xml
+++ b/modules/plugins/mysql/pom.xml
@@ -241,7 +241,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file
diff --git a/modules/plugins/netservices/pom.xml b/modules/plugins/netservices/pom.xml
index 9f35dbf..66e1ec5 100644
--- a/modules/plugins/netservices/pom.xml
+++ b/modules/plugins/netservices/pom.xml
@@ -248,7 +248,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file
diff --git a/modules/plugins/nss/pom.xml b/modules/plugins/nss/pom.xml
index 0b8578a..b63e10f 100644
--- a/modules/plugins/nss/pom.xml
+++ b/modules/plugins/nss/pom.xml
@@ -91,6 +91,90 @@
</plugins>
</build>
</profile>
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/modules/plugins/onewire/pom.xml b/modules/plugins/onewire/pom.xml
index 8b2fa39..3fa0f08 100644
--- a/modules/plugins/onewire/pom.xml
+++ b/modules/plugins/onewire/pom.xml
@@ -152,7 +152,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
diff --git a/modules/plugins/oracle/pom.xml b/modules/plugins/oracle/pom.xml
index be37d2b..6551f7f 100644
--- a/modules/plugins/oracle/pom.xml
+++ b/modules/plugins/oracle/pom.xml
@@ -247,7 +247,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file
diff --git a/modules/plugins/perftest/pom.xml b/modules/plugins/perftest/pom.xml
index 136770c..4f56cf4 100644
--- a/modules/plugins/perftest/pom.xml
+++ b/modules/plugins/perftest/pom.xml
@@ -138,5 +138,5 @@
<layout>legacy</layout>
</pluginRepository>
</pluginRepositories>
-
+
</project>
diff --git a/modules/plugins/platform/pom.xml b/modules/plugins/platform/pom.xml
index 5597a30..5e5c810 100644
--- a/modules/plugins/platform/pom.xml
+++ b/modules/plugins/platform/pom.xml
@@ -197,7 +197,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file
diff --git a/modules/plugins/pom.xml b/modules/plugins/pom.xml
index 880254c..6220581 100644
--- a/modules/plugins/pom.xml
+++ b/modules/plugins/pom.xml
@@ -76,6 +76,12 @@
<scope>provided</scope> <!-- by RHQ container -->
</dependency>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<!-- !!! -->
diff --git a/modules/plugins/postfix/pom.xml b/modules/plugins/postfix/pom.xml
index 2130abe..059f197 100644
--- a/modules/plugins/postfix/pom.xml
+++ b/modules/plugins/postfix/pom.xml
@@ -220,7 +220,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/modules/plugins/postgres/pom.xml b/modules/plugins/postgres/pom.xml
index beab355..b227b4a 100644
--- a/modules/plugins/postgres/pom.xml
+++ b/modules/plugins/postgres/pom.xml
@@ -240,7 +240,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file
diff --git a/modules/plugins/rhq-agent/pom.xml b/modules/plugins/rhq-agent/pom.xml
index 3aa3bb6..df376e9 100644
--- a/modules/plugins/rhq-agent/pom.xml
+++ b/modules/plugins/rhq-agent/pom.xml
@@ -212,6 +212,89 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file
diff --git a/modules/plugins/rhq-server/pom.xml b/modules/plugins/rhq-server/pom.xml
index d0ef9fe..1b50ec5 100644
--- a/modules/plugins/rhq-server/pom.xml
+++ b/modules/plugins/rhq-server/pom.xml
@@ -238,6 +238,89 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file
diff --git a/modules/plugins/samba/pom.xml b/modules/plugins/samba/pom.xml
index a338a98..0a4becf 100644
--- a/modules/plugins/samba/pom.xml
+++ b/modules/plugins/samba/pom.xml
@@ -220,7 +220,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/modules/plugins/script/pom.xml b/modules/plugins/script/pom.xml
index 05cb816..c61942f 100644
--- a/modules/plugins/script/pom.xml
+++ b/modules/plugins/script/pom.xml
@@ -192,7 +192,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file
diff --git a/modules/plugins/script2/pom.xml b/modules/plugins/script2/pom.xml
index ed7473b..5a76049 100644
--- a/modules/plugins/script2/pom.xml
+++ b/modules/plugins/script2/pom.xml
@@ -171,6 +171,90 @@
</build>
</profile>
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
diff --git a/modules/plugins/services/pom.xml b/modules/plugins/services/pom.xml
index f6b8556..e48e3d7 100644
--- a/modules/plugins/services/pom.xml
+++ b/modules/plugins/services/pom.xml
@@ -115,6 +115,90 @@
</build>
</profile>
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
diff --git a/modules/plugins/snmptrapd/pom.xml b/modules/plugins/snmptrapd/pom.xml
index 93bb45a..035eaba 100644
--- a/modules/plugins/snmptrapd/pom.xml
+++ b/modules/plugins/snmptrapd/pom.xml
@@ -152,7 +152,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
diff --git a/modules/plugins/sshd/pom.xml b/modules/plugins/sshd/pom.xml
index a68e444..f05a21e 100644
--- a/modules/plugins/sshd/pom.xml
+++ b/modules/plugins/sshd/pom.xml
@@ -212,7 +212,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/modules/plugins/sudoers/pom.xml b/modules/plugins/sudoers/pom.xml
index 0353f4f..8aaf25c 100644
--- a/modules/plugins/sudoers/pom.xml
+++ b/modules/plugins/sudoers/pom.xml
@@ -209,7 +209,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/modules/plugins/tomcat/pom.xml b/modules/plugins/tomcat/pom.xml
index 4c93bb3..8d53a0a 100644
--- a/modules/plugins/tomcat/pom.xml
+++ b/modules/plugins/tomcat/pom.xml
@@ -206,7 +206,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
\ No newline at end of file
diff --git a/modules/plugins/twitter/pom.xml b/modules/plugins/twitter/pom.xml
index a6fdf4f..f94b21b 100644
--- a/modules/plugins/twitter/pom.xml
+++ b/modules/plugins/twitter/pom.xml
@@ -131,6 +131,91 @@
</build>
</profile>
+
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
diff --git a/modules/plugins/virt/pom.xml b/modules/plugins/virt/pom.xml
index c2550aa..35082d0 100644
--- a/modules/plugins/virt/pom.xml
+++ b/modules/plugins/virt/pom.xml
@@ -280,7 +280,90 @@
</plugins>
</build>
</profile>
-
+ <profile>
+ <id>cobertura</id>
+ <activation>
+ <activeByDefault>false</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>net.sourceforge.cobertura</groupId>
+ <artifactId>cobertura</artifactId>
+ <version>1.9.4.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>cobertura-instrument</id>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <tasks>
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/cobertura/backup"/>
+ <!-- backup all classes so that we can instrument the original classes-->
+ <copy toDir="target/cobertura/backup" verbose="true" overwrite="true">
+ <fileset dir="target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- create a properties file and save there location of cobertura data file-->
+ <touch file="target/classes/cobertura.properties"/>
+ <echo file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- instrument all classes in target/classes directory -->
+ <cobertura-instrument datafile="${project.build.directory}/cobertura/cobertura.ser" todir="${project.build.directory}/classes">
+ <fileset dir="${project.build.directory}/classes">
+ <include name="**/*.class"/>
+ </fileset>
+ </cobertura-instrument>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>cobertura-report</id>
+ <phase>post-integration-test</phase>
+ <configuration>
+ <tasks>
+ <taskdef classpathref="maven.runtime.classpath" resource="tasks.properties" />
+ <!-- prepare directory structure for cobertura-->
+ <mkdir dir="target/cobertura" />
+ <mkdir dir="target/site/cobertura" />
+ <!-- restore classes from backup folder to classes folder -->
+ <copy toDir="target/classes" verbose="true" overwrite="true">
+ <fileset dir="target/cobertura/backup">
+ <include name="**/*.class" />
+ </fileset>
+ </copy>
+ <!-- delete backup folder-->
+ <delete dir="target/cobertura/backup"/>
+ <!-- create a code coverage report -->
+ <cobertura-report format="html" datafile="${project.build.directory}/cobertura/cobertura.ser" destdir="${project.build.directory}/site/cobertura">
+ <fileset dir="${basedir}/src/main/java">
+ <include name="**/*.java" />
+ </fileset>
+ </cobertura-report>
+ <!-- delete cobertura.properties file -->
+ <delete file="target/classes/cobertura.properties"/>
+ </tasks>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
13 years, 8 months