Bug 778768 (SOA-1223)

Summary: Schema tool can't be used more than once while changing DB.
Product: [JBoss] JBoss Enterprise SOA Platform 4 Reporter: Pavel Macik <pmacik>
Component: ToolingAssignee: Julian Coleman <jcoleman>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: high    
Version: 4.3 CP01   
Target Milestone: ---   
Target Release: 4.3 CP02   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/SOA-1223
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-08-17 07:04:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Pavel Macik 2009-03-12 12:46:47 UTC
Date of First Response: 2009-06-24 10:19:15
project_key: SOA

If one use the schema tool for the first time, it works. When db is changed and the schema tool is used again, the schema tool is not aware of the db change it uses old one (db.properties file).

The fix is below (on the /tools/schema/build.xml):
@@ -2,6 +2,14 @@
 <project name="SOA Database Configuration Script" default="execute" basedir=".">
     <property file="build.properties"/>
 
+    <macrodef name="restore">
+        <attribute name="file"/>
+        <sequential>
+            <delete failonerror="false" file="@{file}"/>
+            <copy file="@{file}.orig" tofile="@{file}" overwrite="true"/>
+        </sequential>
+    </macrodef>
+
     <target name="execute" depends="check.profile, ask.profile, exists.profile, check.clustered, check.backup, do.backup">
         <input addproperty="source.dir"
                message="Please enter the database you wish to configure [db2, mssql, mysql, oracle9i, oracle10g, postgresql]:"/>
@@ -129,14 +137,6 @@
             </sequential>
         </macrodef>
 
-        <macrodef name="restore">
-	    <attribute name="file"/>
-	    <sequential>
-		<delete failonerror="false" file="@{file}"/>
-		<copy file="@{file}.orig" tofile="@{file}" overwrite="true"/>
-	    </sequential>
-        </macrodef>
-
         <delete failonerror="false">
             <fileset dir="${target.dir}/deploy">
                 <include name="hsqldb-ds.xml"/>
@@ -370,6 +370,13 @@
 		<copy file="@{file}" tofile="@{file}.orig"/>
 	    </sequential>
         </macrodef>
+        
+        <if>
+            <available file="../console/management-esb/db.properties.orig"/>
+            <then>
+                <restore file="../console/management-esb/db.properties"/>
+            </then>
+        </if>
 
 	<echo message="Backing up files ..."/>
 	<backup file="${target.dir}/deploy/jbossesb.sar/esb.juddi.xml"/>

Comment 1 Pavel Macik 2009-05-21 13:55:04 UTC
Link: Added: This issue related SOA-1325


Comment 2 Julian Coleman 2009-06-24 14:19:15 UTC
Fixed with revision 3208 (4.3 branch) of:
  build-tools/resource/schema/tool/esb/build.xml

Commit message:
  JIRA SOA-1223 

  Split the backup into two parts - one for the configuration directories and
  one for the common directories.  Fixes a bug when the schema tool was used
  with different configurations and should also fix db.properties overwrite
  (SOA-1223).

  Tested by pmacik.


Comment 3 Pavel Macik 2009-08-17 07:04:17 UTC
verified in CR2