Bug 778190 (SOA-695)

Summary: The schema tool is broken for files when multiple changes as required
Product: [JBoss] JBoss Enterprise SOA Platform 4 Reporter: Jiri Pechanec <jpechane>
Component: ToolingAssignee: Julian Coleman <jcoleman>
Status: CLOSED NEXTRELEASE QA Contact:
Severity: urgent Docs Contact:
Priority: urgent    
Version: 4.3 IR1   
Target Milestone: ---   
Target Release: 4.3 IR3   
Hardware: Unspecified   
OS: Unspecified   
URL: http://jira.jboss.org/jira/browse/SOA-695
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-09-12 04:35:25 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 Jiri Pechanec 2008-08-20 14:18:33 UTC
Date of First Response: 2008-08-20 11:48:01
project_key: SOA

The file changes are made in this way
1) Make a copy of file (.orig)
2) Copy the copied file to the orginal one and replace the requested string

SOA-567 - it prevents the .orig file to be overwirtten. It means now that if there are multiple calls to reconfigure than only the last change on the file is preserved because we are still operation on the original file.

To fix the problem the chnge should be rolled back thus change
                <copy file="@{file}" tofile="@{file}.orig" overwrite="false"/>
                <copy file="@{file}.orig" tofile="@{file}" overwrite="true">
to
                <copy file="@{file}" tofile="@{file}.orig" overwrite="true"/>
                <copy file="@{file}.orig" tofile="@{file}" overwrite="true">

Comment 1 Jiri Pechanec 2008-08-20 14:19:01 UTC
Link: Added: This issue is related to SOA-567


Comment 2 Julian Coleman 2008-08-20 15:19:18 UTC
Link: Added: This issue is related to SOA-512


Comment 3 Julian Coleman 2008-08-20 15:48:01 UTC
It looks like there are further potential problems with this tool.
The file:
  .../deploy/jboss-messaging.sar/jms-ds.xml
is copied with overwrite="false", so will only be copied the first time the tool
is run.

The file:
  .../eploy/jbpm.esb/hibernate.cfg.xml
is assumed to have not been changed, so the reconfiguration will fail the
second time the tool is run (and subsequent times).


Comment 4 Julian Coleman 2008-08-20 15:52:08 UTC
Revision 1713 of build-tools/resource/schema/tool/esb/build.xml should fix
the original problem.  Log message:

  Allow multiple reconfigure macros to be applied to the same file.
  Should fix the original problem in SOA-695.


Comment 5 Martin Vecera 2008-08-21 06:47:35 UTC
If there's a need to apply more reconfigurations to the same file, I suggest this approach:

1. Only at the beginning of the reconfiguration process
    <copy file="@{file}" tofile="@{file}.orig" overwrite="false"/> 
    <copy file="@{file}.orig" tofile="@{file}.work" overwrite="true"> 


2. For each reconfiguration step
    <copy file="@{file}" tofile="@{file}.work" overwrite="true"/>
    <copy file="@{file}.work" tofile="@{file}" overwrite="true"> - with applying filters here

Comment 6 Julian Coleman 2008-08-27 10:39:16 UTC
After some experimentation and after reading the Ant manual at:

  http://ant.apache.org/manual/index.html

the description of "overwrite" is:

  Overwrite existing files even if the destination files are newer.

This means that even if overwrite="false" is set, then the file will be overwritten if the
source file is new enough (it appears that ant ignores seconds when checking).

Comment 7 Julian Coleman 2008-08-28 14:47:37 UTC
Fixed in revision 1771 of:
  build-tools/resource/schema/tool/esb/build.xml
Log message:
  Backup all files from the original deploy that we modify once only.
  Should fix JIRA SOA-695.


Comment 8 Jiri Pechanec 2008-09-12 04:35:25 UTC
Verified in IR4

Comment 9 nwallace 2008-09-25 19:28:59 UTC
Link: Added: This issue is related to SOA-853


Comment 10 nwallace 2008-09-25 19:56:17 UTC
Link: Added: This issue is related to SOA-860