modules/core/dbutils/pom.xml
| 2
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
| 21 ++--------
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionList.java
| 12 -----
modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
| 20 +++++++++
4 files changed, 28 insertions(+), 27 deletions(-)
New commits:
commit aed615737ff5d08081ccd6070aad2770976056ee
Author: mtho11 <mikecthompson(a)gmail.com>
Date: Fri Sep 28 09:56:27 2012 -0700
[BZ861127 - Upgrade issue with respect to min/max property attributes] - Fix the
rhq_config_prop_def.max_entries default to 32767 instead of 0 if it is null. And changing
signature of setter back to setMax(int) from setMax(Integer) although compile time
coercion makes them equivalent. And fix 2 bugs in DBInstallationTest.java that wasn't
checking the schema version since RHQ3.3.0 and JON3.0.0.
(cherry picked from commit 7d937712636fcad497fec9e89afc3fe84168ad23)
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index e0ceba4..700e079 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -17,7 +17,7 @@
<description>Database schema setup, upgrade and other
utilities</description>
<properties>
- <db.schema.version>2.124</db.schema.version>
+ <db.schema.version>2.125</db.schema.version>
<rhq.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.ds.type-mapping>
<rhq.ds.server-name>${rhq.test.ds.server-name}</rhq.ds.server-name>
<rhq.ds.db-name>${rhq.test.ds.db-name}</rhq.ds.db-name>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index ad4b851..00722db 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -4031,32 +4031,23 @@
<!-- JON 3.1.1 RELEASE uses DB Schema 2.122 -->
<schemaSpec version="2.123">
+
<schema-addColumn table="RHQ_CONFIG_PROP_DEF"
column="MIN_ENTRIES" columnType="INTEGER"/>
<schema-addColumn table="RHQ_CONFIG_PROP_DEF"
column="MAX_ENTRIES" columnType="INTEGER"/>
- <schema-directSQL>
- <statement desc="Update the NULL to 0 for
MIN_ENTRIES">
- UPDATE RHQ_CONFIG_PROP_DEF
- SET MIN_ENTRIES = 0
- WHERE MIN_ENTRIES IS NULL
- </statement>
- <statement desc="Update the NULL to 0 for
MAX_ENTRIES">
- UPDATE RHQ_CONFIG_PROP_DEF
- SET MAX_ENTRIES = 0
- WHERE MAX_ENTRIES IS NULL
- </statement>
- </schema-directSQL>
+
</schemaSpec>
- <schemaSpec version="2.124">
+<!-- RHQ 4.5.0 uses DB Schema 2.125 -->
+ <schemaSpec version="2.125">
<schema-directSQL>
<statement desc="Update the NULL to 0 for
MIN_ENTRIES">
UPDATE RHQ_CONFIG_PROP_DEF
SET MIN_ENTRIES = 0
WHERE MIN_ENTRIES IS NULL
</statement>
- <statement desc="Update the NULL to 0 for
MAX_ENTRIES">
+ <statement desc="Update the NULL to 32767 for
MAX_ENTRIES">
UPDATE RHQ_CONFIG_PROP_DEF
- SET MAX_ENTRIES = 0
+ SET MAX_ENTRIES = 32767
WHERE MAX_ENTRIES IS NULL
</statement>
</schema-directSQL>
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionList.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionList.java
index dfca8ee..3290393 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionList.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/definition/PropertyDefinitionList.java
@@ -86,24 +86,16 @@ public class PropertyDefinitionList extends PropertyDefinition {
return max;
}
- public void setMax(Integer max){
- if(null == max){
- this.max = 0;
- }else {
+ public void setMax(int max){
this.max = max;
- }
}
public int getMin() {
return min;
}
- public void setMin(Integer min){
- if(null == min){
- this.min = 0;
- }else {
+ public void setMin(int min){
this.min = min;
- }
}
}
diff --git
a/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
b/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
index 20dbbc0..4fca7e1 100644
---
a/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
+++
b/modules/enterprise/gui/installer-war/src/test/java/org/rhq/enterprise/installer/DBInstallationTest.java
@@ -103,6 +103,12 @@ public class DBInstallationTest {
}
@Test
+ public void upgradeJON311Schema() throws Exception {
+ installSchemaAndData("3.1.1");
+ installer.upgradeExistingDatabaseSchema(getInstallProperties());
+ }
+
+ @Test
public void upgradeRHQ420Schema() throws Exception {
installSchemaAndData("rhq-4.2.0");
installer.upgradeExistingDatabaseSchema(getInstallProperties());
@@ -113,6 +119,18 @@ public class DBInstallationTest {
installSchemaAndData("rhq-4.3.0");
installer.upgradeExistingDatabaseSchema(getInstallProperties());
}
+
+ @Test
+ public void upgradeRHQ440Schema() throws Exception {
+ installSchemaAndData("rhq-4.4.0");
+ installer.upgradeExistingDatabaseSchema(getInstallProperties());
+ }
+
+ @Test
+ public void upgradeRHQ450Schema() throws Exception {
+ installSchemaAndData("rhq-4.5.0");
+ installer.upgradeExistingDatabaseSchema(getInstallProperties());
+ }
private void initLogDirectory() {
File logDir = new File(LOG_DIRECTORY);
@@ -202,7 +220,7 @@ public class DBInstallationTest {
ByteArrayInputStream contentInStream = new
ByteArrayInputStream(content.getBytes());
StreamUtil.copy(contentInStream, xmlFileOutStream);
- return xmlFile.getAbsoluteFile();
+ return filteredXmlFile.getAbsoluteFile();
}
}
Show replies by date