[rhq] 3 commits - etc/rhq-ircBot modules/core modules/enterprise
by Jiri Kremser
etc/rhq-ircBot/pom.xml | 2
etc/rhq-ircBot/src/main/java/org/rhq/etc/ircbot/RhqIrcBot.java | 4 -
etc/rhq-ircBot/src/main/java/org/rhq/etc/ircbot/RhqIrcBotListener.java | 33 ++++----
modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNodeLoadComposite.java | 22 ++++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeDetailView.java | 6 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeTableView.java | 14 +--
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties | 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties | 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties | 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties | 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties | 2
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBean.java | 39 ++++++----
15 files changed, 87 insertions(+), 49 deletions(-)
New commits:
commit 3d3f1aae4bbf93ad44d50ae70794a0bf86b1282f
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri May 31 14:38:03 2013 +0200
Adding some localization for Storage Node entity UI.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeDetailView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeDetailView.java
index b9b442e..1f94abb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeDetailView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeDetailView.java
@@ -186,7 +186,7 @@ public class StorageNodeDetailView extends EnhancedVLayout implements Bookmarkab
// portItem.setValidators(portValidator);
jmxPortItem.setValue(storageNode.getJmxPort());
- final StaticTextItem jmxConnectionUrlItem = new StaticTextItem("jmxConnectionUrl", "td(i18n) JMX Connection URL");
+ final StaticTextItem jmxConnectionUrlItem = new StaticTextItem("jmxConnectionUrl", MSG.view_adminTopology_storageNode_jmxUrl());
jmxConnectionUrlItem.setValue(storageNode.getJMXConnectionURL());
final TextItem cqlPortItem = new TextItem(FIELD_CQL_PORT.propertyName(), FIELD_CQL_PORT.title());
@@ -201,7 +201,7 @@ public class StorageNodeDetailView extends EnhancedVLayout implements Bookmarkab
// make clickable link to associated resource
StaticTextItem resourceItem = new StaticTextItem("associatedResource",
- "td(i18n) Associated Resource");
+ "Associated Resource");
String storageNodeItemText = "";
Resource storageNodeResource = storageNode.getResource();
if (storageNodeResource != null && storageNodeResource.getName() != null) {
@@ -209,7 +209,7 @@ public class StorageNodeDetailView extends EnhancedVLayout implements Bookmarkab
String formattedValue = StringUtility.escapeHtml(storageNodeResource.getName());
storageNodeItemText = LinkManager.getHref(detailsUrl, formattedValue);
} else {
- storageNodeItemText = "td(i18n) none";
+ storageNodeItemText = MSG.common_label_none();
}
resourceItem.setValue(storageNodeItemText);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeTableView.java
index 31ab7ff..863081c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeTableView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/storage/StorageNodeTableView.java
@@ -63,7 +63,7 @@ import org.rhq.enterprise.gui.coregui.client.util.message.Message;
public class StorageNodeTableView extends
TableSection<StorageNodeDatasource> implements HasViewName {
- public static final ViewName VIEW_ID = new ViewName("StorageNodes", "td(i18n) Storage Nodes", IconEnum.STORAGE_NODE);
+ public static final ViewName VIEW_ID = new ViewName("StorageNodes", MSG.view_adminTopology_storageNodes(), IconEnum.STORAGE_NODE);
public static final String VIEW_PATH = AdministrationView.VIEW_ID + "/"
+ AdministrationView.SECTION_TOPOLOGY_VIEW_ID + "/" + VIEW_ID;
@@ -119,11 +119,11 @@ public class StorageNodeTableView extends
try {
rawUrl = LinkManager.getResourceLink(record.getAttributeAsInt(FIELD_RESOURCE_ID.propertyName()));
} catch (NumberFormatException nfe) {
- rawUrl = "td(i18n) none";
+ rawUrl = MSG.common_label_none();
}
String formattedValue = StringUtility.escapeHtml(rawUrl);
- String label = StringUtility.escapeHtml("td(i18n) Link to Resource");
+ String label = StringUtility.escapeHtml("Link to Resource");
return LinkManager.getHref(formattedValue, label);
}
});
@@ -181,7 +181,7 @@ public class StorageNodeTableView extends
operationsMap.put("Start RPC Server", "startRPCServer");
operationsMap.put("Decommission", "decommission");
- addTableAction("td(i18n) Invoke Operation", null, operationsMap, new AuthorizedTableAction(this,
+ addTableAction(MSG.common_title_operation(), null, operationsMap, new AuthorizedTableAction(this,
TableActionEnablement.ANY, Permission.MANAGE_SETTINGS) {
@Override
@@ -203,7 +203,7 @@ public class StorageNodeTableView extends
public void execute() {
// Message msg = new Message(MSG.view_adminTopology_message_setMode(
// String.valueOf(selections.length), mode.name()), Message.Severity.Info);
- Message msg = new Message("td(i18n) Operation" + operationName
+ Message msg = new Message("Operation" + operationName
+ " was successfully scheduled for resources with ids"
+ Arrays.asList(getSelectedIds(selections)), Message.Severity.Info);
CoreGUI.getMessageCenter().notify(msg);
@@ -225,7 +225,7 @@ public class StorageNodeTableView extends
}
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(
- "td(i18n) Scheduling operation " + operationName
+ "Scheduling operation " + operationName
+ " failed for resources with ids"
+ Arrays.asList(getSelectedIds(selections)) + " "
+ caught.getMessage(), caught);
@@ -243,7 +243,7 @@ public class StorageNodeTableView extends
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(
- "td(i18n) Scheduling operation " + operationName
+ "Scheduling operation " + operationName
+ " failed for resources with ids"
+ Arrays.asList(getSelectedIds(selections)) + " "
+ caught.getMessage(), caught);
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 1c6cb41..fbd2321 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -653,6 +653,8 @@ view_adminTopology_server_securePort = Secure Port
view_adminTopology_server_setMaintenance = Set Maintenance
view_adminTopology_server_setNormal = Set Normal
view_adminTopology_servers = Servers
+view_adminTopology_storageNode_jmxConnectionUrl=JMX Connection URL
+view_adminTopology_storageNodes=Storage Nodes
view_adminUsersDetails_dataTypeName = user
view_adminUsers_failCreateUserWithExistingName = Failed to create user with existing name [{0}]. Please use another name.
view_admin_administration = Administration
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
index 12c8632..3eaafc3 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
@@ -669,6 +669,8 @@ view_adminTopology_server_securePort = Zabezpečený port
view_adminTopology_server_setMaintenance = Nastavit údržbu
view_adminTopology_server_setNormal = Nastavit do normálu
view_adminTopology_servers = Servery
+view_adminTopology_storageNode_jmxConnectionUrl=URL pro JMX spojení
+view_adminTopology_storageNodes=Datové uzly
view_adminUsersDetails_dataTypeName = uživatel
view_adminUsers_failCreateUserWithExistingName = Nepodařilo se vytvořit uživatele s existujícím jménem [{0}]. Použíjte prosím jiné jméno.
view_admin_administration = Administrace
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index f02eace..5e6013b 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -617,6 +617,8 @@ view_adminTopology_server_mode = Modus
##view_adminTopology_server_setMaintenance = Set Maintenance
##view_adminTopology_server_setNormal = Set Normal
view_adminTopology_servers = Server
+##view_adminTopology_storageNode_jmxConnectionUrl=JMX Connection URL
+##view_adminTopology_storageNodes=Storage Nodes
view_adminUsersDetails_dataTypeName = Benutzer
##view_adminUsers_failCreateUserWithExistingName = Failed to create user with existing name [{0}]. Please use another name.
view_admin_administration = Verwaltung
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
index 07ecabf..c28d079 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
@@ -649,6 +649,8 @@ view_adminTopology_remoteAgentInstall = リモートエージェントのイン
##view_adminTopology_server_setMaintenance = Set Maintenance
##view_adminTopology_server_setNormal = Set Normal
view_adminTopology_servers = サーバー
+##view_adminTopology_storageNode_jmxConnectionUrl=JMX Connection URL
+##view_adminTopology_storageNodes=Storage Nodes
view_adminUsersDetails_dataTypeName = ユーザー
##view_adminUsers_failCreateUserWithExistingName = Failed to create user with existing name [{0}]. Please use another name.
view_admin_administration = 管理
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
index da0a8a5..728544e 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
@@ -572,6 +572,8 @@ view_adminTopology_remoteAgentInstall = 원격 에이전트 설치
##view_adminTopology_server_setMaintenance = Set Maintenance
##view_adminTopology_server_setNormal = Set Normal
view_adminTopology_servers = 서버
+##view_adminTopology_storageNode_jmxConnectionUrl=JMX Connection URL
+##view_adminTopology_storageNodes=Storage Nodes
view_adminUsersDetails_dataTypeName = 사용자
view_adminUsers_failCreateUserWithExistingName = 기존 이름 [{0}]과 사용자를 만들지 못했습니다. 다른 이름을 사용하십시오.
view_admin_administration = 관리
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
index a3cf109..6560399 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
@@ -653,6 +653,8 @@ view_adminTopology_remoteAgentInstall = Instala\u00E7\u00E3o Remota de Agentes
##view_adminTopology_server_setMaintenance = Set Maintenance
##view_adminTopology_server_setNormal = Set Normal
view_adminTopology_servers = Servidores
+##view_adminTopology_storageNode_jmxConnectionUrl=JMX Connection URL
+##view_adminTopology_storageNodes=Storage Nodes
view_adminUsersDetails_dataTypeName = usu\u00E1rio
##view_adminUsers_failCreateUserWithExistingName = Failed to create user with existing name [{0}]. Please use another name.
view_admin_administration = Administra\u00E7\u00E3o
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
index 1637583..3c419e5 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
@@ -614,6 +614,8 @@
##view_adminTopology_partitionEvents_typeFilter = Type Filter
#view_adminTopology_remoteAgentInstall = Remote Agent Install
#view_adminTopology_servers = Servers
+##view_adminTopology_storageNode_jmxConnectionUrl=JMX Connection URL
+##view_adminTopology_storageNodes=Storage Nodes
##view_adminTopology_serverDetail_connectedAgents = Connected Agents
##view_adminTopology_serverDetail_installationDate = Installation Date
##view_adminTopology_serverDetail_operationMode = Operation Mode
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
index 5ed9e01..ec487c1 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
@@ -641,6 +641,8 @@ view_adminTopology_remoteAgentInstall = \u8fdc\u7a0b\u4ee3\u7406\u5b89\u88c5
##view_adminTopology_server_setMaintenance = Set Maintenance
##view_adminTopology_server_setNormal = Set Normal
view_adminTopology_servers = \u670d\u52a1\u5668
+##view_adminTopology_storageNode_jmxConnectionUrl=JMX Connection URL
+##view_adminTopology_storageNodes=Storage Nodes
view_adminUsersDetails_dataTypeName = user
##view_adminUsers_failCreateUserWithExistingName = Failed to create user with existing name [{0}]. Please use another name.
view_admin_administration = \u7ba1\u7406
commit 71635b0463fad04a696a0e66a709571ad8b8e824
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri May 31 13:24:55 2013 +0200
Fixing bug in IRC bot (isRedHatChannel); pto command now shows PTOs longer than 1 day; ensuring the bot do not notify users when using the pto and support commands
diff --git a/etc/rhq-ircBot/pom.xml b/etc/rhq-ircBot/pom.xml
index a6ab873..adbab6a 100644
--- a/etc/rhq-ircBot/pom.xml
+++ b/etc/rhq-ircBot/pom.xml
@@ -8,7 +8,7 @@
<groupId>org.rhq.etc</groupId>
<artifactId>rhq-ircbot</artifactId>
- <version>1.1</version>
+ <version>1.1.1</version>
<packaging>jar</packaging>
<name>RHQ IRC Bot</name>
diff --git a/etc/rhq-ircBot/src/main/java/org/rhq/etc/ircbot/RhqIrcBot.java b/etc/rhq-ircBot/src/main/java/org/rhq/etc/ircbot/RhqIrcBot.java
index 7e8f563..998efa9 100644
--- a/etc/rhq-ircBot/src/main/java/org/rhq/etc/ircbot/RhqIrcBot.java
+++ b/etc/rhq-ircBot/src/main/java/org/rhq/etc/ircbot/RhqIrcBot.java
@@ -45,7 +45,7 @@ public class RhqIrcBot extends PircBotX {
public RhqIrcBot(RhqIrcBotListener rhqBot) {
setName("rhq-bot");
- setVersion("1.1");
+ setVersion("1.1.1");
setFinger("RHQ IRC bot (source code in RHQ git under etc/rhq-ircBot/)");
setVerbose(true);
@@ -96,7 +96,7 @@ public class RhqIrcBot extends PircBotX {
PircBotX bot = new RhqIrcBot(rhqBotListener);
bot.connect(server);
- bot.joinChannel(channel);
+ bot.joinChannel(channel.trim());
}
private static void setupTrustStore() {
diff --git a/etc/rhq-ircBot/src/main/java/org/rhq/etc/ircbot/RhqIrcBotListener.java b/etc/rhq-ircBot/src/main/java/org/rhq/etc/ircbot/RhqIrcBotListener.java
index a7b3e78..6b8529f 100644
--- a/etc/rhq-ircBot/src/main/java/org/rhq/etc/ircbot/RhqIrcBotListener.java
+++ b/etc/rhq-ircBot/src/main/java/org/rhq/etc/ircbot/RhqIrcBotListener.java
@@ -45,7 +45,7 @@ public class RhqIrcBotListener extends ListenerAdapter<RhqIrcBot> {
private static final Pattern ECHO_PATTERN = Pattern.compile("(?i)echo[ ]+(.+)");
private static final String SUPPORT_LINK = "https://docspace.corp.redhat.com/docs/DOC-124477";
private static final String COMMIT_LINK = "https://git.fedorahosted.org/cgit/rhq/rhq.git/commit/?id=%s";
- private static final String PTO_LINK = "https://mail.corp.redhat.com/home/ccrouch@redhat.com/JBoss%20ON%20OOO?fmt...";
+ private static final String PTO_LINK = "https://mail.corp.redhat.com/home/ccrouch@redhat.com/JBoss%20ON%20OOO?fmt...";
private static final DateFormat monthFormat = new SimpleDateFormat("MMM");
private static final DateFormat dayInMonthFormat = new SimpleDateFormat("d");
@@ -104,7 +104,8 @@ public class RhqIrcBotListener extends ListenerAdapter<RhqIrcBot> {
public RhqIrcBotListener(String server, String channel) {
this.server = server;
this.channel = channel;
- isRedHatChannel = "irc.devel.redhat.com".equals(channel);
+ isRedHatChannel = "irc.devel.redhat.com".equals(server);
+ if (isRedHatChannel) System.out.print("Red Hat channel");
StringBuilder commandRegExp = new StringBuilder();
commandRegExp.append("^(?i)[ ]*").append(Command.PREFIX).append("(");
for (Command command : Command.values()) {
@@ -317,21 +318,21 @@ public class RhqIrcBotListener extends ListenerAdapter<RhqIrcBot> {
if (cellText.startsWith(month.toLowerCase())) {
monthFound = true;
if (cellText.substring(cellText.length() - 1, cellText.length()).equals(dayInMonth)) {
- return cell.firstElementSibling().text() + " is on support this week";
+ return doNotNotify(cell.firstElementSibling().text() + " is on support this week");
}
continue;
}
if (monthFound && cellText.equals(dayInMonth)) {
- return cell.firstElementSibling().text() + " is on support this week";
+ return doNotNotify(cell.firstElementSibling().text() + " is on support this week");
} else if (monthFound) {
if (cell.equals(cell.firstElementSibling()) || cell.equals(cell.lastElementSibling())) {
continue; //the first row with name or the last row with a comment
}
- int day = -1;
+ int day;
try {
day = Integer.parseInt(cellText);
if (day > dayInMonthInt) {
- return cell.parent().previousElementSibling().child(0).text() + " is on support this week";
+ return doNotNotify(cell.parent().previousElementSibling().child(0).text() + " is on support this week");
}
} catch (NumberFormatException nfe) {
break; // next month
@@ -343,26 +344,29 @@ public class RhqIrcBotListener extends ListenerAdapter<RhqIrcBot> {
}
// fallback solution if SSL is not set correctly
String randomDevel = JON_DEVS.toArray(new String[JON_DEVS.size()])[new Random().nextInt(JON_DEVS.size())];
- return "404 Developer Not Found, selecting randomly " + randomDevel + ". Check the " + SUPPORT_LINK;
+ return "404 Developer Not Found, selecting randomly " + doNotNotify(randomDevel) + ". Check the " + SUPPORT_LINK;
}
private static String whoIsOnPto(String link) {
- String month = monthFormat.format(new Date());
- String dayInMonth = dayInMonthFormat.format(new Date());
try {
String onPto = "";
Document doc = Jsoup.connect(link).ignoreContentType(true).get();
- Elements dates = doc.getElementsContainingOwnText(dayInMonth + " " + month);
- for (Element date : dates) {
- onPto += date.firstElementSibling().text() + ", ";
+ Elements titles = doc.select("rss channel item title");
+ for (Element title : titles) {
+ onPto += doNotNotify(title.text()) + ", ";
}
if (!onPto.isEmpty()) {
- return onPto.substring(0, onPto.length() - 2);
+ return doNotNotify(onPto.substring(0, onPto.length() - 2));
}
} catch (IOException e) {
e.printStackTrace();
}
- return "noone is on PTO today";
+ return "no one is on PTO today";
+ }
+
+ private String doNotNotify(String nick) {
+ //replace all vowels with unicode chars that look same not to spam users with notifications
+ return nick.toLowerCase().replaceFirst("a", "\u0430").replaceFirst("e", "\u0435").replaceFirst("i", "\u0456").replaceFirst("o", "\u043E").replaceFirst("u", "\u222A").replaceFirst("y", "\u028F");
}
public void setDocspaceLogin(String docspaceLogin) {
@@ -372,4 +376,3 @@ public class RhqIrcBotListener extends ListenerAdapter<RhqIrcBot> {
public void setDocspacePassword(String docspacePassword) {
this.docspacePassword = docspacePassword;
}
-}
commit bb390b7f6f9a156221e6e6de95ec9238c2bb2ee2
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri May 31 13:23:39 2013 +0200
Adding calculated metric heap percentage usage to the StorageNodeLoadComposite.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNodeLoadComposite.java b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNodeLoadComposite.java
index e93670e..137af64 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNodeLoadComposite.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/cloud/StorageNodeLoadComposite.java
@@ -37,8 +37,9 @@ public class StorageNodeLoadComposite implements Serializable {
private long beginTime;
private long endTime;
- private MeasurementAggregateWithUnits heapCommited;
+ private MeasurementAggregateWithUnits heapCommitted;
private MeasurementAggregateWithUnits heapUsed;
+ private MeasurementAggregateWithUnits heapPercentageUsed;
private MeasurementAggregateWithUnits load;
private MeasurementAggregate tokens;
private MeasurementAggregateWithUnits actuallyOwns;
@@ -77,12 +78,12 @@ public class StorageNodeLoadComposite implements Serializable {
this.endTime = endTime;
}
- public MeasurementAggregateWithUnits getHeapCommited() {
- return heapCommited;
+ public MeasurementAggregateWithUnits getHeapCommitted() {
+ return heapCommitted;
}
- public void setHeapCommited(MeasurementAggregateWithUnits heapCommited) {
- this.heapCommited = heapCommited;
+ public void setHeapCommitted(MeasurementAggregateWithUnits heapCommitted) {
+ this.heapCommitted = heapCommitted;
}
public MeasurementAggregateWithUnits getHeapUsed() {
@@ -92,6 +93,14 @@ public class StorageNodeLoadComposite implements Serializable {
public void setHeapUsed(MeasurementAggregateWithUnits heapUsed) {
this.heapUsed = heapUsed;
}
+
+ public MeasurementAggregateWithUnits getHeapPercentageUsed() {
+ return heapPercentageUsed;
+ }
+
+ public void setHeapPercentageUsed(MeasurementAggregateWithUnits heapPercentageUsed) {
+ this.heapPercentageUsed = heapPercentageUsed;
+ }
public MeasurementAggregateWithUnits getLoad() {
return load;
@@ -131,8 +140,9 @@ public class StorageNodeLoadComposite implements Serializable {
builder.append("storageNode.addresss=").append(storageNode.getAddress()).append(", ");
builder.append("beginTime=").append(beginTime).append(", ");
- builder.append("heapCommited=").append(heapCommited).append(", ");
+ builder.append("heapCommitted=").append(heapCommitted).append(", ");
builder.append("heapUsed=").append(heapUsed).append(", ");
+ builder.append("heapPercentageUsed=").append(heapPercentageUsed).append(", ");
builder.append("load=").append(load).append(", ");
builder.append("tokens=").append(tokens).append(", ");
builder.append("actuallyOwns=").append(actuallyOwns);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBean.java
index 89ffe11..fca789b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/cloud/StorageNodeManagerBean.java
@@ -169,7 +169,7 @@ public class StorageNodeManagerBean implements StorageNodeManagerLocal, StorageN
public StorageNodeLoadComposite getLoad(Subject subject, StorageNode node, long beginTime, long endTime) {
StorageNodeLoadComposite result = new StorageNodeLoadComposite(node, beginTime, endTime);
final String tokensMetric = "Tokens", ownershipMetric = "Ownership", loadMetric = "Load";
- final String heapComittedMetric = "{HeapMemoryUsage.committed}", heapUsedMetric = "{HeapMemoryUsage.used}";
+ final String heapCommittedMetric = "{HeapMemoryUsage.committed}", heapUsedMetric = "{HeapMemoryUsage.used}", heapUsedPercentageMetric = "Calculated.HeapUsagePercentage";
int resourceId;
if (node.getResource() == null) {
@@ -194,7 +194,7 @@ public class StorageNodeManagerBean implements StorageNodeManagerLocal, StorageN
StorageNode.QUERY_FIND_SCHEDULE_IDS_BY_GRANDPARENT_RESOURCE_ID_AND_MEASUREMENT_DEFINITION_NAMES,
Object[].class);
query.setParameter("grandparrentId", resourceId).setParameter("metricNames",
- Arrays.asList(heapComittedMetric, heapUsedMetric));
+ Arrays.asList(heapCommittedMetric, heapUsedMetric, heapUsedPercentageMetric));
scheduleIds = query.getResultList();
for (Object[] pair : scheduleIds) {
scheduleIdsMap.put((String) pair[0], (Integer) pair[1]);
@@ -210,11 +210,11 @@ public class StorageNodeManagerBean implements StorageNodeManagerLocal, StorageN
if (scheduleIdsMap.get(ownershipMetric) != null) {
MeasurementAggregate ownershipAggregate = measurementManager.getAggregate(subject,
scheduleIdsMap.get(ownershipMetric), beginTime, endTime);
- StorageNodeLoadComposite.MeasurementAggregateWithUnits ovnershipAggregateWithUnits = new StorageNodeLoadComposite.MeasurementAggregateWithUnits(
+ StorageNodeLoadComposite.MeasurementAggregateWithUnits ownershipAggregateWithUnits = new StorageNodeLoadComposite.MeasurementAggregateWithUnits(
ownershipAggregate, MeasurementUnits.PERCENTAGE);
- ovnershipAggregateWithUnits.setFormattedValue(getSummaryString(ownershipAggregate,
- MeasurementUnits.PERCENTAGE));
- result.setActuallyOwns(ovnershipAggregateWithUnits);
+ ownershipAggregateWithUnits.setFormattedValue(getSummaryString(ownershipAggregate,
+ MeasurementUnits.PERCENTAGE));
+ result.setActuallyOwns(ownershipAggregateWithUnits);
}
if (scheduleIdsMap.get(loadMetric) != null) {
MeasurementAggregate loadAggregate = measurementManager.getAggregate(subject,
@@ -225,14 +225,14 @@ public class StorageNodeManagerBean implements StorageNodeManagerLocal, StorageN
result.setLoad(loadAggregateWithUnits);
}
- if (scheduleIdsMap.get(heapComittedMetric) != null) {
- MeasurementAggregate heapCommitedAggregate = measurementManager.getAggregate(subject,
- scheduleIdsMap.get(heapComittedMetric), beginTime, endTime);
- StorageNodeLoadComposite.MeasurementAggregateWithUnits heapCommitedAggregateWithUnits = new StorageNodeLoadComposite.MeasurementAggregateWithUnits(
- heapCommitedAggregate, MeasurementUnits.BYTES);
- heapCommitedAggregateWithUnits.setFormattedValue(getSummaryString(heapCommitedAggregate,
- MeasurementUnits.BYTES));
- result.setHeapCommited(heapCommitedAggregateWithUnits);
+ if (scheduleIdsMap.get(heapCommittedMetric) != null) {
+ MeasurementAggregate heapCommittedAggregate = measurementManager.getAggregate(subject,
+ scheduleIdsMap.get(heapCommittedMetric), beginTime, endTime);
+ StorageNodeLoadComposite.MeasurementAggregateWithUnits heapCommittedAggregateWithUnits = new StorageNodeLoadComposite.MeasurementAggregateWithUnits(
+ heapCommittedAggregate, MeasurementUnits.BYTES);
+ heapCommittedAggregateWithUnits.setFormattedValue(getSummaryString(heapCommittedAggregate,
+ MeasurementUnits.BYTES));
+ result.setHeapCommitted(heapCommittedAggregateWithUnits);
}
if (scheduleIdsMap.get(heapUsedMetric) != null) {
MeasurementAggregate heapUsedAggregate = measurementManager.getAggregate(subject,
@@ -243,6 +243,15 @@ public class StorageNodeManagerBean implements StorageNodeManagerLocal, StorageN
.setFormattedValue(getSummaryString(heapUsedAggregate, MeasurementUnits.BYTES));
result.setHeapUsed(heapUsedAggregateWithUnits);
}
+ if (scheduleIdsMap.get(heapUsedPercentageMetric) != null) {
+ MeasurementAggregate heapUsedPercentageAggregate = measurementManager.getAggregate(subject,
+ scheduleIdsMap.get(heapUsedPercentageMetric), beginTime, endTime);
+ StorageNodeLoadComposite.MeasurementAggregateWithUnits heapUsedPercentageAggregateWithUnits = new StorageNodeLoadComposite.MeasurementAggregateWithUnits(
+ heapUsedPercentageAggregate, MeasurementUnits.PERCENTAGE);
+ heapUsedPercentageAggregateWithUnits.setFormattedValue(getSummaryString(heapUsedPercentageAggregate,
+ MeasurementUnits.PERCENTAGE));
+ result.setHeapPercentageUsed(heapUsedPercentageAggregateWithUnits);
+ }
}
return result;
@@ -269,7 +278,7 @@ public class StorageNodeManagerBean implements StorageNodeManagerLocal, StorageN
entityManager);
return runner.execute();
}
-
+
private String getSummaryString(MeasurementAggregate aggregate, MeasurementUnits units) {
String formattedValue = "Min: "
+ MeasurementConverter.format(aggregate.getMin(), units, true)
10 years, 11 months
[rhq] modules/plugins
by Thomas Segismont
modules/plugins/jboss-as-7/pom.xml | 2
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/InterruptibleOperationsTest.java | 49 ++----
modules/plugins/netservices/pom.xml | 7
modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java | 72 ++++------
modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/NetServiceComponentTest.java | 2
modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PortNetServiceComponentTest.java | 55 ++++---
6 files changed, 81 insertions(+), 106 deletions(-)
New commits:
commit 3fb76cb4bc1f745985b8a9805481648fe5fa9e46
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Fri May 31 13:37:48 2013 +0200
Use a port from dynamic port range in integration tests
diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml
index d85e7e3..52cccde 100644
--- a/modules/plugins/jboss-as-7/pom.xml
+++ b/modules/plugins/jboss-as-7/pom.xml
@@ -30,7 +30,6 @@
<java.tieredCompilation>-Dxxx</java.tieredCompilation>
<java.useCompressedOOPS>-Dxxx</java.useCompressedOOPS>
<rhq.internal>false</rhq.internal>
- <as7.itest.mock.http.management.server.port>32259</as7.itest.mock.http.management.server.port>
</properties>
@@ -638,7 +637,6 @@
<jboss.domain.portOffset>${jboss.domain.portOffset}</jboss.domain.portOffset>
<jboss.domain.httpManagementPort>${jboss.domain.httpManagementPort}</jboss.domain.httpManagementPort>
<settings.localRepository>${settings.localRepository}</settings.localRepository>
- <as7.itest.mock.http.management.server.port>${as7.itest.mock.http.management.server.port}</as7.itest.mock.http.management.server.port>
</systemPropertyVariables>
</configuration>
<executions>
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/InterruptibleOperationsTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/InterruptibleOperationsTest.java
index 9597d47..192117c 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/InterruptibleOperationsTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/InterruptibleOperationsTest.java
@@ -30,6 +30,7 @@ import static org.rhq.modules.plugins.jbossas7.helper.ServerPluginConfiguration.
import static org.testng.Assert.assertEquals;
import java.io.IOException;
+import java.net.BindException;
import java.net.InetSocketAddress;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -39,8 +40,6 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.codehaus.jackson.map.ObjectMapper;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
@@ -59,7 +58,6 @@ import org.rhq.core.pluginapi.availability.AvailabilityContext;
import org.rhq.core.pluginapi.inventory.ResourceContext;
import org.rhq.core.pluginapi.operation.OperationResult;
import org.rhq.core.system.SystemInfoFactory;
-import org.rhq.core.util.StringUtil;
import org.rhq.modules.plugins.jbossas7.StandaloneASComponent;
import org.rhq.modules.plugins.jbossas7.json.Operation;
import org.rhq.modules.plugins.jbossas7.json.Result;
@@ -72,15 +70,14 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
*
* @author Thomas Segismont
*/
+@Test(singleThreaded = true)
public class InterruptibleOperationsTest {
- private static final Log LOG = LogFactory.getLog(InterruptibleOperationsTest.class);
-
private static final String HTTP_HOST = "localhost";
- private static final int HTTP_PORT = 31159;
+ private static final int MIN_DYNAMIC_PORT = 49152;
- private static final String HTTP_PORT_VARIABLE = "as7.itest.mock.http.management.server.port";
+ private static final int MAX_PORT_NUMBER = 65535;
@Mock
private ResourceContext resourceContext;
@@ -95,36 +92,29 @@ public class InterruptibleOperationsTest {
private void setup() throws Exception {
MockitoAnnotations.initMocks(this);
serverComponent = new TestStandaloneASComponent();
- int httpPort = getJettyPort();
+ int httpPort = setupJettyServer();
setupResourceContext(httpPort);
- setupJettyServer(httpPort);
- jettyServer.start();
executorService = Executors.newSingleThreadExecutor();
serverComponent.start(resourceContext);
}
- private void setupJettyServer(int httpPort) {
- jettyServer = new Server(new InetSocketAddress(HTTP_HOST, httpPort));
- ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
- context.setContextPath("/");
- jettyServer.setHandler(context);
- HttpServlet testServlet = new TestServlet();
- context.addServlet(new ServletHolder(testServlet), "/*");
- }
-
- private static int getJettyPort() {
- String httpPortVariable = System.getProperty(HTTP_PORT_VARIABLE);
- if (StringUtil.isNotBlank(httpPortVariable)) {
+ private int setupJettyServer() throws Exception {
+ // Loop until Jetty binds to an available port
+ for (int httpPort = MIN_DYNAMIC_PORT; httpPort <= MAX_PORT_NUMBER; httpPort++) {
+ ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
+ context.setContextPath("/");
+ HttpServlet testServlet = new TestServlet();
+ context.addServlet(new ServletHolder(testServlet), "/*");
+ jettyServer = new Server(new InetSocketAddress(HTTP_HOST, httpPort));
+ jettyServer.setHandler(context);
try {
- int port = Integer.parseInt(httpPortVariable);
- LOG.info("Using port " + httpPortVariable + " for http server");
- return port;
- } catch (NumberFormatException e) {
- LOG.warn("Invalid port variable: " + httpPortVariable);
+ jettyServer.start();
+ return httpPort;
+ } catch (BindException e) {
+ // Port already in use
}
}
- LOG.info("Using default port " + String.valueOf(HTTP_PORT) + " for http server");
- return HTTP_PORT;
+ throw new RuntimeException("Could not find an available port");
}
private void setupResourceContext(int httpPort) {
@@ -147,7 +137,6 @@ public class InterruptibleOperationsTest {
@AfterMethod
private void tearDown() throws Exception {
- LOG.info("Shutting down Jetty test server");
try {
if (jettyServer != null) {
jettyServer.stop();
diff --git a/modules/plugins/netservices/pom.xml b/modules/plugins/netservices/pom.xml
index 6b663ff..0cb6f9c 100644
--- a/modules/plugins/netservices/pom.xml
+++ b/modules/plugins/netservices/pom.xml
@@ -16,10 +16,6 @@
<name>RHQ Network Services Plugin</name>
<description>A plugin for monitoring network services.</description>
- <properties>
- <netservices.itest.http.server.port>31158</netservices.itest.http.server.port>
- </properties>
-
<dependencies>
<dependency>
@@ -111,9 +107,6 @@
</properties>
<useSystemClassLoader>false</useSystemClassLoader>
<argLine>${jacoco.integration-test.args}</argLine>
- <systemPropertyVariables>
- <netservices.itest.http.server.port>${netservices.itest.http.server.port}</netservices.itest.http.server.port>
- </systemPropertyVariables>
</configuration>
<executions>
<execution>
diff --git a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java
index fc02516..eb07d65 100644
--- a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java
+++ b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java
@@ -25,6 +25,7 @@ import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
+import java.net.BindException;
import java.net.InetSocketAddress;
import java.util.HashMap;
import java.util.HashSet;
@@ -36,8 +37,6 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
@@ -53,7 +52,6 @@ import org.rhq.core.domain.measurement.MeasurementData;
import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
-import org.rhq.core.util.StringUtil;
import org.rhq.plugins.netservices.HTTPNetServiceComponent;
import org.rhq.plugins.netservices.HTTPNetServiceComponent.ConfigKeys;
import org.rhq.plugins.netservices.HTTPNetServiceComponent.HttpMethod;
@@ -61,17 +59,16 @@ import org.rhq.plugins.netservices.HTTPNetServiceComponent.HttpMethod;
/**
* @author Thomas Segismont
*/
+@Test(singleThreaded = true)
public class HTTPNetServiceComponentTest extends NetServiceComponentTest {
- private static final Log LOG = LogFactory.getLog(NetServiceComponentTest.class);
-
private static final String SERVICE_NAME = "HTTPService";
private static final String HTTP_HOST = "localhost";
- private static final int HTTP_PORT = 31158;
+ private static final int MIN_DYNAMIC_PORT = 49152;
- private static final String HTTP_PORT_VARIABLE = "netservices.itest.http.server.port";
+ private static final int MAX_PORT_NUMBER = 65535;
private static final int SERVLET_SLEEP = 1000;
@@ -83,48 +80,26 @@ public class HTTPNetServiceComponentTest extends NetServiceComponentTest {
@BeforeClass
public void startJetty() throws Exception {
- LOG.info("Setting up Jetty test server");
- httpPort = getJettyPort();
- jettyServer = new Server(new InetSocketAddress(HTTP_HOST, httpPort));
- ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
- context.setContextPath("/");
- jettyServer.setHandler(context);
- @SuppressWarnings("serial")
- HttpServlet testServlet = new HttpServlet() {
- @Override
- protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
- resp.getWriter().println("Test servlet request: success view");
- long start = System.currentTimeMillis();
- do {
- try {
- Thread.sleep(SERVLET_SLEEP);
- } catch (InterruptedException e) {
- }
- } while (System.currentTimeMillis() - start < SERVLET_SLEEP);
- }
- };
- context.addServlet(new ServletHolder(testServlet), "/*");
- jettyServer.start();
- }
-
- private static int getJettyPort() {
- String httpPortVariable = System.getProperty(HTTP_PORT_VARIABLE);
- if (StringUtil.isNotBlank(httpPortVariable)) {
+ // Loop until Jetty binds to an available port
+ for (httpPort = MIN_DYNAMIC_PORT; httpPort <= MAX_PORT_NUMBER; httpPort++) {
+ ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
+ context.setContextPath("/");
+ HttpServlet testServlet = new TestServlet();
+ context.addServlet(new ServletHolder(testServlet), "/*");
+ jettyServer = new Server(new InetSocketAddress(HTTP_HOST, httpPort));
+ jettyServer.setHandler(context);
try {
- int port = Integer.parseInt(httpPortVariable);
- LOG.info("Using port " + httpPortVariable + " for http server");
- return port;
- } catch (NumberFormatException e) {
- LOG.warn("Invalid port variable: " + httpPortVariable);
+ jettyServer.start();
+ return;
+ } catch (BindException e) {
+ // Port already in use
}
}
- LOG.info("Using default port " + String.valueOf(HTTP_PORT) + " for http server");
- return HTTP_PORT;
+ throw new RuntimeException("Could not find an available port");
}
@AfterClass
public void stopJetty() {
- LOG.info("Shutting down Jetty test server");
try {
if (jettyServer != null) {
jettyServer.stop();
@@ -180,4 +155,17 @@ public class HTTPNetServiceComponentTest extends NetServiceComponentTest {
assertTrue(value > 0);
}
+ private static class TestServlet extends HttpServlet {
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ resp.getWriter().println("Test servlet request: success view");
+ long start = System.currentTimeMillis();
+ do {
+ try {
+ Thread.sleep(SERVLET_SLEEP);
+ } catch (InterruptedException e) {
+ }
+ } while (System.currentTimeMillis() - start < SERVLET_SLEEP);
+ }
+ }
}
diff --git a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/NetServiceComponentTest.java b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/NetServiceComponentTest.java
index 503e359..f0c1230 100644
--- a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/NetServiceComponentTest.java
+++ b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/NetServiceComponentTest.java
@@ -134,7 +134,7 @@ public abstract class NetServiceComponentTest {
}
@Test
- public static void testPluginLoad() {
+ public void testPluginLoad() {
assertNotNull(pluginEnvironment, "Plugin not loaded");
assertEquals(pluginEnvironment.getPluginName(), PLUGIN_NAME);
}
diff --git a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PortNetServiceComponentTest.java b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PortNetServiceComponentTest.java
index 75a9370..ebab01f 100644
--- a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PortNetServiceComponentTest.java
+++ b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PortNetServiceComponentTest.java
@@ -25,6 +25,7 @@ import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
+import java.net.BindException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
@@ -33,8 +34,6 @@ import java.util.HashSet;
import java.util.Map;
import java.util.Set;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
@@ -54,14 +53,17 @@ import org.rhq.plugins.netservices.PortNetServiceComponent.ConfigKeys;
/**
* @author Thomas Segismont
*/
+@Test(singleThreaded = true)
public class PortNetServiceComponentTest extends NetServiceComponentTest {
- private static final Log LOG = LogFactory.getLog(PortNetServiceComponentTest.class);
-
private static final String SERVICE_NAME = "PortService";
private static final InetAddress LOOPBACK_ADDRESS = InetAddress.getLoopbackAddress();
+ private static final int MIN_DYNAMIC_PORT = 8080/*49152*/;
+
+ private static final int MAX_PORT_NUMBER = 8081/*65535*/;
+
private PortNetServiceComponent portNetServiceComponent;
private ServerSocket serverSocket;
@@ -74,32 +76,37 @@ public class PortNetServiceComponentTest extends NetServiceComponentTest {
@BeforeClass
public void startSocketServer() throws Exception {
- LOG.info("Setting up a socket server");
- // Let's bind a server socket to any available port
- serverSocket = new ServerSocket(0, 50, LOOPBACK_ADDRESS);
- // Do not block indefinitely on call to #accept
- serverSocket.setSoTimeout(1000);
- serverSocketLocalPort = serverSocket.getLocalPort();
- LOG.info("Using port " + serverSocketLocalPort + " for socket server");
- acceptorThread = new Thread(new Runnable() {
- @Override
- public void run() {
- while (!stopListening) {
- try {
- Socket socket = serverSocket.accept();
- socket.close();
- } catch (IOException ignore) {
+ // Loop until the Server Socket binds to an available port
+ for (int port = MIN_DYNAMIC_PORT; port <= MAX_PORT_NUMBER; port++) {
+ try {
+ serverSocket = new ServerSocket(port, 50, LOOPBACK_ADDRESS);
+ // Do not block indefinitely on calls to #accept
+ serverSocket.setSoTimeout(1000);
+ serverSocketLocalPort = serverSocket.getLocalPort();
+ acceptorThread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ while (!stopListening) {
+ try {
+ Socket socket = serverSocket.accept();
+ socket.close();
+ } catch (IOException ignore) {
+ }
+ }
}
- }
+ });
+ acceptorThread.setDaemon(true);
+ acceptorThread.start();
+ return;
+ } catch (BindException e) {
+ // Port already in use
}
- });
- acceptorThread.setDaemon(true);
- acceptorThread.start();
+ }
+ throw new RuntimeException("Could not find an available port");
}
@AfterClass
public void stopSocketServer() {
- LOG.info("Shutting down socket server");
stopListening = true;
try {
serverSocket.close();
10 years, 11 months
[rhq] modules/common
by John Sanda
modules/common/cassandra-ccm/cassandra-ccm-arquillian/src/main/java/org/rhq/cassandra/ccm/arquillian/CCMSuiteDeploymentExtension.java | 2 ++
modules/common/cassandra-ccm/cassandra-ccm-testng/src/main/java/org/rhq/cassandra/CCMTestNGListener.java | 2 ++
2 files changed, 4 insertions(+)
New commits:
commit c05af973930a239e4f1a1e4cbcba3cf84ef7c11a
Author: John Sanda <jsanda(a)redhat.com>
Date: Fri May 31 07:49:47 2013 -0400
need to used reduced heap sizes for C* on master jenkins jobs
The C* jvm was failing to start on the master jenkins job because enough space
could not be allocated for the requested heap. There is no need however to use
the default heap size. 256 MB is sufficient for the automated tests.
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-arquillian/src/main/java/org/rhq/cassandra/ccm/arquillian/CCMSuiteDeploymentExtension.java b/modules/common/cassandra-ccm/cassandra-ccm-arquillian/src/main/java/org/rhq/cassandra/ccm/arquillian/CCMSuiteDeploymentExtension.java
index 1ad3599..5e0b3b5 100644
--- a/modules/common/cassandra-ccm/cassandra-ccm-arquillian/src/main/java/org/rhq/cassandra/ccm/arquillian/CCMSuiteDeploymentExtension.java
+++ b/modules/common/cassandra-ccm/cassandra-ccm-arquillian/src/main/java/org/rhq/cassandra/ccm/arquillian/CCMSuiteDeploymentExtension.java
@@ -124,6 +124,8 @@ public class CCMSuiteDeploymentExtension implements LoadableExtension {
options.setUsername("cassandra");
options.setPassword("cassandra");
options.setClusterDir(clusterDir.getAbsolutePath());
+ options.setHeapSize("256M");
+ options.setHeapNewSize("64M");
ccm = new CassandraClusterManager(options);
List<StorageNode> nodes = ccm.createCluster();
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-testng/src/main/java/org/rhq/cassandra/CCMTestNGListener.java b/modules/common/cassandra-ccm/cassandra-ccm-testng/src/main/java/org/rhq/cassandra/CCMTestNGListener.java
index 7f21fa8..cf6f87e 100644
--- a/modules/common/cassandra-ccm/cassandra-ccm-testng/src/main/java/org/rhq/cassandra/CCMTestNGListener.java
+++ b/modules/common/cassandra-ccm/cassandra-ccm-testng/src/main/java/org/rhq/cassandra/CCMTestNGListener.java
@@ -95,6 +95,8 @@ public class CCMTestNGListener implements IInvokedMethodListener {
deploymentOptions.setUsername(annotation.username());
deploymentOptions.setPassword(annotation.password());
deploymentOptions.setStartRpc(true);
+ deploymentOptions.setHeapSize("256M");
+ deploymentOptions.setHeapNewSize("64M");
// TODO Figure where/when to initialize ccm
// Ideally I would like to support multiple test/configuration methods using
10 years, 11 months
[rhq] modules/enterprise
by John Sanda
modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml | 47 ----------
1 file changed, 47 deletions(-)
New commits:
commit 20065943d5abbe546bd12de38b6d33806dd3e62e
Author: John Sanda <jsanda(a)redhat.com>
Date: Fri May 31 07:16:06 2013 -0400
remove unused properties
diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
index 598a02f..438b0d0 100644
--- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
+++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
@@ -688,27 +688,6 @@ rhq.cassandra.password=${rhq.cassandra.password}
# hostname|jmxPort|nativeTransportPort|
#
rhq.cassandra.seeds=
-
-# When a node initializes it contacts a seed and then sleeps for RING_DELAY
-# (milliseconds) to learn about other nodes in the cluster. This defaults to 30
-# seconds.
-# rhq.cassandra.ring.delay
-
-# Defines the number of tokens randomly assigned to a node on the ring. The more
-# tokens, relative to other nodes, the larger the proportion of data that this
-# node will store. You probably want all nodes to have the same number of tokens
-# assuming they have equal hardware capability. Tokens are randomly generated
-# with the expectation of an even distribution. With that said, there can be
-# some variation. Either increasing this value or increasing the number of
-# nodes in the cluster will help even out the distribution.
-rhq.cassandra.num-tokens=${rhq.cassandra.num-tokens}
-
-# The port for the CQL native transport to listen for clients on. Default value
-# is 9042.
-rhq.cassandra.native-transport-port=${rhq.cassandra.native-transport-port}
-
-# The maximum number of threads handling native CQL requests. The default value is 64.
-rhq.casandra.native-transport-max-threads=${rhq.casandra.native-transport-max-threads}
</echo>
</target>
@@ -755,32 +734,6 @@ rhq.casandra.native-transport-max-threads=${rhq.casandra.native-transport-max-th
<echo>Putting a developer setting in rhq-server.properties to turn on/off strict agent update version checking</echo>
<echo file="${project.build.outputDirectory}/bin/rhq-server.properties" append="true">
rhq.server.agent-update.nonstrict-version-check=true
-
-# Accepts a value of true or false and specifies whether or not the cluster is embedded.
-# Note that if this property is set to false, the other, remaining cluster configuration
-# properties that are set will be ignored as they are only used with embedded clusters.
-rhq.cassandra.cluster.is-embedded=${rhq.cassandra.cluster.is-embedded}
-
-# The directory in which cluster nodes will be installed.
-rhq.cassandra.cluster.dir=${rhq.cassandra.cluster.dir}
-
-# Used for both the min and max heap sizes for the Cassandra JVM. Defaults to 512 MB. When
-# you change this property you should also change the rhq.cassandra.heap.new.size property
-# accordingly.
-# rhq.cassandra.max.heap.size=
-
-# Heap new size refers to the size of the young generation. Defaults to 128 MB. When
-# you change this property you should also change the rhq.cassandra.max.heap.size property
-# accordingly. Note that this value must be smaller than rhq.cassandra.max.heap.size.
-# rhq.cassandra.heap.new.size=
-
-# The number of nodes in the cluster. This specifies how many nodes to install
-# and configure. The top level or base directory for each node will be nodeN
-# where N is the node number.
-rhq.cassandra.cluster.num-nodes=${rhq.cassandra.cluster.num-nodes}
-
-# The log4j logging level to use on each node.
-rhq.cassandra.logging.level=${rhq.cassandra.logging.level}
</echo>
<!-- We must use forward slashes when writing paths to a properties files. Properties.load()
10 years, 11 months
[rhq] modules/common
by John Sanda
modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptionsFactory.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
New commits:
commit 020d0386918824aa1e5d5029fb05a5d27cc1790b
Author: John Sanda <jsanda(a)redhat.com>
Date: Fri May 31 06:58:24 2013 -0400
need to use reduced thread stack size for openjdk 7 on i686 arch
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptionsFactory.java b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptionsFactory.java
index b78f56b..4c79543 100644
--- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptionsFactory.java
+++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/java/org/rhq/cassandra/DeploymentOptionsFactory.java
@@ -46,8 +46,7 @@ public class DeploymentOptionsFactory {
String javaVMName = System.getProperty("java.vm.name");
String javaVersion = System.getProperty("java.version");
- if ((arch.equals("i386") || arch.equals("amd64")) && javaVMName.startsWith("OpenJDK") &&
- javaVersion.startsWith("1.6")) {
+ if ((arch.equals("i386") || arch.equals("amd64") || arch.equals("i686")) && javaVMName.startsWith("OpenJDK")) {
System.setProperty("rhq.cassandra.stack.size", "240k");
}
10 years, 11 months
[rhq] Changes to 'bug/956442'
by Thomas Segismont
New branch 'bug/956442' available with the following commits:
commit 5b7e8394781ec7d40a8ce37293ba662301fdf0d6
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Fri May 31 11:21:40 2013 +0200
Bug 956442 - Server script rhq-server.sh 'stop' command creates many shutdown threads that can exhaust user process limits
Added two variables in the script:
* one to set the number of minutes to wait for the server to shutdown after the TERM signal
* another to decide if the server should be killed if still being up after the waiting period
Stop and kill cases updated accordingly
10 years, 11 months
[rhq] modules/core
by John Sanda
modules/core/dbutils/pom.xml | 36 +++++++++++++++++++++---------------
1 file changed, 21 insertions(+), 15 deletions(-)
New commits:
commit 5da62839eb8a1971474fa9d9f9e9a76d910d599d
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu May 30 22:58:33 2013 -0400
disable C* schema updates by default
This commit introduces a few changes:
* Cassandra schema updates are not applied by default
* You have to set -Dstorage-schema in order for C* schema updates to be applied
* Cassandra schema updates are only run when the dbsetup-upgrade or dbreset
properties are set
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index 06cf148..33f18e0 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -272,27 +272,33 @@
<id>dbsetup-storage</id>
<phase>test</phase>
<configuration>
- <target if="dbsetup">
+ <target>
<script language="groovy">
import org.rhq.cassandra.schema.SchemaManager
- if (project.getProperty('db') == 'dev') {
- self.log('PERFORMING STORAGE NODE SETUP TO LATEST SCHEMA')
- username = project.getProperty('rhq.dev.cassandra.username') ?: "cassandra"
- password = project.getProperty('rhq.dev.cassandra.password') ?: "cassandra"
- seeds = project.getProperty('rhq.dev.cassandra.seeds') ?: "127.0.0.1|7199|9142"
+ if (project.getProperty('dbsetup-upgrade') || project.getProperty('dbreset')) {
+ if (project.getProperty('storage-schema')) {
+ if (project.getProperty('db') == 'dev') {
+ self.log('PERFORMING STORAGE NODE SETUP TO LATEST SCHEMA')
+ username = project.getProperty('rhq.dev.cassandra.username') ?: "cassandra"
+ password = project.getProperty('rhq.dev.cassandra.password') ?: "cassandra"
+ seeds = project.getProperty('rhq.dev.cassandra.seeds') ?: "127.0.0.1|7199|9142"
- schemaManager = new SchemaManager(username, password, seeds)
+ schemaManager = new SchemaManager(username, password, seeds)
- if (project.getProperty('dbreset') == 'true') {
- self.log('Dropping schema')
- schemaManager.drop()
- }
+ if (project.getProperty('dbreset') == 'true') {
+ self.log('Dropping schema')
+ schemaManager.drop()
+ }
- self.log('Install schema')
- schemaManager.install()
- } else {
- self.log('SKIPPING SCHEMA SETUP FOR STORAGE NODE')
+ self.log('Install schema')
+ schemaManager.install()
+ } else {
+ self.log('SKIPPING SCHEMA UPDATES FOR STORAGE NODE')
+ self.log('Schema updates will only be applied to the dev-container storage node')
+ self.log('Run to with -Ddb=dev or -Pdev for to activate storage node schema changes')
+ }
+ }
}
</script>
</target>
10 years, 11 months
[rhq] modules/core
by John Sanda
modules/core/util/src/main/java/org/rhq/core/util/exec/ProcessExecutor.java | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
New commits:
commit a6341a855844845c523c09c343a74f31b542b97c
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu May 30 22:05:52 2013 -0400
revert changes to ProcessExecutor.startProgram since they break api compatibility
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/exec/ProcessExecutor.java b/modules/core/util/src/main/java/org/rhq/core/util/exec/ProcessExecutor.java
index eb64ecb..e74bcce 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/exec/ProcessExecutor.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/exec/ProcessExecutor.java
@@ -68,8 +68,8 @@ public class ProcessExecutor {
ProcessExecutorResults results = new ProcessExecutorResults();
try {
- startProgram(processToStart, results);
-
+ Integer exitCode = startProgram(processToStart);
+ results.setExitCode(exitCode);
} catch (Throwable t) {
results.setError(t);
}
@@ -89,7 +89,7 @@ public class ProcessExecutor {
* start the process but not wait or was to wait and the wait time expired before the process exited
* @throws Exception if any error occurs while trying to start the child process
*/
- protected void startProgram(final ProcessToStart process, ProcessExecutorResults results) throws Exception {
+ protected Integer startProgram(final ProcessToStart process) throws Exception {
// prepare the process comand line and environment
String[] cmdline = getCommandLine(process);
File workingDir = getWorkingDirectory(process);
@@ -97,7 +97,6 @@ public class ProcessExecutor {
// execute the program
final Process childProcess = Runtime.getRuntime().exec(cmdline, environment, workingDir);
- results.setProcess(childProcess);
// redirect the program's streams
final RedirectThreads redirect = redirectAllStreams(process, childProcess);
@@ -139,8 +138,7 @@ public class ProcessExecutor {
}
}
- results.setExitCode(exitCode);
- ;
+ return exitCode;
}
/**
10 years, 11 months
[rhq] modules/enterprise
by John Sanda
modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml | 1 +
1 file changed, 1 insertion(+)
New commits:
commit e72b1e035a9eeb757da0cc5a3a6245926622913f
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu May 30 21:40:02 2013 -0400
set hostname of dev-container storage node to localhost by default
If the hostname option is not set, the storage installer defaults to
InetAddress.getLocalHost().getHostName() which may not return localhost
depending on your hosts configuration. This in turn has led to some problems
with people being able to connect to Cassandra. By explicitly setting the
hostname to 127.0.0.1, I hope we will avoid those issues in the future. Also
note that I explicitly chose 127.0.0.1 instead of localhost since localhost
aliases (e.g., 127.0.0.1, 127.0.0.2, etc.) are used to run multiple nodes on
the same box.
diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
index cbf6cbd..598a02f 100644
--- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
+++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
@@ -796,6 +796,7 @@ data=${safe.datadir}/storage/data
saved-caches=${safe.datadir}/storage/saved_caches
heap-size=256M
heap-new-size=64M
+hostname=127.0.0.1
</echo>
<echo file="${project.build.outputDirectory}/bin/rhqctl.properties" append="true">rhqctl.install.storage-config=bin/rhq-storage.properties</echo>
10 years, 11 months
[rhq] modules/enterprise
by John Sanda
modules/enterprise/server/appserver/pom.xml | 6 ++++++
1 file changed, 6 insertions(+)
New commits:
commit 7a15a35f9daca7c84d0d55d51f022792a570b80b
Author: John Sanda <jsanda(a)redhat.com>
Date: Thu May 30 20:49:22 2013 -0400
add log4j depenedency needed in order to build datastax driver module
diff --git a/modules/enterprise/server/appserver/pom.xml b/modules/enterprise/server/appserver/pom.xml
index 1d6e7f9..683157c 100644
--- a/modules/enterprise/server/appserver/pom.xml
+++ b/modules/enterprise/server/appserver/pom.xml
@@ -69,6 +69,12 @@
<artifactId>groovy-all</artifactId>
</dependency>
+ <!-- needed by rhq-container-build.xml in order to create datastax driver module -->
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>1.2.17</version>
+ </dependency>
</dependencies>
<build>
10 years, 11 months